[lxc-users] Failure to resolve container hostname
Serge Hallyn
serge.hallyn at ubuntu.com
Tue Jul 15 00:29:47 UTC 2014
Quoting Liam Elberty (liam.elberty at gmail.com):
> Hello all,
>
> I just started playing around with LXC earlier today.
>
> I'm on Ubuntu 12.04.4 LTS, running LXC version 0.7.5-3ubuntu69
>
> I'm using LXC out-of-the-box, which means it's by default using a dnsmasq
> server.
>
> If I get a container up and running with:
>
> *lxc-create -t ubuntu -n c1*
> *lxc-start -d -n c1*
>
> I cannot resolve the hostname.
>
> *ssh c1 *times out, I cannot *ping c1*, and *host c1 *also fails.
>
> However, I am able to connect through ssh if I grab the ip address directly
> by checking dnsmasq's lease:
>
> *cat /var/lib/misc/dnsmasq.leases*
>
> I can add the leased ip to my /etc/hosts and it resolves just fine, but
> this is not optimal as it will break as soon as a container gets assigned a
> new address.
>
> I'll also note that I tried adding '*dhcp-host=c1,10.0.3.101*' to
> /etc/lxc/dnsmasq.conf and restarted the network manager, as well as the
> lxc-net service, and this did nothing. The container was still dynamically
> assigned an IP.
This gets touchy - a few complications: 1. restarting network-manager does
not help at all. 2. 'restart lxc-net' won't help, you'll need to actually
"stop lxc-net; start lxc-net" due to some upstart details. 3. if any
containers are running, 'stop lxc-net' wont' actually destroy lxcbr0, so
'start lxc-net' won't restart the dnsmasq.
So I'd do "stop lxc-net", then check to make sure the dnsmasq is no longer
running. After that, and after restarting lxc-net, it *should* work. Does
for me here.
> I've been googling for the better part of the afternoon and figured I'd hit
> up the list, as I could not find anything. My networking chops are not the
> greatest - I'd say I'm at the high end of novice.
>
> Thanks in advance!
>
> Liam
> _______________________________________________
> lxc-users mailing list
> lxc-users at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users
More information about the lxc-users
mailing list