Bonding wired and wireless while using Network Manager
Solution 1
- Disable your ethernet connection
- Ensure you wifi connection is activated
- Execute the following commands replacing myeth0 with your ethernet device, mywifi0 with your wifi device, MYSSID with your wifi network and MYWIFIPASSWORD with your wifi 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 c 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 c up bond
- You may also need to do the following if they aren't automatically started:
nmcli c up bond-eth
nmcli c up bond-wlan
Solution 2
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.
Solution 3
$ nmcli con add type wifi ifname wlps3s0 master bond0 ssid $YOURSSID
Related videos on Youtube
P Daddy
Updated on September 18, 2022Comments
-
P Daddy almost 2 years
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?
-
törzsmókus over 6 yearsfor not breaking ssh sessions, I would recommend mosh.
-
mcarans over 5 yearsDid you get this working in the end? I'm trying to do the same in Mint 19.1.
-
P Daddy over 5 years@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). -
mcarans over 5 years@PDaddy Thanks for that link, I have added an answer based on that link as it seems to work.
-
Seb35 over 2 yearsThis 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
-
-
loa_in_ almost 6 yearsAlso, one might consider MAC cloning on either one of the interfaces.
-
done almost 6 years@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.
-
S edwards almost 6 yearscould you please try to explain how this could help. Giving long command line without explaining them a little bit is generally a bad idea.
-
Alexis almost 3 yearsthe 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.
-
sezanzeb over 2 yearsI guess you meant
nmcli c up bond-wlan
? -
mcarans over 2 yearsThanks @sezanzeb. You are right. I have edited the answer.