Hosts file

Hosts file

The hosts file is a computer file used to store information on where to find a node on a computer network. This file maps hostnames to IP addresses. The hosts file is used as a supplement to (or instead of) the domain name system on networks of varying sizes. Unlike DNS, the hosts file is under the control of the local computer's administrator.

History

The ARPANET (predecessor to the Internet) had no domain name system for giving network nodes their own addresses. Because there was no centralized system for this purpose, each network node contained its own “map” of the network nodes that it needed to know about, and assigned them names that were memorable to the user. There was no system for ensuring that all systems on a network were called the same thing, nor was there a way to read some other user’s hosts file to automatically obtain their copy.

The small size of the ARPANET permitted hosts files to be used with some convenience for some time. Network nodes typically had one address, and could have potentially many names. As individual TCP/IP computer networks started becoming popular, however, the hosts file became a large burden on system administrators — networks and network nodes were being added all the time — making maintenance of the hosts file a task which grew significantly.

Location and default content

The host file is located in different locations in different operating systems and even in different Windows versions: [http://www.lunarsoft.net/forums/index.php?showtopic=1153]

* Windows NT/2000/XP/2003/Vista: %SystemRoot%system32driversetc is the default location, which may be changed. The actual directory is determined by the Registry key HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipParametersDataBasePath.
* Windows 95/98/Me: %WinDir%
* Linux and other Unix-like operating systems (including iPhone OS): /etc
* Mac OS 9 and earlier: System Folder: Preferences or System folder (format of the file may vary from Windows and Linux counterparts)
* Mac OS X: /private/etc (uses BSD-style Hosts file)
* OS/2 and eComStation: "bootdrive":mptnetc
* Symbian 1st/2nd edition phones: C:systemdatahosts
* Symbian 3rd edition phones: C:private10000882hosts, only accessible with file browsers with AllFiles capability, most are not. [http://wiki.forum.nokia.com/index.php/Hosts_file_on_S60_3.x_Devices]

Default content on Windows operating systems

In Windows, the default hosts file is often [http://www.pcanswers.co.uk/tips/default.asp?pagetypeid=2&articleid=44680&subsectionid=616 blank] or it contains (inactive) comment lines followed by IPv4 or IPv6 localhost entries.

127.0.0.1 localhost ::1 localhost

An example can be found at http://vlaurie.com/computers2/Articles/hosts.htm.

Other uses for the hosts file

Blocking

The hosts file has alternate uses, including filtering online advertising (ads) by having entries for known ad servers redirect to machines without the advertising on them or more typically by redirecting references to ad servers to the local address 127.0.0.1. This can save network bandwidth, as well, by eliminating a request to the DNS server normally used for obtaining address information and not downloading the advertisements. The user's experience may be further enhanced by running a minimal web server locally that only returns a blank page for every request [http://code.google.com/p/kwakd] . In this way the ads from the web pages literally disappear without error. However, if the hosts file is to be used for this purpose, it must be kept up to date with lists of Internet servers known to host such content. On Windows machines, the "DNS Client" service may need to be stopped in order for changes to the hosts file to have effect.

Blocking ads in this way can result in quicker browser operation and performance improvement for several reasons. The first reason is that rather than the browser having to contact a DNS server in order to resolve multiple IP addresses, it quickly parses a small text file (the HOSTS file) located locally on a computer. Second, when the HOSTS file returns an invalid or local IP address (for example 0.0.0.0) it is not able to load the requested ad which saves time and bandwidth. For example, adding an entry to the HOSTS file such as "0.0.0.0 www.doubleclick.net" would mean that requests for ads from the ad company DoubleClick would be forwarded to an invalid IP address (0.0.0.0) and never be loaded. It is quicker to load nothing rather than download an ad image from the Internet.

This phenomenon is discussed in more detail on the well-known podcast "Security Now" with Steve Gibson available at http://www.grc.com/securitynow.htm under episode #45 - The Hosts File.

Another solution is to block browser requests for the ads in the first place. This can be done through browser based plugins such as "No Script" and "Adblock" for Firefox. Another solution would be to block the ad addresses via a proxy or firewall.

Another use of the host file is to block known dubious or criminal domains and servers (with spyware and other malware). This has the same risks as hosts blocking ads, but generally requires fewer addresses in the hosts file and therefore would have a smaller impact on the system.

Redirecting

A useful and time-saving tip for web site programmers, intranet developers and IT managers is to enable non-standard TLDs on a LAN such as example.local (for accessing Example Company's Intranet) or sample.new (for a new version of the Sample.com website during testing).

192.168.1.100 example.local 127.0.0.1 sample.new

Malicious use of redirection

The hosts file can also be "hijacked," or used for malicious purposes. For example, adware, computer viruses, trojan horses, or other malware can edit the hosts file to redirect traffic from a "safe" site (such as Google or Wikipedia) to sites hosting content that may be offensive or intrusive to the user or the user’s computer system. For example, a trojan (Qhosts) redirected traffic from search engines such as Google and AltaVista to a site specified by the author of the trojan horse [http://www.symantec.com/security_response/writeup.jsp?docid=2003-100116-5901-99&tabid=1] . Mydoom.B (a malware program) blocked users from visiting sites regarding computer security and antivirus software, which also affected the Windows Update web site.

See also

* Adblock
* ARPANET
* Computer virus
* DNS
* resolv.conf
* Malware
* Spyware
* TCP/IP
* Trojan horse (computing)
* Unix-like
* Windows

References and footnotes

External links

* [http://www.hackernotcracker.com/2007-01/why-should-you-wait-for-internet-propagation.html Why Should You Wait for Internet Propagation?] – An alternative use to the hosts file
* [http://cubicspot.blogspot.com/2006/02/eliminating-web-advertisements.html Using a hosts file to remove ads without getting broken images] - Using hosts files with other tools makes viewing website content more pleasing.

Custom hosts files

* [http://www.mvps.org/winhelp2002/hosts.htm Most Valuable Professional (MVP) site] Updated monthly with free custom HOSTS file; information and instructions for installation. Focused on preventing unwanted advertisements & parasites. Numerous 3rd party awards and recognition(s). One of the best for lowest ads.
* [http://www.xcitdns.co.nr/download/ XCIT DNS Service] Updated frequently with an application which auto-downloads the hosts file to your system every 10 minutes. Intended as an ad-blocking service, but now domains mapped to IP addresses can be added via the registration page. These domains are added to the servers "hosts" file.
* [http://someonewhocares.org/hosts/ Dan Pollock's hosts file] A well maintained hosts file with updates almost daily
* [http://hostsfile.mine.nu/ Andrew Short’s Hosts file project] – comprehensive hosts file
* [http://www.hosts-file.net/?s=Download HPHosts] – An ad blocking hosts file
* [http://www.grc.com/sn/notes-045.htm The Security Now! podcast page on the hosts file]
* [http://www.everythingisnt.com/hosts.html Mikes Ad-Blocking hosts file] – available as a direct download to merge in, or as an installer (last edited 2-13-07)
* [http://members.dialmaine.com/drdole/#hosts SCoooBY’s Hosts File] – A large list of ad servers
* [http://pgl.yoyo.org/adservers/index.php Ad Blocking Lists] – Peter Lowe’s List
*fr icon [http://rlwpx.free.fr/WPFF/hosts.htm Airelle Lists] – Hosts files with a large blacklist of 500,000 sites
*Spybot - Search & Destroy has an advanced setting that adds a blacklist to your hosts file.
* [http://blogdeny.net/solusi-dns-flush-hyperwebenable.html DNS Flush Solution] – Solution for Error DNS flush

Applications to Manage Hosts Files

* [http://hostsman.abelhadigital.com/ Abelhadigital’s HostsMan 3.1.55] – A freeware application for hosts file management with auto-updates
* [http://www.bluetack.co.uk/forums/index.php?act=dscript&CODE=showdetails&f_id=5 Kimberly's Hosts Manager] – Freeware Microsoft Windows hosts file manager, on the forum B.I.S.S-Bluetack Internet Security Solutions
* [http://www.funkytoad.com/index.php?option=com_content&view=article&id=13&Itemid=31&28d444df85eb4f435055ed9d39c02f03=eb1e052d6f7ffb7710beaac92f5b7dab Funkytoad’s HostsXpert v4.2] – A free application to arrange, and edit hosts files
* [http://www.accs-net.com/hosts/HostsToggle/ Mike Meyer’s HostsToggle 2.1] – An open source hosts file tool
* [http://www.khempire.co.uk/ KH Blocker] – A free Microsoft Windows application which manages an ad-blocking hosts file
* [http://www.raymarron.com/hostess/ Ray Marron's Hostess] – Freeware Microsoft Windows hosts file manager.


Wikimedia Foundation. 2010.

Игры ⚽ Нужна курсовая?

Look at other dictionaries:

  • HOSTS — Die Datei hosts ist eine lokale Textdatei, welche der Aufgabe von DNS Informationen nahe kommt. Diese Datei dient der festen Zuordnung von Hostnamen mit IP Adressen. Inhaltsverzeichnis 1 Details 2 Pfade unter verschiedenen Betriebssystemen 3… …   Deutsch Wikipedia

  • Hosts — Die Datei hosts ist eine lokale Textdatei, welche der Aufgabe von DNS Informationen nahe kommt. Diese Datei dient der festen Zuordnung von Hostnamen mit IP Adressen. Inhaltsverzeichnis 1 Details 2 Pfade unter verschiedenen Betriebssystemen 3… …   Deutsch Wikipedia

  • Hosts.txt — Die Datei hosts ist eine lokale Textdatei, welche der Aufgabe von DNS Informationen nahe kommt. Diese Datei dient der festen Zuordnung von Hostnamen mit IP Adressen. Inhaltsverzeichnis 1 Details 2 Pfade unter verschiedenen Betriebssystemen 3… …   Deutsch Wikipedia

  • Hosts-Datei — Die Hosts Datei (bei unixähnlichen Betriebssystemen „hosts“ geschrieben; englisch für „Wirte“ oder „Gastgeber“) ist eine lokale Textdatei, die heute in der Regel für die feste Zuordnung von Hostnamen zu IP Adressen in lokalen Rechnernetzen (LAN)… …   Deutsch Wikipedia

  • hosts — Le fichier hosts est un fichier utilisé par le système d exploitation d un ordinateur lors de l accès à Internet. Son rôle est d associer des noms d hôtes à des adresses IP. Lors de l accès à une ressource réseau par nom de domaine, ce fichier… …   Wikipédia en Français

  • File Transfer Protocol — (FTP) is a network protocol used to transfer data from one computer to another through a network such as the Internet.FTP is a file transfer protocol for exchanging and manipulating files over a TCP computer network. A FTP client may connect to a …   Wikipedia

  • File hosting service — Types of Internet hosting service …   Wikipedia

  • File Transfer Protocol — FTP (File Transfer Protocol) Familie: Internetprotokollfamilie Einsatzgebiet: Datenübertragung, Dateiverwaltung Port: 20/TCP DATA Port, 21/TCP Control Port FTP im TCP/IP‑Protokollstapel: Anwendung FTP …   Deutsch Wikipedia

  • HOSTS —    An ASCII text file used to associate IP machine names and aliases with IP addresses …   IT glossary of terms, acronyms and abbreviations

  • /etc/hosts — Die Datei hosts ist eine lokale Textdatei, welche der Aufgabe von DNS Informationen nahe kommt. Diese Datei dient der festen Zuordnung von Hostnamen mit IP Adressen. Inhaltsverzeichnis 1 Details 2 Pfade unter verschiedenen Betriebssystemen 3… …   Deutsch Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”