Enter an invalid or wrong IP address for the site you want to block, and each time you try accessing it, the hosts file will load the IP address you chose. Depending on what you picked, it might c ompletely block the website. You can use the same technique to make the hosts file block malicious sites. There are even lists of hosts file entries such as this one you can download and import into your hosts file to block hundreds of malicious sites or ads.
Another use for the hosts file is to speed up your web browsing. Tip : Learn how to use alternate DNS servers to get faster internet access. You need to know where to go to find the hosts file before you can open it for editing.
This is the hosts file location in Windows 10 through Windows XP:. The hosts file is a text file, meaning that you need a text editor to make changes to it. There are a few examples in the hosts file to show you how to format your entries. Once in the Windows folder you'll need to open the 'System32' folder, then the 'drivers' folder, followed by the 'etc' folder. Once you've located the hosts file open it using Notepad. One thing to note: be aware that your windows installation might be in a different folder then the one mentioned above.
If you double click the file and it asks which program to open this file with, select Notepad and make sure you leave the 'Always use the selected program to open this kind of file' box unchecked. Once you've opened the file you should see a description with some examples at the top of the file and then depending on whether your hosts file has had entries added to it some numbers will be on the bottom.
Note that any line starting with the symbol is a comment and therefore will not have any effect in other words it is harmless. For most users the only uncommented line i. This just refers to your own computer; Any other line that doesn't start with a can be deleted or if you're afraid to completely delete a line then just comment out the line using the symbol which will disable the entry.
Then if everything is working properly you can come back later and clean out unneeded lines. That's all there is to it. Connect and share knowledge within a single location that is structured and easy to search.
The hosts file doesn't work. No matter what I do, adding or removing entries in the file doesn't make any difference, pinging the added names times out. Edit: Thanks for your answer guys, but the problem is more complicated than this. It seems I'll have to reinstall Windows.
As another commenter noted, sometimes editors will try and impose their default extensions. Are you sure about the re-install?
I am all for it, I do it once or twice a year to clean the fluff, but what makes you think it will solve the issue with basically name resolution? Delete the " etc " folder and replace it " etc " from another user, who hots enterties are working fine.
Had the same issue, after a new XP baseline was installed on my computer at work. Tried flushing DNS cache, rebooting, etc, to no avail. Solution was to save hosts to hosts. If you entered the default IP for address, Instead do a nslookup and see if proper IP is being returned.
The idea of hosts is not to block traffic, but to redirect addresses. The hosts file is for resolving the name to ip address. If your problem is a lack of reply and the address is correct then that is another problem. Use the -a option on the ping command 'ping -a ipaddress' to help you figure out the name resolution.
Make sure you don't have any trailing space after the hostname or it won't resolve either. If you have an entry like ' For some reason that worked just fine. Without it, the hosts file wont be used at all. Sign up to join this community.
The best answers are voted up and rise to the top. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Learn more. Asked 12 years, 6 months ago.
0コメント