Static routing is the process of manually entering the routes to the routing table to reach a particular destination. Basically two commands are used in Linux to add routes. The first command is the old traditional route add and second is the IP route command.
Earlier we learned how to route add in Linux, in this tutorial, here I will show you how to add permanent static routes in Linux distributions such as Centos and Ubuntu.
Adding temporary static routes
In order to add a static route temporarily on your Linux machine, you can use either route or ip command.
You can list the current routing table as follows.
$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.206.1 0.0.0.0 UG 100 0 0 eno1
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 eno1
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
192.168.206.0 0.0.0.0 255.255.255.0 U 100 0 0 eno1
route -n command
Read more