View previous topic :: View next topic |
Author |
Message |
mahi n00b
Joined: 18 Mar 2004 Posts: 34
|
Posted: Wed Dec 22, 2021 11:19 am Post subject: Single NIC bridge: dhcpcd gets IP for both bridge and NIC |
|
|
[OpenRC, system up-to-date, kernel configured with support for 802.1d Ethernet Bridging]
I've created a single NIC bridge for a QEMU virtual machine according to the instructions in the Gentoo Wiki (Network bridge).
My physical interface is eno16777728 and the bridge br0:
/etc/conf.d/net
Code: | config_eno16777728="null"
bridge_br0="eno16777728"
config_br0="dhcp"
bridge_forward_delay_br0=0
bridge_hello_time_br0=1000 |
In /etc/init.d/ there's a symbolic link from net.br0 to net.lo and net.br0 is added to the default run level. There is no entry for eno16777728 in /etc/init.d/.
The bridge works. Both the host computer and the QEMU virtual machine can use the network.
However, I'm very confused by the dhcpcd logs and ifconfig output. I would have expected the bridge to fully replace the physical interface but it seems both are online:
ifconfig
Code: | br0: flags=4419<UP,BROADCAST,RUNNING,PROMISC,MULTICAST> mtu 1500
inet 192.168.1.134 netmask 255.255.255.0 broadcast 192.168.1.255
ether 00:0c:29:bb:6a:a6 txqueuelen 1000 (Ethernet)
RX packets 8873 bytes 4019949 (3.8 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 392 bytes 166048 (162.1 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eno16777728: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.134 netmask 255.255.255.0 broadcast 192.168.1.255
ether 00:0c:29:bb:6a:a6 txqueuelen 1000 (Ethernet)
RX packets 8009 bytes 2626551 (2.5 MiB)
RX errors 0 dropped 35 overruns 0 frame 0
TX packets 2045 bytes 1737002 (1.6 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
... |
Why is eno16777728 still listed here and why does it even have an IP address - the same as br0?
System logs:
Code: | Dec 22 11:45:08 [dhcpcd] dhcpcd-9.4.0 starting
Dec 22 11:45:08 [dhcpcd] dev: loaded udev
Dec 22 11:45:08 [dhcpcd] DUID 00:01:00:01:21:9e:27:ed:00:0c:29:bb:6a:a6
Dec 22 11:45:08 [dhcpcd] no interfaces have a carrier
Dec 22 11:45:08 [dhcpcd] eno16777728: waiting for carrier
Dec 22 11:45:08 [dhcpcd] eno16777728: carrier acquired
Dec 22 11:45:08 [dhcpcd] eno16777728: IAID 29:bb:6a:a6
Dec 22 11:45:08 [kernel] [ 3.320567] e1000: eno16777728 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None
Dec 22 11:45:08 [kernel] [ 3.388668] br0: port 1(eno16777728) entered blocking state
Dec 22 11:45:08 [kernel] [ 3.388678] br0: port 1(eno16777728) entered disabled state
Dec 22 11:45:08 [kernel] [ 3.388794] device eno16777728 entered promiscuous mode
Dec 22 11:45:08 [kernel] [ 3.390729] device br0 entered promiscuous mode
Dec 22 11:45:08 [kernel] [ 3.391695] br0: port 1(eno16777728) entered blocking state
Dec 22 11:45:08 [kernel] [ 3.391696] br0: port 1(eno16777728) entered forwarding state
Dec 22 11:45:08 [dhcpcd] sending commands to dhcpcd process
Dec 22 11:45:08 [dhcpcd] control command: dhcpcd -m 3 br0
Dec 22 11:45:08 [dhcpcd] br0: IAID 29:bb:6a:a6
Dec 22 11:45:08 [dhcpcd] br0: IAID conflicts with one assigned to eno16777728
Dec 22 11:45:08 [dhcpcd] eno16777728: rebinding lease of 192.168.1.134
Dec 22 11:45:08 [dhcpcd] eno16777728: probing address 192.168.1.134/24
Dec 22 11:45:10 [dhcpcd] br0: rebinding lease of 192.168.1.134
Dec 22 11:45:10 [dhcpcd] br0: probing address 192.168.1.134/24
Dec 22 11:45:14 [dhcpcd] eno16777728: leased 192.168.1.134 for 7200 seconds
Dec 22 11:45:14 [dhcpcd] eno16777728: adding route to 192.168.1.0/24
Dec 22 11:45:14 [dhcpcd] eno16777728: adding default route via 192.168.1.1
Dec 22 11:45:14 [dhcpcd] br0: leased 192.168.1.134 for 7200 seconds
Dec 22 11:45:14 [dhcpcd] br0: adding route to 192.168.1.0/24
Dec 22 11:45:14 [dhcpcd] br0: adding default route via 192.168.1.1 |
So it seems dhcpcd ignores /etc/conf.d/net and first brings up the physical interface, then the bridge. But why?
In topic Network does not work after boot a very similar issue is being described. The user created a single NIC bridge and here too both bridge and physical interface come online. The user "fixed" that by removing dhcpcd from the default run level.
I tried that as well but it does not fix the issue. Both interfaces are still online after a reboot. The system log looks different, though:
Code: | Dec 22 11:58:30 [kernel] [ 3.280876] br0: port 1(eno16777728) entered blocking state
Dec 22 11:58:30 [kernel] [ 3.280886] br0: port 1(eno16777728) entered disabled state
Dec 22 11:58:30 [kernel] [ 3.280982] device eno16777728 entered promiscuous mode
Dec 22 11:58:30 [kernel] [ 3.282875] device br0 entered promiscuous mode
Dec 22 11:58:30 [dhcpcd] dhcpcd-9.4.0 starting
Dec 22 11:58:30 [dhcpcd] DUID 00:01:00:01:21:9e:27:ed:00:0c:29:bb:6a:a6
Dec 22 11:58:30 [kernel] [ 3.300447] e1000: eno16777728 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None
Dec 22 11:58:30 [kernel] [ 3.300957] br0: port 1(eno16777728) entered blocking state
Dec 22 11:58:30 [kernel] [ 3.300959] br0: port 1(eno16777728) entered forwarding state
Dec 22 11:58:30 [dhcpcd] br0: IAID 29:bb:6a:a6
Dec 22 11:58:31 [dhcpcd] br0: rebinding lease of 192.168.1.134
Dec 22 11:58:31 [dhcpcd] br0: probing address 192.168.1.134/24
Dec 22 11:58:37 [dhcpcd] br0: leased 192.168.1.134 for 7200 seconds
Dec 22 11:58:37 [dhcpcd] br0: adding route to 192.168.1.0/24
Dec 22 11:58:37 [dhcpcd] br0: adding default route via 192.168.1.1
...
Dec 22 11:58:48 [dhcpcd] dhcpcd-9.4.0 starting
Dec 22 11:58:48 [dhcpcd] dev: loaded udev
Dec 22 11:58:48 [dhcpcd] DUID 00:01:00:01:21:9e:27:ed:00:0c:29:bb:6a:a6
Dec 22 11:58:48 [dhcpcd] eno16777728: IAID 29:bb:6a:a6
Dec 22 11:58:50 [dhcpcd] eno16777728: rebinding lease of 192.168.1.134
Dec 22 11:58:50 [dhcpcd] eno16777728: probing address 192.168.1.134/24
Dec 22 11:58:54 [dhcpcd] eno16777728: leased 192.168.1.134 for 7200 seconds
Dec 22 11:58:54 [dhcpcd] eno16777728: adding route to 192.168.1.0/24
Dec 22 11:58:54 [dhcpcd] eno16777728: adding default route via 192.168.1.1 |
At first it seems to be working fine. Dhcpcd brings online only br0. But then dhcpcd suddenly starts a second time and brings eno16777728 online. Why?
I searched for occurrences of eno16777728 over the entire /etc/* and /usr/* directories but the only ones are in /etc/conf.d/net. Thus why does dhcpcd insist on bringing the interface online and how can I prevent it?
Last edited by mahi on Wed Dec 22, 2021 5:49 pm; edited 1 time in total |
|
Back to top |
|
|
grknight Retired Dev
Joined: 20 Feb 2015 Posts: 2010
|
Posted: Wed Dec 22, 2021 1:47 pm Post subject: |
|
|
Hopefully, the dhcpcd service is not running.
Show the output of 'rc-status -a' for futher assistance. |
|
Back to top |
|
|
mahi n00b
Joined: 18 Mar 2004 Posts: 34
|
Posted: Wed Dec 22, 2021 4:09 pm Post subject: |
|
|
Here's the output of rc-status:
rc-status -a
Code: | Runlevel: shutdown
killprocs [ stopped ]
savecache [ stopped ]
mount-ro [ stopped ]
Runlevel: boot
termencoding [ started ]
hwclock [ started ]
modules [ started ]
fsck [ started ]
root [ started ]
mtab [ started ]
swap [ started ]
localmount [ started ]
urandom [ started ]
hostname [ started ]
procfs [ started ]
binfmt [ started ]
sysctl [ started ]
bootmisc [ started ]
keymaps [ started ]
save-keymaps [ started ]
loopback [ started ]
save-termencoding [ started ]
stmpfiles-setup [ started ]
Runlevel: default
samba [ started ]
metalog [ started ]
sshd [ started ]
dhcpcd [ started ]
net.br0 [ started ]
netmount [ started ]
pure-ftpd [ started ]
nullmailer [ started ]
apache2 [ started ]
acpid [ started ]
cronie [ started ]
startstopmailer [ started ]
autofs [ started ]
nfs [ started ]
ntpd [ started ]
numlock [ started ]
wsdd [ started ]
local [ started ]
Runlevel: nonetwork
local [ started ]
Runlevel: sysinit
sysfs [ started ]
devfs [ started ]
udev [ started ]
dmesg [ started ]
kmod-static-nodes [ started ]
stmpfiles-dev [ started ]
udev-trigger [ started ]
cgroups [ started ]
Dynamic Runlevel: hotplugged
Dynamic Runlevel: needed/wanted
rpc.pipefs [ started ]
rpcbind [ started ]
rpc.statd [ started ]
rpc.idmapd [ started ]
Dynamic Runlevel: manual |
When I remove dhcpcd from runlevel default it is still shown as started (after a reboot) but under "Dynamic Runlevel: needed/wanted". |
|
Back to top |
|
|
grknight Retired Dev
Joined: 20 Feb 2015 Posts: 2010
|
Posted: Wed Dec 22, 2021 4:21 pm Post subject: |
|
|
mahi wrote: | When I remove dhcpcd from runlevel default it is still shown as started (after a reboot) but under "Dynamic Runlevel: needed/wanted". |
So this problem is the generic requiring "net" problem that the defaults starts all net services available.
Ways to solve this is to change rc_depend_strict in /etc/rc.conf or else find out what is "wanting/needing" dhcpcd by pretending to stop it.
The latter is easy to do with 'rc-service --dry-run dhcpcd stop'. Once this is known, the dependencies can be customized in the respective conf.d files.
(EDIT: changed command) |
|
Back to top |
|
|
mahi n00b
Joined: 18 Mar 2004 Posts: 34
|
Posted: Wed Dec 22, 2021 5:46 pm Post subject: |
|
|
Thank you. That was very useful information!
I'm embarrassed to admit the problem is caused by a script I wrote myself: startstopmailer visible as started in runlevel default. It's a very simple script and its sole purpose is to send me a mail with the public and private IP addresses whenever the system is started, and the uptime when the system is stopped. Its depend section looks as follows:
Code: | depend() {
need dhcpcd net nullmailer
use dns mta
} |
There's my problem...
I have removed dhcpcd from the depend section and everything seems to work fine now: Rc-status no longer lists dhcpcd after a reboot, the system logs indicate dhcpcd acquires an IP address for the bridge only and ifconfig shows no IP address for the physical interface. |
|
Back to top |
|
|
|