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

share|improve this question
    
Could you post the instructions you followed and the current content of related config files hosts...? – user.dz Jun 12 '14 at 10:02
    
i added 127.0.1.1 myname to the resolv.conf file.. everything was fine then i rebooted and everything gone. – pritamprasad Jun 12 '14 at 10:06
2  
Resolv.conf is generated file, sure you have seen this at top of it # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN. See askubuntu.com/questions/130452/… – user.dz Jun 12 '14 at 10:12
    
You should include in your question the version of Ubuntu you are using and whether it is a server version or a desktop (GUI) version. – steeldriver Jun 12 '14 at 11:54
up vote 8 down vote accepted

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.

share|improve this answer
    
You are awesome.. – user2407394 Jun 9 '15 at 12:34

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).

share|improve this answer
    
in my case i have wlan1, as i am using network through this, but the command [sudo ifdown wlan1 && sudo ifup wlan1] do not work for me.... it is giving error as [ignoring unknown interface] – pritamprasad Jun 12 '14 at 11:11
    
Can you post the output or a screenshot of the output from sudo ifconfig and sudo ifdown wlan1 – Pabi Jun 12 '14 at 11:16

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.