LinuxQuestions.org
Visit Jeremy's Blog.
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 02-25-2003, 03:56 PM   #1
Yorky
LQ Newbie
 
Registered: Feb 2003
Posts: 5

Rep: Reputation: 0
resolv.conf and DHCP problems


Im pretty much a linux newbie, and any advice would be appreciated.

My eth0 card is set to obtain IP from ISP via DHCP..... all well and good. I wanted to set up an internal caching nameserver for my local lan, but resolv.conf seems to be over-written every time i boot up by DHCP.

I run Slackware 8.1.

I have tried adding "prepend domain-name-servers 127.0.0.1" in the dhclient.conf file, and adding the -R option to DHCP start-up in inet1.dc for eth0, i.e.

/sbin/dhcpcd -R -t 10 $[DHCP_HOSTNAME] -d eth0

Still geting resolv.conf over-written.

Any ideas?

Last edited by Yorky; 02-25-2003 at 05:22 PM.
 
Old 02-25-2003, 11:21 PM   #2
cojo
Member
 
Registered: Feb 2003
Location: St. Louis
Distribution: RedHat 8
Posts: 262

Rep: Reputation: 31
I'm not quite sure what you want to do exactly. Since you are getting a dhcp IP from your provider. It will over-write the resolv.conf file everytime you bootup. Because, their dhcp server need to put their DNS servers entry in the file so you could browse the internet by name.

If you are trying to browse your local network by name. You don't need to setup an internal caching nameserver. All you have to do is insert the line

option domain-name-server xxx.xxx.xxx.xxx(your provider dns IP)

And if you have windozes machine on your lan. You will need to install Samba and turn WINS on with Samba.

If I'm totally off what you are trying to do. Give me more info.
 
Old 02-26-2003, 12:35 AM   #3
moses
Senior Member
 
Registered: Sep 2002
Location: Arizona, US, Earth
Distribution: Slackware, (Non-Linux: Solaris 7,8,9; OSX; BeOS)
Posts: 1,152

Rep: Reputation: 50
In your /etc/rc.d/rc.inet1 file, add the following to the very end of the
file:

Code:
echo nameserver xxx.xxx.xxx.xxx >> /etc/resolv.conf
I do this at home because my stupid ISPs DNS servers go offline
so often that I need to use my work DNS servers in addition.

Last edited by moses; 02-26-2003 at 12:37 AM.
 
Old 02-26-2003, 04:36 AM   #4
Yorky
LQ Newbie
 
Registered: Feb 2003
Posts: 5

Original Poster
Rep: Reputation: 0
Thank you for your replies. It's really nice of you to take the time to help out newbies.

Maybe I did not make myself that clear - I simply wanted to set up a local DNS caching server, to speed up browsing. Not particularly as I absolutely NEED to, but more so because I want to explore Linux and start learning about what it can do.

The Linux machine is currently acting as a router to 2 PC's - nothing major :-). Every thing is working fine, except when I follow the HOW-TO guides on setting up a caching name-server I get no joy, as resolv is always over-written.


After exploring BIND I intend trying SAMBA and APACHE - yeah get ready for many more dumb question lol. I have actually tried to read up about the above problem on the net and here before posting... only sometimes there is TOO much info and contradictory advice, that you simply don't know where to begin.

So anyway I will try you suggestions, and report back if they are successful or not.

Thanks again.
 
Old 02-26-2003, 04:54 AM   #5
Yorky
LQ Newbie
 
Registered: Feb 2003
Posts: 5

Original Poster
Rep: Reputation: 0
Cojo, you method almost works! I get 127.0.0.1 now added to my resolv.conf file when i boot up. perfect, except for the fact that it appears LAST on the list (my ISP's first 2 DNS addresses entered by DHCP appear first).

If I want to set up an internal caching only DNS server I think I need the order reversed and so have nameserver 127.0.0.1 appearing first. Otherwise I will always use my ISP's cach first.

Its only a matter of a few ms difference.... but i really want ed to get this to work! Any further ideas?
 
Old 02-26-2003, 05:12 AM   #6
dunkyb
Member
 
Registered: Nov 2002
Distribution: Debian testing.
Posts: 143

Rep: Reputation: 15
Hi ..

DHCP usually contains a script (dhclient-script, in a default debian distro, using dhclient-2.2.x) somewhere in the /etc directory probably, which will re-write /etc/resolv.conf from a function within the script, each time it is run.

I advise you to find your dhcp client's config files and scripts, and search them for anything that would be over writing the resolv.conf file. (Should be fairly obvious). Then edit that.

HTH

Duncan
 
Old 02-26-2003, 10:29 AM   #7
SlickWilly
Member
 
Registered: Dec 2002
Posts: 327

Rep: Reputation: 30
I solved this one by telling it not to overwrite at all.

Stick your name server at the top of the file, stick 2 or 3 of your ISP's nameservers beneath it and tell dhcpd not to overwrite (-R).

The ip address of the name servers won't change. On account of um.. they're nameservers

Given two or three if one of them goes down, you should be good, and you'll be even better because you'll only ever hit *yours* anyway and it'll have cached addresses you've been to before.

(as long as you have your own set to forward unknown requests to your ISP's ns's).

Slick.
 
Old 02-26-2003, 10:33 AM   #8
dunkyb
Member
 
Registered: Nov 2002
Distribution: Debian testing.
Posts: 143

Rep: Reputation: 15
Fair play.
 
Old 02-26-2003, 10:36 AM   #9
Yorky
LQ Newbie
 
Registered: Feb 2003
Posts: 5

Original Poster
Rep: Reputation: 0
I have actually found a work-around solution based on moses' advice.

In rc.inet1 i simply add the lines:

cd /etc
rm resolv.cong
echo nameserver 127.0.0.1 >> resolv.conf
echo nameserver 10.0.0.1 >> resolv.conf
echo nameserver 10.0.0.2 >> resolv.conf
chmod 700 resolv.conf

I am sure there is a neater way... maybe copying a back-up resolv.congf file to etc.

looking further yes there is a dhclient-script in sbin/ .... i wll have a go at editing out the offending lines.

Thanks again guys! Interesting stuff this linux thingy.
 
Old 02-26-2003, 11:24 AM   #10
dunkyb
Member
 
Registered: Nov 2002
Distribution: Debian testing.
Posts: 143

Rep: Reputation: 15
So what caching dns software do you use?

I find dnsmasq seems to work quite nicely......

Duncan
 
  


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
DHCP client overwriting resolv.conf... how to stop it? gauge73 Linux - Networking 6 05-04-2005 11:51 AM
DHCP update resolv.conf forrestevans Linux - Networking 0 11-03-2004 09:12 PM
dhcp and resolv.conf naflan Linux - Networking 2 10-04-2004 07:48 PM
/etc/resolv.conf and dhcp client win32sux Linux - Networking 2 07-29-2004 08:19 AM
dhclient reversing dhcp offer in resolv.conf zugwrack Linux - Wireless Networking 2 03-16-2004 09:34 AM

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

All times are GMT -5. The time now is 11:56 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