<div dir="ltr"><div><div><div><div>Hi Fajar,<br><br></div>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.<br><br></div>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.<br><br></div>Thanks,<br></div>Dan<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 9, 2015 at 3:39 PM, Fajar A. Nugraha <span dir="ltr"><<a href="mailto:list@fajar.net" target="_blank">list@fajar.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Fri, Apr 10, 2015 at 5:29 AM, Dan Shi <<a href="mailto:bruingo@gmail.com">bruingo@gmail.com</a>> wrote:<br>
> I ran into a problem that only 253 containers get network connection. New<br>
> containers after that can't getIP from lxc bridge, even if I stop/destroy<br>
> existing running containers. The problem, apparently, is that the default in<br>
> /etc/default/lxc-net, has LXC_DHCP_MAX set to 253.<br>
><br>
> I suppose I can increase that number to have a large enough subnet. However,<br>
> I'm wondering if there is a more elegant solution. For example, I can<br>
> periodically call a script, or call it before destroying a container, to<br>
> release IP for dead containers?<br>
<br>
</div></div>The elegant solution should be letting the container shutdown<br>
gracefully (IIRC the default with lxc-stop since some time), which<br>
should release its DHCP lease.<br>
<br>
You could also look at /var/lib/misc/dnsmasq.lxcbr0.leases , but IMHO<br>
it's not worth the effort. Simply adjust /etc/default/lxc-net<br>
according to your needs (including changing its address and netmask if<br>
you plan to use more than 253 max dhcp clients) and shutdown your<br>
containers cleanly whenever possible.<br>
<br>
See also dnsmasq man page<br>
(<a href="http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html" target="_blank">http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html</a>).<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Fajar<br>
_______________________________________________<br>
lxc-users mailing list<br>
<a href="mailto:lxc-users@lists.linuxcontainers.org">lxc-users@lists.linuxcontainers.org</a><br>
<a href="http://lists.linuxcontainers.org/listinfo/lxc-users" target="_blank">http://lists.linuxcontainers.org/listinfo/lxc-users</a></font></span></blockquote></div><br></div>