Add

Wednesday, 27 November 2013

Time to edit /etc/hosts file

Unlocking /etc/hosts file

Looking inside of /etc/hosts  - It’s simply a list of names mapped to IP address of every host on the network in order to provide name resolution( name resolution - .
If you have a small host network, easiest way to provide name resolution is by /etc/hosts, which contains the name and address information for important hosts on the local network. This is will be useful when DNS is not running, hosts file has power to override DNS. 

Whenever new host added trick was keeping all those Hosts files up to date, its triggered invention of (BIND) Berkeley Internet Name Domain Server - (DNS) Domain Naming Service to solve this problem

EXAMPLE :
$ vim /etc/hosts
      
# IP_address         canonical_hostname                 [aliases...]

127.0.0.1               localhost.localdomain               localhost
192.168.1.10         bat.mydomain.org                      bat
192.168.1.13         cat.mydomain.org                      cat
146.82.138.7         master.mydomain.org                master

This enables users to access a host by using the alias as an alternative name, Now, you can test "ping bat" or "ping cat.mydomain.org", any of the hosts inside using names instead of its IP address.

Operating System
Location of Hosts File
Windows 9x/Me
c:\windows\hosts
Windows NT/2000
c:\winnt\system32\drivers\etc\hosts
Windows XP/Vista/2003/2008
c:\windows\system32\drivers\etc\hosts
Unix/Linux
/etc/hosts

No comments:

Post a Comment