How does an ISP block my website with a warning message

Solution 1:

As you already said:

If I change my DNS to google DNS, the site can be viewed normally.

So it has something to do with DNS. Your ISP provides his own DNS-Servers and he has a list of blocked domains. When you now query the IP-address of a blocked domain your ISP will not respond with the correct ip-address but with a ip-address of his own servers (or FBI or whatever) which will then host only the "blocked"-site.

Solution 2:

Lets' say that you have the website http://example.org. When you use your ISP's DNS servers it would resolve that domain to an IP address

Since the ISP doesn't want you to see the website, they will let their DNS servers give you a different IP. On that IP address, they can host the page that shows you the warning message.

The ISP does not alter your website in any way, they only direct users to their own webservers.


Solution 3:

You asked:

how can the ISPs redirect other people into another directory

Strictly speaking, they're not. They're redirecting people to another server. This has to do with how DNS works. Other answers have covered this broadly, so I'll go into a little more detail:

When someone goes to http://www.example.com/, the browser first makes a DNS request to find the IP address for www.example.com. This usually goes to a DNS server run by their ISP. ServerFault has more details on DNS requests in another question.

The DNS server responds to the request with an IP address. In the case of a website block like you described, the server responds with some other server -- perhaps a government-run server -- which redirects all requests to /blocked.aspx.

Google's DNS isn't blocking your domain in this way, so you're getting your server's IP address instead of the government-block webserver.


Solution 4:

From what I've read on other answers, it feels like you're asking specifically how your ISP is managing to add "blocked.aspx" to the end of your domain. If that's the case, let's look at a case study:

You have a web server running on http://mysite.mine/, which a public, completely trustworthy DNS resolves to public IP 10.0.0.1. You can browse to http://mysite.mine/index.aspx or /about.aspx or whatever because you're hosting it on your server. In reality, it ACTUALLY resolves to http://10.0.0.1/about.aspx because that's what DNS does - It resolves domain names to IP addresses.

Your ISP has decided that your website needs to be blocked for whatever reason, so they redirect DNS requests asking for http://mysite.mine/ to public IP 192.168.0.1, a webserver hosted by your ISP. So any attempt to access http://mysite.mine/ would actually redirect to http://192.168.0.1/. Once they've got that in place, it's a simple matter to configure their web server to redirect any attempt at accessing that weberver with blocked.aspx. Your browser shows http://mysite.mine/blocked.aspx, but in actuality you're accessing http://192.168.0.1/block.aspx.

As far as your browser is concerned, it's displaying http://mysite.mine/, because that's what the DNS server is telling it, so your browser won't change the domain in the case of a redirect to the same IP address. This is why you see a blocked.aspx at the end of the domain - Because it isn't your webserver.


Solution 5:

ISPs usually run their own DNS servers, which their customers use by default (usually because the customers neglect to change this). This allows the ISP to re-direct traffic to any domain name to a different server, simply by returning a false IP address for that domain name. Among other flaws, this allows the ISP to re-direct "blocked" websites to their own server, which will host only the "blocked.aspx" page (or whatever page the ISP uses).

Tags:

Isp

Website