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
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 22.214.171.124
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 126.96.36.199.
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).