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 127.0.0.1 On the fourth line of my hosts file here, you will see an association of the private IP 192.168.100.10 to the domain google.com

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

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

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 *