How to Add a Local DNS Lookup to Hosts File

When you add a permanent entry to the DNS cache, it will always override the information provided by the nameserver. If a nameserver gives the wrong address for a domain or provides no information at all, you can still access the domain if it’s listed in the local Hosts file.

It could also improve lookup performance. If you frequently access a particular server, and you know its IP address isn’t likely to change anytime soon, you can a local entry to eliminate the initial delay as Windows looks it up. For example, add an entry for your mail server to decrease the time it takes to check for mail.

Also if you frequently access a remote server without a domain name (rather than only by its IP address), you can configure a custom domain name, to be used as a kind of “shortcut” to the server.

To edit your local DNS lookup file, explore this folder: C:\Windows\System32\Drivers\etc [note: I am assuming that you have Windows installed in drive C, otherwise change it to your own Windows drive]


Open the file using any text editor then make an entry at the bottom with two information: the IP address and the customized domain name.  The IP address and the domain name entry should be separated by a single space.  In the example below I entered an IP address for


So when I browse that domain using my browser I see it pointing correctly to that address:


You could always alter the IP address in the hosts file to something else. Windows will prioritize the entries to this hosts file.

Ben Carigtan shows you how it’s done!

Comments [4]

  1. […]  you want to put a permanent entry in the DNS cache, follow this tip we discussed earlier. Ben Carigtan shows you how it’s done! AKPC_IDS += […]

  2. […] use this tip, you will need a little background about the hosts file.  Make sure to checkout our previous post about the hosts file if you are new to this DNS config file. The HOSTS file is a plain-text file you can create or edit […]

  3. Camilo says:

    Great Solution!!! It helped me to solve a HUGE problem that I was having!!! Thanks a lot!!!

  4. rob says:

    Thanks. This saved my bacon.

Leave a Reply