Jan-Philipp Litza

Bonding Wifi interfaces with Network Manager

For a long time, it bothered me that transitioning from network cable to Wifi caused a loss of all persistent connections. SSH being the most painful, others were noticable too (streams, chat, …).

After upgrading to Ubuntu 18.04, I noticed that Network Manager has the ability to control bonding devices. Maybe it gained this ability even earlier, but I just noticed it now. What Linux calls bonding, others teaming, port channel or link aggregation group, is usually used with multiple cables to increase throughput, reliability or both of mostly servers. The different modes decide which packets are sent out which “slave” interface, sometimes in cooperation with the switches they are connected to, sometimes without. So why not use bonding to bond the ethernet and Wifi cards in active-backup mode?

Problem was, the GUI of Network Manager apparently doesn’t want you to bond wifi interfaces. Manually, using ip link, I was able to configure the desired bond. But ditching Network Manager altogether makes managing Wifi networks really cumbersome. So after digging around a bit, I found the holy grail:

nmcli conn modify "Wifi connection" connection.master bond0 connecion.slave-type bond

This simply adds the already configured wifi connection as a slave to the already configured active-backup bond connection. You can even use the GUI afterwards to mange both, it’s just this link that cannot be created with the GUI.

Now, I can dock and undock my laptop without losing all SSH connections. ☺