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

Connection sharing, Firewall, Samba..etc
Forum rules
Before you post please read this

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

Postby orange_roughy on 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
orange_roughy
Level 1
Level 1
 
Posts: 21
Joined: Thu Dec 08, 2011 11:43 am

Linux Mint is funded by ads and donations.
 

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

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

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

Code: Select all
gksudo gedit /etc/resolv.conf
GeneC

AMD Phenom2x4 3.2 ghz, 12GB DDR3, Nvidia GTX 460

Qiana (Cinnamon)
Sparky XFCE (Debian Testing)
Sparky Gnome 3.14 (SID)
EvolveOS (Budgie)
User avatar
GeneC
Level 7
Level 7
 
Posts: 1565
Joined: Fri Sep 03, 2010 1:59 pm
Location: Maine, USA

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

Postby orange_roughy on 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.
orange_roughy
Level 1
Level 1
 
Posts: 21
Joined: Thu Dec 08, 2011 11:43 am

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

Postby remoulder on 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.
User avatar
remoulder
Level 17
Level 17
 
Posts: 7667
Joined: Fri May 09, 2008 1:14 pm

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

Postby joshh on 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
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 orange_roughy on 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.
orange_roughy
Level 1
Level 1
 
Posts: 21
Joined: Thu Dec 08, 2011 11:43 am

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

Postby garrath on 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.
garrath
Level 1
Level 1
 
Posts: 1
Joined: Sat Dec 10, 2011 7:11 am

Linux Mint is funded by ads and donations.
 

Return to Other networking topics

Who is online

Users browsing this forum: No registered users and 10 guests