[Lxc-users] adding a default gateway inside a container as a non root user

Bekir Dogan bekirdo at gmail.com
Sat Mar 3 11:28:42 UTC 2012


On Fri, Mar 2, 2012 at 19:27, Serge Hallyn <serge.hallyn at canonical.com> wrote:
> Right now in ubuntu precise, it's
>    lxc-create -t ubuntu -n p1
>    lxc-start -n p1
> If you want to deploy a bunch of cloned images, you can
>    lxc-create -t ubuntu -n plain -B lvm
>    < customize /dev/lxc/plain image if you like >
>    for i in `seq 1 20`; do
>        lxc-clone -s -o plain -n p$i
>    done
> The only things different in Ubuntu are that a lxcbr0 bridge gets
> installed by default (*1), and the release has been tweaked a bit so no
> changes are needed to run in a container.  The first can't really
> be done in lxc.git (because it's distro-dependent),

I've looked into ubuntu precise lxc package, and after then realised
/etc/init/lxc-net.conf have a better implementation than I've been
trying to accomplish in simplelxc.
I've been trying to distribute IP addresses for containers by my,
using dnsmasq seems sane, actually I don't understand why I've been
trying to re-invent dhcp.

This might be a disto-dependent solution but maybe other distros could
implement the same concept and this provide inter-distro consistency
about default lxc networking.

Daniel (Bauman), what do you think about implementing a similar
solution into debian package, it looks sensible, we can add a new
init.d script like the one in
ubuntu:precise:lxc:/etc/init/lxc-net.conf and prepare host system

> and the second
> is of course independent of lxc.
> -serge
> (*1) and if you don't specify a configuration file at creation time,
> a default one using lxcbr0 is used.

More information about the lxc-users mailing list