Make added routes permanent

I have added some routes to make my networked linux box run a special configuration.  I entered the routes in /etc/rc.local so they are added at startup.

I seem to be having issues where the routes are lost after some time.

What files do I need to add these routes to so they will be permanent?

Running Centos 5.5

Here is what I added:

ip route add via table 192
ip route add default via table 192
ip rule add from table 192
ip route add via table 10
ip route add default via table 10
ip rule add from table 10

I would also like to keep the default routes...
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface        *        U     0      0        0 eth1     *        U     0      0        0 eth0     *          U     0      0        0 eth1
default         UG    0      0        0 eth0

LVL 23
Who is Participating?
savoneConnect With a Mentor Author Commented:
For anyone reading this in the future this is how I resolved the issue:

1) Add new table to /etc/iproute2/rt_tables
echo -e "200\tNet" >> /etc/iproute2/rt_tables

2)Add new route to interface
echo "default table Net via" > /etc/sysconfig/network-scripts/route-eth1

3) Add new rule to interface
echo "from table Net" > /etc/sysconfig/network-scripts/rule-eth1
savoneAuthor Commented:
Also, it looks as if I am losing my routes when the DHCP lease is renewed... Why is this?
Michael WorshamInfrastructure / Solutions ArchitectCommented:
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Michael WorshamInfrastructure / Solutions ArchitectCommented:
Also, found a forum thread using the /etc/sysconfig/network-scripts/rule-ethX method...
savoneAuthor Commented:
Ok this is the link that led me to the answer:

So why is DHCP killing my routes?  Anyone?

Michael WorshamInfrastructure / Solutions ArchitectCommented:
Is the server acting as a DHCP client or a DHCP server?

If DHCP client, what do you currently have set (listed) in the following files:
 - /etc/sysconfig/network-scripts/ifcfg-ethX (X = 0, 1, etc)
 - /etc/sysconfig/network-scripts/route-ethX (X = 0, 1, etc)

Hi ,
I agree with @mwecomputers.
Please let us know whether the dhcp server and client are assigned to behave as dhcp
savoneAuthor Commented:
The server is a DHCP client...

# cat /etc/sysconfig/network-scripts/ifcfg-eth0
# ADMtek NC100 Network Everywhere Fast Ethernet 10/100

# cat /etc/sysconfig/network-scripts/ifcfg-eth1
# Broadcom Corporation NetXtreme BCM5751 Gigabit Ethernet PCI Express
savoneAuthor Commented:
I was unable to get an accurate answer from experts.  Found the solution on my own and would like to share it with the community.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.