I have a CentOS running. It is important to have my CentOS available when I am remotely connected to a VPN router. I tried to add a default gateway to the VPN router, but after reboot it goes away. How can i put this as permanent?

ip route add 192.168.2.3 via 10.0.0.1 dev eth0
link|improve this question

feedback

2 Answers

up vote 1 down vote accepted

If i've read your question right, i think you want to add

GATEWAY=192.168.2.3

into /etc/sysconfig/network then reboot or do service network restart to test it.

Although i'm not entirely sure from your question that you do actually want a default gateway at all. I think you may just want to make a static route permanent ?

link|improve this answer
1  
I want to make 192.168.2.1/24 subnet route permanent. – YumYumYum Aug 9 '11 at 13:14
2  
ok. add a route-eth0 file in /etc/sysconfig/network-scripts, as outlined here: linuxquestions.org/questions/linux-networking-3/… – Sirex Aug 9 '11 at 13:44
feedback

You may be able to add that line to the appropriate /etc/ifconfig.INT (where "INT" represents the appropriate interface), just like we do with dhclient sometimes (notice the leading explanation point inserted as the first character):

!ip route add 192.168.2.3 via 10.0.0.1 dev eth0

(I haven't tried CentOS, but I'm assuming this mechanism should essentially be the same as it is on NetBSD.)

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.