Major Attitude
01-09-04, 16:40
Occasionally, you may want to block access to websites so they can not be visited. This can be to block porn sites, sites loaded with spyware and so on. There are programs out there that block large lists of sites, but they are not perfect and can sometimes be more trouble then they are worth.
Your best bet is to manually edit your hosts file.
Windows XP = C:\WINDOWS\SYSTEM32\DRIVERS\ETC
Windows 2K = C:\WINNT\SYSTEM32\DRIVERS\ETC
Win 98\ME = C:\WINDOWS
Every website has an ip address, so that has to be resolved before your computer goes there. By telling your hosts file the ip address, it can skip the DNS process (looking up the IP address) For example, if you wanted to visit Yahoo.com, you could actually go to 204.71.200.67, which is that sites IP address. This also works very well for dial up modems to speed up the time it takes to load websites.
It also works well for blocking access to websites. All computers have an address that refers to themselves called the localhost. Its IP is 127.0.0.1. By telling your hosts file that a website is 127.0.0.1, your computer never even tries to find it, it assumes it is already there. So, by telling your hosts file that yahoo.com is 127.0.0.1 it will make Yahoo.com unreachable.
Let’s test it, so you see how it works. First let’s visit Yahoo.com at http://204.71.200.67 and then visit localhost at http://127.0.0.1 . As you can see, Yahoo loads fine with the IP address and the localhost loads nothing.
All you have to do is open your hosts file with a text editor, type in yahoo.com and 127.0.0.1 under the first line and Yahoo.com is blocked. You can continue adding in sites as often as you want. The screenshot below shows the default hosts file including where I typed in Yahoo.com as 127.0.0.1 as an example.
You can also use this in reverse to check as a potential problem if you can not reach a website you normally visit to see if it is somehow blocked in your hosts file.
The hosts file can also be used to your advantage to speed up load times of websites. You can add frequently visited websites with their IP address so that the ip does not have to be resolved. This can be very helpful with dial up connections.
Your best bet is to manually edit your hosts file.
Windows XP = C:\WINDOWS\SYSTEM32\DRIVERS\ETC
Windows 2K = C:\WINNT\SYSTEM32\DRIVERS\ETC
Win 98\ME = C:\WINDOWS
Every website has an ip address, so that has to be resolved before your computer goes there. By telling your hosts file the ip address, it can skip the DNS process (looking up the IP address) For example, if you wanted to visit Yahoo.com, you could actually go to 204.71.200.67, which is that sites IP address. This also works very well for dial up modems to speed up the time it takes to load websites.
It also works well for blocking access to websites. All computers have an address that refers to themselves called the localhost. Its IP is 127.0.0.1. By telling your hosts file that a website is 127.0.0.1, your computer never even tries to find it, it assumes it is already there. So, by telling your hosts file that yahoo.com is 127.0.0.1 it will make Yahoo.com unreachable.
Let’s test it, so you see how it works. First let’s visit Yahoo.com at http://204.71.200.67 and then visit localhost at http://127.0.0.1 . As you can see, Yahoo loads fine with the IP address and the localhost loads nothing.
All you have to do is open your hosts file with a text editor, type in yahoo.com and 127.0.0.1 under the first line and Yahoo.com is blocked. You can continue adding in sites as often as you want. The screenshot below shows the default hosts file including where I typed in Yahoo.com as 127.0.0.1 as an example.
You can also use this in reverse to check as a potential problem if you can not reach a website you normally visit to see if it is somehow blocked in your hosts file.
The hosts file can also be used to your advantage to speed up load times of websites. You can add frequently visited websites with their IP address so that the ip does not have to be resolved. This can be very helpful with dial up connections.