[lxc-users] LXD static IP in container

Mike Wright nobody at nospam.hostisimo.com
Sat Feb 8 17:27:20 UTC 2020


On 2/8/20 6:13 AM, Andrey Repin wrote:
> Greetings, Michael Eager!
> 
>> Thanks.  I had tried this, but it didn't appear to work.  I just tried
>> it again and got it to work.
> 
>> I assume that I can move the eth0 definition back to the profile,
>> without the ipv4.address specification.
> 
> I don't know about LXD specifics, but for bare LXC, there was a difference
> in lxc.net.X.flags = up/down
> If you configure container network to be "up", LXC will try to configure
> network from the outside. If you set the interface to be "down", it will leave
> configuration to the container.

Hi Andrey,

I'm running lxc (lxc-ls --version 3.0.4).  Here's a stanza from config:

     lxc.net.3.type = veth
     lxc.net.3.link = LAN
     lxc.net.3.flags = up
     lxc.net.3.hwaddr = 00:16:3e:cf:2b:b3

As you can see I set the interface "up" in the config.  All network 
settings (IP, etc) are set within the container.  The bridge it is using 
is predefined in the host before invoking the container.

Hope that clears some things up.

Mike Wright


More information about the lxc-users mailing list