How to speed up your internet connection on Linux

The speed of your internet connection is something that is affected by a lot of different elements, most of which are out of your reach and/or jurisdiction. That said, there isn't a way to transform a slow internet connection into a lighting-speed one if your provider is just not giving you enough bandwidth, no matter what you do. This post is only aiming to provide generic advice on how to make things a little bit better if possible, and if applicable to each case.


Sometimes browsing websites seems to be somewhat “clunky” with images not loading correctly, large latency values between your computer and the DNS resolving server, and online cache issues. This may be a sign that your internet provider's DNS are not up to the task, so you may have to change to an alternative option. The two most popular DNS server alternatives are the Google Public DNS and the OpenDNS, but there are a lot more free to use alternatives as well.

Here's how to change to the Google Public DNS on Ubuntu-based distributions. Open your network settings and hop onto the “Advanced Settings”. This will open up a new window where you will find the “IPv4 and IPv6 Settings” tabs. Navigate to both and change the “Method” from Automatic (DHCP) to Automatic (DHCP) Addresses only. Then insert “” on the DNS servers box of the IPv4 tab, and “2001:4860:4860::8888” on the IPv6 tab. Now, click the “Save” button and you're done.

To test whether your new DNS settings are working properly or not, insert any fixed IP address that points to a website and see if it gets correctly resolved. Insert “” on your browser address bar and if it gets resolved to, then you have done things right. You may always revert to your default DNS by leaving the DNS servers box blank and setting the method back to “Automatic (DHCP)”. You can also benchmark your new DNS by using the namebench open source DNS benchmarking utility, and see how much faster your internet browsing really got. It is worth noting that changing your DNS also improves your privacy, security, and may potentially open up access to geoblocked content.

Firewall and Security

It is often the case that aggressive firewalls cause bottlenecks to your regular browsing and downloading. If you don't really need them, change their settings to allow more traffic to pass back and forth without proactive checking, or completely disable them. You can open a terminal and give “sudo iptables -L” to determine what is you Linux kernel-level firewall settings. For higher-level firewalls, you will need to check your router settings and the specific software tools you are using for this purpose.

If you're using Fedora or CentOS, chances are SELinux will be enabled by default. This otherwise magnificent piece of software could possibly cause increased latencies so you may want to disable it. To do so, open the /etc/sysconfig/selinux configuration file as root and find the line that contains “SELINUX=enforcing” and change it to “SELINUX=disabled” and save the file. Hopefully, things will get somewhat faster by doing this, but you should consider the required security level in your system before disabling SELINUX. A median solution would be the “SELINUX=permissive” option that keeps the security module active, but limited to the printing of warning messages.

MTU Setting

MTU stands for Maximum Transmission Unit and it is basically a parameter that determines the maximum size of data packets that are allowed to be transferred from the network to your system. If the MTU value is too small, then you are crippling your speed by dealing with large number of packages, and if it is too large, you are letting the data transmission occupy significant portions of your bandwidth for larger periods of time, essentially causing lag. So, there is a golden ratio as in everything really and if you want to squeeze the maximum performance out of your internet connection, you can determine and set your MTU to an optimal value.

Open a new terminal session and start ping tests to see what the optimal MTU value is. Use the following command:

ping -M do -s 1472

Start with 1472 and drop 10 by 10 until you find the highest value that is indicating 0% packet loss, using “Ctrl+C” to cancel each ping.

After you have determined the optimal MTU value, go to /etc/network/interfaces:

nano /etc/network/interfaces

And add a line “mtu 1462” (or whatever value you found as the best) and save the file. Note that you need to open the configuration file as the system administrator or else you won't be able to save your changes. Hopefully, this will speed things up a bit without causing network data package errors.


If all of the above has failed to deliver anything truly noteworthy, you may want to resort to the browser settings as a final attempt to give your internet browsing a small boost to the better. Firefox and Chrome/Chromium have started to tentatively use a simpler and faster caching method that may speed up your regular browsing a little bit. To enable them do the following:

On Chrome, insert the following on the address bar and press enter:


Then locate the “Simple Cache for HTTP” and choose the enable option.

On Firefox, insert the following on the address bar and press enter:


Then search for browser.cache.use_new_backend and double click it to open a new config window. Change the “0” value to “1” and press “OK” and you're done.

Finally, you can use the Opera browser that offers an up to date Linux version. Opera features a “Turbo mode” that when enabled activates a server-side compression of images on a rate to up to 80%, essentially letting you browse more comfortably on slower internet connections.

Share this page:

Suggested articles

10 Comment(s)

Add comment


From: iParent at: 2015-10-20 09:28:37


I have one question, what is Xserver used ?


From: Ricardo at: 2015-10-20 20:43:35

You should at least warn that disabling SELinux and loosening you firewall rules might be a security risk, and using Google's DNS servers will certainly NOT improve your privacy but the contrary.

From: MrRtd at: 2015-10-20 21:14:39

I tried the option for Firefox "browser.cache.use_new_backend" and it seemed to have majorly increased memory and cpu usage. It appears this is disabled by default for a reason at this time.

I tried this on Firefox 41 Linux 64bit, maybe others will have different results on Windows.

From: sonoracomm at: 2015-10-20 22:29:08

I may be wrong or missing something, but in the part about MTU, I think what you are testing for is MSS.  For example, with an MSS of 1492, wouldn't you usually want to set the MTU to 1500?

The "mturoute" tool will quickly show the MSS as well as the "path MTU".


From: Frank at: 2015-10-20 23:54:04

Instead of the CTL-C option, try

ping -c 5 -M do -s 1472

From: sylvan db at: 2015-10-21 02:45:20

The correct MTU is 28 added to the value you discovered using ping.

(Ping has 28 bytes of overhead not counted in the bytes specified by -s)

From: Justathought at: 2015-10-21 16:33:18

Isnt that why hes starting at 1472 and not 1500 in howto. Default is typically 1500

From: Albin at: 2015-10-21 13:24:30

Browser performance can go well beyond internet throughput, there are easily googled "flags" tweaks for Chrome/Chromium and "about:config" tweaks for Firefox when they get sluggish.  Can't recommend as it seems to vary, but worth trying.

From: JD at: 2015-10-22 01:12:00

The suggested MTU may significantly reduce the performance on a GigE LAN. Normally, for GigE connections, the MTU should be consistently set to 9000 or so. Of course, this assumes all directly connected LAN equipment supports Jumbo-Frames.

From: Ivan at: 2017-08-25 13:46:18

You can install chrome extension "7 Times Faster". It speed up your internet in 2 times by blocking ads and tracking.