• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

DNS and hosts file

Which takes priority when a browser or any application looks up a domain? Hosts file or the DNS servers? Say I make a route change for google.com to yahoo.com's IP address in the hosts, would the system still check the DNS even if the hosts file has a different entry?
 
It looks at the hosts file first.

~\system\drivers\etc\hosts for Windows and /etc/hosts for *nix.

If it finds it in hosts, it doesn't go for a DNS request .... it thinks it already has a valid address.

FWIW

Scott
 
You know, it's easy to find out... 🙂

The hosts file will generally take priority, but it doesn't have to. Apps can be coded to do a DNS lookup directly, rather than use system name resolution. I know Sendmail does this sometimes, not sure about others...
 
On most unix systems you can control the priority with /etc/nsswitch.conf, I don't think you have any choice on Windows.
 
Originally posted by: Nothinman
On most unix systems you can control the priority with /etc/nsswitch.conf, I don't think you have any choice on Windows.
Indeed, on Unix systems you get to list the order of priorities
example:
hosts: files nisplus nis dns

Microsoft hard coded certain DNS entries into Windows since sp2 and there's no way you can change them in hosts.
One example is msn.com.
I've tried to point msn.com to a bunch of different IPs in hosts file, and Windows still points to msn.com.
 
I can't imagine MS would do something stupid like hard code A records into their code, if they ever want to move the boxes hosting MSN.com they would have to release a patch to fix that. Most likely MS just went around the normal gethostbyname(3), etc calls and either asked the local DNS cache directly or did a direct DNS lookup themselves. Both are stupid, but there's not much you can do since it's closed source.
 
If I wasnt mistaken, host file are loaded to memory when the computer start and yes it will look at records at host file first before using DNS.
I know there was a list of order of how MS windows resolve name, but i dont remember the whole thing.
 
Ctrl+F5 on yahoo.com?

Close all browser instances and reopen to make sure that it has not already cached old DNS queries in memory.
 
Back
Top