[lxc-users] adding lxc containers to local DNS

Valentin LAB valentin.lab at kalysto.org
Wed Jul 2 15:45:55 UTC 2014


On 02/07/14 15:45, Bill Smith wrote:
> On Centos and/or Ubuntu, is there a way to configure the host's DNS so
> that the containers mapped in dnsmasq.leases are resolvable by nslookup?
>   I know I could get there by assigning static IPs and adding them to
> /etc/hosts.  I'm wondering whether it's possible for the host to use the
> usual C runtime to map a container name to an IP address without having
> to specify the mapping in /etc/hosts.

I use a DNS cascade: using "dnsmasq" to provide DHCP and DNS resolution 
(that's the job of dnsmasq) on lxcbr0, my /etc/resolv.conf points to a 
local dnsmasq running on device lo, this one falls back on the lxcbr0 
one and the lxcbr0 one falls back to my main BIND9 DNS (bound on my eth0 
- the internet connection). This main DNS can be authoritative of local 
public domains.

It's a little bit fancy but I get full domain resolution without any 
'.lxc' domain suffix or things like that. I can also add specific rules 
in my /etc/dnsmasq.conf that would only apply to the host and not the LXC.

Works well for now...
I'm on ubuntu.

-- 
Valentin LAB



More information about the lxc-users mailing list