The hosts file is a computer file used by an operating system to map hostnames to IP addresses. It is a plain text file, conventionally called hosts. In Windows 10 this is no different. Wikipedia defines the purpose of the Hosts file as: “The hosts file is one of several system facilities that assists in addressing network nodes in a computer network. It is a common part of an operating system’s Internet Protocol (IP) implementation, and serves the function of translating human-friendly hostnames into numeric protocol addresses, called IP addresses, that identify and locate a host in an IP network.” ths
Hosts file primarily consists of lines of text depicting IP address within the first block of text, followed by one or more host names(i.e. google.com). Each of the fields is separated by a white space- tabs are preferred over space for formatting reasons, although spaces can also be used. Comment lines must begin with a hash (#)
The Hosts file has larger applications in internet resource blocking and redirecting local domains. For example, some web services,intranet developers and administrators define locally defined domains in a LAN for various purposes, such as accessing the company’s internal resources or to test local websites in development. Any security concerns regarding hosts file are that they may present themselves as a vector for malignant software; this leads to the file being modified by Trojan horse software or computer viruses to deflect traffic from intended havens to sites hosting malignant contents. For example, the widespread computer worm Mydoom.B blocked users from visiting sites about computer security and antivirus software and also affected access from the compromised computer to the Microsoft Windows Update website.
Generally, most computer users will never have the need to alter their hosts file, but occasionally the need does arise. To alter these files, one first needs to identify these files. Buried deep inside the folders of Windows 10, it is a text file, but doesn’t have .txt extension. It can be found by navigating to the path
C:WindowsSystem32Driversetc.
Usually when open, the file won’t have but a few lines by default.. By visiting through the path mentioned above, a window will pop up depicting the hosts file along with some other files like protocol, networks and lmhosts.sam.
Modifying or editing this hosts can be done by following the steps below. Before modifying this file, make sure that administrator privilege is available, as only administrators can modify / edit these files. You may also want to disable Antivirus software temporarily, as this might get flagged as a suspicious activity
– After all these, right click on file, and open with notepad. Next as per requirements, a whole range of functions can be performed:
Blocking a site on Windows 10: For blocking access to any particular site, adding of entry at the end of the hosts file like 127.0.0.1 blocksite.com (where blocksite.com is the URL that you want to block) will do the necessary bits.
Unblocking a site on Windows 10: Just the opposite of the above step, select the URL pathway, delete the pathway, and save.
Locking the Hosts file: As mentioned earlier, sometimes hosts file may present itself as an easy target for virus and trojan attacks. Instances of these can be seen when traffic is diverted from intended destinations to other malicious websites. In cyber communities, this is popularly known as Hosts File Hijacking. Two methods can be employed for obstructing this:
- The first option is a simple installation of a trusted and reputed antivirus software.
- However, to add an extra layer of security, the locking of the hosts file can be done to prevent any other users or programs from modifying it. To perform this action, right click on the hosts file with Windows Explorer, visit properties at the bottom of the menu, and make it a Read Only file by selecting the option from the Properties dialogue box. Then hit OK.
Sometimes, even with administrator credentials, an error message reading or Cannot create the C:WindowsSystem32driversetchosts file. Make sure that the path and file name are correct can be displayed. In such cases, visit Notepad from Start Menu, and select Run As Administrator. This will allow administrator credentials to appear, and necessary changes to hosts file can be made.
Disclaimer: Some pages on this site may include an affiliate link. This does not effect our editorial in any way.