bridge-ports does not add second interface
I have the following setup:
A Pi zero W with a USB hub/ethernet adapter and a second USB/ethernet device plugged into one of the ports.
eth0 (the USB-NET on the 3-port USB hub) is a dhcp-enabled device
eth1 is part of the bridge, and connected to a powered switch (i.e. the link should always be good).
wlan0 is part of the bridge
br0 is static interfaces file is as follows:
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
hostname wirelessz
auto br0
iface br0 inet static
pre-up brctl addbr br0
pre-up ifconfig eth1 up
# up brctl addif br0 wlan0
# up brctl addif br0 eth1
bridge-ports eth1 wlan0
bridge-stp off
address 192.168.1.3
broadcaset 192.168.1.255
netmask 255.255.255.0
gateway 192.168.0.3
eth0 comes up just fine with a dhcp address.
br0 is set, and wlan0 is part of the bridge, but eth1 never is.
If I edit /etc/init.d/networking and in the start function, just after done (end of loop), I add this line:
brctl addif br0 eth1
Then it works as expected - eth1 is part of the bridge and everyone is happy.
Here is the log as it comes up:
[ 4.591049] Run /init as init process
[ 4.633506] mmc0: host does not support reading read-only switch, assuming write-enable
[ 4.652568] mmc0: new high speed SDHC card at address 1234
[ 4.673661] mmcblk0: mmc0:1234 SA08G 7.21 GiB
[ 4.696532] mmcblk0: p1 p2
[ 4.739680] mmc1: new high speed SDIO card at address 0001
[ 4.789135] usb 1-1: new high-speed USB device number 2 using dwc_otg
[ 4.798533] Indeed it is in host mode hprt0 = 00001101
Alpine Init 3.4.5-r3
* Loading boot drivers: [ 4.941630] squashfs: version 4.0 (2009/01/31) Phillip Lougher
ok.
* Mounting root: [ 5.039799] usb 1-1: New USB device found, idVendor=1a40, idProduct=0101, bcdDevice= 1.11
[ 5.053906] usb 1-1: New USB device strings: Mfr=0, Product=1, SerialNumber=0
[ 5.064245] usb 1-1: Product: USB 2.0 Hub
[ 5.192240] hub 1-1:1.0: USB hub found
[ 5.237719] hub 1-1:1.0: 4 ports detected
[ 5.699140] usb 1-1.2: new high-speed USB device number 3 using dwc_otg
[ 5.960674] usb 1-1.2: New USB device found, idVendor=0bda, idProduct=8152, bcdDevice=20.00
[ 5.975277] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 5.985903] usb 1-1.2: Product: USB 10/100 LAN
[ 5.993539] usb 1-1.2: Manufacturer: Realtek
[ 6.000887] usb 1-1.2: SerialNumber: 00E04F3988A1
[ 6.289142] usb 1-1.4: new high-speed USB device number 4 using dwc_otg
[ 6.530268] usb 1-1.4: New USB device found, idVendor=0bda, idProduct=8153, bcdDevice=30.00
[ 6.544740] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=6
[ 6.555337] usb 1-1.4: Product: USB 10/100/1000 LAN
[ 6.563397] usb 1-1.4: Manufacturer: Realtek
[ 6.570755] usb 1-1.4: SerialNumber: 000001
[ 8.549100] EXT4-fs (mmcblk0p2): mounting ext2 file system using the ext4 subsystem
[ 8.575522] EXT4-fs (mmcblk0p2): mounted filesystem without journal. Opts: (null)
ok.
OpenRC 0.42.1.a79726f487 is starting up Linux 5.4.83-0-rpi (armv6l)
* /proc is already mounted
* Mounting /run ... * /run/openrc: creating directory
* /run/lock: creating directory
* /run/lock: correcting owner
* Caching service dependencies ... [ ok ]
* Caching service dependencies ... [ ok ]
* Clock skew detected with `(null)'
* Adjusting mtime of `/run/openrc/deptree' to Fri Jan 1 09:37:29 2021
* WARNING: clock skew detected!
* Remounting devtmpfs on /dev ... [ ok ]
* Mounting /dev/mqueue ... [ ok ]
* Mounting security filesystem ... [ ok ]
* Mounting debug filesystem ... [ ok ]
* Mounting config filesystem ... [ ok ]
* Starting busybox mdev ... [ ok ]
* Loading hardware drivers ... [ ok ]
* WARNING: clock skew detected!
* Setting the local clock based on last shutdown time ... [ ok ]
* Loading modules ... [ ok ]
* Checking local filesystems ... [ ok ]
* Remounting root filesystem read/write ... [ ok ]
* Remounting filesystems ... [ ok ]
* Mounting local filesystems ... [ ok ]
* Configuring kernel parameters ... [ ok ]
* Creating user login records ... [ ok ]
* Wiping /tmp directory ... [ ok ]
* Setting hostname ... [ ok ]
* Starting busybox syslog ... [ ok ]
* WARNING: clock skew detected!
* Loading iptables state and starting firewall ... [ ok ]
* Starting networking ... * lo ... [ ok ]
* eth0 ...udhcpc: started, v1.31.1
udhcpc: sending discover
udhcpc: sending discover
udhcpc: sending select for 192.168.0.32
udhcpc: lease of 192.168.0.32 obtained, lease time 86400
[ ok ]
* br0 ...ip: RTNETLINK answers: Network unreachable
[ !! ]
* Starting dnsmasq ... [ ok ]
* Starting hostapd ...Configuration file: /etc/hostapd/hostapd.conf
wlan0: Could not connect to kernel driver
Using interface wlan0 with hwaddr b8:27:eb:05:68:d9 and ssid "nonei"
random: Cannot read from /dev/random: Resource temporarily unavailable
random: Only 0/20 bytes of strong random data available
random: Not enough entropy pool available for secure operations
WPA: Not enough entropy in random pool for secure operations - update keys later when the first station connects
wlan0: interface state UNINITIALIZED->ENABLED
wlan0: AP-ENABLED
[ ok ]
* Starting sshd ... [ ok ]
Welcome to Alpine Linux 3.12
Kernel 5.4.83-0-rpi on an armv6l (/dev/ttyS0)