Howto failover to alternate default gateway on pppoe failure


CentOS server has 2 ethernet ports(eth0 and eth1).
eth0: connected to switch and then to internet
eth1:connected to adsl modem and running rp pppoe through it and creates ppp0

I want default gateway to be through ppp0  when ppp0 is up (this happens - as the setting for gateway in rp pppoe is enabled).
However when ppp0 goes down then default gateway to revert to eth0. This does not happen.

Please help.
Who is Participating?
have a look this one

it should help you

look at enabling failover routing
shaunwinginAuthor Commented:
Tx. However.
My setup is different.
Once route is vial pppoe.

Also see: Which indicates that this will do load balancing and not failover.

 Re:true failover?
Posted by: Anonymous Coward on April 17, 2005 01:16 AM
I'm afraid that's not how it works. In the setup you describe, until the Linux box detects one of these Ethernet interfaces are down, at the Ethernet level, it will continue to send packets out that interface. The Linux box you describe has ethernet connections to routers "upstream" of it. Typically that router is customer premise equipment provided by the ISP. You have an Ethernet connection to it. It then has a connection to the ISP, via DSL, another Ethernet interface, etc. If if looses its link layer connection (DSL, Ethernet, wireless, etc.) on its WAN, you are still going to have an Ethernet connection between the Linux box and the CPE. The Linux box does not know there is a problem and continues to route out that inteface, as the previous poster said it would.

The previous poster also noticed something about your setup but only impied it, when he said you would lose half your packets. The setup you describe will not send traffic out one connection, and fail over to the second. All have you done is create to equal weight default routes. The Linux box will route out both interfaces, not one or the other, unless it detects one of the Ethernet inerfaces down, as discussed above.

You've started on the right track, but you have a a ways to go.
Network Scalability - Handle Complex Environments

Monitor your entire network from a single platform. Free 30 Day Trial Now!

shaunwinginAuthor Commented:
I've been looking at it...
Hello I hope that this thread is alive:

Here is my solution about the problem:

1. Configure pppoe connection
1.1. Do not UP it on boot

2. On boot load script with following settings
2.1. Configure eth0 and eth1 IP addresses and MAC addresses
2.2. Start pppoe connection
2.3. Firewall connection as you wish
2.4. Start monitor script to switch between internet lines if one of them fail

3. Monitor script:
3.1. Each X seconds check with ping -I interface IP if connection on this interface is alive
3.2. If connection is not alive then change default route with:

thats it.

I have server that work this way perfectly and can help with setup and monitor script instalation
shaunwinginAuthor Commented:
Tx. This looks usefull. Would appreciate help with the script.
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.