This website may use cookies. More info. That's Fine x
Welcome Login

Windows: Hosts configuration file


The hosts file is a computer file used in an operating system to map hostnames to IP addresses.


The hosts file is a plain-text file and is traditionally named hosts.

No wildcards are allowed and only the main domain name is a valid entry.

1. Host file is loaded into memory (cache) at startup,

2. then windows checks it before it queries any dns servers, which enables it to override addresses in the dns.


Eg: to host file at:



Add following entry to direct url to a server



Eg2: loopback:

This entry is a not an actual Internet IP address but defines a local address and can be used to direct the computer to send a packet to itself.       localhost


Blocking sites:

By overriding addresses, you can prevent access to sites by redirecting any connections back to the your machine (local machine).

Eg: By adding following entry to hosts file:

It blocks all files supplied by that DoubleClick Server to the web page you are viewing.




For more details on blocking sites, see here.

Created on: Wednesday, August 17, 2011 by Andrew Sin