LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices

Reply
 
LinkBack Search this Thread
Old 10-19-2012, 10:08 AM   #1
mickeyboa
Senior Member
 
Registered: May 2004
Location: Indianapolis, Indiana
Distribution: FC-KDE, 32 and 64 bit
Posts: 1,386

Rep: Reputation: 55
Howto lock Resolv.conf from changing nameserver


F17

how does one lockin nameserver in resolv.conf.

It keeps changing nameserver to 192.168.1.1 which is my Router gateway IP.
 
Old 10-19-2012, 10:43 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 26,534
Blog Entries: 51

Rep: Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601
Add DNS{0,1,2}= statements to the /etc/sysconfig/network-scripts/ifcfg-%{devicename} configuration file?
 
Old 10-19-2012, 06:05 PM   #3
mickeyboa
Senior Member
 
Registered: May 2004
Location: Indianapolis, Indiana
Distribution: FC-KDE, 32 and 64 bit
Posts: 1,386

Original Poster
Rep: Reputation: 55
This is my new ifcfg-p128p1 (which is eth0)
It still changes resolv.conf to nameserver 192.168.1.1, Is it possible that NetworkManger is doing the changes instead of ifcfg-p128p1 ?

UUID="e676da02-6018-4567-8c0f-ab849ac673cb"
NM_CONTROLLED="yes"
HWADDR="78:E3:B5:95:98:2C"
BOOTPROTO="dhcp"
DEVICE="p128p1"
ONBOOT="yes"
PEERDNS=no
DNS1=8.8.8.8
DNS2=8.8.0.0

PEERDNS=no is not suppose to change resolv.conf if it is already set to 8.8.8.8.
 
Old 10-19-2012, 08:36 PM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 26,534
Blog Entries: 51

Rep: Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601
Quote:
Originally Posted by mickeyboa View Post
This is my new ifcfg-p128p1 (which is eth0)
It still changes resolv.conf to nameserver 192.168.1.1, Is it possible that NetworkManger is doing the changes instead of ifcfg-p128p1 ?
IIRC in F16 we still had a dhclient.conf in which you could prepend, append or override DNS entries. Sure enough there's a nm-dhclient-device.conf in /var/run/ in F18 (I decided to skip F17) but given the "nm" it's obvious NM "manages" it. I know you can use the NM GUI to configure the device and opt for Automatic DHCP addresses only after which you can enter DNS addresses but if you run multi-user.target (ye aulde runlevel 3) then I don't know how to accomplish the same using nm-tool or nmcli.
 
Old 10-20-2012, 09:38 AM   #5
SharpyWarpy
Member
 
Registered: Feb 2003
Location: Florida
Distribution: Fedora 18
Posts: 860

Rep: Reputation: 87
Ahh, the beauty of bloatware. Alas, over the last two or three years I've watched as Linux developers push new "management" software that does things behind the scenes like Windows. Pulseaudio, NetworkManager, SELinux, all three of which I either disable or remove after every upgrade, much to the chagrin of these well meaning programmers. Here I go again, after I swore to myself not to bite the hand that feeds me - in this case all the Linux developers that make it possible for me to run a free, good operating system. My recommendation in your case is remove NetworkManager.
Code:
yum remove NetworkManager
Take back control of your computer. Now, before I catch he** from the developers just let me say this. Linux started out as a way to have complete control without background supervision. What happened? When did it become so important to be like Windows?
 
Old 10-25-2012, 05:10 AM   #6
Glennzo
Member
 
Registered: May 2003
Location: Salem, Mass USA
Distribution: Fedora
Posts: 389

Rep: Reputation: 46
Wouldn't making the file immutable do the trick?

Code:
chmod +i /etc/resolv.conf
 
Old 10-25-2012, 05:42 PM   #7
SharpyWarpy
Member
 
Registered: Feb 2003
Location: Florida
Distribution: Fedora 18
Posts: 860

Rep: Reputation: 87
Quote:
Originally Posted by Glennzo View Post
Wouldn't making the file immutable do the trick?

Code:
chmod +i /etc/resolv.conf
Yes it most certainly would do the trick. The only problem (please bear in mind I'm an old man nursing a poor memory) is remembering you have done that next time you want to play with that file!
 
Old 10-25-2012, 05:58 PM   #8
Glennzo
Member
 
Registered: May 2003
Location: Salem, Mass USA
Distribution: Fedora
Posts: 389

Rep: Reputation: 46
Yes, remembering could be an issue. The "why can't I edit that file" thing might drive one temporarily insane.
 
Old 10-25-2012, 06:59 PM   #9
unSpawn
Moderator
 
Registered: May 2001
Posts: 26,534
Blog Entries: 51

Rep: Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601
Quote:
Originally Posted by Glennzo View Post
Wouldn't making the file immutable do the trick?
It would but there's a difference between making things work like they should (requiring knowledge of individual components and their interaction) and brute force. And while SharpyWarpy may have a point wrt things becoming complicated in some distros (deities know I haven't mastered systemd yet) it's not like SW has no documentation.


Quote:
Originally Posted by SharpyWarpy View Post
Yes it most certainly would do the trick. The only problem (..) is remembering you have done that next time you want to play with that file!
Not with DE apps but a wrapper should work if you edit files from the CLI. May look something like:
Code:
nano() { i=($(lsattr "$1")); i=${i[0]}; case ${i//-/} in *i*) chattr -iu "$1";; esac; nano "$1"; chattr =$i "$1"; }
As is obvious it doesn't handle other attributes you may set (or not!) and it's an untested example so YMMV(VM).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Secondary nameserver resolv.conf not queried hansaplazt Linux - Networking 6 12-08-2010 04:41 AM
nameserver entries in /etc/resolv.conf Ron7 Linux - Software 11 09-03-2010 03:18 PM
resolv.conf nameserver ordering/priorities jmoschetti45 Linux - Networking 6 01-25-2010 11:27 AM
router being added to resolv.conf as nameserver thatwouldbeme Linux - Networking 3 11-15-2006 12:44 PM
pppd: nameserver -> /etc/resolv.conf ?? tredegar Linux - Networking 6 03-21-2004 07:45 AM


All times are GMT -5. The time now is 05:15 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration