I have a laptop that has wifi and cable. The ethernet interface is called enp0s21f5 and I need to have it under a bridge to be able to connect tap/tun from kvm virtual machines. The networking is configured via /etc/network/interfaces:

auto br0 iface br0 inet dhcp bridge_ports enp0s21f5 bridge_stp off

(I have bridge_stp off to avoid the learning phase of the bridge where dhcp would hold for 30 seconds)..

The problem I try to solve is the case where the network cable is not connected and I boot up. I already decreased the timeout in the systemd scripts. However I want to make it use allow-hotplug instead. allow-hotplug br0 doesnt seem to work because the event is on enp0s21f5.

Question: Is there some howto that describe howto setup the networking definition to handle this kind of setup? I understand that I would need to trigger a script on plugin/plugoff of ethernet cable that would configure my bridge setup. Maybe with allow-hotplug enp0s21f5 and manual configuration? Maybe

auto br0
iface br0 inet manual
  bridge_ports enp0s21f5
  bridge_stp off   

allow-hotplug enp0s21f5
iface enp0s21f5 inet manual
  post-up brscript.sh
  post-down brscript.sh

or similar? Because this is a standard scenario I wonder weather there is such a brscript.sh script already? Or is there some other way to do it?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.