Ubuntu – Fix for Slow Wireless Internet Connection Speed after upgrading to 11.04 Natty Narwhal

I am a die hard fan of Ubuntua lot more better than Windows Operating System based on Linux – so much so that I have completely stopped using Windows in my PC long time back. Windows costs money and makes you pay for buying it, while Ubuntu is free and makes your life much much better after installing it. Recently Ubuntu came out with its newest version 11.04 code named Natty Narwhal, and after upgrading my earlier 10.10 version Maverick to this new Version of Ubuntu, I faced my first real issue with Ubuntu in so many years – My USB Wireless Internet Connection speed had almost come to a standstill like a slow dial up connection after upgrading Ubuntu to 11.04! The connection was n times weaker than Windows based systems running on same wireless connection. Many a times it even simply dropped Internet connections.

And I was quite sure that the Upgrade to 11.04 was causing this issue, and that too only with my wireless connection. That was because, the upgrade which I downloaded which was more than a GB I guess was relatively very quick over my wireless connection and happened within a couple of hours. And when the wireless became dead slow after the upgrade, I did a check on the same connection using a normal Ethernet connection (a wirefull connection) and the speed with Ethernet was good as usual, only the wireless sucked.

I searched the entire Ubuntu documentation and forums, only to see that most people had the same problem after their upgrades, but none of the solutions posted there worked – not at least for me. I was going mad with my slow wireless Internet connection when I finally found this thread which said that it was the new Power Management settings in Ubuntu that were causing less power to be supplied to the wireless Interent device there by considerably slowing down the Internet speed in many wireless devices!

And the solution? Well, that is the reason I posted this off-topic post. The solution is to run the following command to turn off Power Management by Ubuntu to your wireless device, and instantly after running this command my wireless Internet gained Rocket speed!

Just open a Terminal window in Ubuntu and type

sudo iwconfig

This will list the available wireless interfaces in your system. Now check out your wireless device name here, usually it will be wlan0

Now type the command

sudo iwconfig wlan0 power off

What this essentially does is switch off the power management by Ubuntu for your wireless device. That’s it, and now trying to download a file or watching a youtube video, and you will see that your wireless Internet connection is now back to top speed :)

But this is only a temporary solution, because the next time your operating system starts, you will have to run this command again. So we actually need a permanent solution to forever prevent Ubuntu from handling the power management of our wireless device. How to get that done?

All we need to do is edit the file at the path /etc/pm/power.d/wireless – if this file or path does not exist, then you need to create it.

So cd to the directory /etc/pm/power.d and if this directory structure is not there then you need to create it using mkdir.

The create or edit the file called wireless in this folder using the following command in a terminal window

sudo pico /etc/pm/power.d/wireless

NOTE: I prefer pico to gedit, if you are more comfortable with gedit, then simply repace pico with gedit.

The above command opens the wireless file for editing as a root user.

In this file add the following lines and save the file and exit. That’s it.

#!/bin/sh

/sbin/iwconfig wlan0 power off

The above lines tell Ubuntu not to manage the power supply to the wlan0 wireless device. So even after you restart your system, Ubuntu will not control the power supply of your USB wireless device, and there you are your wireless internet speed back to normal forever or at least till you face another issue.

By the way, I also don’t like the new Unity interface in Ubuntu 11.04 and have reverted it back to the classic GNOME – dont’t want my powerful PC to look like a small Notebook :)

Update (Feb 21 2011)

Even though my wireless Internet connection gained back a significant amount of its original speed after applying the above fix, it still was not running at its peak speed and I continued to search for other solutions to bring back my wireless internet connection to full speed. And finally the below additional fix brought back my wireless connection to its top speed on par with my windows system. So here goes the solution.

There is a bug in the Debian Avahi daemon in Ubuntu. And to resolve this you need to edit the following file /etc/nsswitch.conf as follows.

Type the following in the command line

 sudo gedit  /etc/nsswitch.conf

This will open the nsswitch.conf file in the text editor. Then simply change the following line

hosts:          files mdns4_minimal [NOTFOUND=return] dns mdns4

to the below line and save the file.

hosts:          files dns

That is it. Just reset your internet connection or probably restart your system and your wireless connection should be back on top speed. This worked for me like a charm.

  • Dalia Ghoniem

    thank you! what a simple solution. and to know that I have been frustrated for the past 2 months unable to find a solution after updating ubuntu.

  • aaron f

    Thanks! This trick worked for me as well, i was getting brutal download speeds prior.

  • Ron

    You my friend are GREAT, Thanks a million for this, my internet speed is fast again!

  • arueen

    wow!!! it really works!

  • Math

    Thanks a lot!!!
    The changes to nsswitch.conf doubled my download speed on Ubuntu 12.10!
    =D

  • Dex souid

    thanks it works. but can I know what’s the trick

    • itzguru

      The power management system in Ubuntu for the wireless device had an issue which caused less power to be supplied to the device slowing down the connection speed. Turning it off fixes the issue if that is the reason for the slow connection.

      • Dex souid

        thanks!
        so the Ubuntu dev team do not know this issue
        in your opinion

        • itzguru

          Its not actually an Ubuntu issue because not all wireless devices have this issue, but I guess they have made power management more smarter in later kernel versions and this issue doesn’t exist now.

          • Dex souid

            thanks dude :)

  • Caio

    worket like a charm, thank you!

  • Vince

    the /etc/nsswitch.conf mod did the trick perfectly, thank you!

  • http://www.facebook.com/robert.ramirez.54390876 Robert Ramirez

    This worked great for my daughters Lenovo G585 running Edubuntu. Thank you soooo much!! It took me forever to find this but I am glad I did!!

  • Ruben

    Thank you! just installed Ubuntu12.10 for the very first time, and I noticed the drop in speeds.. From a brand new Ubuntu newb.. THANK YOU!

  • Marko Lazarevic

    Dude you are a life savior!!! This works on 12.10 like a charm. Thanks a lot!

  • Harnesh

    Thanx a ton !!!!
    i mean it !!

  • davebarbarian24

    You’re update from Feb 21 2011 put my machine to the point where it wouldn’t load any webpages at all. The other solution did not speed it up at all. Running ubuntu 12.10

  • jasonrbriggs

    Brilliant. Fixed my problem (which has been driving me nuts)! Thanks very much.

  • Aprianto Nursetiawan

    sudo iwconfig wlan0 power off give me:

    Error for wireless request “Set Power Management” (8B2C) :

    SET failed on device wlan0 ; Operation not supported.

    Is there anything wrong?

  • http://www.facebook.com/Insidioussoliloquy44 Clyde Johnson

    Thank you Thank you Thank you. I am reinvesting the majority of my time away from windows “X” back to a few of my favorite linux distros. This is the reason why I love the linux community. Appreciate the help and the time you took. Have a happy new year.

  • Lamberto Acyatan

    You’re genius. Thank you!

  • http://twitter.com/fabioportugal portugatartruga

    My problem wasn’t with the speed, but with the wifi turning off during the streaming of movies. but it seems this fixed that issue as well!!! Thanks a lot!!!

  • Robert

    Thank you, thank you, thank you, thank you!!! After hours of searching, your article finally helped me fix the problem in Ubuntu 12.04. I was almost ready to go back to Windows. They should really include this fix in their next update. Before the fix, my speeds would get down to dial-up speeds (literally). Now, I’m back up to 1.1Mbps.

  • Alberta51ca

    Thank you so much.  I have been looking for a solution for this for ages! Works great.

  • Guest

    Very informative n really very effective…. i had been facing this issue for a very long time n even after some rigorous search on internet couldnt find the result to this bug… bt this article really helped resolving the issue… thanks to the author!!!! cheers!!! ;)

  • ChickenMusket

     Correction…ChickenMusket here again…this final step worked (after all the others & maybe all the others were unnecessary). Went into wireless connections, the edited the one I’m currently using. Edited the ipv4 settings Method: automatic (dhcp) address only. And in the dns server field I specified the ip address of my gateway wireless router. Basically, you want to specify a dns server here: the one that tests the fastest for you. If you don’t know what it is, use this website’s app to find it. http://www.grc.com/dns/benchmark.htm. I wasn’t able to run it in linux, but I ran it in a virtual box windows 7 machine (bridged to my linux wifi interface). Sort it by fastest. My two fastest dns turned out to be the wireless router ip address & the modem in my LAN.

  • ChickenMusket

    Hi everyone. I’m using an Asus u56e-bal7. Super Ubuntu 11.04 fresh install. I tried a buttload of commands and things (disabling n, disabling ipv6 on wifi & firefox, disabling power management). I don’t know if some of them put together plus the following worked, but this is the final step that worked for me…

    Kernel 2.6.39 completely fixed the issues with the ath9x driver for me in 11.04 (Natty). I can do high-load transfers without issue. Comment #8 on “wlan (AR928X, ath9k) slow since upgrade to natty” contains instructions on how to get this kernel from a PPA. I did an apt-get install rather than a dist-upgrade, but either one should get you the new kernel. Here’s what I did:

    sudo add-apt-repository ppa:kernel-ppa/ppa
    sudo apt-get update && sudo apt-get install linux-generic-pae

    If you’re using a 64-bit kernel, I think the package to install is just “linux-generic”. Or just follow the instructions right in the bug (use apt-get dist-upgrade -y).

    Also possibly related:

        UNR Ath9K unstable connection
    https://bugs.launchpad.net/ubuntu/+source/linux/+bug/378156

    After upgrading to linux 2.6.39, changing the ath9k driver config (as suggested in Why is my internet so slow with an Atheros wireless card?) is not necessary.

    Hope this helps!

    I forget where it’s from…

  • Guest

    For some reason I can turn it off, but I can not make it persistent. Made the file executable, but every time I reboot it’s turned on again. I’m on a desktop. Any ideas?

  • Bipr38

    I am very new to Ubuntu , my terminal shows below comment , anybody can help me ?

    inaya@binaya-HP-Pavilion-dv2000-GG176PA-ABG:~$ sudo iwconfig
    [sudo] password for binaya:
    lo        no wireless extensions.

    eth0      no wireless extensions.

    wlan0     IEEE 802.11abg  ESSID:”BPNetwork”  
              Mode:Managed  Frequency:2.462 GHz  Access Point: 00:24:D2:9A:E7:65   
              Bit Rate=54 Mb/s   Tx-Power=14 dBm   
              Retry  long limit:7   RTS thr:off   Fragment thr:off
              Encryption key:off
              Power Management:off
              Link Quality=46/70  Signal level=-64 dBm  
              Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
              Tx excessive retries:1  Invalid misc:2119   Missed beacon:0

  • Edubyah

    Thank you so much, you my friend are a Linux beginner’s Champion!

  • virgodave

    OMG Awesome, new life! Faster than my Windows system now!

  • Rajan

    thanks – this worked just beautiful

  • Eyr

    you rock.thx

  • Korilius

    Genius

  • mursalat92

    worked like a charm

  • Arthur

    I got an error “Error for wireless request “Set Power Management” (8B2C) :
        SET failed on device wlan0 ; Operation not supported.” :( any solutions?

  • Steve Sampson

    Nice, my power management was already defaulted to off but the second suggestion worked great. Thanks..

  • Emkas

    Works excellent! I had this problem on Ubuntu 10.10, so this works also for this edition ;-)

  • Dasajama

    Thank you so much!  I’m a Ubuntu newbie, and I was worried that the OS was somehow crippled because the internet connection was so slow.  This fixed it!  I’m a big Ubuntu fan again!

  • Coolalways

    You are a lifesaver dude.
    God bless you

  • Lwfitz

    Perfect, thank you very much! I just used this on Mint 12 KDE RC and it worked perfect. I got an initial error when trying to shut off power control with the Konsole but after saving the file and rebooting it was great.

  • http://www.facebook.com/guanyu.chu Guanyu Chu

    wow. magic. thanks.

  • Adf

    same slow wifi problem with ubuntu 10.04 but instructions above solved it.  wireless is very fast now.
    thank you very much

  • Rjndr0

    I am having the same problem in 11.04 it Internet Speed is between 8Kbits to 20kbits and it dips to zero often. So I wipe the Hard drive clean re-install the 11.04 and worked fine. Only for problem to return in few hours. So I wiped it clean again. ( Isn’t this cools you can do because of Ubuntu One account) And re-installed 11.04 and speed was good. So I upgraded to 11.10 and it only too me 4 hours to do a complete upgrade which is good at 54Mbit speed. And I was able to use 11.10 fine until I downloaded Android Sdk. It seems that once download is started. either ISP has got a way to filter GID of the machine that consist of non-windows and non-mac Machines and put it on Slow Internet. If they do not have a business account.
    Anybody thing this may be a possibility. ?

    • Anonymous

      Did you try downloading something else, like watching a youtube video? Just to make sure that it is Ubuntu issue or only Android download issue?

      • Rjndr0

        Yes Youtube vedios are slow as well But I can run the browser just fine.. Its only the download speed for streaming or data transfer that is slow. So it gives me reason to believe ISP may be rationing download only. But then it does not happen on XP machine I can download just fine.

  • Falgun

    thanks a lot bro!!! i was really pissed of with wireless speed.. ur post has solved the problem!!! i m also in favour of ubuntu so i really wanted to get rid of this problem!!! really thanks for helping!!!

    • Anonymous

      You are welcome Falgun.

  • Piyush

    Need help. My wireless device name is wlan0. But when I type “sudo iwconfig wlan0 power off”, I get the response:Error for wireless request “Set Power Management” (8B2C) :    SET failed on device wlan0 ; Operation not supported.and nothing changes. My internet is still horrible. What do I do to fix this and get my internet working again?

    • Henrik

      I get the same error message, except my device is called wlan1. Help!

    • Falgun

      even i got the same responce 1st!!! try the next method as described above!!! it works.. i am getting full speed now by saving the changes in root!!!

  • Tomquid

    Dear all, l am new to ubuntu and first downloaded the new 11.10. After my wireless internet speed was extremely low and after some research l decided to try 11.04 – with somewhat of success. However, my internet speed will fluctuate from extremely slow to great. Other non ubuntu machines running on the same wireless network will be just fine. It also seems random when it will be fast and when it will be slow (and the connection icon in ubuntu is always showing full connection). 
    l tried to turn off power management but when l was running iwconfig the wlan0 already list the power management as off (and l’m not able to run the rest of the script which l’m guessing is because the power management is already off).l’ve also tried the other  wireless usb adapter l’m running on my second htpc (running xp) and this has the same issues on the ubuntu machine yet non of the two usb adapters are running slow when used on the xp machine. Any help would be appreciated.Thanks

  • Ashishtuscano

    wow.. my connection issues seems to have been solved.. will do some more rigorous testing and get back.. but so far looks great! Thanks!

  • CAO

    Hi I’ve just downloaded ubuntu for the first time and am having this slow internet connection problem that many people seem to have had.  I’ve disabled the power manager in the terminal, but didn’t really notice any change.  Web browsing is still horrendously slow.  Also I’ve noticed that the power manager has stayed off even after I re-booted.  Is there anything else I should try?

  • Onescape

    thx so much

  • Eric

    Thank you for this fix, but why do you disallow copying from your blog? It’s annoying that I have to rewrite each and every command line.

    • Anonymous

      Sorry about that. Copying is not disallowed. Its only appending a credit to the original link, just in case somebody misses it out :)

  • Anonymous

    Need help. My wireless device name is wlan0. But when I type “sudo iwconfig wlan0 power off”, I get the response:

    Error for wireless request “Set Power Management” (8B2C) :    SET failed on device wlan0 ; Operation not supported.

    and nothing changes. My internet is still horrible. 

    What do I do to fix this and get my internet working again?

    • Derpina

       you have to make executable the script so run

      sudo chmod +x  /etc/pm/power.d/wireless then everything must be ok

  • Easy

    Great help! Really made a difference for me. Thanks…

  • Rodney Theng

    Awesome. Great write up…. I owe you!!!

  • Manish Mishra

    I am using Huawei USB Modem Mobile Broadband. Is “sudo iwconfig” is applicable for this. What I get after issuing command is
    lo        no wireless extensions.
    eth0      no wireless extensions.
    ppp0      no wireless extensions

    Although slow But I am using it to connect to the net.

    • Anonymous

      Looks like your USB device was not connected to the internet when you ran the command? Since yours is a mobile broadband, the device would be ppp0. So the command you need to run is

      sudo iwconfig ppp0 power off

      • Manish Mishra

        1. I was connected to internet when I ran “sudo iwconfig” command. When not connected this command gives 1st two lines.
               i.e. “ppp0  no  wireless extensions” is absent.2.  running “sudo iwconfig ppp0 power off” gives following          Error for wireless request “Set Power Management” (8B2C) :         SET failed on device ppp0 ; Invalid argument.
        3.  lsusb shows Moem to be connected at Bus 001 Device 005

  • Marcus

    I was struggling with this for days on end. This is very helpfull. I thought it was my old (10 years) computer, ha.

    • Anonymous

      Same here, I thought it was some problem with my system till I realized that booting into windows in the same system didnt have any internet speed issue. Hence after finding a solution posted it so that atleast others dont get frustrated as I got. Good to hear others benefiting from it :)

  • Sean

    I think its made my internet respond a little tiny bit quicker, still on speedtests i’m only getting 2 megs download on a 8 meg connection (that works fine with vista on the same machine). Would love to get this sorted as im really digging ubuntu (downloaded it yesterday) 

  • Greg

    how do you actually save and exit after you have created the file ? I am new to ubuntu and dont have a clue. I tried typing save and exit in the terminal but it done nothing, so i just turned the PC off. What do i do to save it so the power management stays permanently off ?

    • Anonymous

      If you are using the following command (pico) to edit the document
      sudo pico /etc/pm/power.d/wireless

      Just do a Ctrl+X after completing the edits, which will make the editor quit which in turn will prompt you to save the changes before quitting. Then pressing “Y” will save the changes and quit the editor.

  • Dizzy_danny3

    ok please somebody tell me how to fix this, i typed in “sudo iwconfig wlan0 power off” and it says operation not supported

    • Anonymous

      Just type iwconfig and see whether it lists wlan0, most probably yours has a different name in place of wlan0 – just replace wlan0 with that and run the above command

  • Saumvik2003

    Absolutely brilliant. Thanx a ton. Am new to Ubuntu but am totally fascinated by it.

    • Anonymous

      You are welcome Saumvik!

  • rembuntu

    Works like a charm! Many thanks.
    Greetings from Harderwijk!

    • Anonymous

      Glad to know this helped you!

  • http://twitter.com/raynmune raynmune

    thanx a lot it works like a charm

    • Anonymous

      Glad to hear that

  • Asdadsas

    great thanks !!! being looking a long time for a solution

  • Asdadsas

    great thanks !!! being looking a long time for a solution

  • Alfango

    Thank you, i feel my connection is better now, but I have a question… it’s not supposed that when I use iwconfig it must show “power management: off”? Because that’s my case.

  • Alfango

    Thank you, i feel my connection is better now, but I have a question… it’s not supposed that when I use iwconfig it must show “power management: off”? Because that’s my case.

    • Anonymous

      Yes in this case once you do the changes it should show, power management: off

  • Daniel Rodriguez

    Works perfect, but in my case i turn on the power managment and boom double speed.
    Thanks!

  • Guest

    Thanks a lot for this buddy, my Ubuntu is now back to speed on the Internet

    • Anon

      Cool, same here :)

    • Anon

      Cool, same here :)

  • Martin

    Thanks man, you ROCK!!!

    • DarkStar

      Thanks a lot. It worked

  • Webe1959

    Thank you so much. That was such a big help. Interesting that such a simple item like power manger could be cause.

    Thanks again.

  • Cliff

    Thanks for the great tutorial. It did help my speed issue, as well as updating the kernel. But, it didn’t work at first until
    I followed the thread you listed and found that I needed to change the permissions to allow it to run as as an executable. After that, all is well.
    And, I agree with you on Unity. I found it cumbersome and hard to navigate to my common programs/files. I reverted back to Gnome classic.
    Much better!!

  • Matt

    okay so i figured out how to do this as a sudo/root user and it says operation not supported, wtf!

    • Anonymous

      It means either the wireless device is not plugged in into your system or is recognized using a different name other than wlan0

      Did you find wlan0 listed when you entered the command “sudo iwconfig” in the terminal window? If there was some other term used for the wireless device then you need to replace wlan0 with that term.

      • Prescilla

        When I typed sudo iwconfig no wireless extensions were displayed. What does that mean? I do have a wireless broadband USB for my Internet connection.

        • Anonymous

          Is your USB connected and connected to the Internet? In that case iwconfig should show something like wlan0. Can you post what exactly is the ouput of your iwconfig?

  • Matt

    Hey having a small problem: if I type in “iwconfig wlan0 power off” the prompt says operation not supported. what does this mean? having this problem too, please answer!

    • Anonymous

      You need to issue this command using sudo ie as root user

      • Matt

        gonna be honest and say that i have no idea what you mean… im a complete ubuntu linux noob =/ 

        • Anonymous

          Go to start menu ie Applications -> Accessories -> Terminal window and then type the commands as root user which means you need to first enter ‘sudo’ (without the quotes), then give a space and enter the actual command. The system will prompt you for the root password when you do so, and once you type in the root password, the command will then be executed.

  • Yannick

    I started having the same problem recently on my 10.10 Maverick install of Ubuntu, probably due to some recent updates. And the same workaround works, thanks a lot!

    • Anonymous

      Good to hear it worked for you :)

  • Chris

    Hey having a small problem: if I type in “iwconfig wlan0 power off” the prompt says operation not supported. what does this mean?

    • Anonymous

      You need to issue this command using sudo ie as root user
      sudo iwconfig wlan0 power off

  • Anonymous

    Thank you very much ! You solved that ! Also try to update your post using the following phrase: Ubuntu wireless weaker than windows (because I was trying to search for that solution with the above phrase)

    • Anonymous

      Thanks for the tip, updated the meta title and keywords accordingly :)

  • S. Ferreira

    Whoooohooo, this works! Thanks for the good work!
    To me Ubuntu 11.04 seems quite buggy…

    • Anonymous

      Yes, I couldnt see any major improvement, only some crappy user interface which I got reverted to classic interface of 10

  • Ahsan Smiles

    Thanks allot you made my day wondefully back to SPEED!! :) Peace from Pakistan.

    • Anonymous

      You are welcome Ahsan, keep smiling :)

  • Mario

    Thanks a lot!

    • Anonymous

      You are welcome!

  • Mark Ryan

    Thanks I’ve been really bugged that Opera would report I’m on a slow connection when I have a 30 MB connection. Hoping this will fix it..

    • Anonymous

      Hope your internet gets back to speed :)

      • Mark Ryan

        Even though I setup the config file correctdly, it’s not working. I no longer get a message suggesting I use Opera’s Turbo feature, but when I try to load pages such as facebook, it often just spins it’s wheels.. I may be looking at going back to 10.4 and skipping this 11 release.

        • Anonymous

          Yes, I didnt find anything really substantial in 11 release apart from the messy new desktop which I have reverted back to 10

  • Steve

    You made my day

    • Anonymous

      My pleasure Steve!