Speed Up Your Internet Connection in Ubuntu Linux – Part 1

July 21, 2007 | By: UbuntuLinuxHelp | 10 Comments
Posted in How to...

1 Star2 Stars3 Stars4 Stars5 Stars (3 votes, average: 4.33 out of 5)
Loading ... Loading ...

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:

524288
262144
131072
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/

If you like this post, why not share it?
  • StumbleUpon
  • del.icio.us
  • Digg
  • Google Bookmarks
  • Reddit
  • Mixx
  • Yahoo! Bookmarks
  • blogmarks
  • Twitter

Related posts:

  1. Speed Up Your Internet Connection in Ubuntu Linux – Part 2
  2. A Quick Way to Improve Ubuntu Linux Operating Speed Performance.
  3. Speed Up Web Browsing by Caching DNS to Your Hard Drive in Ubuntu.
  4. How to Speed Up Amarok – Part 1
  5. Faster Internet With an Old Laptop – Ubuntu and Squid


Comments

10 Comments so far

  1. UbuntuLinuxHelp UbuntuLinuxHelp on July 21, 2007 1:33 pm

    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!

  2. Elwyn Jenkins Elwyn Jenkins on August 3, 2007 12:51 am

    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.

  3. UbuntuLinuxHelp UbuntuLinuxHelp on August 3, 2007 10:47 am

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

  4. Speed Up and Improve Web Surfing With an Ubuntu Squid Server. | Ubuntu Linux Help Speed Up and Improve Web Surfing With an Ubuntu Squid Server. | Ubuntu Linux Help on March 1, 2008 4:09 pm

    [...] Speed Up Your Internet Connection in Ubuntu Linux – Part 1. Speed Up Your Internet Connection in Ubuntu Linux – Part 2. Speed Up Web Browsing by Caching DNS to Your Hard Drive in Ubuntu. [...]

  5. Answers to Linux Questions | Ubuntu Linux Help Answers to Linux Questions | Ubuntu Linux Help on March 13, 2008 10:13 am

    [...] There’s info about this here: Speed Up Your Internet Connection in Ubuntu Linux – Part 1 [...]

  6. A Quick Way to Improve Ubuntu Linux Operating Speed Performance. | Ubuntu Linux Help A Quick Way to Improve Ubuntu Linux Operating Speed Performance. | Ubuntu Linux Help on April 3, 2008 10:09 am

    [...] Speed Up Your Internet Connection in Ubuntu Linux – Part 1 Speed Up Your Internet Connection in Ubuntu Linux – Part 2 Speed Up Web Browsing by Caching DNS to Your Hard Drive in Ubuntu. Speed Up and Improve Web Surfing With an Ubuntu Squid Server. [...]

  7. Quite Late Quite Late on May 26, 2008 5:58 pm

    http://ubuntu-tutorials.com/20.....right-way/

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

  8. UbuntuLinuxHelp UbuntuLinuxHelp on May 27, 2008 7:36 am

    @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? :)

    Thanks!

  9. UbuntuLinuxHelp UbuntuLinuxHelp on May 27, 2008 7:46 am

    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.

  10. Quite Late Quite Late on May 29, 2008 12:25 am

    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.

Name (required)

Email (required)

Website

Speak your mind