pavement

Hosts

From FreeBSDwiki
Revision as of 16:43, 17 October 2007 by DrModiford (Talk | contribs)
Jump to: navigation, search

The hosts file originates from the earliest implementations of UNIX when TCP/IP emerged. It was originally used (and still available) for resolving host names to their IP address. Nowadays this form of name resolution is provided by DNS servers.

Located within /etc the hosts file typically contains entries in the following format:

::1                     localhost.example.com localhost
127.0.0.1               localhost.example.com localhost
172.27.0.2              mail.example.com mail
172.27.0.2              mail.example.com.

Where an IP address is entered on a line followed by a hostname, seperated by a space (several tabs in this example). It is possible to have several variations of the hostname on the same line. Also worthy of note is that, despite the historic origin of the hosts file, it can be used to resolve modern day IPv6 (the latest incarnation of traditional IP, IPv4) addresses too.

Despite the availability of DNS servers the hosts file can still be useful for blocking advertising sites from your FreeBSD workstation, as this guide demonstrates.

It is well documented on the internet that Microsoft used FreeBSD's implementation of TCP/IP for network-enabling their operating systems and the legacy of this may well be apparent even today. The hosts file is still available on the latest releases including Windows XP and it also resides in C:\Windows\System32\Drivers\etc\hosts (note the 'etc' in keeping with true Unix configurations).

Personal tools