Discussion:
source of ether address for tap0 ?
Kurt Jaeger
2021-04-20 11:38:09 UTC
Permalink
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...
--
***@opsec.eu +49 171 3101372 Now what ?
Kyle Evans
2021-04-20 12:14:50 UTC
Permalink
Post by Kurt Jaeger
Hello,
does anyone know how the system selects the MAC/ether adress of a
newly-created tap0 device ?
ifconfig tap0 create
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
Kurt Jaeger
2021-04-21 07:55:44 UTC
Permalink
Hi!
Post by Kyle Evans
Post by Kurt Jaeger
does anyone know how the system selects the MAC/ether adress of a
newly-created tap0 device ?
ifconfig tap0 create
[...]
Post by Kyle Evans
Post by Kurt Jaeger
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
Thanks! I've submitted two PRs to help others find this info in
the future.

augment if_tuntap man page on source of autogenerated MAC (/etc/hostid)
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=255294

man page for /etc/hostid and pointer in sethostid/gethostid(3) to /etc/hostid
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=255293

If I find the time, I'll try to submit the necessary patches.
--
***@FreeBSD.org +49 171 3101372 Now what ?
Loading...