This short tutorial describes how to create an active-backup bonding with netcfg, wpa_supplicant, systemd, ..
I had to install (additionally) ifplugd and ifenslave
The config file /etc/modprobe.d/bonding.conf needs to be adapted to:
/etc/modprobe.d/bonding.conf:
options bonding mode=active-backupFirst create a wpa_supplicant config file with all you wireless networks, passwords and stuff in it - here it is: /etc/wpa_supplicant/wpa_supplicant-roaming.conf (example file should be available in the directory)
You can run wpa_supplicant -c/etc/wpa_supplicant/wpa_supplicant-roaming.conf -iwlan0 to test if it works so far. It should connect to one of the available wireless networks (but without getting an ip address). Run dhcpcd wlan0 to get an ip and check if your wpa_supplicant config works so far.
If it works we have to enable it automatically at startup. This is done by creating /etc/systemd/system/mywpa_supplicant@.service with the following content:
/etc/systemd/system/mywpa_supplicant@.service:
[Unit]Then enable it with systemctl enable mywpa_supplicant@wlan0 and maybe try starting it manually by systemctl start mywpa_supplicant@wlan0.
Create a profile like /etc/network.d/bond with the following options:
/etc/network.d/bond:
CONNECTION='bond'Enable it at startup via systemctl enable netcfg@bond.service
This is required to recognize the plug-in and plug-out of the ethernet. It restarts the dhcpcd for the correct device.
Create file /etc/ifplugd/bond_dhcp.action and make it executable by chmod +x /etc/ifplugd/bond_dhcp.action
/etc/ifplugd/bond_dhcp.action:
#!/bin/shNow create the systemd service which starts ifplugd for bond0:
/etc/systemd/system/net-auto-bonded@.service:
[Unit]And enable it via systemctl enable net-auto-bonded@bond0.service