[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: auto add usb network to bridge



	Hi.

On Mon, Sep 25, 2023 at 11:35:50AM +0200, Petric Frank wrote:
> My /etc/network/interfaces reads like this:
> ------------------ cut --------------------
> auto lo
> iface lo inet loopback
> 
> # onloard device
> iface ens18 inet manual
> 
> # usb device (not always there)
> iface enx0 inet manual
> 
> auto br0
> iface br0 inet static
>   address 10.10.10.1/24
>   bridge-ports ens18 enx0
>   bridge-stp off
>   bridge-fd 0
> ------------------ cut --------------------
> 
> This works as long the usb device is plugged in at boot time.
> 
> Connecting it later the usb network device appears but will not be attached to  the bridge.

You have to do it differently, like this:

auto lo
iface lo inet loopback

# onloard device
iface ens18 inet manual

# usb device (not always there)
allow-hotplug enx0
iface enx0 inet manual
up /sbin/ip link set $IFACE master br0

auto br0
iface br0 inet static
	address 10.10.10.1/24
	bridge-ports ens18
	bridge-stp off
	bridge-fd 0

What that does is forces udev to execute "ifup enx0" on USB device
detection, which in turn causes the network interface to attach to br0.

Reco


Reply to: