Operating System - Linux
1829149 Members
2163 Online
109986 Solutions
New Discussion

Default route entry gets deleted on my linux box on every reboot

 
SOLVED
Go to solution
Amit Dixit_2
Regular Advisor

Default route entry gets deleted on my linux box on every reboot

Hi,
Whenever i reboot my linux server one of
its route entry gets deleted and i have to
type it manually.

#route add default gw 192.168.1.4
Which is the IP address of my server.
How can i make this entry permanenet.

Linux (Redhat 5.2 Apollo).
Thanks,
Amit.
3 REPLIES 3
Mark Grant
Honored Contributor
Solution

Re: Default route entry gets deleted on my linux box on every reboot


In red hat it would appear that you need to edit /etc/sysconfig/network to put the gateway in.

However, if you want to do it in a generaic way that will work on every distribution (with the possible exception of the one I'm actually using) you need to put the command command in the rc.local file within the start-up scripts or better still, earlier within the startup scripts, but rc.local will work.

Never preceed any demonstration with anything more predictive than "watch this"
Sergejs Svitnevs
Honored Contributor

Re: Default route entry gets deleted on my linux box on every reboot

add new string to the /etc/sysconfig/network:
GATEWAY=192.168.1.4

Regards,
Sergejs
Alexander Chuzhoy
Honored Contributor

Re: Default route entry gets deleted on my linux box on every reboot

to add persitent routes you must create a file
/etc/sysconfig/static-routes


and to add an entry like the following-for adding route to subnet

any net 10.0.0.0 netmask 255.0.0.0 gw 192.168.100.1 eth0


use this example as guide



best regards