A WiFi connection is a common issue that can be either a software or a hardware issue. In Ubuntu, the NetworkManager makes the connection to wifi without you having to perform any manual task. At times however unexpected things might occur and you will have to configure or adjust the connection settings by yourself.
Before we delve into some of the solutions to this issue, you first need to make sure that the problem is not related to the router or the modem. Try first to reboot these devices before proceeding to the troubleshooting steps. You might also want to verify your computer WiFi switch in case you have a laptop for instance.If you have a mobile phone or another PC, make sure the wifi connection is up and running and that the signal is strong enough.
Remember when you boot your computer to configure the automatic connection to a wireless network or a wired one in the NetworkManager.
In this article we will provide some solutions for those who have a problem to connect to Wi-FI in Ubuntu.
Although it is quite rare that the DNS is behind the issue, it can still be worth investigating. We will use the nmcli command since now NetworkManager ships with nmcli which is a very simple interface that enables users to connect to some specific networks as well as allows them to create connections to new available wireless networks.
You may be interested to read: How to keep Ubuntu clean
First determine the name of your WiFi interface by issuing the command :
Now open up the Terminal and type in the following command which determines the origin of the DNS:
nmcli device show <interface name> | grep IP4.DNS
You can also use :
nmcli dev show | grep DNS
Remember to plugin your own wireless interface name that you found above.
Now you need to ping the LAN address of your router. If this checks out, try to ping Google’s DNS server which can be found by issuing the command :
Run the command:
You might now be able to find out where the DNS problem might come from. Try to change the router DNS to Google’s in case you noticed that your mobile phone for instance is yielding a page load error.
If your DNS problem is related to Ubuntu only, then the following steps might help you out with the issue. We will be using the Network Manager GUI:
- Right click on Network Manager (Click on the network icon in the top right corner of your screen)
You can also open it if you go to System Settings… → Network.
Or you can also use the terminal by running the following command:
- Click on Edit Connections.
- Choose the relevant Wi-Fi connection.
- Select the IPv4 Settings.
- Alter Method to DHCP Addresses Only.
- In the DNS server’s box , Add 184.108.40.206, 220.127.116.11
- Save and close
Finally you will need to either restart your computer or the Network Manager. The latter can be restarted via the sudo command :
sudo service network-manager restart
You may be interested to read: Network configuration in Ubuntu
Sometimes, when you execute the command
It can yield the following output :
DEVICE TYPE STATE CONNECTION
wlan0 wifi disconnected —
In which case you will need to connect to the wifi. Now make sure first that the WiFi is in its default state (radio is on) by running the command :
nmcli r wifi on
Then, find out the available WiFi networks via the command :
nmcli d wifi list
Which will display something like :
* SSID MODE CHAN RATE SIGNAL BARS SECURITY
wifi0 Infra 5 100 Mbit/s 74 ▂▄▆█ WPA2
You can for instance connect to ‘wifi0’ access point, via the following command:
nmcli d wifi connect wifi0 password <password>
Where <password> is the connection password which require 8-63 characters or 64 hexadecimal characters in order to specify a full 256-bit key.
It is also important that WiFi/WWAN radios are enabled in order to establish a. You can see for instance the state of WiFi and WWAN (cellular) radio interfaces via the command:
You can also watch for changes in NetworkManager activity or monitor nmcli connection in certain devices or connections via the command :
Network Manager aims to provide a seamless uninterrupted network connectivity which goes unnoticed by users. At times however it could be that the Network Manager has been uninstalled by accident or removed altogether in which case you will have no WiFi connection and no wired connection. There is a solution in this situation which consists in installing Network Manager. This goes as follows :
Open up the terminal and run the command :
sudo apt-get install network-manager
You may be interested to read: How to set up a firewall on Ubuntu 18.04 ?
Assuming Ubuntu can see your machine wireless adapter. If this is not the case, you may need to refer to section 5 below.
Now that your wireless card is recognized by Ubuntu, .i.e. the firmware is working, we need to guide the system in order to let it know how to handle the wireless card.This is achievable via drivers or modules. A device driver is a program which tells the machine how to handle a hardware device properly. Although the computer has recognized the wireless adapter, the corresponding drivers may not work very well.
In this case, you may need to look up different drivers which do work. Below are some solutions you can try out :
A list of supported wireless devices can be found in Most Linux distributions. You can find additional information about which drivers needed in order for the wireless adapters to work properly. Consult the list in Ubuntu and check if your model of wireless adapter is listed (refer to section 5 below).
Free and open source device drivers can be found in many Linux Distros including Ubuntu. Proprietary or closed-source drivers cannot be distributed and thus cannot come pre-installed. If the appropriate driver for your wireless adapter is not pre-installed by default then it might only be available in a “binary-only” or non free version, in which case you may refer to the manufacturer’s website to check if they provide any Linux drivers.
Device drivers designed for one operating system (MAC OS) cannot in general be used with another OS.
You can however , in the case of wireless adapters, you can install a compatibility wrapper called NDISwrapper which enables Linux to use some Windows wireless drivers since in the case where Linux drivers are not available. You can find out more about NDISwrapper here. Not all wireless drivers can be handled with NDISwrapper.
Now go back to the terminal and type in the following command:
A list of the currently modules will be displayed. Type in the following command In order to activate your module: “modulename” is your chipset name.
sudo modprobe your-module-name
Once this is done, issue the lsmod command in order to check if it has loaded correctly.
You will be able to force load the driver module permanently at boot via the command below:
sudo nano /etc/modules
One the text editor opens up, you can add your module name and save. Once you reboot, check if the wireless card can detect available networks.
We first need to make sure that Ubuntu can see your machine wireless adapter. Although this can be connected to your computer , it could be that it is not recognized as a network device by Ubuntu. We will now check whether this device was recognized properly.
Issue the command below in order to check if you have a plug in USB wireless card/dongle
And run the command below in order to check for internal wireless cards:
If your output looks like the ones above, then the network adapter can be detected (Look up “Network Controller” or “Ethernet Controller”) .
You can also issue the command below to check if Ubuntu can see the wireless
lshw -C network
- lshw provides information on your hardware
- -C network to only show the network class.
If you see an error message, you may need to install the lshw application.
Now check the result and look up the Wireless interface section. If you have a wireless adapter or if this was detected properly, the output should look like the following:
In the line before the last, which starts with configuration, you will see the driver used by your card.
You may be interested to read:How to speed up Linux
Another alternative would be to use the command:
lspci -nnk | grep 0280
- lspci yields information on your connected PCI cards
- -nnk tells lspci to display extra information (driver being used) about these cards
- | hands over the output to the upcoming command
- grep 0280 shows lines which contain 0280 ( wireless PCI controllers in Ubuntu)
here is a sample output :
08:00.0 Network controller : Realtek Semiconductor Co., Ltd. RTL8723AE PCIe Wireless Network Adapter [10ec:8723]
Subsystem: Realtek Semiconductor Co., Ltd. Device [10ec:0724]
Kernel driver in use: rtl8723ae
Once you know the driver, issue the command below for more information:
In order to find out the currently installed wireless drivers , issue the command below :
find /lib/modules/$(uname -r)/kernel/drivers/net/wireless -name ‘*.ko’
This will yield a pretty big list since these are pre-installed drivers on your Ubuntu.