systemd, netctl, ifplugd and bridge

Today I attended to automatic connection on wireless and wired interface. The wireless interface was no problem on Arch Linux. Just install wpa_actiond and enable netctl-auto@.service. More headache on the bridged interface:

ifplugd only recognizes interfaces listed in /proc/net/dev, where br0 isn’t listed until it is started by netctl. So after a bit research I found /etc/ifplugd/netctl.action which is called by ifplugd in conjunction with netctl. A typical call is “/etc/ifplugd/netctl.action eth0 up”. But eth0 isn’t in one of my netctl profiles as interface and br0 is no device in which a cable is ever plugged in..

So I’ve had to options: 1. Giving up my bridge, 2. Adjusting netctl.action. Giving up my bridge would lead to unusable VMs, ergo only one option left:

Replace the test against the interface with the bridge interface and the test against the connection with “bridge”. This will always use your bridge profile and nothing else anymore. In other words:

#Replace
[[ "$Interface" == "$1" && "$Connection" == "ethernet" ]] || continue
#with
[[ "$Interface" == "br0" && "$Connection" == "bridge" ]] || continue

After changing netctl.action you just need to enable netctl-ifplugd@eth0.service and ifplugd@eth0.service (replace eth0 with your interface).

Attention: I use only one bridge profile with a static IP. Whenever I need a dynamic IP I use my WiFi. It is possible that this solution my not work, if you use other profiles as well…