[lxc-users] Determining a container's MAC address

Serge Hallyn serge.hallyn at ubuntu.com
Tue Sep 1 05:03:14 UTC 2015


Quoting Fajar A. Nugraha (list at fajar.net):
> On Tue, Sep 1, 2015 at 3:23 AM, Peter Steele <pwsteele at gmail.com> wrote:
> 
> > On 08/31/2015 06:32 AM, Serge Hallyn wrote:
> >
> >>
> >> Should show up in a line like
> >>
> >> lxc.network.hwaddr = 00:16:3e:83:d1:8f
> >>
> >> in the created container config.
> >> _______________________________________________
> >> lxc-users mailing list
> >> lxc-users at lists.linuxcontainers.org
> >> http://lists.linuxcontainers.org/listinfo/lxc-users
> >>
> >
> > This is what I'd use to create a container with my own custom mac address,
> > but this field does not appear to get populated when a container is
> > created. I don't need my own custom address-- I'm happy to let LXC pick its
> > own mac address. I'd just like to be able to determine what mac it has
> > assigned a container without having to boot that container first.
> >
> >
> >
> 
> How did you create the container? which distro/version?
> 
> At least in ubuntu, the generated mac should be created and stored in
> config file without you having to edit anything.
> 
> If you DON'T see the lines in your config file, IIRC that means a new mac
> will be generated everytime the container boots. The only way to know its
> mac is by booting the container.

Right - if you use lxc-create to create the config file, and your
initial lxc.conf (i.e. /etc/lxc/default.conf or whatever you pass
as CONF to lxc-create -f CONF) contains something like

lxc.network.hwaddr = 00:16:3e:xx:xx:xx

then your container config will have an expanded hwaddr entry.


More information about the lxc-users mailing list