After adding a static route in any linux Ubuntu/CenOS it hardly lasts till next reboots. To make those routes persistent you need to make an entry for each route in /etc/network/interfaces file.
This is very simple just add up infront of the command you hit on the terminial to add an static router. For instance i'm going to an route with below command.
root@ipsec:~# route add -net 192.168.50.0 netmask 255.255.255.0 gw 192.168.90.10 dev eth0
just add entry for the same like this
root@ipsec:~# vim /etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.90.2
netmask 255.255.255.0
gateway 192.168.90.254
#### static rotue to 192.168.50 series #######
up route add -net 192.168.50.0 netmask 255.255.255.0 gw 192.168.90.10 dev eth0
gil ...
This is very simple just add up infront of the command you hit on the terminial to add an static router. For instance i'm going to an route with below command.
root@ipsec:~# route add -net 192.168.50.0 netmask 255.255.255.0 gw 192.168.90.10 dev eth0
just add entry for the same like this
root@ipsec:~# vim /etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.90.2
netmask 255.255.255.0
gateway 192.168.90.254
#### static rotue to 192.168.50 series #######
up route add -net 192.168.50.0 netmask 255.255.255.0 gw 192.168.90.10 dev eth0
gil ...
0 Comments