Slow internet browsing in Ubuntu

I have a dual boot set up with Windows and Ubuntu. When I'm using Windows, web browsing is a lot faster than when I'm using Ubuntu and I don't know why. It's like there's just a big latency rather than the maximum speed is lower, there's a big delay before anything happens when using Ubuntu, it happens with all websites all the time. I've never configured the Internet connection because it just worked straight away. I have a broadband connection through a router shared with some other computers. When we set up the router and Internet connection everything was done with Windows. What could I do to fix this?


Solution 1:

Are you using Firefox? It's dog slow on my PC as well for some reason.

I've installed Google Chrome and Opera - and they just fly.

google chrome

Also - try this as well: (thanks to Ubuntu Geek)

Open your Firefox and type about:config at URL address bar and hit enter. To make a False into True, select the line to change, and double click. On the 2nd option change, right click and select Modify

  • network.http.pipelining > Make it True

  • network.http.pipelining.maxrequests > Make it 8 or 10

  • network.http.proxy.pipelining > Make it True

  • network.dns.disableIPv6 > Make it True

Solution 2:

You may be suffering from bufferbloat. It manifests itself as huge latencies when you're transmitting or receiving a lot of data.

I've had success doing the following:

Run ifconfig and look for "txqueuelen" in it. The default on almost every machine I've seen is 1000.

Lower the size of your transmit buffer to 50. (Almost every modern chipset will support 0, but some don't, so we'll go with 50 for safety reasons).

sudo ifconfig eth0 txqueuelen 50

To restore the original setting:

sudo ifconfig eth0 txqueuelen 1000

As of note, this MAY bump you off the network temporarily - you may need to force your machine to reconnect to the network (unplug/replug cable, sudo ifconfig eth0 up, etc.)

The short version of what this does - TCP expects packets to be dropped and/or not acknowledged in a timely manner. When it encounters these situations it sends out less data to better adapt to the network. By having a huge transmit queue, the queue delays any adaptation the TCP stack would make, and you get these huge latencies and bad throughput because you're sending more data than the network can handle. The "feedback loop" is delayed by the size of the buffers.

Windows XP isn't affected, because it's got other limits on outgoing data and can't saturate lines like Linux & other more modern OS's can.

Solution 3:

I have experienced that problem, which I fixed by running my own DNS cache. This will almost certainly speed things up, though who could say definitely the problem you have? I don't know if you have dnsmasq or bind9, but it won't hurt to try to uninstall them. So let's try to remove them, if they exist - replacing them with the dnscache portion of djbdns, killing off any instance of dnsmasq - if running - and removing the BIND start-up script - if it exists.

sudo apt-get remove bind9 dnsmasq-base
sudo apt-get install djbdns dnscache-run
sudo killall -9 dnsmasq
sudo update-rc.d -f bind9 remove

Then we'll need to tell the system to use our cache.

gksu gedit /etc/resolv.conf

Edit the file to look like this example. This file defines which name servers to use, the default domain, and the search suffix. The search suffix makes it possible to run queries using only the hostname portion of a fully-qualified domain name. For exmaple, 'nslookup www' automagically becomes 'nslookup www.example.com' when example.com is the value of the "search" parameter.

nameserver 127.0.0.1      # Use the local resolver first.
nameserver 208.67.222.222 # OpenDNS
nameserver 208.67.220.220 # OpenDNS
domain example.com
search example.com

This is a little fancy, but we need to get the lastest root name servers.

sudo dnsip $(dnsqr ns . | sed -e '/answer/!d;s/\(.*\)NS \(.*\)/\2/') | sudo tee /etc/dnscache/root/servers/@

I think the resolv.conf file is overwritten when we use DHCP. So let's give ourselves a static IP address, removing the software that squashes it, and editing our interfaces file to set up the static IP address.

sudo apt-get purge network-manager network-manager-gnome
gksu gedit /etc/network/interfaces

My interfaces file looks as follows, but modify yours to your configuration.

# Loopback
#
auto lo
iface lo inet loopback

# First network card (attached to NAT router, attached to cable internet)
#
auto eth0
iface eth0 inet static
address 192.168.1.254
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1

Now let's just restart.

sudo reboot

Now you are using a local resolver and the latest root servers. This is much, much faster and more reliable than what I happen to get from my ISP, which is so very slow. Does this help the slow-problem you have?

UPDATE

Or - if you don't want to run your own cache (above), and per the conversation below, you could just log into your router and configure it to provide alternate DNS servers, like Google and OpenDNS: 8.8.8.8, 208.67.222.222, 208.67.220.220. This would fix slow DNS also.

Solution 4:

I know this is an old thread but as I was looking for the answer so would be others so I decided to post.

I had the same problem . In windows everything works fine but in ubuntu some websites would not open taking forever to open. I solved it by changing my modem from "DIAL ON DEMAND" mode to "ALWAYS ON" mode.