Howto: Tweak your Internet connection and maximize your bandwidth in Ubuntu/Linux via sysctl!

Here I will unleash a few hidden settings that should improve your internet speed, and work with all current linux operating systems including Ubuntu:
first open a Terminal via Applications->Accessories->Terminal
Type:
sudo gedit /etc/sysctl.conf
Then Paste the Following at the end of the file:
# increase TCP max buffer size setable using setsockopt()
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
# increase Linux autotuning TCP buffer limits
# min, default, and max number of bytes to use
# set max to at least 4MB, or higher if you use very high BDP paths
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216
# don't cache ssthresh from previous connection
net.ipv4.tcp_no_metrics_save = 1
net.ipv4.tcp_moderate_rcvbuf = 1
# recommended to increase this for 1000 BT or higher
net.core.netdev_max_backlog = 2500
# for 10 GigE, use this, uncomment below
# net.core.netdev_max_backlog = 30000
# Turn off timestamps if you're on a gigabit or very busy network
# Having it off is one less thing the IP stack needs to work on
#net.ipv4.tcp_timestamps = 0
# disable tcp selective acknowledgements.
net.ipv4.tcp_sack = 0
#enable window scaling
net.ipv4.tcp_window_scaling = 1

Press Ctrl-S To save then alt-F4 to exit and then type:
sudo sysctl -p
to apply the settings.

Hitup a speed test site or a very healthy torrent and see how your speed is:
Test your Internet connection speed at Speedtest.net
You can disable all these settings by removing these lines you added via:
sudo gedit /etc/sysctl.conf

You can recieve more information here

Have any additional tips to add? Please post in the comments!

Comments (19)

Loading... Logging you in...
  • Logged in as
Thanks for that... That worked a treat... I used http://www.speakeasy.net/speedtest/ as a before and after... and found that I had 4 Mb before and 6Mb afterwards-
Is there any drawback to turning off the timestamps?
Mark Preston's avatar

Mark Preston · 881 weeks ago

Upon installing the code, and running sudo sysctrl I received:

kernel.shmmax = 268435456

error: "vm.bdflush" is an unknown key

error: "vm.buffermem" is an unknown key

net.ipv4.tcp_max_syn_backlog = 1024

is the "unknown" stuff a problem. My 'net working to the best of my knowledge.
jonfhancock's avatar

jonfhancock · 881 weeks ago

It would probably be a good idea to run the following command before you start editing stuff:

sudo cp /etc/sysctl.conf /etc/sysctl.conf.bak

That way, you can easily restore your original file if something goes wrong.

Also, gedit only works for gnome. We use kate in KDE. Make it a more generic editor if you want it to work on multiple distros. nano is a good one.
Mine went slower with the new settings.
mine was exactly the same before and after...
2 replies · active 879 weeks ago
does'nt make any difference for me. In fact it became a little bit slower.
Same here
ive found other artcle about this

http://ubuntulinuxhelp.com/speed-up-your-internet...

why the value is just not the same as yours ?

can u tell me ?

hope u can mail me for this

thanks

nice blog
Worked great - I got my best ever on Speedtest.net both download and upload. Very easy to follow your instructions and delivered exactly what you promised -- thanks!!
what kind of connection are you guys using? eg. cable/fiber/dsl/dial up haha
best tweak ever.
i went from 7.5 mbps to 9.5 mbps.
...and i thought cable internet couldnt get any better.
This change dramatically *reduced* my download speed results over the default settings in my 8.04 system. I had appx. 26,000 kb/s on download w/default and it dropped to appx. 6,000 kb/s with the changes above. Upload seemed pretty much unaffected. If I tried the settings from the site linked to by piju, then I got about the same results as the default. I've backed out all the changes now and speed is back up to default (excellent) levels.
1 reply · active 835 weeks ago
sorry for my bad english..i think, Why did you need this tutorial..?
well, it didnt really have a great effect.
Ok. For me it's about the same. The first speed test I did was, to my surprise, quite a bit faster. I ran the test again and it was about the same. Every time I run it again it's a little better or a little worse. Mostly the same though.
Mehboob Sadicote's avatar

Mehboob Sadicote · 833 weeks ago

After i exit i get: ** (gedit:7639): WARNING **: Could not write gedit state file: Failed to create file '/root/.gnome2/gedit-2.75I9RU': No such file or directory.
my speed didn't improve. it's the same.

Post a new comment

Comments by

Clicky Web Analytics