On Mon, 2013-04-22 at 22:58 +0200, Robin Monjo wrote: > Thank you for your answer. > I want to have the hostname and ip written in the /etc/hosts file so I > can access them directly using their hostname and not their ip. For > example, I'd like to ping the hostname rather than the ip.
But... You should get that from dnsmasq and not need them in /etc/hosts. That's the whole point of the DNS system. Reliance on /etc/hosts is old old stuff that was intended to be replaced by the DNS system ages ago. We should only need to rely on /etc/hosts for local things and very rare exceptional conditions. > I will document myself on dnsmasq to get a better understanding of everything. Cool. In most cases, dnsmasq can deal with DNS issues. You have to be sure that your host server references it, though, in /etc/resolv.conf (i.e. "nameserver 127.0.0.1) or it won't now where to ask. You then configure other domains under /etc/dnsmasq.d/ since dnsmasq is a limited forwarding / caching server. To go "full bore" will a full dns server and dhcp server, you would use the dhcpd package and bind (Berkeley Internet Name Daemon) package but that's probably overkill in your case. Regards, Mike > On Apr 22, 2013, at 10:48 PM, Michael H. Warfield <m...@wittsend.com> wrote: > > > 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 | m...@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! > > -- Michael H. Warfield (AI4NB) | (770) 985-6132 | m...@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!
signature.asc
Description: This is a digitally signed message part
------------------------------------------------------------------------------ Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis & visualization. Get a free account! http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________ Lxc-users mailing list Lxc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-users