1

I tweaked my system by installing ftp server and a dns server. I think in the process I messed up resolv.conf and the hosts file.

Now I want to restore it but am not able to do so. I am using ubuntu 14.04 x86_64.

Here is a screenshot that might help:

enter image description here

Seth
  • 59,332
pritamprasad
  • 73
  • 1
  • 8

2 Answers2

8

If you are running a currently-supported desktop version of Ubuntu, then networking should be handled by the NetworkManager service, and your /etc/network/interfaces file should contain only the default loopback interface definition

auto lo
iface lo inet loopback

To fix your /etc/resolv.conf file, you probably need to reconfigure the package from the command line using

sudo dpkg-reconfigure resolvconf

It will present you with a question about preparing /etc/resolv.conf for dynamic updates - answer "Yes". It may also present you with another question about temporarily appending your existing config to the dynamic one - if so you should probably answer "No" to that one. This will re-create the default symbolic link in place of your manually-edited file.

steeldriver
  • 142,475
1

Edit your /etc/network/interfaces with the correct settings.

sudo nano /etc/network/interfaces

Then restart your network device:

sudo ifdown eth0 && sudo ifup eth0

The resolv.conf will be recreated with the correct settings.

You can put the following in your hosts file if you want the defaults back:

127.0.0.1 localhost
127.0.1.1 hostname

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

The second line is only needed if your pc has a name. (Don't forget to substitue the name).

j.raymond
  • 142
Pabi
  • 7,429