Security In Mind

DNS Hosts File

DNS Hosts File

The hosts file is a unique file that is located on your computer that is used as a first point of lookup for DNS hostname resolution.

A common use to this file is to test DNS changes before making them live on the Internet as well as setting up custom hostnames for local testing.

Currently, am using a Debian operating system (Kali) and to edit the hosts file you can follow the walk through below

gedit /etc/hosts

Note that each IP address is on the same line as the associated host, in this case localhost or vapt.local.

Whenever you enter localhost in your browser, it translates it to your “home” IP or On the fourth line of my hosts file here, you will see an association of the private IP to the domain

With this hosts file in place, whenever you enter in your browser, you’ll would be directed to the IP address, rather than the actual IP address of at
You can test this also by pinging

As you can see above, when you try to ping, the ping is directed to the address associated with google

The hosts file takes precedence over DNS queries. This can be a key bit of information when attempting to do DNS spoofing on a LAN (see below).

Leave a Reply

Your email address will not be published. Required fields are marked *