Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Apr 2018 18:28:11 +0200
From:      Luca Pizzamiglio <pizzamig@freebsd.org>
To:        "Bjoern A. Zeeb" <bzeeb-lists@lists.zabbadoz.net>
Cc:        Giulio Ferro <auryn@zirakzigil.org>,  "freebsd-net@freebsd.org" <freebsd-net@freebsd.org>, FreeBSD Hackers <freebsd-hackers@freebsd.org>
Subject:   Re: Duplicate MAC addresses in VNET epair interaces
Message-ID:  <CAB88xy9-1%2BwsHFkt=YNdqh==XQSXsMr=E3YjD1qch0mpqzKxvQ@mail.gmail.com>
In-Reply-To: <8B1A6A6C-4280-4B96-9D60-FC9E7EEE2222@lists.zabbadoz.net>
References:  <472069af-0f9d-d830-064b-2d984a5774ae@zirakzigil.org> <8B1A6A6C-4280-4B96-9D60-FC9E7EEE2222@lists.zabbadoz.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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=3Dlog)

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@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:
>>
>> =E2=80=A6>
>
>>
>> (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=E2=80=99t make it into the t=
ree).
>
> ifconfig epair<x>[ab] ether 02:xx:xx:xx:xx  is your friend for now.
>
> /bz
>
> _______________________________________________
> freebsd-hackers@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org=
"
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAB88xy9-1%2BwsHFkt=YNdqh==XQSXsMr=E3YjD1qch0mpqzKxvQ>