after reading this answer for how to setup dynamic network failover I am having a question. First of all thanks a lot to @Ingo posting this manual how to setup bonding/dynamic network failover. It was very easy to setup and works fine for me if my ethernet and wlan network IP address are the same!

However, if my wifi connection is a phone/cellular hotspot that uses a different internet IP address (for example instead of on the ethernet connection), the failover is not working! It looks to me like the bonding interface sticks with the old IP address and then the new connection on the wifi does not work. Do you have any idea what could be the reason?

I have tried to setup the ethernet and wifi interface with static ips, however that didn't help. The bonding interface (still on DHCP) sticks with the IP address from the ethernet interface, even though that one is down.

Any help is appreciated!!

2 Answers 2


The goal of bonding is that the ip address on an interface does not change no matter what connection is used. The interface is connected to a subnet with a defined ip address range. It can only direct connect to devices on the same subnet. If it want to connect to devices on other subnets there is a router needed that sends packets from one subnet to the next.

Your internet router uses subnet and the DHCP server on this subnet gives ip address to the RasPi. The cell phone uses subnet and the DHCP server on this subnet gives ip address to the RasPi. With DHCP enabled on the RasPi you will get different ip addresses on the bond0 interface. That breaks bonding by definition.

First of all you have to determine what subnet to use, maybe that private subnet from the cell phone Then you can give bond0 a static ip address, e.g. Now you have to configure the internet router for the wired connection to use the same subnet so all devices are on this subnet.

But as you see, a cell phone is a device for personal use and not very suitable to improve stability of a network.

  • Thanks a lot for your fast answer! This explains it very well. I understand. I will use separate LTE Router where I can change the IP address range for DHCP and then I will set both connections up with fixed ip addresses (the same addresses) and assume that the internet failover should successfully work. Existing connections might drop/need to reconnect as @RalfFriedl said below, but if the internet works on the backup connection it should be no problem too reconnect. :)
    – Darksta
    Sep 29, 2019 at 10:08
  • @Darksta You cannot give both connections the same ip address. Each device must have a unique ip address. And it is also not a good idea to work with static ip addresses if you decide to use a dedicated LTE Router (good idea). It is much less error prone using DHCP unless you want to run any server on the RasPi.
    – Ingo
    Sep 29, 2019 at 11:18
  • I understand, thank you for the information! Then I will stick with DHCP on all the interfaces (including bond). Per my understanding, it technically works by putting 2 (or 3) network interfaces into the network, the bond and the actual ethernet and wifi interface. The bond IP address will and has to stay the same at all times, no matter to which network/interface (wifi or ethernet) the bond and its active interface is connected. Thank you!
    – Darksta
    Sep 29, 2019 at 12:20
  • @Darksta Bonding is only an internal function of the RasPi. All external devices see the RasPi only with one interface with one stable ip address. A hotspot will see it as wifi client or connected by wire, always with the same ip address. Local bonding ensures that only one connection is used so there is no conflict. Important is that all interfaces are on the same broadcast domain.
    – Ingo
    Sep 29, 2019 at 12:53
  • I see, thanks a lot for the explanation! Earlier you mentioned that "Each device must have a unique IP address." What did you mean, I thought the ethernet and wifi adapter are not allowed to have the same IP address? I am not sure I fully understand yet. Bonding is only internal on the Raspi and ensures switching between wifi and ethernet depending on connectivity. The bonding interface will always have the same IP address (the IP address that it got on the first interface via DHCP I am assuming). And when the bond switches over to wifi, it will continue to work with the same ip etc.
    – Darksta
    Sep 29, 2019 at 15:20

The simple answer is that you can't use that as a failover for existing connections.

If you have short connections or can reconnect after a failure, the next connection will use the other interface. But an existing connection is always tied to a specific IP address pair.

Even if you could convince the kernel to move the connection to the other local address, it wouldn't work because the other end doesn't expect packets for the connection to suddenly come from a different IP address.

IPv6 has some support for failover, and you can do something similar with IPv4, but both sides must support it, so you can't use that for standard connections.

If you really want a failover for existing connections, you can set up two links to a server configured to allow that. All connections to the outside will seem to come from this server.

  • I am glad to hear that IPv6 support more things. I don't know what is going on the discussion here, but I think when IPv6 and 5G arrive, all network problems wiil disappear, just like glass fiber wire replacing copper wire, and 1/23/4/5G mobile phones replace land line phones and the stupid "0.5G pagers.
    – tlfong01
    Sep 29, 2019 at 0:03
  • Thanks a lot for your reply! Important point. However, as long as the internet is working then through the failover I will be able to reconnect my running applications that I am working with. Main importance in my case is that the internet is working on the backup connection.
    – Darksta
    Sep 29, 2019 at 10:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.