Solved

Make added routes permanent

Posted on 2010-11-10
9
1,704 Views
Last Modified: 2012-06-27
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 192.168.1.0/24 via 192.168.1.1 table 192
ip route add default via 192.168.1.1 table 192
ip rule add from 192.168.1.0/24 table 192
ip route add 10.0.0.0/24 via 10.0.0.1 table 10
ip route add default via 10.0.0.1 table 10
ip rule add from 10.0.0.0/24 table 10

I would also like to keep the default routes...
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.0.0.0        *               255.255.255.0   U     0      0        0 eth1
192.168.1.0     *               255.255.255.0   U     0      0        0 eth0
169.254.0.0     *               255.255.0.0     U     0      0        0 eth1
default         192.168.1.1     0.0.0.0         UG    0      0        0 eth0


0
Comment
Question by:savone
  • 5
  • 3
9 Comments
 
LVL 23

Author Comment

by:savone
ID: 34108303
Also, it looks as if I am losing my routes when the DHCP lease is renewed... Why is this?
0
 
LVL 29

Expert Comment

by:Michael W
ID: 34108372
0
 
LVL 29

Expert Comment

by:Michael W
ID: 34108430
Also, found a forum thread using the /etc/sysconfig/network-scripts/rule-ethX method...

http://www.centos.org/modules/newbb/viewtopic.php?viewmode=thread&topic_id=8153&forum=40&post_id=25805
0
 
LVL 23

Author Comment

by:savone
ID: 34108473
Ok this is the link that led me to the answer:
http://sysadminsjourney.com/content/2009/04/15/doing-simple-source-policy-routing-centos

So why is DHCP killing my routes?  Anyone?

0
Save on storage to protect fatherhood memories

You're the dad who has everything. This Father's Day, make sure your family memories are protected. My Passport Ultra has automatic backup and password protection to keep your cherished photos and videos safe. With up to 3TB, you have plenty of room to hold the adventures ahead.

 
LVL 29

Expert Comment

by:Michael W
ID: 34108915
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)

0
 
LVL 15

Expert Comment

by:Insoftservice
ID: 34109269
Hi ,
I agree with @mwecomputers.
Please let us know whether the dhcp server and client are assigned to behave as dhcp
0
 
LVL 23

Author Comment

by:savone
ID: 34110874
The server is a DHCP client...

# cat /etc/sysconfig/network-scripts/ifcfg-eth0
# ADMtek NC100 Network Everywhere Fast Ethernet 10/100
DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=00:04:5A:7C:ED:38
ONBOOT=yes

# cat /etc/sysconfig/network-scripts/ifcfg-eth1
# Broadcom Corporation NetXtreme BCM5751 Gigabit Ethernet PCI Express
DEVICE=eth1
BOOTPROTO=dhcp
HWADDR=00:13:72:BB:2B:9C
ONBOOT=yes
0
 
LVL 23

Accepted Solution

by:
savone earned 0 total points
ID: 34129411
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 10.0.0.1" > /etc/sysconfig/network-scripts/route-eth1

3) Add new rule to interface
echo "from 10.0.0.2 table Net" > /etc/sysconfig/network-scripts/rule-eth1
0
 
LVL 23

Author Closing Comment

by:savone
ID: 34162508
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.
0

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
resolv.conf empty ubuntu server 14 3 70
Ubuntu VNC server rejects access by client 7 141
Squid Connection Pools 3 43
iptables limit connection per ip correct way ? 2 83
I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…

943 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now