[Lxc-users] lxcbr0 MAC addr issue

Serge Hallyn serge.hallyn at ubuntu.com
Wed Jun 5 14:30:34 UTC 2013


Quoting Michael H. Warfield (mhw at WittsEnd.com):
> On Wed, 2013-06-05 at 07:40 -0500, Serge Hallyn wrote: 
> > > Now my question, could not lxc (at boot) setup a fixed MAC addr for the host port?
> 
> > Yeah, given how bad this was for libvirt/qemu I'm surprised I've not seen
> > this happen in lxc - but I haven't, and noone else has reported it.
> 
> Actually, this has come up on both the -devel list and here, the last
> time about a year and a half ago:
> 
> On the -devel list...
> 
> Subject: "Set high byte of mac addresses for host veth devices to 0xfe"
> 
> It had a patch and referenced an open bug associated with it:
> 
> random veth device MAC addresses cause bridge problems - ID: 3411497
> https://sourceforge.net/tracker/index.php?func=detail&aid=3411497&group_id=163076&atid=826303
> 
> Christian Seiler included a proposed patch with his original posting to
> the -devel list back in November of 2011 where he set the high order
> byte to FE for a private "locally administered" MAC and some discussion
> ensued.  After a couple of bug fixes, it was Acked it on 01/03/2012.
> 
> It looks like it was applied.  Right around line 3109 of src/lxc/conf.c:
> 
> static int setup_private_host_hw_addr(char *veth1)
> 
>    ...
> 
>        ifr.ifr_hwaddr.sa_data[0] = 0xfe;
>        err = ioctl(sockfd, SIOCSIFHWADDR, &ifr);
>        close(sockfd);

yes and it does this.  The point is that lxcbr0 is not tied to any
physical nic.  So the first container you start, however high the
macaddr is, lxcbr0 takes its mac.  If the next container gets a
lower macaddr, lxcbr0's macaddr drops.

Right now I have:

lxcbr0    Link encap:Ethernet  HWaddr fe:02:72:77:79:ff  
vethtdjU5K Link encap:Ethernet  HWaddr fe:02:72:77:79:ff  

-serge




More information about the lxc-users mailing list