Windows Host File Location Function
In some operating systems, the hosts file content is used over other methods, such as Domain Name System (DNS). But many systems implement name service switches (eg: nsswitch.conf) to provide customization. Unlike DNS, the host file is under the direct control of local computer administrators.
Windows Host File Contents
The hosts file contains lines of text consisting of IP addresses in the first text followed by one or more hostnames. Each field is separated by a space. A comment line can be entered by adding a hash character (#) in the first position of the line. Here is an example:
# This is an example of the contents of the hosts file
127.0.0.1 localhost loopback
:: 1 localhost
Above is the default instance of the contents of the hosts file, The example specifies that the IP address may have multiple hostnames, and the hostname can be mapped to multiple IP addresses.
The location of the hosts file of several operating systems
Windows Host File Tutorial
1. Click Start menu -> All programs -> Accessories
2. Right click on notepad
3. Select Run as administrator
4. In notepad, click "File"> "Open"
5. Open folder: "C: \ Windows \ System32 \ drivers \ etc"
6. Select All Files instead of Text Documents
7. Select a file named "hosts"
8. Add the IP address and domain name to the last line
9. Example: 18.104.22.168 domainname.com
10. Save the file
11. After that when accessed the domain name from the browser, it will lead to IP address that has been set.