Hello friends.

I am trying to make an internet blacklist.

I've been looking this up, but can't find anything on the internet.

What are the advantages of editing the hosts file, as opposed to making some explicit website blocker?

If by what you mean "explicit website blocker" is programmatically blocking sites in your list; then, there goes the cons. I can't thought of any other pros except you have more control or options on this one.

For manually editing the host file, it's a systemwide approach, all users will share the same hostfile and all website being accessed will be blocked by the hostfile.

Here's a summary of CONS and PROS, assuming this one's in the context of a dedicated server, not virtual:



  • All users in the same system will share the host file, and updates to the hostfile will be a lot easier. Any additional blacklisted website will be blocked system-wide.
  • Any programs attempting to access the blacklisted website may or may not be able to run properly.
  • Blocking is done on the OS level.


  • You need to be admin or root to access and edit the files.
  • Editing might or will be a problem if you have virus scanners safe-guarding the file.
  • The same issue with the PRO, having a system-wide implementation of blocking website might be a burden for some benign programs who needs access. Especially if you're running the blacklisted website, hosting it on the same server. LOL.
  • Have to clear the DNS cache for some programs to use the updated host file, and sometimes, restart the server.



  • You have more controll on how you will be handling the blacklist. A very generic reason, as what you created is how you wanted it to be, and will act and perform based on your wants.


  • Needs more time for research and coding, depending on the complexity of what you're doing.

Hope that enlightens and helps you.


It's "programmatically blocking websites"


I've started manually editing the hostfile (very simple job) to prevent access to like www.ebay.com.

However, I've found out that my browsers doesn't repond to the host file changes right away; it takes time. E.g. If I edit the hosts file to prevent access to eBay, it takes like 2 minutes before this takes effect; I can still access eBay for 2 minutes, and not right away.

Why does this happen? I need the browser to respond right away, as soon as the hosts file changes.

What alternatives are there to block access to certain websites, besides editing the hosts file? -Make a proxy server? (I don't know where to start with that one, please give me pointers!)

Thank you.

You can have to flush it to get the changes.

in Windows, open your command line then enter this ipconfig /flushdns
if you're linux: service nscd reload

You can block it in your router, if you have a GUI panel, it'll be a lot easier. Mostly, it's in the security panel, or administration. The guys in the networking forum will be able to help you a lot on this one. DW Networking Forum