[Lxc-users] How long the dhcp lease lasts
Michael H. Warfield
mhw at WittsEnd.com
Mon Apr 22 20:48:41 UTC 2013
On Mon, 2013-04-22 at 21:59 +0200, Robin Monjo wrote:
> Hello everyone,
>
> Using the default config, containers will have their IP attributed by
> the dnsmasq service. I'd like to write in the '/etc/hosts' file of the
> host system the hostname and the corresponding IP address of each
> container I start.
Why? If you're using dnsmasq, it's in the DNS cache of the dnsmasq
server. That's its purpose in life, to act as a DNS caching service.
Why do you need it in /etc/hosts when you've already got in in DNS?
> I will then use this hostname in an iptable rules for port forwarding.
> But what if dnsmasq change an IP at the end of the lease ?
> So the question is: how long an IP given by dnsmasq will last ?
What is your lease expiration configured for? I've used anything for a
few hours (high turnover large WiFi sites) to several days to carry over
a weekend along with static leases for servers and "permanent" devices.
It depends on what you've configured it for.
> May I see one of my container have its IP changed ?
Maybe. Depends on what you've configured it for. I'm not so sure about
dnsmasq acting as the dhcp server (which is what you are talking about)
but dhcpd will notify you of things like this. Most notably, you will
get deletes on old name/addresses and adds for new name/addresses both
forward and reverse, but it's all configuration driven.
> Any ways to have the dnsmasq table synced with the /etc/hosts file
> (container's host side) ?
Again... Why? Use the DNS cache in dnsmasq. You have no need to refer
to /etc/hosts at all.
> Kind regards
Regards,
Mike
--
Michael H. Warfield (AI4NB) | (770) 985-6132 | mhw at WittsEnd.com
/\/\|=mhw=|\/\/ | (678) 463-0932 | http://www.wittsend.com/mhw/
NIC whois: MHW9 | An optimist believes we live in the best of all
PGP Key: 0x674627FF | possible worlds. A pessimist is sure of it!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 482 bytes
Desc: This is a digitally signed message part
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20130422/c1d93df0/attachment.pgp>
More information about the lxc-users
mailing list