From CCID
Recently, live chat viruses are rampant. These viruses mainly send malicious website addresses that are infected with viruses through QQ, MSN, and other instant chat tools.
How can we prevent unauthorized access to known malicious websites? Here we will introduce you to a simple and effective defense method-using Hosts files to prevent mistaken access to malicious websites!
Analysis
When we use a domain name to access a website, the DNS server in the network will interpret the domain name as the corresponding IP address. If the domain name of a malicious website interferes with the explanation result before being interpreted as the corresponding IP address, will it not achieve our goal?
Solution
The Hosts file can help us implement this idea. Take the Win98 system as an example. The Hosts file is located in the "C: Windows" directory. It can be regarded as a local DNS system and has a higher priority than the DNS server on the network. We can open it in notepad, and you will see instructions for using the Hosts file. For example, we can write the following line: 127.0.0.1 www.test.com
Save and run: ping www.test.com in the MS-DOS window
What do you see? Yes! The system interprets the domain name www.test.com as 127.0.0.1 (local IP address), which is exactly what we want! Of course, we can also specify the IP address of the website that we usually visit. Do you understand this? We can describe all the domain names of known malicious websites to the IP addresses of the cost machines, that is, 127.0.0.1. After this setting, when we mistakenly access a malicious website, Hosts will interpret the domain name as the address of the cost server to prevent unauthorized access to the malicious website. After I write several example website addresses (not real URLs) into the Hosts file, When you access these URLs, you will directly access 127.0.0.1:
127.0.0.1 www.123.com
127.0.0.1 321.123.com
127.0.0.1 213.123.com
127.0.0.1 321.123.com
Note: The default file name stored in the Hosts file is Hosts. sam. After modification, you must remove the extension. sam; otherwise, the file is invalid.