[lxc-users] How to release IP for inactive containers?
Dan Shi
bruingo at gmail.com
Fri Apr 10 22:34:24 UTC 2015
Hi Fajar,
Thanks for the reply! I tried to stop container gracefully (lxc-stop), but
the IP is not released, I can still find it in
/var/lib/misc/dnsmasq.lxcbr0.leases.
However, the IP assignment does get cleaned up after a while (once a day?)
it seems to be controlled by lease time, maybe default to 24 hours. I will
look into that.
Thanks,
Dan
On Thu, Apr 9, 2015 at 3:39 PM, Fajar A. Nugraha <list at fajar.net> wrote:
> On Fri, Apr 10, 2015 at 5:29 AM, Dan Shi <bruingo at gmail.com> wrote:
> > I ran into a problem that only 253 containers get network connection. New
> > containers after that can't getIP from lxc bridge, even if I stop/destroy
> > existing running containers. The problem, apparently, is that the
> default in
> > /etc/default/lxc-net, has LXC_DHCP_MAX set to 253.
> >
> > I suppose I can increase that number to have a large enough subnet.
> However,
> > I'm wondering if there is a more elegant solution. For example, I can
> > periodically call a script, or call it before destroying a container, to
> > release IP for dead containers?
>
> The elegant solution should be letting the container shutdown
> gracefully (IIRC the default with lxc-stop since some time), which
> should release its DHCP lease.
>
> You could also look at /var/lib/misc/dnsmasq.lxcbr0.leases , but IMHO
> it's not worth the effort. Simply adjust /etc/default/lxc-net
> according to your needs (including changing its address and netmask if
> you plan to use more than 253 max dhcp clients) and shutdown your
> containers cleanly whenever possible.
>
> See also dnsmasq man page
> (http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html).
>
> --
> Fajar
> _______________________________________________
> lxc-users mailing list
> lxc-users at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20150410/59bf5802/attachment.html>
More information about the lxc-users
mailing list