Solved tap0 device always comes up with same MAC address

Hello,

Got the issue here, I have 2 VMs and I'm trying to connect them with TINC VPN.
TINC uses if_dap driver and tap virtual interface. So far so good.

However for some reason (may be because both systems are vmware cloned VMs) whenever I create a tap interface on any of the systems it's always created with the same MAC address.
And because of tap0 interfaces with duplicate MAC addresses comes up on both systems there can't be established communication between them.

Even with just ifconfig tap0 create command I still got always the same MAC.

I have searched on the web trying to figure how does this MAC address is being generated but couldn't find any record about the FreeBSD if_tap driver and how to get an actual random MAC address generated on every tap0 device creation.

If I use ifconfig ether and change the MAC address then things starts working but this is not really the way I expected it to work.

Is this how the if_dap driver is expected to work? Having fixed MAC on every tap device creation?
 
Hello,

Thanks, it's the same hostid. I have change it and everything is fine now.
Didn't know and had no clue anywhere on the web that tap driver uses the hostid to generate MAC.
 
had no idea either but a quick grep thru the source and found iflib_gen_mac() which generates a mac
starting with 58-9C-FC and ending with the first 3 bytes of the md5 of hostuuid-ifnameX
 
had no idea either but a quick grep thru the source and found iflib_gen_mac() which generates a mac
starting with 58-9C-FC and ending with the first 3 bytes of the md5 of hostuuid-ifnameX
Interesting! Is there any way to create some specific MAC then? Other than altering the source, that is😁
 
Back
Top