Subject: Re: How does the linux kernel select the MAC address for TAP devices?

From: Vlad Yasevich <[email-masked]>
Date: Mon, 16 Jun 2014 09:39:29 -0400

On 06/16/2014 04:00 AM, Albert Krenz wrote:
> As stated in the email subject: Where does the kernel get the used
> MAC-Adress for a newly create TAP device? Are they randomly generated
> or does it select one from a fixed pool of reserved MAC-Adresses?
> 
> I have not found any official documentation about the selection of
> MAC-addresses for TAP-devices. Most sites like
> http://backreference.org/2010/03/26/tuntap-interface-tutorial/ state
> that the MAC addresses are auto-generated and can be changed. But they
> do not explain the generation rules.
> 
> Does anyone know an official document (preferably from kernel.org)
> explaining the MAC selection process? Or is it only explained in the
> Source?

Yes, it is explained in the source.  In particular look at the function
tun_net_init().  The default MAC is random.

-vlad