Fix: Ubuntu 16.04 to 17.10 WiFi and Ethernet Problem

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.

  1. Ubuntu will not connect to wifi at all.
  2. 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.

Now type:

 

In the document that opens, add the following line to the bottom (as shown in screenshot):

[device]
wifi.scan-rand-mac-address=no

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: 8.8.8.8, 8.8.8.4

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

Followed by:

sudo dkms add ./rtl8192cu-fixes
And next:
sudo dkms install 8192cu/1.10

Now we’ll refresh the modules list:

sudo depmod -a

And blacklist the faulty driver:

 

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

Followed by:

git clone https://github.com/lwfinger/rtl8723au.git
Now type:

cd rtl8723au
And then:

make
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
blacklist rtl8723au
blacklist r8723au
blacklist rtl8723bu
blacklist r8723bu

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:

cd rtl8188eu
make
sudo make install

Now reboot your computer.

ABOUT THE AUTHOR

Kevin Arrows


Kevin Arrows is a highly experienced and knowledgeable technology specialist with over a decade of industry experience. He holds a Microsoft Certified Technology Specialist (MCTS) certification and has a deep passion for staying up-to-date on the latest tech developments. Kevin has written extensively on a wide range of tech-related topics, showcasing his expertise and knowledge in areas such as software development, cybersecurity, and cloud computing. His contributions to the tech field have been widely recognized and respected by his peers, and he is highly regarded for his ability to explain complex technical concepts in a clear and concise manner.

Comments

7
    WW
    White Wolf Nov 15, 2017

    How to Fix no wifi connecting problem and ( Showing Connect Network Adapter ) ?
    1 ) Search Softwares and Updates
    2 ) Open it (Softwares and Updates)
    3 ) Plug in the ethernet cable into your computer and connect another end to router
    (You will see Internet connected through Cable)
    4 ) Now go to Additional Drivers in Softwares and Updates
    5 ) Select (Using Broadcom 802.11 Linux STA . . . )
    and
    6 ) Select Apply Changes
    And Wait untill whole processing is over .
    Now You will see Wifi Icon Appearing in Top-Left Corner on your desktop.
    ( Note : Don’t plugout the cable untill the whole process is over or untill the WIFI-Icon doesn’t appear !

    VI
    Victor Dec 29, 2017

    Thank you for the solution (the first in the text)! After a few hours searching you finally gave me it!

    JE
    jeremy5321 Feb 24, 2018

    Kevin perhaps you should visit pvaret’s github site and notice that it says it is now deprecated because of new kernel support. And when dealing with iwlwifi issues 11n_disable=8 works better than 11n_disable=1 and don’t forget that newer HP laptops with rtl8723be chipsets might only have one antenna

      TC
      Tony Celentano Feb 28, 2018

      Hi Jeremy,

      Thank you for pointing these things out.

      The github site does indeed mention that the fix is now deprecated, but it also says in the next paragraph that it could still be worth a try for some users.

      “In some cases, though, this driver has been known to work fine where rtl8xxxu doesn’t. If rtl8xxxu doesn’t work for you even after the troubleshooting steps listed above, follow the instructions below to install this one instead.”

      Because Linux troubleshooting can sometimes be so difficult, its worth mentioning as many potential fixes as possible in these types of guides.

    SU
    Sutriman May 2, 2019

    My Wifi worked after update the driver, but ethernet not yet….

    MA
    Muhammed Ahmed Mar 4, 2020

    my laptop has the RTL8723BE, but when I run the first command, I get these exact lines
    “Reading package lists… Done
    Building dependancy tree
    Reading state information… Done
    E: Unable to locate package gksu
    E: Unable to locate package leafpad”

      SW
      Shane Warren Author Mar 6, 2020

      This happens when you dont have the package inside the highlighted directories. Make sure that you have the package inside the directory that you are highlighting in the command and also verify that you are using the correct command.