
How to Setup Wifi in Ubuntu? Linux Network Steps
Introduction If you are wondering How to Setup Wifi in Ubuntu?, you are not alone. Ubuntu handles wireless networking well, but the best method depends on whether you prefer a graphical interface, command-line tools, or advanced system configuration. This guid
Introduction
If you are wondering How to Setup Wifi in Ubuntu?, you are not alone. Ubuntu handles wireless networking well, but the best method depends on whether you prefer a graphical interface, command-line tools, or advanced system configuration. This guide explains the complete Linux network steps for connecting to Wi-Fi, checking adapters, installing drivers, using NetworkManager, configuring Netplan, setting static IP addresses, and securing your connection.
Whether you are setting up Wi-Fi on a laptop, desktop with a USB adapter, or a server, the steps below will help you move from detection to a stable connection. You will also find troubleshooting tips, a comparison table, and answers to common questions.
Table of Contents
- Understanding Ubuntu Wi-Fi Basics
- Check Wireless Hardware and Drivers
- Method 1: Connect Using Ubuntu GUI
- Method 2: Connect via Terminal
- Method 3: Configure Wi-Fi with Netplan
- Set a Static IP Address for Wi-Fi
- Connect to a Hidden SSID
- Security: WPA2, WPA3, and VPN
- Comparison of Ubuntu Wi-Fi Setup Methods
- Tips and Best Practices
- Frequently Asked Questions
- Conclusion
Understanding Ubuntu Wi-Fi Basics
Ubuntu uses NetworkManager as the default network service for most desktop systems. NetworkManager manages Wi-Fi, Ethernet, VPN, and other connections. It stores connection profiles, remembers passwords, and can automatically reconnect when a known network is available.
On servers, Ubuntu may use Netplan instead of a graphical NetworkManager applet. Netplan reads YAML configuration files and applies network settings through a backend such as NetworkManager or systemd-networkd. Understanding which tool your system uses is the first step in learning How to Setup Wifi in Ubuntu? without confusion.
A typical Wi-Fi setup involves four layers: hardware detection, driver availability, network scanning, and authentication. If any layer fails, the connection will not work. For example, Ubuntu may detect your adapter but lack the proprietary driver. Or the driver may work, but the network requires a specific security protocol.
Check Wireless Hardware and Drivers
Before connecting, confirm that Ubuntu can see your wireless adapter. This prevents wasted time trying to connect through a device that is not recognized.
Identify Your Wi-Fi Adapter
Open a terminal and run the following commands. These commands list PCI and USB network devices.
lspci | grep -i network
lsusb
ip link show
If you see a wireless interface such as wlan0, wlp2s0, or wlx..., Ubuntu recognizes the adapter. You can also check the device status with NetworkManager.
nmcli device status
A Wi-Fi device should appear as wifi with a state such as disconnected or connected. If it says unavailable, the adapter may be disabled, blocked, or missing a driver.
Install or Update Drivers
Many Wi-Fi adapters work out of the box with open-source drivers. Some Broadcom, Realtek, and MediaTek adapters require additional firmware. First, update your package list and installed packages.
sudo apt update
sudo apt upgrade
Then check for recommended drivers using Ubuntu’s driver tool.
ubuntu-drivers devices
sudo ubuntu-drivers autoinstall
If you have a Broadcom adapter, you may need a package such as bcmwl-kernel-source. For Realtek adapters, firmware packages may be required. After installing drivers, reboot the system.
sudo reboot
After reboot, run nmcli device status again. If the Wi-Fi device now appears, you are ready to connect.
Method 1: Connect Using Ubuntu GUI
The graphical method is the easiest option for most desktop users. It is ideal if you want to avoid terminal commands and need a visual list of available networks.
Step-by-Step GUI Connection
- Click the network icon in the top-right corner of the Ubuntu desktop.
- Select Wi-Fi and turn it on if it is disabled.
- Choose your network name from the list of available SSIDs.
- Enter the Wi-Fi password when prompted.
- Click Connect.
- Wait for the network icon to show a connected status.
Ubuntu usually saves the connection profile automatically. The next time you boot, it should reconnect to the same network if it is in range.
You can also manage connections through Settings. Open Settings, go to Network, select Wi-Fi, and click the gear icon next to a network. From there, you can edit security, IP settings, DNS, and proxy options.
Troubleshooting GUI Connection Issues
If the network list is empty, airplane mode may be enabled. Check the quick settings panel and disable airplane mode. You can also verify whether the radio is blocked.
rfkill list
rfkill unblock wifi
If the password is correct but the connection fails, restart NetworkManager.
sudo systemctl restart NetworkManager
If the issue persists, remove the saved connection profile and reconnect.
nmcli connection show
nmcli connection delete "Your-SSID"
nmcli device wifi connect "Your-SSID" password "Your-Password"
Method 2: Connect via Terminal
The terminal method is useful for servers, remote sessions, minimal Ubuntu installations, and troubleshooting. It also gives you precise control over connection profiles.
Using nmcli Commands
First, check whether Wi-Fi is enabled.
nmcli radio wifi
nmcli radio wifi on
Then scan for available networks.
nmcli device wifi list
Connect to a network using its SSID and password.
nmcli device wifi connect "Your-SSID" password "Your-Password"
If the connection succeeds, NetworkManager creates a profile and connects automatically. You can view saved profiles with the following command.
nmcli connection show
To disconnect, use:
nmcli device disconnect wlan0
code>
Replace wlan0 with your actual interface name. To reconnect to a saved profile, use:
nmcli connection up "Your-SSID"
If you need to modify a profile, use nmcli connection modify. For example, you can change the password or set DNS servers.
Using nmtui Text Interface
nmtui provides a text-based menu that is easier than raw commands for some users. Install it if needed, although it is often included with NetworkManager.
sudo apt install network-manager
nmtui
code>
In the menu, choose Activate a connection, select your Wi-Fi network, and enter the password. You can also use Edit a connection to change advanced settings. This method is helpful when you are working in a terminal-only environment but still want a guided interface.
Method 3: Configure Wi-Fi with Netplan
Netplan is common on Ubuntu Server and is also used in some desktop configurations. It uses YAML files, usually located in /etc/netplan/. Before editing, back up the existing configuration.
ls /etc/netplan/
sudo cp /etc/netplan/01-netcfg.yaml /etc/netplan/01-netcfg.yaml.bak
code>
Open the Netplan file with a text editor.
sudo nano /etc/netplan/01-netcfg.yaml
code>
A basic Wi-Fi configuration may look like this:
network:
version: 2
renderer: NetworkManager
wifis:
wlan0:
dhcp4: true
access-points:
"Your-SSID":
password: "Your-Password"
Replace wlan0 with your interface name and use your actual SSID and password. YAML is sensitive to indentation, so use spaces, not tabs. Apply the configuration with:
sudo netplan apply
code>
If there is an error, use:
sudo netplan try
code>
This applies the configuration temporarily and reverts it if you do not confirm. Netplan is powerful, but for most desktop users, NetworkManager is simpler and less error-prone.
Set a Static IP Address for Wi-Fi
Sometimes you need a fixed IP address for port forwarding, remote access, or network services. You can set a static IP through the GUI, nmcli, or Netplan.
Using nmcli, modify an existing connection profile.
nmcli connection modify "Your-SSID" ipv4.addresses 192.168.1.150/24
nmcli connection modify "Your-SSID" ipv4.gateway 192.168.1.1
nmcli connection modify "Your-SSID" ipv4.dns "8.8.8.8,1.1.1.1"
nmcli connection modify "Your-SSID" ipv4.method manual
nmcli connection up "Your-SSID"
Make sure the IP address is outside your router's DHCP range to avoid conflicts. If you prefer automatic IP assignment, keep ipv4.method auto.
In the GUI, open Settings, go to Network, select your Wi-Fi connection, and edit IPv4 settings. Choose Manual, enter the address, netmask, gateway, and DNS, then save and reconnect.
Connect to a Hidden SSID
A hidden network does not broadcast its name. You can still connect if you know the exact SSID and security settings.
Using nmcli:
nmcli device wifi connect "Hidden-SSID" password "Your-Password" hidden yes
code>
Using a saved profile:
nmcli connection add type wifi con-name "Hidden-Profile" ifname wlan0 ssid "Hidden-SSID"
nmcli connection modify "Hidden-Profile" wifi-sec.key-mgmt wpa-psk
nmcli connection modify "Hidden-Profile" wifi-sec.psk "Your-Password"
nmcli connection up "Hidden-Profile"
Hidden SSIDs do not provide strong security by themselves. Anyone scanning packets can still discover the network name. Use strong WPA2 or WPA3 encryption and a long password.
Security: WPA2, WPA3, and VPN
Modern Ubuntu supports WPA2 and, on compatible hardware and drivers, WPA3. WPA3 provides stronger protection against offline password guessing. You can check the connection security in the network details.
For stronger privacy, consider using a VPN. NetworkManager supports OpenVPN, WireGuard, and other VPN types. You can import a VPN profile and connect through the GUI or terminal.
nmcli connection import type wireguard file ~/wg0.conf
nmcli connection up wg0
code>
Always keep your system updated. Security patches often include Wi-Fi driver and firmware improvements.
sudo apt update && sudo apt upgrade
code>
Avoid using WEP or open networks for sensitive work. If you must use a public network, use a VPN and verify website certificates.
Comparison of Ubuntu Wi-Fi Setup Methods
The table below compares the most common methods for setting up Wi-Fi in Ubuntu.
| Method | Best For | Difficulty | Persistent Profiles | Requires Terminal |
|---|---|---|---|---|
| Ubuntu GUI | Desktop users | Easy | Yes | No |
| nmcli | Automation and servers | Moderate | Yes | Yes |
| nmtui | Terminal-only users | Easy to moderate | Yes | Yes |
| Netplan | Advanced server configuration | Advanced | Yes | Yes |
Tips and Best Practices
- Keep Ubuntu and firmware packages updated to improve driver stability.
- Use strong WPA2 or WPA3 passwords and avoid sharing them unnecessarily.
- Save network profiles only on trusted devices.
- Use
nmclifor repeatable setups and automation scripts. - Back up Netplan files before editing them.
- Check
rfkillif Wi-Fi appears disabled at the hardware level. - Use a static IP only when your network requires it.
- Test connectivity with
pingafter connecting.
A simple connectivity test looks like this:
ping -c 4 8.8.8.8
ping -c 4 ubuntu.com
code>
If the first ping works but the second fails, DNS may be the issue. Check your DNS settings in the connection profile.
Frequently Asked Questions
Why does Ubuntu not detect my Wi-Fi adapter?
The adapter may lack a driver or firmware. Run lspci, lsusb, and ubuntu-drivers devices to identify the hardware. Install recommended drivers and reboot.
How do I turn Wi-Fi on from the terminal?
Use nmcli radio wifi on. If the radio is soft-blocked, run rfkill unblock wifi.
Can I connect to Wi-Fi without a GUI?
Yes. Use nmcli, nmtui, or Netplan. These tools work well on Ubuntu Server and minimal installations.
How do I forget a saved Wi-Fi network?
Run nmcli connection delete "Network-Name". You can also remove it from the GUI network settings.
What is the difference between DHCP and static IP?
DHCP assigns an IP address automatically from the router. A static IP is manually configured and remains the same until you change it.
Is WPA3 supported in Ubuntu?
WPA3 support depends on your Wi-Fi adapter, driver, and router. Many modern systems support it, but some older hardware may only support WPA2.
How do I troubleshoot a connection that keeps dropping?
Update drivers, check signal strength, disable power saving if needed, and review logs with journalctl -u NetworkManager. Router firmware updates can also help.
Conclusion
Learning How to Setup Wifi in Ubuntu? becomes straightforward once you understand the tools available. Desktop users can connect quickly through the GUI. Terminal users can rely on nmcli or nmtui. Advanced users and server administrators can use Netplan for precise control. Start by confirming that your adapter is detected, install any required drivers, connect to your network, and test the connection. With the steps and best practices in this guide, you can set up and maintain a reliable Ubuntu Wi-Fi connection in almost any environment.