LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 04-22-2007, 09:58 AM   #1
Richtown
Member
 
Registered: Apr 2006
Location: Portsmouth
Distribution: CentOS & Ubuntu
Posts: 49

Rep: Reputation: 15
Question /etc/resolv.conf PROBLEM


When my Linux machine reboots the dhcpd server generates the script below:

; generated by /sbin/dhclient-script
search localdomain
nameserver 172.16.87.2


How can i stop this from happening, so i can have my own setting saved here.


Thanks Rich.
 
Old 04-22-2007, 10:05 AM   #2
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Enter 'man dhclient-script' and read the "Hooks" section.
 
Old 04-22-2007, 11:18 AM   #3
urka58
Member
 
Registered: Nov 2003
Distribution: slackware 15
Posts: 546

Rep: Reputation: 43
As root open your /sbin/dhclient-script with your favourite text editor and try to find out a line like
/sbin/dhcpcd -d -t 10 (10 is the timeout, it might be something else like 15, 60 or whatever)
and edit to
/sbin/dhcpcd -d -R -t 10
This prevent your /etc/resolv.conf to be rewritten.
Set up /etc/resolv.conf according to your needs
Hope this helps
ciao
 
Old 04-22-2007, 11:33 AM   #4
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Quote:
Originally Posted by urka58
As root open your /sbin/dhclient-script with your favourite text editor and try to find out a line like
/sbin/dhcpcd -d -t 10 (10 is the timeout, it might be something else like 15, 60 or whatever)
and edit to
/sbin/dhcpcd -d -R -t 10
This prevent your /etc/resolv.conf to be rewritten.
Set up /etc/resolv.conf according to your needs
Hope this helps
ciao
The problem with that method is that the next update to dhclient will break the change. That's why user interfaces are documented.
 
Old 04-22-2007, 11:55 AM   #5
Richtown
Member
 
Registered: Apr 2006
Location: Portsmouth
Distribution: CentOS & Ubuntu
Posts: 49

Original Poster
Rep: Reputation: 15
Smile

Ok i understand whats going on know,

Thanks for the help guys :-)

Rich
 
Old 04-23-2007, 12:14 PM   #6
urka58
Member
 
Registered: Nov 2003
Distribution: slackware 15
Posts: 546

Rep: Reputation: 43
@ macemoneta

My system uses isc.org dhcpcd and is working perfectly well with such method.
dhcpcd man pages reports
"-R Prevents dhcpcd from replacing existing <etcDir>/resolv.conf file."
So unless we are talking of different programs or a patched version it should work.
Ciao
 
Old 04-23-2007, 12:28 PM   #7
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Quote:
Originally Posted by urka58
@ macemoneta

My system uses isc.org dhcpcd and is working perfectly well with such method.
dhcpcd man pages reports
"-R Prevents dhcpcd from replacing existing <etcDir>/resolv.conf file."
So unless we are talking of different programs or a patched version it should work.
Ciao
There's no question that it will work. However since modifying that script is not a documented user interface, when the script is updated by the next maintenance to it you will need to reapply your change. Using a documented interface (as explained in the man page) will continue to work correctly even when the script is updated by maintenance.

If you never apply maintenance, or your distribution rarely releases any, then you will have no problem. However, if you are using a distribution that keeps its software close to upstream, you will find yourself performing frequent rework.
 
Old 04-23-2007, 12:42 PM   #8
urka58
Member
 
Registered: Nov 2003
Distribution: slackware 15
Posts: 546

Rep: Reputation: 43
@ macemoneta
I understand your point of view, but I guess it is beyond the discussion focus..
Anyway, from this perspective you are absolutely right
Ciao
 
Old 04-23-2007, 02:07 PM   #9
Richtown
Member
 
Registered: Apr 2006
Location: Portsmouth
Distribution: CentOS & Ubuntu
Posts: 49

Original Poster
Rep: Reputation: 15
Question

Actually. . . ive been looking on /sbin/dhclient-script and cannot find the line you are talking about. I have used the find command and cannot locate the line "sbin/dhcpcd -d -t X". Is there an easier way to stop the dhcp server overwritting the /etc/resolv.conf file.

Thanks agian rich.
 
Old 04-23-2007, 02:15 PM   #10
lazlow
Senior Member
 
Registered: Jan 2006
Posts: 4,363

Rep: Reputation: 172Reputation: 172
Rich

On my FC systems the easiest way I found was just to switch to static addresses. On my home box(when I was going straight to the cable modem) I could still do this by using DHCP first and get the ip address, then apply that address to the static setup. Once every couple of months(at most) I would have to go through and do it again, as my isp did forced ip changes. Once I got a router it became a non-issue.

Good Luck
Lazlow
 
Old 04-23-2007, 04:03 PM   #11
Richtown
Member
 
Registered: Apr 2006
Location: Portsmouth
Distribution: CentOS & Ubuntu
Posts: 49

Original Poster
Rep: Reputation: 15
Cool

Solution, i mistakably had my /etc/sysconfig/network-scripts/ifcfg-eth0 file set to BOOTPROTO=dhcp. I changed it to static and the file /et/resolv.conf is no longer overwritten on boot.

Thanks for the input Rich

Last edited by Richtown; 04-23-2007 at 04:06 PM.
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
DNS Hosts.conf or resolv.conf problem mac_casey SUSE / openSUSE 0 03-26-2006 09:21 AM
problem with resolv.conf roddyguk Linux - Software 8 01-18-2006 12:57 PM
Problem with resolv.conf divdude Linux - Networking 6 08-01-2005 09:43 PM
Resolv.conf problem saurya_s Linux - Software 3 01-11-2004 12:53 PM
resolv.conf SCSI problem Rutnut Linux - Newbie 1 12-22-2000 08:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 02:15 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration