Now, they have moved DNS resolution into systemd for a while now, and on the host machine this has not caused me an issue. I have to say though, it appears to me that using systemd to resolve DNS is not only overly complicated but a waste of everyone's time - but I'm sure someone must appreciate the value of it.
I tested that the network was working correctly and the virtual machine could access the DNS resolver if it had been configured correctly with the following command:
dig @192.168.1.1 www.ubuntu.com
This worked, so I knew that the virt. machine would work if the DNS resolver was working correctly.
So, how to fix the issue. I tried several methods - each trying not to disable the systemd service - but all met with failure with my testing , so in the end I decided to just turn it off and use the tried and trusted /etc/resolv.conf
The commands to achieve this are:
systemctl stop systemd.resolved
systemctl disable systemd.resolved
Then edit the following line in the file
/etc/NetworkManager/NetworkManager.conf
[main]
dns=default
Then remove the link in /etc
rm resolv.conf
Now create a new resolv.conf in /etc with the name of the nameserver you wish to use i.e.
namesever 192.168.1.1 < or whatever yours is >
The you need to restart the NetworkManager
sudo systemctl restart NetworkManager
This worked perfectly and the virtual machine is now happily resolving DNS correctly.
None of the above is destructive and can be reversed if the systemd could be made to work, but as this was only a test machine, I decided I had wasted enough time on it.
NB. While working on some more virtual machines I came across this blog post which offers a more elegant solution to this DNS problem for Ubuntu/Debian based distros.It allows you to keep DNS resoltion in systemd - so I can't have been the only person having issues with it.
Solve local DNS issues in Ubuntu and Debian
No comments:
Post a Comment