Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 3 down vote accepted

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.

share|improve this answer

                                        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;

enter image description here

liberiangeek


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

virtualmin

share|improve this answer
    
Note that this also breaks Vagrant and you need to add this line in your config: config.vm.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] –  user81043 Aug 3 '12 at 12:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.