how to add multiple gateways permanently in centos 6.2
I have 2 ISPs having router-IPs 172.16.1.10 & 172.16.1.253.
Server's present route is 172.16.1.10, when it goes off server should switch automatically to second one ie 172.16.1.253 Plz. guide me to add both gateways in centos |
One potential method
How many NIC's do you have?
If there's a single nic, I'm not sure that you can do it... Well, not without scripting up a constant icmp check to the 172.16.1.10 address, and if it fails, then have the script change a file for you. The absolute easiest way to do it (Without setting any strange routes), I would: cp /etc/sysconfig/network /etc/sysconfig/network.orig vi /etc/sysconfig/network ---> Change the default gateway in here When the gateway fails, then you can have a script to switch the two files over for you and restart the network service: ie. mv /etc/sysconfig/network /etc/sysconfig/network.orig1 mv /etc/sysconfig/network.orig /etc/sysconfig/network mv /etc/sysconfig/network.orig1 /etc/sysconfig/network.orig service network restart The above assumes that you haven't set up your gateways in /etc/sysconfig/network-scripts/ifcfg-eth0 It also assumes you haven't set any routes for info. Don't forget to test it before it's implemented. Hope that helps somewhat. |
multiple gateway in centos 6.2
Thanx for reply.
In have a single NIC, and one gateway is already defined in \etc\sysconfig\network\ifcfg-eth0 and no default gateway in \etc\sysconfig\network. still can I use your given commands to add multiple defult gateways. Plz. Help me. Thanx ssy Quote:
|
You may check this:
http://code.google.com/p/wanfailoverscript/ or http://joel.amw.co.id/w/failover-scr...y-in-linux.txt But this assumes you have two external interface connected to the ISP. Thanks! |
You can use the same commands, just change it to the ifcfg-eth0 instead of the 'networks' file.
And as I mentioned, you can do it with magical routes, as mmheera has suggested. Good luck. |
All times are GMT -5. The time now is 02:29 AM. |