Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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.
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...
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)
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.
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.