Howto failover to alternate default gateway on pppoe failure

Posted on 2009-02-10
Last Modified: 2012-06-22

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.
Question by:shaunwingin
    LVL 29

    Expert Comment

    have a look this one

    it should help you

    look at enabling failover routing

    Author Comment

    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.
    LVL 29

    Accepted Solution


    Author Comment

    I've been looking at it...
    LVL 2

    Expert Comment

    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:
    ip route change default via ALIVEGATEWWAYIP dev ALIVEGATEWAYINTERFACE

    thats it.

    I have server that work this way perfectly and can help with setup and monitor script instalation

    Author Comment

    Tx. This looks usefull. Would appreciate help with the script.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Article by: IanTh
    Hi Guys After a whole weekend getting wake on lan over the internet working, I thought I would share the experience. Your firewall has to have a port forward for port 9 udp to your local broadcast x.x.x.255 but if that doesnt work, do it to a …
    Even if you have implemented a Mobile Device Management solution company wide, it is a good idea to make sure you are taking into account all of the major risks to your electronic protected health information (ePHI).
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    737 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

    20 Experts available now in Live!

    Get 1:1 Help Now