One Web site stalls (due to 'black hole' router) [Solved]

Issues Related to Networking (Wired and Wireless)

Moderator: Moderators

Post Reply
Sagely Hen
Posts: 8218
Joined: Sat Mar 10, 2007 5:40
Location: United Kingdom

One Web site stalls (due to 'black hole' router) [Solved]

Post by Fitzcarraldo » Sun Nov 28, 2010 23:43

Is there one specific Web site that you can never access? That always causes your Web browser to stall when you click on a link to that site or enter the site's URL in the browser's address bar? Perhaps it's an Internet banking site? You don't have trouble with any other sites, just this one particular site or perhaps just a couple of sites?

The chances are that this problem is caused by what is called a 'black hole' router somewhere between you and that site. For the technical explanation of a black hole router, see e.g. the article How to Troubleshoot Black Hole Router Issues. That article is aimed at Windows, but the explanation of the problem is good.

The reason I'm posting now is because I experienced this precise problem today with, believe it or not, the popular Web site IMDb on one of my laptops, which uses a CardBus wireless card. Being an old laptop, it has no built-in wired or wireless networking hardware. I discovered the problem after I had installed SL 5.4 E17 x86 Experimental Spin on an old Gateway Solo 9300 laptop using a Linksys WPC54G (EU) v7.1 wireless card notebook adapter. I could ping other sites by IP address and by domain name, but pinging the IMDb site stalled: my machine never received a reply from that site.

I also experienced this problem once several years ago under Windows XP when trying to access a certain Web site using an MTU that was incorrectly set to a value smaller than possible and that was smaller than a router somewhere could handle properly. The problem this time was due to a correctly-set MTU that is smaller than a router somewhere can handle properly.


Bear with me while I explain how the problem arose, as it's relevant (and useful) information.

Once I had installed SL and got the network connection up, the first thing I did was to launch Firefox. With an MTU of 1500 for wlan0, Firefox would only load Google (and that only intermittently). All other sites would stall. So I used the following command iteratively in order to find the MTU for this hardware combination, which is 1464 (the maximum packet size in bytes that does not fragment + 28 bytes):

Code: Select all

ping -M do -s <packet size>
(See How to determine the proper MTU size with ICMP pings.)

I can reduce the MTU to 1464 as follows:

Code: Select all

# ifconfig wlan0 mtu 1464
I could make this permanent by adding an entry (mtu_wlan0="1464") to the file /etc/conf.d/net, but I chose instead to make it permanent by adding the above ifconfig command to the file /etc/conf.d/local. This (correct) MTU works fine for all sites except for two, which just stall: IMDb and my bank's Web site. Now, I also happen to have a Belkin wired Ethernet CardBus card for that laptop. It works fine with an MTU of 1500, and there is no problem accessing the IMDb Web site. So, apparently, the MTU is the problem when using the wireless network connection. Now let's look at the solution...


Well, if you had a look at the page I linked to above, you'll have seen a solution for Windows, which consists in editing the Registry. But what do you do in the case of Linux? Google pointed me quickly to the answer: Does Linux have an Equivalent of Windows PMTU Blackhole Router Discovery?. The kernel /proc file system provides an easy way to enable and disable TCP MTU Probing by changing a value in the 'file' /proc/sys/net/ipv4/tcp_mtu_probing. A value of 0 = disabled; 1 = enabled when a black hole router is detected; 2 = always enabled.

This is what my laptop had in that 'file':

Code: Select all

# cat /proc/sys/net/ipv4/tcp_mtu_probing
So all I needed to do was:

Code: Select all

# echo 2 > /proc/sys/net/ipv4/tcp_mtu_probing
and, bingo, I can access IMDb without a problem. To make it permanent, I just added the above command to the file /etc/conf.d/local so that it is executed every time I boot the laptop. Here is what my file /etc/conf.d/local looks like now:

Code: Select all

# Here is where you can put anything you need to start
# that there is not an init script for.

local_start() {
	# This is a good place to load any misc programs
	# on startup (use &>/dev/null to hide output)

	# The Linksys CardBus card does not work with MTU greater than 1464:
	ifconfig wlan0 mtu 1464
	# Update the system clock at start-up:
	echo "System date and time at boot:" > /home/fitzcarraldo/date_this_boot.txt
	date >> /home/fitzcarraldo/date_this_boot.txt
	sleep 10s && /etc/init.d/ntp-client restart
	echo "System date and time after running ntp-client:" >> /home/fitzcarraldo/date_this_boot.txt
	date >> /home/fitzcarraldo/date_this_boot.txt
	# Enable TCP MTU Probing in order to deal with black hole routers:
	echo 2 > /proc/sys/net/ipv4/tcp_mtu_probing

	# We should always return 0
	return 0

local_stop() {
	# This is a good place to unload any misc.
	# programs you started above.
	# We should always return 0
	return 0
I hope this helps a fellow SL user in future who is banging his/her head against a brick wall trying to figure out why a specific site won't load when all others load fine.

Post Reply