This Blog is to share our knowledge and expertise on Linux System Administration and VMware Administration

Thursday, November 16, 2017

How to add temporary & permanent route in Linux box?

Follow the below steps for adding the route as  temporary or permanent . 

Temporary Route

We just need to add the ip route add command in command line. like below

[root@testserver ~]#ip route add 10.217.156.0/25 via 10.194.32.1 dev eth0

[root@testserver ~]# route -n | grep -i 10.217.156.0

10.217.156.0    10.194.32.1     255.255.255.128 UG    0      0        0 eth0

Above route entry will be invicible post reboot the linux box.

Permanent Route

We need to create a file route-eth0 (since it is pointing eth0 device) under /etc/sysconfig/network-scripts/ path & add the below entry.

[root@testserver network-scripts]# cat route-eth0
10.217.156.0/25 via 10.194.32.1 dev eth0

save & exit.

Route will be persistent after every reboot of the Linux box.


Note : Permanent route need  network interface.reload for immediate effect.

Hope it helps.




No comments:

Post a Comment