LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-14-2003, 08:46 PM   #1
dcruz
LQ Newbie
 
Registered: Jul 2003
Location: sunrise, fla
Posts: 23

Rep: Reputation: 15
Question quick DCHP question


Hi.

I read that RH9 will perform better if you enter the hostname and IP in /etc/hosts. In fact I did find thats true and RH seems speedier now. How do I have it dynamically update that file if the machines grabs another DCHP address?
 
Old 07-15-2003, 12:15 AM   #2
jpbarto
Senior Member
 
Registered: Mar 2003
Location: Pittsburgh, PA
Distribution: Gentoo / NetBSD
Posts: 1,251

Rep: Reputation: 45
linux gurus help me out on this one... /etc/hosts is an alternative to DNS name resolution. Why would redhat run faster if the localhost's machine would be entered into /etc/hosts?

dcruz, I'm not sure if a dhcp client such as dhcpcd would have such a feature. However you could easily write a small bash script that you could set to execute after you've pulled an IP address that would rewrite your /etc/hosts file.
 
Old 07-15-2003, 12:33 AM   #3
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,612

Rep: Reputation: 68
What's faster? Everything, or just getting online?

I know linux is built all around client/server framework, so maybe several applications that RH uses take the /etc/hosts into consideration? It might just be some of the services a user has starting that it increases the speed on, and then if that process completes correctly, other processes won't fumble over it?
Just thoughts...

Cool
 
Old 07-15-2003, 01:03 AM   #4
amosshapira
LQ Newbie
 
Registered: Jun 2003
Distribution: debian
Posts: 5

Rep: Reputation: 0
Install a local caching DNS server

I'd suggest attacking this from another angel - instead of having to update a static (and sensitive) text file you might better install a caching DNS server on your system.

I'm a Debian user so I don't know RH and can't check things up myself, but in general what happens is that whenever your system has to translate its name into an address (or vice versa), it does the following:

1. Look in /etc/nswwitch.conf, it probably says:

hosts: files dns

2. Go to /etc/hosts, don't find the answer there.
3. Go to the DNS server configured in /etc/resolv.conf, probably over a line to your ISP.

So you can shorten times (and generally make your system resolve names and addresses quicker) by installing a caching DNS server and configuring your /etc/resolv.conf to something like:

nameserver 127.0.0.1
<rest of existing nameservers - they won't be used anymore but some caching DNS servers use this file for their own configuration, it depends which one you install>

Which means your DNS queries will access your own caching server - this caching server will only answer from the cache it built up, or recursively query "real" DNS server and cache their answers for you.

Again, since I'm not a RH user I can't point you to the right package to install without doing some digging, and since you have RH installed on your machine then you must be in a better position to start the digging than me.

(General security advice - if you haven't setup a firewall yet then do it, block all ports including port 53 (the DNS port). You don't need to allow outside access to this port in order to make the caching server work. You might also be able to tell the caching DNS server to listen only on the localhost interface, that would be a good thing in addition to a firewall)
 
Old 07-15-2003, 08:30 AM   #5
jpbarto
Senior Member
 
Registered: Mar 2003
Location: Pittsburgh, PA
Distribution: Gentoo / NetBSD
Posts: 1,251

Rep: Reputation: 45
amosshapira, I agree. I was just about to say the same thing. /etc/hosts is simply a text-file DNS. By running named locally and telling it simply to cache addresses you'll get the equivallent of a dynamic /etc/hosts plus all the supposed speed boosts of having all those IP addresses already available. And named doesn't punish you with much overhead so you're cpu performance and so on won't take much of a hit. Now if only I could teach my damned DLink router to run a DNS for my whole network I'd be in business.
 
Old 07-15-2003, 11:31 AM   #6
amosshapira
LQ Newbie
 
Registered: Jun 2003
Distribution: debian
Posts: 5

Rep: Reputation: 0
Quote:
Originally posted by jpbarto
Now if only I could teach my damned DLink router to run a DNS for my whole network I'd be in business.
Does your DLink router have DNS and you just have problem configuring it?
In any case - why not configure your Linux as the DNS server for the network?
I'm not familiar with the properties of this router, but generally having everything else go through your Linux also gives you an excellent firewall.
 
Old 07-16-2003, 08:54 AM   #7
cydd420
LQ Newbie
 
Registered: Nov 2002
Location: Indianapolis, IN
Distribution: RH
Posts: 14

Rep: Reputation: 0
You could also try changing the /etc/resolv.conf file to not include you localhost. This would force it to only use DNS to get names resolved on the internet.
 
Old 07-16-2003, 11:25 AM   #8
amosshapira
LQ Newbie
 
Registered: Jun 2003
Distribution: debian
Posts: 5

Rep: Reputation: 0
Quote:
Originally posted by cydd420
You could also try changing the /etc/resolv.conf file to not include you localhost. This would force it to only use DNS to get names resolved on the internet.
Who are you answer to?
The idea behind my suggestion was that you ask a DNS caching server on the local machine which will either:[list=1][*]Find the answer in its cache.[*]Lookup the answer via other DNS servers, cache it and return it.[/list=1]
So what's the benefit of removing the localhost from /etc/resolv.conf?
Also it still won't prevent programs from looking up /etc/hosts, that's controlled by the "files" in /etc/nsswitch.conf.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
quick question UnforgotteN Linux - Newbie 5 05-28-2005 09:33 AM
Question Concerning ISO's and one quick question. evrae Linux - Software 2 06-21-2004 03:53 AM
samba smb.config question (quick question) TheDOGG Linux - Networking 1 03-02-2004 07:19 AM
just a quick question Willew Linux - General 1 11-22-2003 03:27 PM
Red Hat 7.1 DCHP Question rcamacker Linux - Networking 4 12-27-2001 02:42 AM


All times are GMT -5. The time now is 06:19 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration