You are not logged in.
Netctl is advertised to have the ability to bind a wireless and wired adapter together, for example, to allow ssh access to either adapter on the same IP address. I'd like to include an example setup bonding a wired adapter together with a wireless adapter using systemd-networkd on the freshly re-vamped systemd-networkd wiki page.
1) Does it have this ability?
2) Care to share the setup either on the wiki page or here?
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
Yes, it has this ability. I'm using it as a wired to wireless failover.
These additional packages are requiered: ifenslave and wpa_supplicant. And you need to cofigure wpa_supplicant as explained here, and have it enabled.
I have configured a static IP bond0 interface with my primary interface being the wired device enp0s25 and the slave being the wlp3s0 device. You need four files in /etc/systemd/network/ to do this:
20-bond0.netdev
[NetDev]
Name=bond0
Kind=bond
50-bonding-master.network
[Match]
Name=bond0
[Network]
Address=172.16.0.2/24
Gateway=172.16.0.1
DNS=8.8.8.8
DNS=8.8.4.4
50-bonding-primary.network
[Match]
Name=enp0s25
[Network]
Bond=bond0
50-bonding-slave.network
[Match]
Name=wlp3s0
[Network]
Bond=bond0
Here you have the journal log, showing that it works:
Cable dettached:
ago 10 09:07:23 hipnos kernel: e1000e: enp0s25 NIC Link is Down
ago 10 09:07:23 hipnos kernel: bond0: link status definitely down for interface enp0s25, disabling it
ago 10 09:07:23 hipnos kernel: bond0: making interface wlp3s0 the new active one
ago 10 09:07:23 hipnos systemd[1]: Starting Network Service...
ago 10 09:07:23 hipnos systemd-networkd[3644]: bond0: netdev ready
ago 10 09:07:23 hipnos systemd-networkd[3644]: Enumeration completed
ago 10 09:07:23 hipnos systemd-networkd[3644]: bond0: netdev exists, using existing without changing its parameters
ago 10 09:07:23 hipnos systemd[1]: Started Network Service.
ago 10 09:07:23 hipnos systemd-networkd[3644]: enp0s25: Configured
ago 10 09:07:23 hipnos systemd-networkd[3644]: wlp3s0: Configured
ago 10 09:07:23 hipnos systemd-networkd[3644]: bond0: Configured
Cable reattached:
ago 10 09:07:35 hipnos kernel: e1000e: enp0s25 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: Rx/Tx
ago 10 09:07:35 hipnos systemd-networkd[3644]: enp0s25: Gained carrier
ago 10 09:07:35 hipnos kernel: bond0: link status definitely up for interface enp0s25, 1000 Mbps full duplex
ago 10 09:07:35 hipnos kernel: bond0: making interface enp0s25 the new active one
Here I switch off the wifi adapter (with the cable attached).
ago 10 09:10:18 hipnos kernel: iwlwifi 0000:03:00.0: RF_KILL bit toggled to disable radio.
ago 10 09:10:18 hipnos kernel: wlp3s0: deauthenticating from 10:fe:ed:40:b4:d2 by local choice (Reason: 3=DEAUTH_LEAVING)
ago 10 09:10:18 hipnos kernel: iwlwifi 0000:03:00.0: Not sending command - RF KILL
ago 10 09:10:18 hipnos kernel: wlp3s0: HW problem - can not stop rx aggregation for 10:fe:ed:40:b4:d2 tid 0
ago 10 09:10:18 hipnos kernel: iwlwifi 0000:03:00.0: Not sending command - RF KILL
ago 10 09:10:18 hipnos kernel: wlp3s0: failed to remove key (0, 10:fe:ed:40:b4:d2) from hardware (-5)
ago 10 09:10:18 hipnos kernel: iwlwifi 0000:03:00.0: Not sending command - RF KILL
ago 10 09:10:18 hipnos kernel: iwlwifi 0000:03:00.0: Not sending command - RF KILL
ago 10 09:10:18 hipnos kernel: iwlwifi 0000:03:00.0: Not sending command - RF KILL
ago 10 09:10:18 hipnos kernel: iwlwifi 0000:03:00.0: Not sending command - RF KILL
ago 10 09:10:18 hipnos kernel: iwlwifi 0000:03:00.0: Not sending command - RF KILL
ago 10 09:10:18 hipnos kernel: iwlwifi 0000:03:00.0: Not sending command - RF KILL
ago 10 09:10:18 hipnos kernel: wlp3s0: failed to remove key (1, ff:ff:ff:ff:ff:ff) from hardware (-5)
ago 10 09:10:18 hipnos kernel: iwlwifi 0000:03:00.0: Not sending command - RF KILL
ago 10 09:10:18 hipnos kernel: iwlwifi 0000:03:00.0: Not sending command - RF KILL
ago 10 09:10:18 hipnos systemd[1]: Starting Network Service...
ago 10 09:10:18 hipnos kernel: bond0: link status definitely down for interface wlp3s0, disabling it
ago 10 09:10:18 hipnos systemd-networkd[3747]: bond0: netdev ready
ago 10 09:10:18 hipnos systemd-networkd[3747]: Enumeration completed
ago 10 09:10:18 hipnos systemd-networkd[3747]: bond0: netdev exists, using existing without changing its parameters
ago 10 09:10:18 hipnos systemd[1]: Started Network Service.
ago 10 09:10:18 hipnos systemd-networkd[3747]: enp0s25: Configured
ago 10 09:10:18 hipnos systemd-networkd[3747]: wlp3s0: Configured
ago 10 09:10:18 hipnos systemd-networkd[3747]: bond0: Configured
And here i switch on the card:
ago 10 09:11:26 hipnos kernel: iwlwifi 0000:03:00.0: RF_KILL bit toggled to enable radio.
ago 10 09:11:26 hipnos kernel: iwlwifi 0000:03:00.0: L1 Enabled - LTR Disabled
ago 10 09:11:26 hipnos kernel: iwlwifi 0000:03:00.0: Radio type=0x1-0x0-0x1
ago 10 09:11:26 hipnos kernel: iwlwifi 0000:03:00.0: L1 Enabled - LTR Disabled
ago 10 09:11:26 hipnos kernel: iwlwifi 0000:03:00.0: Radio type=0x1-0x0-0x1
ago 10 09:11:26 hipnos systemd[1]: Starting Network Service...
ago 10 09:11:26 hipnos systemd-networkd[3802]: bond0: netdev ready
ago 10 09:11:26 hipnos systemd-networkd[3802]: Enumeration completed
ago 10 09:11:26 hipnos systemd-networkd[3802]: bond0: netdev exists, using existing without changing its parameters
ago 10 09:11:26 hipnos systemd[1]: Started Network Service.
ago 10 09:11:26 hipnos systemd-networkd[3802]: enp0s25: Configured
ago 10 09:11:26 hipnos systemd-networkd[3802]: wlp3s0: Configured
ago 10 09:11:26 hipnos systemd-networkd[3802]: bond0: Configured
ago 10 09:11:30 hipnos kernel: wlp3s0: authenticate with 10:fe:ed:40:b4:d2
ago 10 09:11:30 hipnos kernel: wlp3s0: send auth to 10:fe:ed:40:b4:d2 (try 1/3)
ago 10 09:11:30 hipnos kernel: wlp3s0: authenticated
ago 10 09:11:30 hipnos kernel: wlp3s0: associate with 10:fe:ed:40:b4:d2 (try 1/3)
ago 10 09:11:30 hipnos kernel: wlp3s0: RX AssocResp from 10:fe:ed:40:b4:d2 (capab=0x431 status=0 aid=1)
ago 10 09:11:30 hipnos kernel: wlp3s0: associated
ago 10 09:11:30 hipnos kernel: bond0: link status definitely up for interface wlp3s0, 0 Mbps full duplex
ago 10 09:11:31 hipnos systemd-networkd[3802]: wlp3s0: Gained carrier
Also, I want to share my systemd configuration that I use for tethering with my android phone. In my case I have three USB ports, so I have three posible name devices: enp14s0u1, enp0s29u1u2 and enp0s26u1u2. By using the name enp*s*u1* I'm able to use any of my three usb ports.
40-androidusb.network
[Match]
Name=enp*s*u1*
[Network]
DHCP=v4
But I run into troubles since every time I connected the phone an additional default route was added, having now two default routes in my table route (one configured by the bonding files, the other one by the tethering file), the solution I ended up with was to define a systemd service to fix the table routes, so every time I tether my phone, this service kick up and delete the default route configured by the bonding interface, and when the phone is disconnected or the tethering is finished, it adds the original default route:
tethering-fix.service
[Unit]
Description=Tethering Route Fix
After=sys-subsystem-net-devices-enp14s0u1.device
After=sys-subsystem-net-devices-enp0s29u1u2.device
After=sys-subsystem-net-devices-enp0s26u1u2.device
StopWhenUnneeded=true
[Service]
ExecStart=/usr/bin/route del default gw 172.16.0.1
ExecStop=/usr/bin/route add default gw 172.16.0.1 bond0
RemainAfterExit=yes
Type=oneshot
[Install]
WantedBy=sys-subsystem-net-devices-enp14s0u1.device
WantedBy=sys-subsystem-net-devices-enp0s29u1u2.device
WantedBy=sys-subsystem-net-devices-enp0s26u1u2.device
I did this mainly because I don't know how to switch network profiles in systemd, although this method has the advantage that it works automatically.
Hope you find it usefull.
Offline