From owner-freebsd-stable@FreeBSD.ORG Mon Nov 4 21:08:34 2013 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id BBC0313A; Mon, 4 Nov 2013 21:08:34 +0000 (UTC) (envelope-from illoai@gmail.com) Received: from mail-pb0-x22c.google.com (mail-pb0-x22c.google.com [IPv6:2607:f8b0:400e:c01::22c]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9147722ED; Mon, 4 Nov 2013 21:08:34 +0000 (UTC) Received: by mail-pb0-f44.google.com with SMTP id rp8so1521016pbb.3 for ; Mon, 04 Nov 2013 13:08:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=/lud48gHxhNycsnZAkWjTP9kr3w4uCGFHbQd2mkLFYY=; b=bZRlaLIP/uemmd6OLgZad6DC3nPBoRknNXiXF5O6226RWiETeDHCHBtKGOQL550D61 ejgOnvpNlxmm7fhc+PRRdMLHJMUopfsP18O11v7y9qw5IICyBW7ZM4gPL15O72FsGBqp y2wYUYPck5ZdF1AMVToCFuyzibkgNyvFl2TI8+ExQtSlRBVH1xoZSkFolP8svysrJlwC DWHXJ7r6bt17r7KgJSQk8toHys1ZMvbebQaXxwgJPxi2MZ+DgayXhlXKb+08f10wcGfe fgaQUk+AMcNO9IaJaUeh4O5qbHWOzcYjj/Zse7PNKQ4gDJKrRRvsHP4P73eirTTxAbnV 6Lfw== MIME-Version: 1.0 X-Received: by 10.68.254.105 with SMTP id ah9mr19703534pbd.87.1383599313931; Mon, 04 Nov 2013 13:08:33 -0800 (PST) Received: by 10.68.218.136 with HTTP; Mon, 4 Nov 2013 13:08:33 -0800 (PST) In-Reply-To: <20131104170955.GH63947@dan.emsphone.com> References: <20131104170955.GH63947@dan.emsphone.com> Date: Mon, 4 Nov 2013 16:08:33 -0500 Message-ID: Subject: Re: how is the MAC for tap(4) computed? From: "illoai@gmail.com" To: Dan Nelson Content-Type: text/plain; charset=ISO-8859-1 Cc: FreeBSD Stable List , Aryeh Friedman , "freebsd-virtualization@freebsd.org" X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Nov 2013 21:08:34 -0000 On 4 November 2013 12:09, Dan Nelson wrote: > In the last episode (Nov 04), Aryeh Friedman said: >> There seems to be a very high rate of MAC address collisions when tap is >> running on different machines.... is there anyway to make the selection >> of MAC more random > > It looks like it's generated based on the number of ticks since boot, plus > the unit number of the tap device: > > http://fxr.watson.org/fxr/source/net/if_tap.c#L434 > > So if you have devices created on boot on a bunch of machines, chances are > high that you'll get conflicts. Maybe instead of using the 'ticks' value, > kern.hostid could be used instead? That has much better randomness than > 'ticks'. With physical interfaces you can use something like ifconfig ath0 ether 00:2d:44:88:ff:00 (assuming the device & the driver support changing MAC addresses) I've never tried it with a virtual interface, but it should work if the device supports it. -- --