I have ubuntu 11.04 as the os, both surfing the net and downloading stuff is a pain, it is really slow. I have turned ipv6 off, my connection is properly configured, but still it is very slow. I checked the net speed on a friend's laptop, it is really fast, but on my pc it is mighty slow. I don't know what to do? help anyone.

If it helps, I too had in some PCs a slow connection but on 11.04. After upgrading to 11.10 it was solved. It would help if you could add the network card you are using (type 'lshw -C network' on the terminal) and if you have tested this in another place like your friend's home.
–
Luis Alvarado♦Feb 21 '12 at 20:15

I have already added my network card, but to no avail. The net connection is still very slow.
–
Ruchir ChaturvediFeb 21 '12 at 20:20

@Ruchir what I meant was that if you could provide us the name or some info about the network card you are using. I will post an answer to how a problem like this can be troubleshooted but do not accept it until the steps I mention there work.
–
Luis Alvarado♦Feb 21 '12 at 23:46

7 Answers
7

For the cases about Ubuntu 11.04 and up here are some of the steps to find out what is wrong. We will assume the following:

You are using a wired connection (Not wirelessly. This will avoid other problems).

You have already tested the connection using, either another Distro, an older version of Ubuntu or Windows. When testing the speed it was much better than when using Ubuntu 11.04+. So we assume that the problem is ONLY on Ubuntu 11.04+. If the problem is the same in Windows or with another Os/Distro then this is not an Ubuntu problem so much as a network problem. Maybe your ISP, Router, ADSL connection, etc..

You installed the default Ubuntu using the LiveCD and not Wubi from inside Windows. There has been several cases where installing Ubuntu via Wubi somehow slowed the network speed. I can only confirm for myself 1 case but I have heard of several. So I will assume you have installed Ubuntu using the LiveCD (Does not matter if you are sharing the hard drive with another distro or with Windows, the important part here is installing Ubuntu using the LiveCD).

You have updated your Ubuntu version to the latest. I recommend activating the multiverse, universe and restricted repos and also activate the proposed and backports updates. All of which can be done using the software sources.

Optional - You have installed Ubuntu from Scratch and not updated from an older version. In the past i have trouble after upgrading from a previous one. Do not know right now but this is "just in case".

You have already rebooted the PC at least once after installing ALL the updates.

You do not have a Firewall that limits anything. Just in case you have a pro-windows firewall device.

So now we can begin...

In each case I will give an answer that works for some but not for others. If one works, do not test the rest. We will also open several files with the terminal tool NANO. After editing or changing anything with it, to exit and save just press CTRL+X and then press Y. That should quit nano and tell it to save the file.

The IPv6 Issue

There has been some issues with having IPv6 for some users. For this let us go step by step with this:

Check to see if IPv6 is ENABLED - Type the following in a terminal: lsmod | grep ipv6. If you see anything mentioning IPv6, then you have it enabled. If not then you can proceed with the next issue mentioned.

Disable IPv6 - There are several ways to accomplish this (Do only one):

2.1 - Edit the file sudo nano /etc/sysctl.conf and add the following lines at the end of the file:

2.2 - Edit the file sudo nano /etc/default/grub and find the line that says GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" and add to it ipv6.disable=1.
It should look like this afterwards: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash ipv6.disable=1". Save it and type sudo update-grub. After this reboot the PC.

2.3 - Edit the file sudo nano /etc/modprobe.d/blacklist.conf and at the end add the line: blacklist ipv6. Save and reboot.

2.4 - Via the GUI version of NetworkManager in the Upper Panel (The network icon that appears when you install Ubuntu in the upper right corner next to the volume icon) select the network icon and select Edit Settings. Select the network connection you are using and in the IPv6 Settings select Ignore. This option can be mixed with the 3 previous mentioned above.

Configuration Issue

In some cases it may be some misconfiguration gone wild. Try this:

1.1 - Type ifconfig and look for the txqueuelen option. Normally it says 1000. Lower it to 500, 200, 100 or 50 just to test if it gets better: sudo ifconfig eth0 txqueuelen 50. In this case we have set txqueuelen to 50. To go back to 1000 just change the 50 to 1000.

1.2 - Edit the file /etc/sysctl.conf and add at the end: net.ipv4.tcp_window_scaling=0 to the file. Save and reboot.

Network Card Issues

In some cases the actual network card is the problem. Maybe a confusion between the drivers and the NIC or the actual NIC. In any case here are some examples depending on the network card:

then in the DNS servers field: type the IP Address of your wireless router or default gateway. Mine was 192.168.0.1 for example.

Hit Save. Disable your wireless hardware for a few seconds (my method is function key F2), turn it back on and test your browser's speed.

I figured out that there was nothing wrong with the wireless or the Internet itself because only browsers were slow at going to websites (Chrome, Firefox, etc). But when I tried my virtual box machines, they were lightening fast on the Internet.

Welcome to Ask Ubuntu! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.
–
fossfreedom♦Nov 3 '12 at 9:48

If that be the case the OP would have mentioned it. I do not think this is the case since you need at least some knowledge to know the app and how to use it. Reasons for the OP to mention it in the first place.
–
Luis Alvarado♦Feb 21 '12 at 20:13

although wondershaper is available it is NOT configured by default in Ubuntu.
–
RingtailFeb 21 '12 at 22:23

The surprising thing is if I reinstall Ubuntu Hardy Heron 8.04, that is the only cd I have, then the net speed becomes fast, but for some reason Ubuntu 11.04 slows down the net speed considerably.
–
Ruchir ChaturvediFeb 21 '12 at 23:09

It looks like the issue for this user has been solved, but I recently went through the same problems and thought that it would be helpful if I shared how I fixed it.

Symptoms:

Incredibly slow internet speed. (Capping at maybe 50 kbps)

Perfectly fine internet speed on the Windows 7 installation I am dual-booting with on the same machine.

RTL8101E/RTL8102E Ethernet Controller (Network Card)

Note: This may still work for you if that is not your specific Realtek card.

I tried reconfiguring, disabling IPV6, etc ... didn't worked.

I did some reading and found that the Realtek LAN network driver that ships with ubuntu 12.10 (and lower if I recall correctly) is RTL8169. For whatever reason (I am not an expert) the RTL8169 driver does not work correctly with Ubuntu on some installations.

The first thing I recommend that you do is run the following in the terminal:

sudo lshw

That will give you a long list of the hardware and software specifications of your machine. You are looking for some lines that will look something like this:

If the driver happens to say r8169, that is most likely the problem. What we are going to do from here is 'dowgrade' the driver to one that is more compatible with ubuntu.
Note: As I said, the specific card I have is the RTL8101. The steps may change slightly if you have a different card.

The driver for the RTL8101 card can be found here.
You can do a simple Google search if that is not the driver you need.

Unpack the downloaded file and extract to some place you can conveniently 'cd' to in the terminal. I chose Desktop.

You should now have a folder on your desktop called 'r8101-1.023.00' or similar.

Open the folder and confirm that there is a file called 'autorun.sh' in the folder. If there is not, you will need to read the README inside of the folder to figure out how to manually install the driver.

Otherwise (if there is an 'autorun.sh' in the folder), open the Terminal. Then change directory to the extracted folder.

e.g.

cd ~/Desktop/r8101-1.023.00

Run the following command:

sudo ./autorun.sh

That should backup and remove your current RTL driver and install the newly downloaded driver.

That's it.

Those are the steps that I took to fix the problem on my machine. Best of luck.

If you ran a packet capture while you browse slow website, you should see AAAA DNS queries that never answer and hang.

One thing in Firefox is the ocsp feature. When you browse a SSL website it will start to query the ocsp. The problem is ocsp is not ipv6 yet... at least not in the options configure by default in firefox.

I guess someone could dig the internet and add an ocsp that is ipv6 enabled.

So to prove that and see if it's your issue, you can go to tools -> options -> Advanced -> encryption (tab), then click on validation button and uncheck 'use the...'

Also, you could add yourself a ocsp. I didn't try it so far, but if I find an ipv6 ocsp I will share it here.