Duplicate MAC addresses in VNET epair interaces

Luca Pizzamiglio pizzamig at freebsd.org
Tue Apr 10 17:26:11 UTC 2018


Hi. I have the same problem.
The arc4random() call was committed  and reverted (
https://svnweb.freebsd.org/base/head/sys/net/if_epair.c?view=log)

I have a patch, that I'm currently using, that solves the issue locally
(available here https://pastebin.com/LpPEVJL7 )

To be more generic, I'd like to add some hostid bits, following the
approach of if_bridge, in case your epair interface has to be connected to
a LAN.

best regards,
pizzamig


On Mon, Feb 6, 2017 at 8:53 PM, Bjoern A. Zeeb <
bzeeb-lists at lists.zabbadoz.net> wrote:

> On 6 Feb 2017, at 18:53, Giulio Ferro wrote:
>
> Hi all,
>>
>>
>> Setup:
>>
>> 11.0-STABLE FreeBSD 11.0-STABLE #0 r312338: Tue Jan 17 12:29:38 UTC 2017
>>
>>
>> I've set up two freebsd hosts, each of which has  a single VNET jail.
>>
>> On each host I've created 2 epair interfaces.
>>
>> Host A
>>
>> - epair0a, epair1a on the host
>>
>> - epair0b, epair1b on the jail
>>
>>
>> Host B
>>
>> - epair0a, epair10a on the host
>>
>> - epair0b, epair10b on the jail
>>
>>
>> What I noticed is that on both hosts, each epair interface has the same
>> MAC address:
>>
>> …>
>
>>
>> (same behavior on the epair interfaces on the jail side)
>>
>>
>> As you can see, the mac addresses seems to depend on the order of the
>> creation of the epair, not on the name or address
>>
>>
>> This is a potentially bad behavior, because if I want to bridge say
>> epair1a on A with epair10a on B with a VPN or
>>
>> a physical connection giving 192.168.1.1 to epair1b and 192.168.1.2 to
>> epair10b, I won't be able to make them
>>
>> talk to each other since they have the same MAC address.
>>
>>
>> My question is: is this a bug or something I'm doing wrong? If there any
>> workaround I can use?
>>
>
>
> From the man page:
>
>      Like any other Ethernet interface, an epair needs to have a network
>      address.  Each epair will be assigned a locally administered address
> by
>      default, that is only guaranteed to be unique within one network
> stack.
>      To change the default addresses one may use the SIOCSIFADDR ioctl(2)
> or
>      ifconfig(8) utility.
>
> I thought someone patched it a few years ago to have a pseudo-random part
> to make collisions less likely and use the FreeBSD vendor space, but it
> seems that never happened for epair (or didn’t make it into the tree).
>
> ifconfig epair<x>[ab] ether 02:xx:xx:xx:xx  is your friend for now.
>
> /bz
>
> _______________________________________________
> freebsd-hackers at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe at freebsd.org"
>


More information about the freebsd-net mailing list