[lxc-users] Setting up LXC on Ubuntu 14.04

Serge Hallyn serge.hallyn at ubuntu.com
Tue Aug 12 15:05:02 UTC 2014


Quoting Fajar A. Nugraha (list at fajar.net):
> On Tue, Aug 12, 2014 at 10:47 AM, Serge Hallyn <serge.hallyn at ubuntu.com> wrote:
> > Ok, earlier you had said that you want a single ip address from
> > which you port forward to your containers.  I do that on my server
> > in a much simpler way.  My eth0 on the host is unmodified, a simple
> > nic using dhcp.  My lxcbr0 is the stock lxcbr0 provided by the lxc
> > package in ubuntu.  Then i use /etc/lxc/dnsmasq.conf to have dnsmasq
> > provide static ips to my containers, i.e.
> >
> > dhcp-host=h1,10.0.3.50
> > dhcp-host=h2,10.0.3.51
> >
> > (see https://help.ubuntu.com/14.04/serverguide/lxc.html)
> 
> Which lxc version is required for that? I'm on lxc 1.0.5-0ubuntu0.1
> from trusty-updates, and that does not work out of the box

I've been using this for quite awhile.

> After poking around a bit I see that /etc/init/lxc-net.conf has this line.
> 
> env LXC_DHCP_CONFILE=""
> 
> changing that to have /etc/lxc/dnsmasq.conf works, but I'm guessing
> users aren't suppose to edit their init scripts manually, and the

No, but /etc/default/lxc-net is fair game.  That's where I have

LXC_DHCP_CONFILE=/etc/lxc/dnsmasq.conf

> feature is automatically available on later versions of lxc?

Hm, my brand new lxc install has the following in /etc/default/lxc-net:

# Uncomment the next line if you'd like to use a conf-file for the lxcbr0
# dnsmasq.  For instance, you can use 'dhcp-host=mail1,10.0.3.100' to have
# container 'mail1' always get ip address 10.0.3.100.
#LXC_DHCP_CONFILE=/etc/lxc/dnsmasq.conf

-serge


More information about the lxc-users mailing list