From owner-freebsd-hackers@freebsd.org Tue Apr 10 17:26:11 2018 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E7A93F89218; Tue, 10 Apr 2018 17:26:10 +0000 (UTC) (envelope-from luca.pizzamiglio@gmail.com) Received: from mail-oi0-f45.google.com (mail-oi0-f45.google.com [209.85.218.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7BE9F8649B; Tue, 10 Apr 2018 17:26:10 +0000 (UTC) (envelope-from luca.pizzamiglio@gmail.com) Received: by mail-oi0-f45.google.com with SMTP id x9-v6so11923743oig.7; Tue, 10 Apr 2018 10:26:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=fXECtlAUaLaid3USiODCktVRejukMwUjc1tze712kEw=; b=BxOEEgKeVoZJyg/f4Vf7B6OYINuvswkvLWNrZZXjLoooSc/4s8ime7V/bzQLsOAD59 Qrl8zN5Fyp4XTkQ0rNbKMbCC7/Ly29XxgNr7qNZuA6Uxox/xj3YjcL8tHONpH4IRRw9L z91UKtkYIbcgtQiotEv9HCggT7qTUUnvXvf/Z5zjpfnhGqb2OTBoRhbdPDV2V1Sin9lb Xliql/C9L8PgGZTXUUsZtkV8fVRslKal6QwolIbDjFOpTQxl/KabyPAVzQxNdWhiuYDB RghH8boulwh9ECLuH1caga1uExvYMRdvvSexMaS3g+QbIjfW8wIlgwggn+i7gfXpxdt/ 7r/w== X-Gm-Message-State: ALQs6tCa3R9OaEh33JHe3jXleCE8D+kh/WQUQzqGnj0xCjcdlypGky8a 68GVvCxqw8etqE1srvWUnvGjlBfX X-Google-Smtp-Source: AIpwx4/KlCImT52/HpHkGREN7OsO0sinRcu9A1ozUqqGqrJQ0Q56VnOraeA0EijJPOxtfNJ9fxjwLg== X-Received: by 2002:aca:5c02:: with SMTP id q2-v6mr705047oib.106.1523377712239; Tue, 10 Apr 2018 09:28:32 -0700 (PDT) Received: from mail-ot0-f169.google.com (mail-ot0-f169.google.com. [74.125.82.169]) by smtp.gmail.com with ESMTPSA id p23-v6sm2316187oie.43.2018.04.10.09.28.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Apr 2018 09:28:32 -0700 (PDT) Received: by mail-ot0-f169.google.com with SMTP id o9-v6so13447470otj.5; Tue, 10 Apr 2018 09:28:31 -0700 (PDT) X-Received: by 2002:a9d:27aa:: with SMTP id c39-v6mr774600otb.104.1523377711876; Tue, 10 Apr 2018 09:28:31 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:22e8:0:0:0:0:0 with HTTP; Tue, 10 Apr 2018 09:28:11 -0700 (PDT) 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> From: Luca Pizzamiglio Date: Tue, 10 Apr 2018 18:28:11 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Duplicate MAC addresses in VNET epair interaces To: "Bjoern A. Zeeb" Cc: Giulio Ferro , "freebsd-net@freebsd.org" , FreeBSD Hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Apr 2018 17:26:11 -0000 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[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= " >