Greetings,
I have an installation with LXD 5.9 and a set of ubuntu-minimal 20.04 containers that are all configured to have an eth0 as a MACVLAN from the host’s main ethernet
I need to migrate from MACVLAN to routed as I need to move the host to work over WiFi rather than ethernet for some time, and MACVLAN doesn’t seem to be working over WiFi
Following multiple discussions on this forum I managed to figure out a more-or-less working procedure, but I’m struggling with DNS settings on the container.
The procedure is as follows:
- Create a new profile for the specific IP
config:
user.network-config: |
version: 2
ethernets:
eth0:
addresses:
- 10.100.160.50/32
nameservers:
addresses:
- 10.100.160.1
routes:
- to: 0.0.0.0/0
via: 169.254.0.1
on-link: true
description: ""
devices:
eth0:
ipv4.address: 10.100.160.50
name: eth0
nictype: routed
parent: enp1s0
type: nic
name: routed_50
- Comment everything in the container’s /etc/netplan/50-cloud-init.yaml
- Restart container
After restarting the container seems to be able to reach the DGW at 10.100.160.1, ping available hosts on the lan but fails to resolve any host names. If I edit the /etc/resolve.conf and point it to my DGW instead of 127.0.0.53, the container starts resolving.
I found a similar problem from @nick_knutov and his solution of running systemd-resolve in the container appears to be working:
systemd-resolve --set-dns=10.100.160.1 --set-llmnr=yes --set-mdns=no --set-dnssec=no --interface=eth0
But unfortunately it doesn’t survive reboots or container restarts
Is there a way to make the DNS changes permanent?
P.S. It is quite possible that the problem is related to the cloud-init not working properly for ubuntu-minimal 20.04 images, that is still not resolved…