source of ether address for tap0 ?

Kyle Evans kevans at freebsd.org
Tue Apr 20 12:15:02 UTC 2021


On Tue, Apr 20, 2021 at 4:38 AM Kurt Jaeger <pi at freebsd.org> wrote:
>
> Hello,
>
> does anyone know how the system selects the MAC/ether adress of a
> newly-created tap0 device ?
>
> ifconfig tap0 create
>
> has this:
>
> tap0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
>         options=80000<LINKSTATE>
>         ether 58:9c:fc:10:98:02
>         groups: tap
>         media: Ethernet autoselect
>         status: no carrier
>         nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
>
> How is that selected ?
>
> We had a case where two devices selected the same ether/MAC...
>

tap MACs are derived from the hostid (/etc/hostid) -- you generally
end up with the same MAC in one of two scenarios:

1.) The hosts have identical /etc/hostid (bad, probably an issue with
machine provisioning where the hostid file is getting copied and thus,
not regenerated at boot?), or
2.) hostid isn't being preloaded

#2 may be the case if it's a machine that doesn't use loader, or
you've specifically disabled it with hostuuid_load="NO" in
loader.conf. I've got a WIP to improve the failure mode for that one
to fallback to a fully random MAC.

#1 can be fixed by moving hostid out of the way and letting the hostid
rc scripts generate and save a new one, assuming they're not getting
their data from bogus/duplicate smbios uuids.

Thanks,

Kyle Evans


More information about the freebsd-net mailing list