Steven Vona
asked on
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 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
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
Take a look at using the /etc/sysconfig/route-eth0 and /etc/sysconfig/route-eth1 files for these configuration needs.
Some references that 'might' help...
http://wiki.robotz.com/index.php/Static_Routes_in_Redhat
http://www.itsyourip.com/Linux/howto-add-a-persistent-static-route-in-redhat-enterprise-linux/
http://www.cyberciti.biz/tips/configuring-static-routes-in-debian-or-red-hat-linux-systems.html
http://sysadminsjourney.com/content/2009/04/15/doing-simple-source-policy-routing-centos
Some references that 'might' help...
http://wiki.robotz.com/index.php/Static_Routes_in_Redhat
http://www.itsyourip.com/Linux/howto-add-a-persistent-static-route-in-redhat-enterprise-linux/
http://www.cyberciti.biz/tips/configuring-static-routes-in-debian-or-red-hat-linux-systems.html
http://sysadminsjourney.com/content/2009/04/15/doing-simple-source-policy-routing-centos
Also, found a forum thread using the /etc/sysconfig/network-scr ipts/rule- ethX method...
http://www.centos.org/modules/newbb/viewtopic.php?viewmode=thread&topic_id=8153&forum=40&post_id=25805
http://www.centos.org/modules/newbb/viewtopic.php?viewmode=thread&topic_id=8153&forum=40&post_id=25805
ASKER
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?
http://sysadminsjourney.com/content/2009/04/15/doing-simple-source-policy-routing-centos
So why is DHCP killing my routes? Anyone?
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-scr ipts/ifcfg -ethX (X = 0, 1, etc)
- /etc/sysconfig/network-scr ipts/route -ethX (X = 0, 1, etc)
If DHCP client, what do you currently have set (listed) in the following files:
- /etc/sysconfig/network-scr
- /etc/sysconfig/network-scr
Hi ,
I agree with @mwecomputers.
Please let us know whether the dhcp server and client are assigned to behave as dhcp
I agree with @mwecomputers.
Please let us know whether the dhcp server and client are assigned to behave as dhcp
ASKER
The server is a DHCP client...
# cat /etc/sysconfig/network-scr ipts/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-scr ipts/ifcfg -eth1
# Broadcom Corporation NetXtreme BCM5751 Gigabit Ethernet PCI Express
DEVICE=eth1
BOOTPROTO=dhcp
HWADDR=00:13:72:BB:2B:9C
ONBOOT=yes
# cat /etc/sysconfig/network-scr
# 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-scr
# Broadcom Corporation NetXtreme BCM5751 Gigabit Ethernet PCI Express
DEVICE=eth1
BOOTPROTO=dhcp
HWADDR=00:13:72:BB:2B:9C
ONBOOT=yes
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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.
ASKER