Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 06 Feb 2017 19:53:12 +0000
From:      "Bjoern A. Zeeb" <bzeeb-lists@lists.zabbadoz.net>
To:        "Giulio Ferro" <auryn@zirakzigil.org>
Cc:        "freebsd-net@freebsd.org" <freebsd-net@freebsd.org>, freebsd-hackers@freebsd.org
Subject:   Re: Duplicate MAC addresses in VNET epair interaces
Message-ID:  <8B1A6A6C-4280-4B96-9D60-FC9E7EEE2222@lists.zabbadoz.net>
In-Reply-To: <472069af-0f9d-d830-064b-2d984a5774ae@zirakzigil.org>
References:  <472069af-0f9d-d830-064b-2d984a5774ae@zirakzigil.org>

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8B1A6A6C-4280-4B96-9D60-FC9E7EEE2222>