This guide is for users who are running Ubuntu versions 16.04, 16.10, 17.04, or the latest 17.10. There have been a large number of bug reports concerning wifi connectivity issues in these releases. If any of the following sounds familiar, read on for potential fixes.
- Ubuntu will not connect to wifi at all.
- Ubuntu wifi randomly disconnects.
So there’s a number of things that could be wrong here. If you’re on a fresh install of Ubuntu, like if you just upgraded from 16.04 to 17.10, you may very well likely be affected by the ‘random MAC address’ bug that has been reported by many users (and the Ubuntu developers are certainly aware of it). Alternatively, you may be effected by a driver issue (very common, and certain Realtek-based wifi adapters are notoriously more difficult than others).
Ubuntu 16.04 / 17.04 / 17.10 Will Not Connect to WiFi
So first what we want to do is make sure you aren’t being affected by the random MAC address bug. Here is an official blog excerpt that describes the issue in detail:
“there is a new privacy feature in the new version of NetworkManager.
This privacy feature can cause some USB WiFi adapters to stop working while they used to work with older versions of NetworkManager (Ubuntu 16.10 or older). The purpose of this privacy feature is to get your computer to report a new random MAC address whenever you connect to a WiFi network.
This privacy feature is especially useful when you connect to public WiFi networks, so that the operators cannot identify you when you connect multiple times. The downside of this privacy feature is that some USB WiFi adapters misbehave when NetworkManager tries to change their MAC address repeatedly.
The result is that those USB WiFi adapters cannot connect anymore to the WiFi network.”
So to disable this security feature, you’ll want to press CTRL + ALT + T to open the terminal.
In the document that opens, add the following line to the bottom (as shown in screenshot):
Save and exit the NetworkManager.conf file, and type in the terminal: sudo service network-manager restart
You should be able to connect to your wireless network now.
Ubuntu 16.04 / 17.04 / 17.10 WiFi Disconnects Randomly
If you’re able to connect to WiFi, but it drops out at random times for seemingly no reason, there are a few things to try. This can either be caused by poor drivers, or weak signal and interference.
Start by opening the Linux terminal (Ctrl + Alt + T is a keyboard shortcut), and copypaste these lines into the terminal:
This is going to disable 802.11n features, which can cause more problems than its worth when 802.11n mode is enabled.
Let’s configure your wireless router to try and eliminate interference from other WiFi networks.
Open your browser and navigate to the IP address of your WiFi router – this is typically 192.168.0.1, but the exact address can be found either on a sticker on the router, or in the router’s manual.
Because all router web interfaces are different, I can’t walk you through this part with screenshots, but try to find your router’s “Advanced Settings”, or wherever you’re able to configure the wireless settings.
Start by playing with the channel and frequency. In many cases, switching your wireless channel to either 1, 6, or 11 can eliminate frequency interference, but it depends on which channels your neighbor’s WiFi routers are broadcasting on.
Now you should also be aware that for whatever reason, NetworkManager plays better with SSIDs that are running WPA2-AES security, not WPA/WPA2 mixed, and definitely not TKIP. So try changing your SSID security to a WPA2-AES passcode.
I also suggest switching from 20/40 Channel Bandwidth to just 20.
Now open another terminal, and type: sudo iwlist scanning
This will show a list of WiFi networks, and their associated MAC addresses. In the list, search for your personal SSID, and write down the string next to “Address”.
Now on the Ubuntu desktop, right-click on the Wi-Fi icon and go to “Edit Connections”.
Click on your WiFi network and click the Edit button.
Go to the IPv4 Settings tab, and set it to “Automatic (DHCP) address only”.
In the box for “DNS Servers”, paste these numbers: 188.8.131.52, 184.108.40.206
Now click on the Wireless tab, and in the box for “BSSID”, paste the MAC address string you copied from when you ran the ‘sudo iwlist scanning’ command.
Save and exit the NetworkManager interface, and try browsing a bit. If you continue to get random WiFi disconnects, we’ll have to assume this is a driver problem.
Realtek Chipset USB WiFi Adapter Issues
Realtek chipsets are very common in budget WiFi adapters, so lets find out if you’re using one, and what we can do to make it more stable.
Lets open a new terminal and type the following command: lsusb
Now scan the list for your USB wifi adapter, and mark down the chipset it uses. For example, in my screenshot, you can see I am using an “Edimax EW-7811Un”, but it uses the Realtek RTL8188CUS chipset.
Now in the terminal, type the command: lsmod | grep rtl
This will display the current WiFi drivers loaded on your system. It will probably display a generic Linux driver that is supposed to be compatible with a wide range of devices. For example, the generic driver for my chipset would be displayed as “rtl8xxxu”. What we want to do is download and install drivers that are specific to your chipset.
We are going to need an alternative method of connecting to the internet to download the drivers, so I hope you either have an ethernet cable, or a mobile device that can set up a USB tethering connection to your computer. So for all of the following Realtek driver guides, you should establish an alternative method of connecting to the internet, preferably over ethernet / USB tethering.
Realtek RTL8188CUS and RTL8192CU
Type into the terminal:
sudo apt-get install linux-headers-$(uname -r) build-essential dkms git
Now we need to download the source code for the driver, so in the terminal type:
git clone https://github.com/pvaret/rtl8192cu-fixes.git
sudo dkms add ./rtl8192cu-fixes
sudo dkms install 8192cu/1.10
Now we’ll refresh the modules list:
sudo depmod -a
Disable the “power management” setting for the adapter:
Now reboot your computer, and try connecting to the WiFi network.
Realtek RTL8723BE chipset
Launch a terminal window and type the following command:
sudo apt-get install gksu leafpad
Now we’ll create a new settings file:
And we’ll edit the file:
Now in the empty text file, paste this line, then save and close the file: options rtl8723be fwlps=0
Now reboot your computer, and the connection should be more stable now.
Now reboot your computer, and the connection should be more stable now.
Realtek RTL8723AU chipset
Launch a terminal and type the following commands:
sudo apt-get install git build-essential linux-headers-$(uname -r) gksu leafpad
git clone https://github.com/lwfinger/rtl8723au.git
Now we’ll install the compiled module: sudo make install
And we’ll blacklist the flawed driver:
In the text file that opens, paste the following lines at the end of the document:
#This will prevent the flawed drivers from loading
#You’re welcome from Appuals.com
Save the text file, close it, and reboot your computer.
Realtek RTL8188EU chipset
Launch a terminal and check which driver is currently loaded with: lsmod | grep 8188
It should display the current driver as ‘r8188eu’. So in the terminal, paste: sudo apt-get install linux-headers-$(uname -r) build-essential dkms git
And then: git clone https://github.com/jeremyb31/rtl8188eu
Now we’ll compile the kernel module with:
sudo make install
Now reboot your computer.