Speed Up Your Internet Connection in Ubuntu Linux – Part 1 07/21/07

After you’ve installed Ubuntu, you may want to tweak your system further, such as improving how Ubuntu connects to the Internet, and therefore speed up your web surfing.
To accomplish this, we’re going to configure IPv6 and the TCP Window Size. Please remember to back up any critical files or data you may need as well as keep records of the settings you change. Doing so will help you recover in the event of a disaster. Keep in mind that you perform these configuration “tweaks” at your own risk.
These configuration tweaks are completed by entering commands into your “Terminal”. We will use Gedit although you can use Vi, nano, etc.
As a side note, if you do not want to enter “sudo” for each command, just begining your terminal session with this command:

sudo su

IPV6 is an Internet protocol. Currently most applications use IPV4 and this can cause conflicts which slow down your system.
Complete the following to disable it.

sudo gedit /etc/modprobe.d/bad_list

and type this in:

alias net-pf-10 off

Then save the file.

Speed up Broadband Internet by editing the appropriate configuration file and adding the following information. – Or, you can use a tool called PowerTweak from here: sourceforge.net/projects/powertweak

sudo gedit /etc/sysctl.conf

The first four line deal with window size and you need to enter numbers that are best for you (because these ones may be too high). Here is what I mean by this:
Computers communicate by sending packets of data back and forth. When they connect with each other to send these packets they use the TCP (Transmission Control Protocol).

Your computer could begin the connection with a small package size, then the other computer might respond with a larger one. In turn your computer will reduce (scale down) the size of the package (to a bit more that your original package size). The other computer again responds with a larger packet size. This cycle continues until your computer or the responding computer meets their maximum package size.

If you choose a windows packet size that is too big, you will notice slower broadband performance (524288 works for me). If you notice a slow down, then reduce your window size.
The largest size you can use is 65536, however these are the three settings that seem to work best:

Which are all multiples of 1024 (or 1K).
Now add the following to the end of the file:

net.core.rmem_default = 524288
net.core.rmem_max = 524288
net.core.wmem_default = 524288
net.core.wmem_max = 524288
net.ipv4.tcp_wmem = 4096 87380 524288
net.ipv4.tcp_rmem = 4096 87380 524288
net.ipv4.tcp_mem = 524288 524288 524288
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

After adding these line you do not need to reboot, instead just reset the file by issuing this command:

sudo sysctl -p

After completing this, you should notice improved web surfing speed. If not, remember to go back and adjust your TCP window size and try again.

Part 2 of this article, which contains more technical information, can be found here: ubuntulinuxhelp.com/speed-up-your-internet-connection-in-ubuntu-linux-part-2/

Sharing is loving!

You can leave a response, or trackback from your own site.

12 Responses to this article

UbuntuLinuxHelp July 21, 2007 Reply

Just to clarify – Yes, this tweak is only for broadband internet users. I’ve found that a TCP window of 524288 works on most PC’s, but just drop the size down if the tweak appears to slow down your web surfing. When changing the window size, don’t forget to “sudo sysctl -p” each time!

Elwyn Jenkins August 3, 2007 Reply

OK I followed some of this. However, there is something missing. I need a little more background on what actually this effects and what can go wrong. I am a little too mindful of the times when I have followed other instructions only to find that I arrive at a location where nothing seems to be as described.

UbuntuLinuxHelp August 3, 2007 Reply

@ Elwyn Jenkins
Here you go: http://ubuntulinuxhelp.com/speed-up-your-internet-connection-in-ubuntu-linux-part-2/
It also includes links to some of the RFC’s that define these specifications in greater detail.
I hope it’s helpful!

Quite Late May 26, 2008 Reply


The link above states that you should not use “sudo su” to create a root shell, but instead use “sudo -i” or “sudo -s”

UbuntuLinuxHelp May 27, 2008 Reply

@Quite late – Thanks for the input. It’s appreciated. :)

One thing to clarify though sudo -s is the equivalent of sudo su using either command will provide root permissions. So… I’m not really sure what the difference would be? – Because this still gives me root’s environment.

However, if I sudo -i then I’ll again get root permissions AND change the (now rooted access) to the user’s (my root) environment (home directory, etc.) I think sudo -i is best used when security is an issue? Is that right?

Please could you clarify? :) I’m not by any stretch of the imagination a Linux expert, but I’d really like to know what the difference is?
It just seems to me that with sudo su (sudo -s) and sudo -i, I still get root’s environment.
Am I missing something here? :)


UbuntuLinuxHelp May 27, 2008

To help clarify for readers, Christer Edwards blog (http://ubuntu-tutorials.com) posted this link about sudo: https://help.ubuntu.com/community/RootSudo
It’s a good link as it shows a couple extra little things we can do to easily manage sudo.

Quite Late May 29, 2008 Reply

This is one of the comments on the webpage I linked too in my last post.

“sudo -s” becomes root when executed, reads the password, then starts a shell.

“sudo su” becomes root when executed, reads the password, then starts su, which looks whether it needs to read the password, discovers that it is already root, says “huh?” to itself, and starts a shell.
-Kai on May 9th, 2008 3:28 pm

I myself am by no stretch of the imagination proficient in Linux. But it seems that the major difference between the two is how they handle the shell. “Sudo -s” seems to create a new shell and “sudo su” seems to give the terminal super user rights.
Though, I’m not particulary sure on why one is better than the other.

Nizam October 31, 2010 Reply

how can i increase internet spead ubuntu9.10 using nokiaN91

UbuntuLinuxHelp November 19, 2010 Reply


Get a faster wireless data package speed? I think you’ll find that you are physically limited by your connection.

C November 20, 2010 Reply

This seems to work great, but I’m getting an error in boot.log

fsck from util-linux-ng 2.17.2

WARNING: All config files need .conf: /etc/modprobe.d/bad_list, it will be ignored in a future release.

WARNING: All config files need .conf: /etc/modprobe.d/bad_list, it will be ignored in a future release.

WARNING: All config files need .conf: /etc/modprobe.d/bad_list, it will be ignored in a future release.

WARNING: All config files need .conf: /etc/modprobe.d/bad_list, it will be ignored in a future release.

/dev/sda1: clean, 133190/45096960 files, 3706199/180360960 blocks

Is there a problem with that?


ubuntupunk November 22, 2010 Reply

Anyway to push more data through a 384Kb line? I am looking for some way of initiating data compression through my pipe, possibly to a server which can act as a compressor for poorly serviced developing countries

Tijs December 31, 2010 Reply

I dont think this does work in all cases, for example: my pages load slower and sometimes do not show up.

I changed it back and everything was okay again 😛

Leave a Reply

close comment popup

Leave A Reply