Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Set Up WiFi on Ubuntu Linux: Step-by-Step

· 5 min read · Home Networking

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Yes, you can set up WiFi on Ubuntu Linux using the graphical settings or the command line. Most modern Ubuntu versions (20.04 and later) use NetworkManager, which makes connecting to a wireless network as simple as clicking the network icon in the top-right corner and selecting your SSID. If you're using a server edition or a minimal install without a desktop, you'll use nmcli or edit a netplan config file. This guide covers both methods, plus troubleshooting for common issues like missing drivers or weak signals.

What You'll Need

  • A computer with a wireless network adapter (built-in or USB).
  • Your WiFi network name (SSID) and password.
  • Administrative (sudo) access to the system.
  • An internet connection via Ethernet (only if you need to install drivers or updates).

Step-by-Step

Method 1: Using the Graphical Interface (Desktop)

  1. Look at the top-right corner of your screen. Click the network icon (usually shown as a set of arcs or a Wi‑Fi symbol). If you don't see it, your desktop environment may have moved it to the top panel or the system tray.
  2. From the dropdown menu, ensure that "Wi‑Fi" is enabled (the toggle should be on). If it's off, click it to turn it on.
  3. Click on your WiFi network's name (SSID) from the list of available networks. If you don't see your network, click "Select Network" or "More Networks" to see the full list.
  4. Enter your WiFi password when prompted. Click "Connect".
  5. Wait a few seconds. The network icon should change to show connected status (usually a filled dot or a checkmark). You can verify by opening a web browser or running ping google.com in a terminal.

Method 2: Using the Command Line (nmcli)

  1. Open a terminal (Ctrl+Alt+T).
  2. Check that NetworkManager is running: systemctl status NetworkManager. If it's not active, start it with sudo systemctl start NetworkManager.
  3. List available WiFi networks: nmcli device wifi list. You'll see a table with SSID, signal strength, and security type.
  4. Connect to a network: nmcli device wifi connect "Your_SSID" password "Your_Password". Replace Your_SSID and Your_Password with your actual credentials.
  5. Verify the connection: nmcli connection show --active. You should see your network listed as active.

Method 3: Using Netplan (Server / Minimal Install)

  1. Find your wireless interface name: ip a or iwconfig. It's usually wlan0 or wlx....
  2. Edit the netplan configuration file: sudo nano /etc/netplan/01-network-manager-all.yaml (or the file in that directory).
  3. Add the following configuration (adjust the interface name and SSID/password):
    network:
      version: 2
      wifis:
        wlan0:
          access-points:
            "Your_SSID":
              password: "Your_Password"
          dhcp4: true
  4. Save the file (Ctrl+O, then Enter) and exit (Ctrl+X).
  5. Apply the configuration: sudo netplan apply.
  6. Check if you have an IP address: ip a show wlan0. If you see an IP, you're connected.

Common Mistakes

  • Typing the SSID or password incorrectly. WiFi names are case-sensitive. Double-check for extra spaces or typos.
  • Using the wrong security type. Most home networks use WPA2 or WPA3. If you're unsure, try "WPA & WPA2 Personal" in the GUI, or let the system auto-detect.
  • Forgetting to enable the wireless adapter. Some laptops have a physical switch or function key (like F12) that turns WiFi on/off. Check that the indicator light is on.
  • Editing netplan with incorrect indentation. YAML is strict. Use spaces, not tabs, and match the indentation exactly.

Tips

  • If you're in a place with many networks, use nmcli device wifi list to see signal strength and choose the strongest one.
  • For a persistent connection, NetworkManager automatically reconnects to known networks after reboot. If you used netplan, it also persists.
  • To forget a saved network in the GUI: go to Settings > Wi‑Fi, click the gear icon next to the network, and select "Forget".
  • If you have a dual-band router, connect to the 5GHz band for faster speeds if your adapter supports it.

Troubleshooting

1. No WiFi adapter detected

Run lspci | grep -i network or lsusb to see if your adapter is recognized. If it's not, you may need to install proprietary drivers. For many Intel and Realtek cards, the drivers are included in the kernel. For others, you may need to connect via Ethernet and run sudo ubuntu-drivers autoinstall or check the manufacturer's website for Linux drivers.

2. WiFi keeps disconnecting

Try disabling power management for the WiFi adapter: sudo iwconfig wlan0 power off. To make it permanent, edit /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf and set wifi.powersave = 2 (or 3 to disable). Then restart NetworkManager: sudo systemctl restart NetworkManager.

3. Can connect but no internet

Check if you have an IP address: ip a. If you have a 169.254.x.x address, DHCP failed. Try sudo dhclient wlan0 (replace with your interface). If that doesn't work, check your router's settings—maybe MAC filtering is blocking you.

4. Hidden network not showing

In the GUI, click "Connect to Hidden Network" and enter the SSID manually. With nmcli: nmcli device wifi connect "SSID" password "password" hidden yes.

5. Wrong password error but password is correct

Sometimes the network security type is misdetected. In the GUI, when prompted, choose "WPA & WPA2 Personal" manually. In nmcli, you can specify: nmcli device wifi connect "SSID" password "pass" wifi-sec.key-mgmt wpa-psk.

Frequently Asked Questions

How do I find my WiFi interface name?

Run iwconfig or ip a. The wireless interface usually starts with w (like wlan0 or wlx...).

Can I connect to WiFi without a password?

If the network is open (no security), you can connect by just selecting it. For security, you should still use a password-protected network.

Why does my WiFi not work after suspend?

This is a common bug. Try sudo systemctl restart NetworkManager after resume, or disable WiFi power saving as described above.

How do I set a static IP for WiFi?

In netplan, add dhcp4: no and specify addresses, gateway4, and nameservers. In NetworkManager GUI, go to the connection's IPv4 settings and change from Automatic to Manual.

Is it safe to use public WiFi?

Public WiFi is not secure. Use a VPN when connecting to untrusted networks. Avoid logging into sensitive accounts without encryption.

What if I don't have sudo access?

You need root privileges to change network settings. Contact your system administrator.