How to force resolv.conf changes to "stick"?

Connection sharing, Firewall, Samba..etc
Forum rules
Before you post please read how to get help
orange_roughy
Level 1
Level 1
Posts: 19
Joined: Thu Dec 08, 2011 11:43 am

How to force resolv.conf changes to "stick"?

Postby orange_roughy » Tue Oct 09, 2012 2:23 pm

Hi,

I searched the forums but didn't see this exact question answered. I also googled it. When I edit /etc/resolv.conf with custom nameservers, the changes eventually revert. How can I make them "sticky"?

thanks in advance,
orange

User avatar
GeneC
Level 7
Level 7
Posts: 1603
Joined: Fri Sep 03, 2010 1:59 pm
Location: Maine, USA

Re: How to force resolv.conf changes to "stick"?

Postby GeneC » Tue Oct 09, 2012 2:38 pm

Are you editing it as 'root'?.... :wink:

Code: Select all

gksudo gedit /etc/resolv.conf

orange_roughy
Level 1
Level 1
Posts: 19
Joined: Thu Dec 08, 2011 11:43 am

Re: How to force resolv.conf changes to "stick"?

Postby orange_roughy » Tue Oct 09, 2012 2:48 pm

GeneC wrote:Are you editing it as 'root'?.... :wink:

Code: Select all

gksudo gedit /etc/resolv.conf


Yes, I am. The changes are saved until I reboot. I do not know if takes a single reboot or multiple before the change, or maybe it is when I connect to a different wifi system. The nameserver changes from (my edits) 8.8.8.8 to 192.168.1.1, which is the gateway/router.

User avatar
remoulder
Level 17
Level 17
Posts: 7653
Joined: Fri May 09, 2008 1:14 pm
Contact:

Re: How to force resolv.conf changes to "stick"?

Postby remoulder » Tue Oct 09, 2012 2:52 pm

If you are using network manager then you set nameservers in the connection properties, manual edits to resolv.conf will be overwritten.
[Edit] your original post and add [SOLVED] once your question is resolved.

“The people are my God” stressing the factor determining man’s destiny lies within man not in anything outside man, and thereby defining man as the dominator and remoulder of the world.

joshh
Level 1
Level 1
Posts: 5
Joined: Tue Oct 09, 2012 9:42 am

Re: How to force resolv.conf changes to "stick"?

Postby joshh » Tue Oct 09, 2012 2:55 pm

You can make it write-protected with:

Code: Select all

sudo chattr +i /etc/resolv.conf

if in the future you want to undo this to change it again:

Code: Select all

sudo chattr -i /etc/resolv.conf

orange_roughy
Level 1
Level 1
Posts: 19
Joined: Thu Dec 08, 2011 11:43 am

Re: How to force resolv.conf changes to "stick"?

Postby orange_roughy » Tue Oct 09, 2012 3:02 pm

remoulder wrote:If you are using network manager then you set nameservers in the connection properties, manual edits to resolv.conf will be overwritten.

I've done it that way, too. Doesn't seem to stick.

garrath
Level 1
Level 1
Posts: 1
Joined: Sat Dec 10, 2011 7:11 am

Re: How to force resolv.conf changes to "stick"?

Postby garrath » Tue Nov 06, 2012 10:05 pm

I'm just posting to maybe help you. I think I figured it out. if you

Code: Select all

edit /etc/NetworkManager/NetworkManager.conf

comment out the line that says

Code: Select all

dns=dnsmasq

i.e.

Code: Select all

#dns=dnsmasq

Code: Select all

sudo restart network-manager


that should be it! Check

Code: Select all

cat /etc/resolv.conf
for the correct dns server.
If there are problems, make sure that in network manager, there are no stray dns servers.

hope that helps.


Return to “Other networking topics”

Who is online

Users browsing this forum: No registered users and 1 guest