I'm trying to make LXC containers use static IP addresses. For that I specify

lxc.network.ipv4 =
lxc.network.ipv4.gateway =

in lxc config file. I have only loopback interface in /etc/network/interfaces in containers. And it mostly works. Except for domain name resolution. Is there a way to do something similar to what dns-nameservers stanza in /etc/network/interfaces does in lxc config file?

For now I'm considering to move network settings inside container.


I ended up having:

auto eth0
iface eth0 inet static

in /etc/network/interfaces. With /var/lib/lxc/*/config being:

lxc.network.type = veth
lxc.network.link = lxcbr0
lxc.network.flags = up
lxc.network.hwaddr = 00:16:3e:d6:21:a6

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.