[lxc-users] How to setup a static IP in a container with LX[C|D] 2.0.0.*

Hans Deragon hans at deragon.biz
Fri Mar 18 13:10:13 UTC 2016


Greetings,

Ok, this is ridiculous and I apologize for asking help for such a simple 
task, but I fail to find the answers by myself.  I fail to find proper 
documentation to setup bridge networking and static IP.  Newbie here btw 
and setup details at the end of this email.

I got the container running and with DHCP configured, it has its own IP 
which the host can address with.

Obviously, I attempted to setup the static IP many times following 
instructions found on many web pages, to no vail.  For example, I 
followed instructions from https://wiki.debian.org/LXC/SimpleBridge.  
But turns out that I am probably running a different version of LXC and 
that this page is now obsolete.

I went so far to run 'strace lxc restart server2' to realize that
/var/lib/lxc/server2/config is not read (server2 is the container).  
This seams to be confirmed by the post at 
http://ubuntuforums.org/showthread.php?t=2275372.

I found 'man lxc.container.conf'.  Seams promising.  However, I fail to 
find within the manual the path where this file should be saved!  If you 
write documentation, please always provide the path where configuration 
files are supposed to be stored.

I created a profile named 'bridged' using commands, but I have not found 
any option/instruction on how to apply that profile on my existing 
image.  'lxc start server2' does not provide any option to start the 
container with a particular profile.  BTW, where are profile 
configuration files stored?

I need clear step by step instructions, with full paths on how to set 
things up and I fail to find any on the web.  Anybody has a useful link 
to suggest?

I have a KVM image running (server1) and it works flawlessly with a 
static IP on my bridge.  And it wasn't hard to find instructions on how 
to set it up.  But LXD/LXc is another story.

The setup:

Host:       Ubuntu 14.04 LTS.
Container:  Ubuntu 14.04 LTS.
LXD:        2.0.0~rc3-0ubuntu4~ubuntu14.04.1~ppa1
LXC:        2.0.0~rc10-0ubuntu2~ubuntu14.04.1~ppa1

Best regards and thanks in advance,
Hans Deragon


More information about the lxc-users mailing list