Upgraded server to 12.04 DNS no longer working
Solution 1
I solved it in another way, because I have the impression the solution above is doing what was not asked, i.e. implementing a dhcp server.
I deleted the bind9 and dhcp3-server with
sudo aptitude remove bind9 dhcp3-server
and restarted networking with
sudo /etc/init.d/networking restart
I also changed the file /etc/NetworkManager/NetworkManager.conf. Its contents looks like:
[main]
plugins=ifupdown,keyfile
dns=dnsmasq
[ifupdown]
managed=true
After modifying this file, I had to restart the Network Manager service:
sudo service network-manager restart
Now the dhcp client seems to set the dns server to the one provided by dhcp.
Solution 2
Setup Static DNS Servers in Ubuntu 12.04 (Precise Pangolin)
sudo nano /etc/dhcp/dhclient.conf
Then change the line highlighted to
prepend domain-name-servers x.x.x.x, y.y.y.y;
Ubuntu 12.04 changes the way DNS setup is handled. Rather than adding nameservers to /etc/resolv.conf, they need to be added to /etc/network/interfaces.
Edit /etc/network/interfaces, look for your primary ethernet device (such as eth0), and add this line under your primary ethernet device:
dns-nameservers 127.0.0.1
And then restart your networking:
/etc/init.d/networking restart
Related videos on Youtube
Pieter
Updated on September 18, 2022Comments
-
Pieter over 1 year
I cannot ping/reach any website/service by name (e.g. ping google.com).
I could temporarily fix this by changing 127.0.0.1 to my router in /etc/resolv.conf But that file gets overwritten.
How can I permanently fix this?
To be clear, I don't need a DNS server, I just want my server to be able to use DNS from DHCP.
-
Admin almost 12 yearsNote that this also breaks Vagrant and you need to add this line in your config: config.vm.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]