Archive for the tag 'static'

Add or delete static routes from the Linux IP routing table.

You need to know the network/subnet you wish to reach, also the interface you wish this route to be added to, i.e., which interface to use to reach the subnet.

How to reach another network, 10.20.30.0/24, that is reachable via a router on the 192.168.1.0/24 network, 192.168.1.254.

The following ip route command would add the desired route to the kernel routing table:

ip route add 10.20.30.0/24 via 192.168.1.254 dev eth1

Note: eth1 is connected to 192.168.1.0/24