3

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

lxc.network.ipv4 = 10.0.3.3
lxc.network.ipv4.gateway = 10.0.3.1

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.

x-yuri
  • 2,141
  • 2
  • 24
  • 29

1 Answers1

2

I ended up having:

auto eth0
iface eth0 inet static
address 10.0.3.2
gateway 10.0.3.1
dns-nameservers 8.8.8.8

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
x-yuri
  • 2,141
  • 2
  • 24
  • 29