Chapter Seven: How To Access Blocked Sites With The Hosts File

Looking for a simple, stable and significant VPS as your web hosting? Check out DigitalOcean, only $5 per month, and you can get $10 in credit just for signing up now.

To unblocked a blocked site (such as Facebook), you can check out VPN, SSH, Proxy and some other free anti-censorship tools as mentioned before.

In fact, you can even unblocked blocked sites without any third-party tools, but just by changing the hosts file on your own computer.

The following will show you how to change the Hosts file and unblocked the Facebook site in 3 steps:

Step 1. Find the IP addresses

OpenDNS Facebook IP Addresses

For Facebook, Twitter, YouTube and some other big sites, each of them usually has more than one IP address, so, how to find out all the IP addresses of a site?

You can visit the CacheCheck page of OpenDNS, enter the domain of the site (such as, and click on the "Check this domain" button, then you can see the site's IP addresses from all over the world.

Step 2. Find one unblocked IP

Ping Facebook

Among all the IP addresses of the site, some of them may be blocked in your area, while the others are not, so how to figure them out?

The most easy way is to ping them on your computers. For Windows, you can open the Command Prompt (cmd.exe), and for Mac OS, you can open the Terminal application, then enter the following command:


The above "" is one of Facebook's IP addresses, remember to change it to the one you are going to ping.

If there is a "timeout" error in the result, then the IP address is blocked in your area, if not, then you are lucky to add it to the hosts file.

Step 3. Edit the hosts file

Adding the Facebook Hosts

The hosts file is something like a DNS system, so we can locate the blocked site's domains to its unblocked IP addresses and then bypass the internet censorship.

For Windows, you can find the hosts file in the following address:


And for Mac OS, you can find and open the hosts file by entering the following command on the Terminal application:

sudo vi /private/etc/hosts

When the hosts file is opened, you can add the blocked site's unblocked IP addresses with domains in the end of the file. Take Facebook for example, you can enter the following 2 lines:

Besides, you can also add more sub-domains (such as with their unblocked IP addresses if any.

After that, save the hosts file, then you can visit the Facebook site directly without any anti-censorship tools, but, you need to use "HTTPS" instead of "HTTP" in the URL, which means that you need to visit the facebook via the following URL:


A piece of cake, right?

But, if all the IP addresses of a site are blocked in your area (for example, all the Twitter IP addresses are blocked in China), you can't unblocked it by changing the hosts file.

Spread the love
This entry was posted in E-book and tagged . Bookmark the permalink.