Friday, October 4, 2019

hosts file helpful harmful

 A question recently concerning how to block an Internet domain name.
Microsoft in this case, but if you have a domain you would like to block  the following is a way.

Windows uses three (3) methods for name lookup.
hosts file  the file name is consistent, the location varies for different versions
NetBIOS   depreciated usage
DNS Dynamic Name Service

the name resolution goes in that order   hosts file, NetBIOS, then DNS
DNS has an order as well, the local machine, then up the routing infrastructure until the name is found or the name requests times out.

CAUTION: Take backup, lotsa backups before attempting and triple check your work at each step!

For Windows 10 the hosts file is C:\Windows\System32\drivers\etc\hosts

NOT FOR the faint of heart!

Invoke Notepad,  type notepad in the search box then select Run as Administrator when right clicking the Notepad executable

IF YOU DO NOT GET A WARNING AND THE PROMPT TO SUPPLY ADMINISTRATOR PASSPHRASE, see the Cyber blog about Administrator rights and privileges.






Change the "Text Documents" to "All Files"


.

Perhaps your desired result will be similar to:




The star (*) before the .microsoft indicates all sub-domains.
the IP Address and domain name need to be separated by white space.  i typically use a TAB and a SPACE.

After the desired edit, use File and Save to complete the edit. I recommend having an original copy saved in the same directory/folder named hosts.original or similar.

Check for the desired affect. Microsoft.com blocked?   the 127.0.0.1 is the IP address of the local machine, your PC.

As a safety/security measure consider removing Modify and Write permissions.



 This is an extreme measure, NOT for the faint of heart.

HOWEVER, i have mentioned before   almost anything can be helpful and harmful.
Some malware works by adding a domain they want blocked to the hosts file. Even worse, they change a valid and oft used domain to an IP address they control.


No comments:

Post a Comment