Few Tips About Windows Hosts File

4/1/2015·1 min read
Responsive image
Photo by AltumCode on Unsplash

With changing hosts file, you can mapping specific hostname to point to your own ip address, or let hostname to point to specific ip address at your current computer. For example, I want dev-mysite.com to point to my local machine will be following.

127.0.0.1           localhost

Another example, I want to google.com host name to point to ipaddress xxx.xxx.xxx.xxx

xxx.xxx.xxx.xxx     google.com

Following are comment from Microsoft.

 This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a '#' symbol. 

From windows hosts file comment

after you changed hostname to point to specific ip address, you might have to type ipconfig /flushdns at command line.

References

ipconfig from microsoft
Linux hosts file