The Hosts file is used by computers to map IP addresses to host names. This file is loaded into memory at startup and the computer checks the Hosts file before it queries any DNS servers, which enables it to override public DNS addresses. A practical; use of this file is preventing access to certain websites an entry in the hosts file such as "127.0.0.1 http://www.espn.com/" will prevent access to http://www.espn.com/ by redirecting any connection attempts back to the local machine.
This works because whenever a web site or application calls up a website it normally uses a standard URL like www.staticit.com which like any URL typed into a web browser must be translated into a machine recognized numerical identifier or IP address pointing to its home on the Internet.
Once you understand how it works, this can be used for some interesting things.
For Example you can turn myspace into facebook and facebook into myspace by inserting an entry such as this into the Hosts file:
69.63.176.140 http://www.myspace.com/
69.69.176.140 myspace.com
216.178.38.116 http://www.facebook.com/
216.176.38.116 facebook.com
A savvy user can use this for less malicious things such as blocking google ads.
Here is an example of that type of entry
127.0.0.1 adwords.google.com
127.0.0.1 pagead.googlesyndication.com
127.0.0.1 pagead2.googlesyndication.com
127.0.0.1 adservices.google.com
127.0.0.1 imageads.googleadservices.com
127.0.0.1 imageads1.googleadservices.com
127.0.0.1 www.googleadservices.com
127.0.0.1 apps5.oingo.com
If you are interested in playing around with this, you can find the hosts file on most common platforms in the following locations;
Windows NT/2000/XP/2003/Vista/7: %SystemRoot%\system32\drivers\etc\
This is the default location, which can be changed. The directory is determined by the Registry key \HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\DataBasePath.
Windows 95/98/Me: %WinDir%\
Linux, BSD based, and other Unix-like operating systems: /etc/hosts
Mac OS 9 and earlier: System Folder: Preferences or System folder
Mac OS X: /private/etc/hosts
iPhone/iPod OS: /private/etc/hosts
Friday, April 17, 2009
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment