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

One Response to “Add or delete static routes from the Linux IP routing table”

  1. 2maledictionon 12 Jan 2022 at 10:15 pm

    2highlights…

Trackback URI | Comments RSS

Leave a Reply

You must be logged in to post a comment.