When connecting to a site, Windows checks the hosts file before requesting its IP from a DNS server: If IP addresses are specified for some sites in that file, they are used.
This can be used to block access to sites (and some viruses block access to antivirus sites) and other tasks. The location of the hosts file is the same in all versions of Windows: it is located in the folder (C:Windows\system32\drivers\etc).
- Use the taskbar search to find “Notepad”, right-click on the result found and select “Run as administrator”.
- Once launched, select “File” – “Open” from the Notepad menu and then select “All files” in the bottom left field and open the hosts file.
- To add entries, add them on a new line: first the IP address, followed by a space for the site that will open the specified IP address.
- When you have finished editing, select File – Save from the menu.
Restore the default hosts file:
# 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.
# 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 handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost