Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
sudo apt-get update 
sudo apt-get upgrade
  1. ifconfig

  2. sudo nano /etc/network/interfaces

    auto eth0
    iface eth0 inet static
  3. sudo nano /etc/resolv.conf

    Do not edit this file by hand --your changes will be overwritten
    # I add this 
  4. sudo apt-get remove dhcp-client

  5. sudo /etc/init.d/networking restart

    *Running /etc/init.d/networking restart is deprecated because it may 
    not enable again some interfaces
    *Reconfiguring network interfaces...
    ssh stop/waiting
    ssh start/running,process 1438

Where is the mistake? I'm not lazy. I Googled it for 3 days but without results. I tried everything.

After reboot the /etc/resolv.conf file is flashing to the original state.

share|improve this question
Hmm any idea why you don't just do everything within the /etc/network/interfaces configuration folder like here: Or does it make more sense to actually split things up like you did within the resolv.conf and interfaces configuration folder? – user153286 Apr 28 '13 at 14:33
I did it by directly going to the networks tab and editing it manually – poorva Jan 6 '14 at 14:30

This has two independent questions:

resolv.conf entries getting reset after a reboot

The way /etc/resolv.conf working has been changed in Ubuntu 12.04. This is because of implementation of foundations-p-dns-resolving as described here to overcome some limitations of static resolv.conf.

Here you can get more details:

You can override the new feature by removing the symbolic link /etc/resolv.conf and create a file named /etc/resolv.conf there. But before doing that refer the link I given above and see why it is strongly discouraged.

IP Address Vs Network and Gateway Conflict (Setting up a static IP) Also, As pgschk pointed out, your IP address is not matching gateway and network entries. But that is not causing the /etc/resolv.conf to go to original state, but the reason I mentioned above.

share|improve this answer
pardon me error when writing I have 2 servers ,detail as possible removing the symbolic link /etc/resolv.conf and create a file named /etc/resolv.conf there. I've never done this before.PLEASE – bemonolit Aug 27 '12 at 15:09
I would suggest to review if any other work around listed in link other than removing symbolic link works for you first. But if you still like to remove the link, you can use, usual commands like 'mv /etc/resolv.conf /etc/resolv.conf.ori' or 'rm /etc/resolv.conf' and then create a new /etc/resolv.conf using your favourite text editor(like vi or nano). – Jamess Aug 29 '12 at 9:28
I hope you intended /etc/resolv.conf, not /etc/resolv.config in the above question – Jamess Aug 29 '12 at 9:30
I'm online,it's just a bug.thank you,and about remove the link>resolvconfig :Error /etc/resolv.conf isn't a symlink,not doing anything. – bemonolit Aug 29 '12 at 17:05

Your gateway address is in a different subnet than your local IP address:

address gateway

Also, the network address was specified in the .2 subnet also:


Do you use the 192.168.1/24 or the 192.168.2/24 subnet?

Edit: About your resolv.conf: This file is mainly updated by different packages (depending on your setup). Try specifying the nameservers in your /etc/network/interfaces file:


share|improve this answer
sudo nano /etc/network/interfaces # The primary network interface auto eth0 address netmask gateway network broadcast dns-nameservers dns-search mydomaine – bemonolit Aug 27 '12 at 14:39
same problem *Running /etc/init.d/networking resrtart is deprecated because it may not enable again some interfaces *Reconfiguring network interfaces... – bemonolit Aug 27 '12 at 14:56
*Running /etc/init.d/networking resrtart is deprecated because it may not enable again some interfaces *Reconfiguring network interfaces... – bemonolit Aug 27 '12 at 15:00
I'm online,it's just a bug.thank you – bemonolit Aug 29 '12 at 16:59

You can try this option :

  • Remove the /etc/resolv.conf and then creat a new resolv.conf.

  • sudo nano /etc/resolv.conf after that add the flag:

  • sudo chattr +i /etc/resolv.conf - with this +i flag, even root can't touch this file. But if you want to change the nameserver, change the flag to be:

  • sudo chattr -i /etc/resolv.conf then add your new nameserver.

Then try to reboot and see what happens :).

I hope this solves your problem.

share|improve this answer

protected by Community Feb 4 '14 at 2:44

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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