[Lxc-users] Static IP in containers

Robin Monjo robin.monjo at applidget.com
Thu Nov 7 17:21:45 UTC 2013


Thank you very much guys !

On Nov 7, 2013, at 5:59 PM, Serge Hallyn <serge.hallyn at ubuntu.com> wrote:

> Quoting Robin Monjo (robin.monjo at applidget.com):
>> Thank you, it does set the correct IP but I can't reach internet now. Any idea ?
> 
> you'll need to set a route and resolv.conf, which lxc doesn't do.  You
> should be able to do that with a lxc.script.up script, though, so
> 
> cat > /usr/share/lxc/hooks/setroute << EOF
> #!/bin/sh
> route add -net default 10.0.3.1
> echo "nameserver 10.0.3.1" > /etc/resolvconf/resolv.conf.d/base
> EOF
> chmod ugo+x /usr/share/lxc/hooks/setroute
> echo "lxc.network.script.up = /usr/share/lxc/hooks/setroute" > /var/lib/lxc/$container/config
> 
> -serge





More information about the lxc-users mailing list