I want to set the DNS for an interface managed by systemd-networkd via cli. The file system is mounted read-only, so is there way to achieve this without manipulating any files?
I tried e.g.:
systemd-resolve --interface eth0--set-dns 12.34.56.1 --set-domain lxd
This gives me the error:
The specified interface eth0 is managed by systemd-networkd. Operation refused. Please configure DNS settings for systemd-networkd managed interfaces directly in their .network files.`
What I also tried is:
busctl call org.freedesktop.resolve1 /org/freedesktop/resolve1 org.freedesktop.resolve1.Manager SetLinkDNS 'ia(iay)' 2 1 2 4 8 8 8 8
Which results in the error: Link eth0 is managed
I would like to manipulate the DNS servers during runtime. It is no problem, when they get lost on reboot.