[TriLUG] How to set a persistent route in Linux

Jon Carnes jonc at nc.rr.com
Tue Mar 28 22:29:40 EST 2006


I've always hacked my /etc/rc.d/rc.local file and added "permanent"
routes that way, but I've known that was a hack... you lose the route if
you do a "service network restart" and that shouldn't happen.

I knew their should be an easy way to add a permanent route and there
is. For Red Hat type installs add a file as such:
  /etc/sysconfig/network-scripts/route-eth0

The route in the file should be of the form:
  192.168.2.0/24 via 192.168.1.2

This is the equivalent to putting a route statement in:
route add -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.1.2 dev eth0

Now when I do a network restart, my static routes come up just dandy!

for more info:
http://www.akadia.com/services/redhat_static_routes.html

Jon Carnes
Trilug: where sometimes the "T" stands for "Trivia!"




More information about the TriLUG mailing list