I'm running Linux Mint 17.3 on my laptop. When docked, I'm connected via Ethernet, but when I undock, I'd like not to break my ssh sessions, ongoing downloads, etc., and to use the same IP address on the Wi-Fi adapter, so that still appears the same to other machines on my network.

Bonding in mode 1, active backup, sounds exactly like what I want. I've found a number of resources online about how to set it up, but network configuration seems to vary quite a bit between distributions and even between different versions of each distribution, so that the steps for this vary quite a bit.

What's more, most of the instructions I've found rely on static configuration, like hardcoding network addresses and even WPA passwords into /etc/network/interfaces. I take my laptop to other networks, so I rely on Network Manager to store network configuration.

By googling "bond eth0 wlan0", I found a sample /etc/networking/interfaces file that more or less works, but I apparently have to disable Network Manager to keep it from doing weird things with my routing table. And while the bond is active, I can't seem to use the Network Manager applet to change Wi-Fi networks.

Network Manager 0.9.8 supports bonded interfaces, but only for Ethernet and InfiniBand connections, not for Wi-Fi.

Is there a way to bond Ethernet and Wi-Fi connections that's compatible with Network Manager?

  • 1
    for not breaking ssh sessions, I would recommend mosh. Commented Oct 23, 2017 at 14:43
  • Did you get this working in the end? I'm trying to do the same in Mint 19.1.
    – mcarans
    Commented Mar 1, 2019 at 14:44
  • @mcarans: There's still no way to do it with Network Manager's GUI. Someone claims to have done it using Network Manager's CLI (nmcli). I don't have cables run for my wired network where I am now, so I haven't tried this yet. If you try it, I'd appreciate it if you report back here (as an answer, if it works).
    – P Daddy
    Commented Mar 4, 2019 at 12:41
  • @PDaddy Thanks for that link, I have added an answer based on that link as it seems to work.
    – mcarans
    Commented Mar 5, 2019 at 11:11
  • This feature was added in Network Manager (GNOME interface) on 25 August 2021 and was released in NM 1.34.0. gitlab.gnome.org/GNOME/network-manager-applet/-/issues/140
    – Seb35
    Commented Jan 18, 2022 at 12:33

4 Answers 4

  1. Disable your ethernet connection

  2. Ensure your Wi-Fi connection is activated

  3. Execute the following commands replacing myeth0 with your ethernet device, mywifi0 with your wifi device, MYSSID with your Wi-Fi network and MYWIFIPASSWORD with your Wi-Fi password:

    nmcli con add type bond con-name bond ifname bond0 mode active-backup primary myeth0 +bond.options "fail_over_mac=active,miimon=100,primary_reselect=always,updelay=200"
    nmcli con add type wifi con-name bond-wlan slave-type bond master bond0 ifname mywifi0 ssid MYSSID
    nmcli con modify bond-wlan wifi-sec.key-mgmt wpa-psk wifi-sec.psk MYWIFIPASSWORD
    nmcli con add type ethernet con-name bond-eth slave-type bond master bond0 ifname myeth0
    nmcli con up bond
  4. You may also need to do the following if they aren't automatically started:

    nmcli c up bond-eth
    nmcli c up bond-wlan
  • 1
    I guess you meant nmcli c up bond-wlan?
    – sezanzeb
    Commented Oct 23, 2021 at 11:15
  • Thanks @sezanzeb. You are right. I have edited the answer.
    – mcarans
    Commented Oct 24, 2021 at 17:00
  • This is great! Only point I'd add is that if your packets don't seem to get replies at first - try clearing the ARP cache on your router for the old and new interface MACs. After I did that this all worked.
    – JinnKo
    Commented Feb 26 at 22:41

Note: Not a complete answer, resources that may derive an answer.

Reiterating the question:

Using Network Manager create a bonded link between a(n) AP and STA; such that:

  • a Wifi connection may exist
  • an Ethernet connection may exist
  • when both connections exist, prefer Ethernet
  • retain connection information regardless the connection (wifi, ethernet, both)

This question focuses on the STA (station), though for a bond to exist, the AP (Access Point) will require configuration.

Arch Linux details a solution (utilizing systemd / systemctl): Wireless Bonding

NetworkManager GUI does NOT present wifi as an option with bonding.

However, NetworkManager CLI does appear to support the Bonding options sought:

Network Bonding Using the NetworkManager Command Line Tool, nmcli

In working with the nmcli, bonding appears to support wifi:

$ nmcli con add type wifi ifname wlps3s0 master bond0

Error: Argument 'ssid' was expected, but 'master' provided.

This should get one closer to the solution of bonding an eth & wifi connection together. I don't presently have a full bond to fully answer this question.

$ nmcli con add type wifi ifname wlps3s0 master bond0 ssid $YOURSSID
  • 7
    could you please try to explain how this could help. Giving long command line without explaining them a little bit is generally a bad idea.
    – Kiwy
    Commented Sep 21, 2018 at 8:50
  • the OP gave a cmd line returning an error, this answer is the fix... (you need to set a SSID the OP didn't). The context is still master in a language communication.
    – None
    Commented Sep 11, 2021 at 7:10

What you need is an static DHCP configuration.

That will keep your network manager working as default and allow you to connect to any network at work/home.

There is no way to make other computers on your local network to believe your computer has the same IP under Ethernet and/or WiFi unless the IP is actually the same, for example

The way to have the same IP in both conditions is to make the DHCP server keep the same IP for the MAC address of your computer. However, the MAC address of Ethernet and Wifi are different (come from different hardware). There are some router software that can not do that

To be more specific, the DHCP server assigns this static IP to a unique MAC address assigned to each NIC on your LAN.

You can, however, get it working with dnsmasq

This allows an IP address to be associated with multiple hardware addresses, and gives dnsmasq permission to abandon a DHCP lease to one of the hardware addresses when another one asks for a lease. Beware that this is a dangerous thing to do, it will only work reliably if only one of the hardware addresses is active at any time and there is no way for dnsmasq to enforce this. It is, for instance, useful to allocate a stable IP address to a laptop which has both wired and wireless interfaces.

But you need to make sure that network manager on your laptop do not start both interfaces at the same time Maybe? this

  • Also, one might consider MAC cloning on either one of the interfaces.
    – loa_in_
    Commented Aug 23, 2018 at 16:01
  • 1
    @loa_in_ MAC clonning in this case is a very bad idea as both interfaces will be active in the same wire (~network). And may be that both get active at the same time. Where is a packet supposed to go if two MACs are equal?. A sure source of problems.
    – user232326
    Commented Aug 23, 2018 at 18:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .