The hosts File

The hosts file is text file is used by your TCP/IP connection on the Internet before DNS to map IP addresses to domain names. For really good discussion on what the hosts file is all about, check out the following Security Now Podcast (this is an MP3 file). The hosts file is used in Windows, Mac and Linux systems.

In windows, the hosts file can be found under: C:\Windows\System32\drivers\etc (presuming C:\Windows is your default Windows directory. Otherwise use %WinDir%\System32\drivers\etc.

You can download hosts files that block bad sites by mapping known, bad addresses to localhost (127.0.0.1) which is your own computer. So instead of going to the bad domain name, it just redirects your browser back to your own PC preventing it from loading a known ad, malware or otherwise bad site.

You can download a comprehensive hosts file from MVPS.org.

Note in addition to the hosts file, there is an lmhost file (Lan Manager hosts) used in Microsoft Windows for the Windows Internet Name Service (WINS) protocol.

An example file is provided in %WinDir%\System32\drivers\etc called lmhosts.sam.

This article explains how WINS resolves names and where the lmhosts file comes into play.

The lmhosts file has the same basic syntax as the hosts file with some additional options. After you add entries into it, re-register your dns cache using the following command through command prompt:

$ ipconfig /registerdns

January 21, 2010 | In Software | No Comments

No Comments yet »

RSS feed for comments on this post. TrackBack URI

Leave a comment