I need to add a new route to my CentOS 7 and Ubuntu 18.04 LTS VM running inside VMWARE. I read ip man page but it confused me too much. Can anyone give me ip route add example?
Say you want to route traffic via 192.168.1.254 gateway connected via eth0 network interface:
ip route add 192.168.1.0/24 dev eth0
Another example with 192.168.1.254 gateway to add a static route:
ip route add 192.168.1.0/24 via 192.168.1.254 dev eth0
For more info see