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.
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:
Sounds like cloud-init isn’t applying the DNS nameserver 10.100.160.1 you specified.
What does resolvectl status show?
Does this work with the LXD built images, such as images:ubuntu/focal/cloud?
After a restart of the container I can ping local IPs. resolvectl reports an “empty” config:
root@focaltest:~# resolvectl status
Global
LLMNR setting: no
MulticastDNS setting: no
DNSOverTLS setting: no
DNSSEC setting: no
DNSSEC supported: no
DNSSEC NTA: 10.in-addr.arpa
16.172.in-addr.arpa
168.192.in-addr.arpa
17.172.in-addr.arpa
18.172.in-addr.arpa
19.172.in-addr.arpa
20.172.in-addr.arpa
21.172.in-addr.arpa
22.172.in-addr.arpa
23.172.in-addr.arpa
24.172.in-addr.arpa
25.172.in-addr.arpa
26.172.in-addr.arpa
27.172.in-addr.arpa
28.172.in-addr.arpa
29.172.in-addr.arpa
30.172.in-addr.arpa
31.172.in-addr.arpa
corp
d.f.ip6.arpa
home
internal
intranet
lan
local
private
test
Link 49 (eth0)
Current Scopes: none
DefaultRoute setting: no
LLMNR setting: yes
MulticastDNS setting: no
DNSOverTLS setting: no
DNSSEC setting: no
DNSSEC supported: no
It seems that cloud init was mostly ignored as netplan get show absolutely nothing:
root@focaltest:~# netplan get
root@focaltest:~#
I’ve spawned a images:ubuntu/focal/cloud container, applied my default, my cloud_init and the mentioned routed profiles and it worked like a charm. netplan was reporting the correct config, resolvectl status too and the container was able to resolve hosts.
Opened the bug as suggested
Solution to the case was to “user.user-data:” instead of “cloud-init.user-data:” in the config statement of the JSON. Verified with 18.04-minimal