Setup and Configuration

How to Configure Wifi in Ubuntu? Easy Step-by-Step Method Today

Introduction If you have ever wondered How to Configure Wifi in Ubuntu?, you are not alone. Ubuntu is one of the most popular Linux distributions in the world, and while it has come a long way in making wireless networking painless, there are still plenty of s

HowToFixWiFi

Introduction

If you have ever wondered How to Configure Wifi in Ubuntu?, you are not alone. Ubuntu is one of the most popular Linux distributions in the world, and while it has come a long way in making wireless networking painless, there are still plenty of scenarios where you need to configure Wi-Fi manually. Maybe you are setting up a fresh server install with no desktop environment, maybe NetworkManager is acting up, or maybe you simply want to learn how Linux networking works under the hood.

In this comprehensive guide, you will learn every practical method to configure Wi-Fi in Ubuntu. We will cover graphical tools, command-line utilities, configuration files, and troubleshooting techniques. By the end, you will be able to connect to any wireless network, whether you are sitting in front of a desktop or logged in remotely over SSH.

This article is written for beginners and intermediate users alike. We will keep the language friendly and the steps clear, while still going deep enough to give you real confidence. Let us get started.

Table of Contents

Understanding Wi-Fi in Ubuntu

Before diving into the steps, it helps to understand how Ubuntu handles wireless networking. Ubuntu, like most modern Linux distributions, relies on a layered networking stack. At the lowest level, the Linux kernel communicates with your wireless hardware through a driver. On top of that sits a userspace daemon, most commonly NetworkManager, which manages connections, handles authentication, and switches between networks automatically.

For desktop users, NetworkManager provides a friendly graphical applet in the system tray. For server users, the same daemon can be controlled through the nmcli command-line tool. Ubuntu also ships with Netplan, a YAML-based network configuration abstraction that lets you declare your desired network state in a file and apply it with a single command.

Depending on your Ubuntu version and installation type, you may find one or more of these tools available. Ubuntu Desktop editions enable NetworkManager by default, while Ubuntu Server editions may use Netplan with systemd-networkd as the backend. Knowing which tools are present on your system is the first step in answering How to Configure Wifi in Ubuntu? for your specific setup.

It is also worth noting that Wi-Fi drivers vary widely. Most modern Intel, Realtek, and Atheros chipsets work out of the box because their drivers are included in the Linux kernel. However, some Broadcom and MediaTek devices may require proprietary firmware or third-party drivers. We will address driver issues in the troubleshooting section.

Prerequisites Before You Begin

Before configuring Wi-Fi, make sure you have the following ready:

  • A working Ubuntu installation (18.04, 20.04, 22.04, or 24.04 LTS recommended).
  • A Wi-Fi adapter, either built-in or USB. Verify it is detected by running lspci | grep -i network or lsusb.
  • The SSID and password of the wireless network you want to join.
  • Sudo privileges on your account.
  • For server setups, a wired Ethernet connection or console access may be needed initially to install packages.

It is also a good idea to update your system before making network changes. Run the following commands:

sudo apt update
sudo apt upgrade -y

Updating ensures you have the latest NetworkManager, wpa_supplicant, and firmware packages, which often fixes connectivity bugs before you even begin.

Method 1: Configure Wi-Fi Using the NetworkManager GUI

The easiest way to answer How to Configure Wifi in Ubuntu? on a desktop system is through the graphical interface. Ubuntu’s GNOME desktop includes a network applet in the top-right corner of the screen.

Step 1: Open the Network Menu

Click the network icon in the top-right corner of the GNOME panel. You will see a list of available Wi-Fi networks. If Wi-Fi is turned off, click the toggle to enable it.

Step 2: Select Your Network

Click on the SSID you want to join. If the network is secured, a dialog box will appear asking for the password.

Step 3: Enter Credentials

Type the Wi-Fi password and click Connect. NetworkManager will authenticate, obtain an IP address via DHCP, and store the connection profile for future use.

Step 4: Verify the Connection

Once connected, the network icon will change to show signal strength. You can verify connectivity by opening a terminal and running:

ping -c 4 google.com

If you receive replies, your Wi-Fi is configured and working. The GUI method is ideal for most desktop users because it handles everything automatically, including DNS, routing, and reconnection on reboot.

Method 2: Configure Wi-Fi Using nmcli

For users who prefer the terminal or are working on a headless system with NetworkManager installed, nmcli is the most powerful and flexible tool. It is installed by default on Ubuntu Desktop and can be installed on Server editions.

Install NetworkManager if Needed

If nmcli is not available, install it with:

sudo apt install network-manager -y

List Available Wi-Fi Networks

First, check that your wireless interface is recognized:

nmcli device status

You should see a device of type wifi. To scan for networks, run:

nmcli device wifi list

This displays SSIDs, signal strength, security type, and channel.

Connect to a Network

To connect, use the following command, replacing the SSID and password with your own:

sudo nmcli device wifi connect "YourSSID" password "YourPassword"

NetworkManager will create a connection profile and connect immediately. If the SSID is hidden, add the hidden yes option:

sudo nmcli device wifi connect "YourSSID" password "YourPassword" hidden yes

Manage Saved Connections

You can list saved profiles with:

nmcli connection show

To delete a profile:

sudo nmcli connection delete "YourSSID"

To modify a profile, for example to set a static IP:

sudo nmcli connection modify "YourSSID" ipv4.addresses 192.168.1.50/24
sudo nmcli connection modify "YourSSID" ipv4.gateway 192.168.1.1
sudo nmcli connection modify "YourSSID" ipv4.dns "8.8.8.8 8.8.4.4"
sudo nmcli connection modify "YourSSID" ipv4.method manual
sudo nmcli connection up "YourSSID"

nmcli is an excellent answer to How to Configure Wifi in Ubuntu? when you need repeatability, scripting, or remote administration.

Method 3: Configure Wi-Fi Using Netplan

Netplan is Ubuntu’s default network configuration tool on Server editions and is also used on Desktop. It reads YAML files from /etc/netplan/ and applies them using either NetworkManager or systemd-networkd as the renderer.

Locate the Netplan Configuration File

List the files in the netplan directory:

ls /etc/netplan/

You will typically see a file like 01-netcfg.yaml or 50-cloud-init.yaml.

Edit the Configuration

Open the file with a text editor:

sudo nano /etc/netplan/01-netcfg.yaml

Add a Wi-Fi section under the appropriate interface. A typical configuration looks like this:

network:
  version: 2
  renderer: NetworkManager
  wifis:
    wlan0:
      dhcp4: true
      access-points:
        "YourSSID":
          password: "YourPassword"

Replace wlan0 with your actual wireless interface name, which you can find with ip link show.

Apply the Configuration

Test the configuration first without applying permanently:

sudo netplan try

If everything works, press Enter to accept. To apply directly:

sudo netplan apply

Netplan is declarative and version-controllable, making it a great choice for infrastructure automation and reproducible server setups.

Method 4: Configure Wi-Fi Using wpa_supplicant

For minimal systems or advanced users, configuring Wi-Fi directly with wpa_supplicant gives you maximum control. This is the lowest-level method and is useful on systems without NetworkManager or Netplan.

Install wpa_supplicant

sudo apt install wpasupplicant -y

Generate a Configuration File

Use wpa_passphrase to generate a secure config:

wpa_passphrase "YourSSID" "YourPassword" | sudo tee /etc/wpa_supplicant/wpa_supplicant.conf

Run wpa_supplicant

Bring up the interface and start wpa_supplicant:

sudo ip link set wlan0 up
sudo wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf

Obtain an IP Address

Use dhclient to get an IP:

sudo dhclient wlan0

To make this persistent across reboots, you can create a systemd service or add the commands to /etc/rc.local. While more involved, this method is the foundation that higher-level tools build upon.

Comparison of Wi-Fi Configuration Methods

Choosing the right method depends on your environment. The table below summarizes the main options.

Method Best For Pros Cons
NetworkManager GUI Desktop users Easiest, automatic, stores profiles Requires desktop environment
nmcli Power users, remote admins Scriptable, powerful, no GUI needed Learning curve
Netplan Servers, automation Declarative, version-controllable YAML syntax sensitive
wpa_supplicant Minimal/embedded systems Low-level control, no dependencies Manual persistence setup

Troubleshooting Common Wi-Fi Issues

Even with the best instructions, things can go wrong. Here are the most common problems and how to fix them.

Wi-Fi Adapter Not Detected

Run lspci | grep -i network or lsusb. If your adapter appears but has no driver, check dmesg | grep -i wifi for firmware errors. You may need to install firmware packages such as linux-firmware or vendor-specific packages.

Wi-Fi Blocked by rfkill

Sometimes Wi-Fi is soft-blocked. Check with:

rfkill list

Unblock with:

sudo rfkill unblock wifi

Authentication Failures

Double-check the password, including case sensitivity. Some networks use WPA2-Enterprise requiring username and password; in that case, configure 802.1X settings in NetworkManager.

Connected but No Internet

If you have an IP but no internet, check DNS resolution:

cat /etc/resolv.conf
ping 8.8.8.8

If pinging an IP works but domain names fail, configure DNS servers in your connection profile.

Proprietary Driver Issues

Broadcom adapters often need the bcmwl-kernel-source package. Install it with:

sudo apt install bcmwl-kernel-source -y

Then reboot and recheck.

Tips and Best Practices

Following these tips will make your Wi-Fi experience on Ubuntu smoother and more reliable:

  • Keep your system and firmware updated regularly.
  • Use strong WPA2 or WPA3 passwords and avoid open networks.
  • Disable Wi-Fi power saving if you experience intermittent drops: sudo iwconfig wlan0 power off.
  • For servers, prefer wired connections when possible for stability.
  • Back up your Netplan and NetworkManager profiles before major upgrades.
  • Use nmcli scripts for consistent configuration across multiple machines.
  • Monitor signal strength with nmcli device wifi list and reposition your adapter if needed.
  • For hidden SSIDs, remember to mark them as hidden in your configuration.

Advanced Wi-Fi Configurations

Once you are comfortable with the basics, you may want to explore advanced setups.

Static IP Configuration

Static IPs are useful for servers and port forwarding. You can set them via nmcli or Netplan as shown earlier. Always ensure your chosen IP is outside the DHCP range of your router.

Creating a Wi-Fi Hotspot

Ubuntu can share its connection as a hotspot. Using nmcli:

sudo nmcli device wifi hotspot ifname wlan0 ssid "MyHotspot" password "HotspotPass123"

This is handy for sharing a wired connection over Wi-Fi.

VPN Over Wi-Fi

Many users configure Wi-Fi and then layer a VPN on top. NetworkManager supports OpenVPN, WireGuard, and others. Install the plugin and configure via GUI or nmcli.

Roaming and Multiple Networks

NetworkManager automatically connects to the strongest known network. You can prioritize networks by setting connection priorities:

sudo nmcli connection modify "OfficeWiFi" connection.autoconnect-priority 10

Higher numbers mean higher priority.

Frequently Asked Questions

How to Configure Wifi in Ubuntu? Is it hard for beginners?

Not at all. On Ubuntu Desktop, the graphical method takes just a few clicks. Even on servers, nmcli and Netplan make it straightforward once you know the commands.

Can I configure Wi-Fi without an internet connection?

Yes. All the tools needed are either preinstalled or available on the Ubuntu installation media. You can install packages from the ISO if needed.

Why does my Wi-Fi disconnect randomly?

This is often due to power management or driver issues. Disable power saving and ensure firmware is up to date.

What is the difference between NetworkManager and Netplan?

Netplan is a configuration abstraction that can use NetworkManager or systemd-networkd as its backend. NetworkManager is the actual daemon managing connections.

How do I find my wireless interface name?

Run ip link show or nmcli device status. Common names include wlan0, wlp2s0, and wlx followed by a MAC address.

Can I configure Wi-Fi on Ubuntu Server?

Absolutely. Use nmcli, Netplan, or wpa_supplicant. Netplan is the default on Server editions.

Is it safe to store Wi-Fi passwords in config files?

Netplan and NetworkManager store passwords in files readable only by root. Still, restrict file permissions and avoid sharing configuration files publicly.

How do I reset network configuration?

You can remove saved profiles with nmcli or restore default Netplan files from /usr/share/doc/netplan/examples/.

Conclusion

By now, you should have a clear and confident answer to How to Configure Wifi in Ubuntu? Whether you prefer the simplicity of the GNOME GUI, the power of nmcli, the declarative elegance of Netplan, or the low-level control of wpa_supplicant, Ubuntu gives you the flexibility to configure Wi-Fi exactly the way you need.

Start with the method that matches your environment. Desktop users should begin with the GUI, while server and automation users will benefit most from nmcli and Netplan. Keep the troubleshooting tips handy, follow best practices, and do not hesitate to experiment in a safe environment.

Wireless networking on Linux has never been more accessible. With the knowledge from this guide, you can connect, manage, and troubleshoot Wi-Fi on Ubuntu like a pro. Happy networking!