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

Re: auto add usb network to bridge



Petric Frank (12023-09-25):
> a special problem. I have a debian (12) machine which has an onboard network
> card. This machine acts as dhcp-server also.
> 
> Now i want to add a usb network device. But this is not always there. It is
> plugged in when needed. And it should serve the same network as the onboard
> one.
> 
> My idea was to create a bridge and attach the host network interface to it.
> The problem now is how to get the usb network card attached to the bridge when
> plugged in.

Hi.

I used to do just that to bridge my two wlan adapters (until a reboot
where the mt76x2u started to refuse to believe it was not in China and
to use the 5 GHz band; I switched to stand-alone mesh access points).
Here is my config:

auto wlanA
iface wlanA inet static
        address 10.0.128.1
        netmask 255.255.255.0
        network 10.0.128.0
        broadcast 10.0.128.255
        bridge_ports none
        post-up systemctl try-reload-or-restart isc-dhcp-server.service

iface wlan0 inet manual
        post-up iw dev wlan0 set 4addr on || true
        post-up ip link set dev wlan0 master wlanA
        post-up systemctl start hostapd@wlan0.service
        pre-down systemctl stop hostapd@wlan0.service

iface wlan1 inet manual
        post-up iw dev wlan1 set 4addr on || true
        post-up ip link set dev wlan1 master wlanA
        post-up systemctl start hostapd@wlan1.service
        pre-down systemctl stop hostapd@wlan1.service

I think the lines that will be of use for you are “bridge_ports none”
and “post-up ip link set dev wlan* master”.

Regards,

-- 
  Nicolas George


Reply to: