Slow broadband in Ubuntu Hardy? - Speed up your internet connection

| | 2 min read
If you have noticed a drastic slowdown in your DSL internet connection after you upgraded to Ubuntu Hardy Heron (Ubuntu 8.04) then it might not be that your ISP is entirely to blame. It could be settings on your PC that is slowing things down. We had a problem in our office where Ubuntu PCs were getting only around 80Kbps as opposed to 2Mbps from Windows machines. After troubleshooting and playing with some configuration parameters we got the Ubuntu Machines up to the same level as the Windows PCs

The solution is simple. All you have to do is to open /etc/sysctl.conf and add the following to the end of the file. You might have to tweak the value 32768 (all occurrences in the following) to any power of 2 that works perfectly fine for you. We had seen several places where these values were different. 32768 was the value for which we had the best results on the BSNL bandwidth test. We use this test because we have a BSNL broadband connection. Once the file is saved you can reload these kernel parameters by running sudo sysctl -p or by simply restarting the system.
# Tweaks for faster broadband...
net.core.rmem_default = 32768
net.core.rmem_max = 32768
net.core.wmem_default = 32768
net.core.wmem_max = 32768
net.ipv4.tcp_wmem = 4096 32768 32768
net.ipv4.tcp_rmem = 4096 32768 32768
net.ipv4.tcp_mem = 32768 32768 32768
net.ipv4.tcp_rfc1337 = 1
net.ipv4.ip_no_pmtu_disc = 0
net.ipv4.tcp_sack = 1
net.ipv4.tcp_fack = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_timestamps = 1
net.ipv4.tcp_ecn = 0
net.ipv4.route.flush = 1
Although this fix was tried out in Ubuntu it is possible that this might work for other distros with comparable kernels. It looks like the DSL routers and connections are optimized for the default values used in windows. So we just tweak the values used in GNU/Linux to match the router - simple :-)