One of the biggest issues I still see cropping up for Ubuntu (and other distributions) are challenges connecting to Wi-Fi networks. This article will provide actionable solutions to overcome common Ubuntu Wi-Fi issues.
Excellent networking stack - befuddled configuration?
Despite what you might read elsewhere, the networking stack for today's Linux distributions is very good. While there are certainly exceptions, most wireless devices today are detected using drivers already provided by popular Linux distros. And on those occasions where this isn't the case, newbie friendly distros provide various proprietary driver tools as a reliable fall back option.
Without exception, the single biggest offender wireless card is Broadcom based. Yes, they're members of the Linux Foundation. So what – so is Microsoft. That doesn't mean that their driver support is going to be rock solid and in my experience, isn't. And while I haven't tried Broadcom Wi-Fi connectivity in recent years, recent requests for help reflect that very little has changed. What has changed, however, is that the issues are usually not related to the driver's usability itself, rather the encryption protocol it can use with your router. So technically, if we're willing to give driver creators a pass, this is an issue with the end-user's router configuration. Personally I don't agree with this position as it works on other operating systems, but the issue is indeed remedied at the router level.
The problem with this and other unrelated surprises are that most people wouldn't know this was the problem. How could they, unless they specialized in Linux IT or have extensive experience with Linux wireless hassles.
The thing to understand here is that this isn't a reflection on Linux distros being harder to use. In truth, after switching over seniors, kids and others, my support calls went to nearly zero as I maintain their PCs as I did when they ran Windows. Difference is, the opportunity for someone to screw something up has been greatly reduced.
Setting Broadcom aside for a moment, the greater reality here is that most Wi-Fi chipsets work just fine. Most of the time the issue users experience are related to heat, resolv.conf contents and chipset power management and issues with Network Manager. Well, except for those running Ubuntu dealing with network manager problems.
Ubuntu Wi-Fi Troubleshooting checklist – device detection
Rather than merely rant on and on about how Linux wireless connectivity needs solutions to be better documented, I'm going to provide you with a generally distro agnostic checklist that should help. That means it should work under most distros, even those not based on Ubuntu.
Note: Most people won't ever have to bother with this section. This is for those rare occasions where the device isn't detected. Most people can connect, but then have problems loading pages or are dealing with time outs. Help for that later in this article.
Network manager doesn't see the device – One common assumption is that if the network manger doesn't see the wireless card, that your distribution didn't detect it. In reality, this is rarely the case. Most of the time, if you run the following, you'll see the device in question:
sudo lsusb or sudo lspci
So if lsusb/lspci sees the wireless card, then the issue usually comes down to either the needed module not loading or needed firmware not being installed.
I could dive even deeper into this as "technically" drivers and modules differ and how firmware is handled can vary from be something that is installed to something provided by the device itself. But for the sake of keeping this human readable, let's just think of modules as "drivers."
So here's the part you care about. Ubuntu (or other distros) sees the device, but sadly it has no idea what to do with it. So it's safe to assume on an Ubuntu system, linux-firmware is installed and doing its job. Now we just need to make sure the module for your Wi-Fi device is being loaded like it should.
If you're using Ubuntu or a variation like Linux Mint, check the Additional Drivers section of your update utility. Odds are something is available there (looking at you, Broadcom) and installing the proprietary driver will get your wireless working upon a reboot. You may still need to blacklist some stuff, however. Especially if you're using Broadcom.
For those fortunate to be using something like Intel, Atheros or even Realtek, you only need to see if the module is loaded or not.
For the sake of example, let's pretend like my Edimax EW-7718UN 802.11n USB Wireless Adapter wasn't loading the needed module properly. We determined this was the device in question from running lsusb earlier. We also learned from that command, the chipset used is RT2870. With the chipset information, we used Google to determine what module Linux should be using. This query indicated that rt2800usb is the module I'm looking for.
Now, our next step is to see what modules are loaded.
This will give us a list of loaded modules. In my case, rt2800usb loads fine. However for the sake of example, let's say it wasn't loading.
If this is the case, our next step is to manually load the module. We do this not to correct the issue, rather to make sure the module loads in the first place. So since my module is rt2800usb, I'd run the following command.
sudo modprobe rt2800usb
After running it, I simply come to a new line without any errors, odds are good the module has been loaded. Let's check.
See your module loaded? Great! Now we know the module is available, but it's simply not loading at boot. Most of the time, this can be fixed by simply rebooting. This is especially true if you had it working previously, but suddenly it stopped loading the module. But on the off chance it needs a little extra help, not to worry. You can force it to load at each system boot. But before you do, be absolutely sure you tried just rebooting and then running lsmod first.
If it turns out we need to load the module manually at each boot (super rare), you would do the following:
sudo nano /etc/modules
At the bottom, add the name of your needed module. In my case, it'd be rt2800usb. (Again, I don't need to do this and this is merely being used as an example.)
After saving the file, some users might suggest that you need to run a specific update command to finalize the change. In reality, this is not true. Don't get me wrong, it won't break anything...but it's not needed as kmod will do this for you after adding a new module name to your /etc/modules file.
After adding the module, reboot and odds are you're going to be able to connect to your wireless network successfully now. However, if you find you can't load webpages even after it first connects, keep reading.
Ubuntu Wi-Fi Troubleshooting checklist – DNS
It's been my experience that even on a new installation, sometimes DNS can be out of whack. This is quite rare as a new installation problem, although it's common for new users after following bad advice from the less informed on various user forums.
Assuming you haven't messed with your DNS configuration too much, odds are you're getting DNS information from your router. So I run the following command to get an accurate idea where my DNS information is coming from.
nmcli device show wlan1 | grep IP4.DNS
Which then provides my router's LAN address. This is good since I use pfSense and I want it to handle my DNS queries. If you're finding your results to be similar, but still can't get a web page to load, there are some things to consider. Also, wlan1 might differ on your machine. Once connected to Wi-Fi, even if it's not working, get your designation by typing:
Now that we have the name of your network connection, can you ping your router's LAN IP address? If so, can you ping Google's DNS servers? Try it like so:
You can do a Ctrl+C to stop the ping after determining this works. If the issue is DNS in nature, your pings will be successful.
Now we need to determine where the DNS breakdown is happening. If all PCs in your home are having page-loading issues, change your router's DNS to use Google or OpenDNS servers. Reboot the router and then reboot each PC to be tested.
If the issue is only on the Ubuntu or other distro based computer using Wi-Fi, then we'll make the DNS changes only affect the PC experiencing the issues. Now some people may tell you that editing your /etc/network/interfaces with the needed address, netmask and gateway information is the way to go. I disagree and recommend doing the following in the network manger GUI instead. Why? Because it works and the former doesn't (at least not in my experience).
- Right click on network manager.
- Edit connections.
- Select the Wi-Fi connection in question.
- Select IPv4 Settings.
- Change Method to DHCP Addresses Only.
- Add 188.8.131.52, 184.108.40.206 into the DNS servers box. Remember the comma separating the IPs, no spaces.
- Save, then Close.
Once again, assuming an Ubuntu based distro, type:
sudo service network-manager restart
Now when you run our DNS check one again:
nmcli device show wlan1 | grep IP4.DNS
And this time the results produce Google's DNS servers instead of our local router. Awesome, now try visiting a website again. Odds are excellent it works great now.
This adds Google's public DNS servers as the goto source for Webpage DNS information. From here, I can restart my networking or simply restart my computer. For the sake of being extra cautious in case something is overwriting our interfaces file (that we forgot about), I'd just restart the computer and see if the problem persists.
Ubuntu's network stack is good
Despite what must look like a tale of horror to newer Linux users, I can say with all honesty that the Linux stack for networking is prime time ready. The issues most people have, usually start with the wireless card vendor and how their wares interact with your chosen distribution.
To make this simple, let me say this. On Windows or OS X, when you experience Wi-Fi troubles, here are your options when you can't get wireless Internet working.
- Check your device manager or OS X system preferences. If it's connected, try hunting for a newer driver. This can be done through updates or Google.
- Make changes to your local DNS or to your router. Try different channels on the router, maybe different encryption methods. Turn off power saving if you experience a connection drop off.
And if that doesn't work or your device simply doesn't have a compatible driver (Windows 10 is famous for this with older networking devices) – you're out of luck.
Using Linux means you have options. First, the retroactive support for older and even newer wireless cards is legend. Sure, you may have to massage some bugs out of it, but it's detected. Last, if Windows doesn't load the driver correctly – tough. If Linux doesn't load the driver correctly, you can work around the problem by forcing it to load, or looking through the logs to see where the issues are taking place.
So while I completely sympathize with those who experience Wi-Fi issues on Ubuntu or other distros, I would counter with the fact that you're able to at least rule out reasons why it's not working. And if that's not for you, that's okay. Use the operating system that best meets your needs. I'm totally fine with that. My wife is an OS X user and I provide support for her Mac.
As a rule, I support Windows, Linux and OS X regularly. But I can tell you point blank as the guy that supports each of those platforms, Linux gives me greater flexibility in overcoming wireless networking headaches than proprietary operating systems. That's not my opinion, that's a simple statement of fact.