Set dns-nameserver via lxc command

I have some containers in different distributions
When I set external ip for my containers, my containers is accessible via external ip but my containers haven’t access to internet.

how can i set dns-nameserver for each container regardless of its distribution?
something like this: lxc config device set ct eth0

You can use the raw.dnsmasq parameter for that, so “lxc config edit containername” and then add:

raw.dnsmasq: dhcp-option=option:dns-server,

in the config section.

1 Like

dnsmasq is one way to do this. If you’ve got a static config, then you should just configure this inside the container or through cloud-init with the mechanism.

1 Like