Windows borrowed a lot of patterns from BSD systems during the implementation of the network. One of the most important modules of the operating system that supports addressing in computer networks is the hosts file. Its role is to translate friendly domain names into their numerical equivalents, i.e. IP addresses. Thanks to this it is easy to identify the computer in the network, without the need to remember complicated numbers.
Editing hosts file allows you to quickly and easily connect to hosting or server if you do not have an active or directed domain yet. This is especially useful when migrating services or testing a new website.
A hosts file is a text file containing an IP address on each line, as well as one or more domain names of the host, which can be separated by spaces or tabs. Lines beginning with hash are comments (and are therefore ignored).
In Windows, the default path to the file looks like this:
Here is how the default document looks like:
# Copyright (c) 1993-2006 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # 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. # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a '#' symbol. # # For example: # # 188.8.131.52 rhino.acme.com # source server # 184.108.40.206 x.acme.com # x client host # localhost name resolution is handle within DNS itself. # 127.0.0.1 localhost # ::1 localhost
Here’s how the default document looks like:To edit and save, it’s best to copy the file to the desktop, change something, save and overwrite it in the default system path. Microsoft has also prepared a special guide on how the default hosts file should look like.
However, you can simplify everything and take advantage of the fully graphical tool called Hosts File Editor. This is a small application that edits the hosts file without having to do the process described above. Below we present the appearance:
Unmarked lines are inhibited, i.e. inactive. Selecting one of them and saving them will activate. The program can additionally create different profiles and archive versions, so that we can have a huge variety of choices. One of the most interesting options is the ability to completely disable all configurations, as well as the option to restore the default appearance.