[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]


Andrew Critchlow wrote:
Hi, I have not yet adjusted /etc/hosts ? Do I need to do this? What is its purpose and why cant it bypass this to use resolv.conf? I have tried restarting etc many thanks


I've not followed the discussion up to this point. I apologize if this doesn't answer your question or covers material already discussed.

The resolv.conf file provides information on name servers for your applications. It contains the IP address of 1 to 3 name servers.

These servers would be on the network and not accessible until the network is up and running. The /etc/hosts file provides a minimum static name service for use during booting, when the network is not yet available. It may also be useful for naming systems on a small local network (I have 3 systems on my local lan, too few to warrant the overhead and knowledge requirement to set up a local DNS server), and to provide basic name services for times with the DNS servers are not available, due to network issues or system crashes.

You tell your system how you want it to use the various name service providers (hosts file, DNS, others) using the /etc/nsswitch.conf file. This file allows configuring the search sequence for a number of other functions besides the name service. So look for the line beginning with 'hosts:' to see what your system is currently set up to do. Mine has the value "files dns" which tells the resolver routines to first use the local hosts file, and if nothing is found there, use DNS.

You could turn this around, as in "DNS files", to have your system consult DNS first. This will guarantee that you get current IP data for any system, but note, if the network is down and you have the maximum 3 DNS servers listed, the resolver will try each of them, timing out 3 times, before it tries the hosts file. This could take a while. Keeping the content of hosts as small as possible and using the default order is the generally accepted best practice, for optimal lookup speed.

I hope this helps.


Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply to: