Solved bridge MAC address selection not random?

This morning I configured a FreeBSD host on my network with a simple bridge:
Code:
cloned_interfaces="bridge0"
ifconfig_bridge0="inet 192.168.0.2/24 addm igb0 addm igb1"
ifconfig_igb0="up"
ifconfig_igb1="up"

igb0 is connected to my network, while igb1 is currently not connected to anything.

For the last couple of hours, I've been banging my head against a wall trying to work out why I can't get any reliable connectivity to 192.168.0.2. Trying to ping it was extremely intermittent, with only 1-3 replies coming in each minute, and attempting to ssh to it took forever, then if it succeeded, the connection stalled right away.

I've just discovered what the problem is. Another FreeBSD host on my network also has a bridge configured, and the "randomly chosen" MAC address on the bridge has turned out to be identical: 58:9c:fc:10:e7:3f.

The if_bridge(4) does say:
The if_bridge interface randomly chooses a link (MAC) address in the
range reserved for locally administered addresses when it is created.
This address is guaranteed to be unique only across all if_bridge
interfaces on the local machine. Thus you can theoretically have two
bridges on different machines with the same link addresses. The address
can be changed by assigning the desired link address using ifconfig(8).

I note the point about two bridges on different machines theoretically getting the same link address, but if it is randomly chosen, then this should seem extremely unlikely to happen. It happened first time for me! Is this claim of "random" choice false?

Also, it mentions choosing an address in the range reserved for locally administered addresses, but according to MAC Address - Wikipedia, this means the second digit of the address should be 2, 6, A or E. 8 means universally administered.

Is the man page inaccurate, or am I misunderstanding something?

(I know that I can fix this issue by manually assigning a MAC to the bridge, or setting the sysctl to use the MAC of the first member interface.)
 
I note the point about two bridges on different machines theoretically getting the same link address, but if it is randomly chosen, then this should seem extremely unlikely to happen.
Law of inevitability, if it can happen it will happen.
 
try setting different hostid in sysctl.conf
kern.hostid
Thanks for this suggestion. I found that both systems had the same hostid, so I tried deleting /etc/hostid and rebooting so that it generated a new one, but it generated the same value as before.

Then I remembered that the system I configured this morning used to be my old 2-port FreeBSD router (Jetway) which I replaced 3.5 years ago with a 6-port SFF PC (Kettop). At the time, I just moved the SSD from the Jetway to the Kettop, so the new router ended up with the same hostid as the old one. It appears the hostid is based on the hardware UUID stored in the smbios, so I needed to regenerate it on my newer router system, not the old one.

Interestingly, the Kettop system has a hardware UUID that's listed as 'INVALID' in /etc/rc.d/hostid, so it randomly generated one instead.

The MAC address of the bridge is now different and connectivity is fine.
 
Back
Top