Setting up a wireless connection on Ubuntu Server — a challenge many administrators face when deploying servers in environments where cabling is impossible or impractical. Unlike the desktop version, the server edition Ubuntu By default, it doesn't include a graphical interface, requiring manual network configuration via the terminal. This article will help you figure out how to connect. Wi-Fi on Ubuntu Server from scratch, avoiding typical mistakes and ensuring a stable connection.
We will look at two main methods: temporary connection via nmcli (for testing) and constant tuning through netplan — a modern network configuration tool in UbuntuWe will pay special attention to diagnosing problems, since the lack of internet access on the server can block the installation of packages or updates. If you are using Ubuntu Server 22.04 LTS or 24.04 LTS, the instructions will work without changes; adjustments may be required for other versions.
1. Preparation: Checking the compatibility of the Wi-Fi adapter
Before attempting to connect to the network, make sure your Wi-Fi adapter is supported Linux kernel. Many built-in and USB adapters (for example, TP-Link TL-WN725N or Intel AX200) work "out of the box", but some budget models have chips Realtek RTL8188EU or RTL8812AU may require installation of drivers.
To check if the adapter is present, run the command:
lspci -knn | grep -iA3 net
For USB adapters use:
lsusb
- 🔍 Search for lines with mention
Network controlleror chipset name (for example,Qualcomm Atheros,Broadcom BCM43xx). - ⚠️ Lack of device in the list means that the adapter is not detected by the system - drivers will need to be installed.
- 📡 Popular adapters with open drivers: Intel Wireless-AC 9260, Atheros AR9485, Ralink RT5370.
⚠️ Attention: If your adapter uses proprietary drivers (for example, some models Broadcom), they will have to be installed manually through apt install firmware-b43-installer or similar packages. This can be a problem without an internet connection—download the drivers in advance on another machine.
2. Installing the required packages
By default Ubuntu Server Comes with a minimal set of network utilities. To use Wi-Fi, you'll need to install:
- 🔧
wireless-tools— basic utilities for managing wireless networks. - 📶
wpasupplicant— a daemon for authentication in encrypted networks (WPA/WPA2). - 🛠️
net-tools- classic utilities likeifconfig(optional, as modern distributions useip).
Run the command:
sudo apt update && sudo apt install -y wireless-tools wpasupplicant
If you already have an Ethernet connection, the packages will install without any problems. Otherwise, download them on another machine and transfer them to the server via USB using dpkg -i.
☑️ Preparing to set up Wi-Fi
3. Method 1: Temporary connection via nmcli (for testing)
nmcli (NetworkManager Command Line Interface) is a convenient tool for quickly connecting to Wi-Fi without editing configuration files. It's useful for testing, but not suitable for permanent server configuration.
First check if it is running NetworkManager:
sudo systemctl status NetworkManager
If the service is disabled, enable it:
sudo systemctl enable --now NetworkManager
Next, follow these steps:
- Get a list of available networks:
nmcli device wifi listLook for yours
SSIDin the conclusion. - Connect to the network (replace
SSIDAndpassword):nmcli device wifi connect "your_SSID" password "your_password" - Check your connection status:
nmcli connection show
⚠️ Attention: Connection via nmcli This method is only suitable for one-time tasks, such as installing updates or additional packages before a permanent setup.
4. Method 2: Permanent configuration via netplan (recommended)
Netplan — a modern network configuration tool in Ubuntu, using YAML files. This method ensures that settings will persist after a reboot and are applied automatically.
Open the configuration file netplan (usually it is located in /etc/netplan/):
sudo nano /etc/netplan/01-netcfg.yaml
Add a configuration for Wi-Fi (example for a network with WPA2-PSK):
network:version: 2
renderer: networkd
wifis:
wlan0: # replace with your interface (you can find out via ip a)
dhcp4: true
access-points:
"your_SSID":
password: "your_password"
Save the file (Ctrl+O, then Ctrl+X) and apply the settings:
sudo netplan apply
| Parameter | Description | Example of meaning |
|---|---|---|
renderer |
Backend for network management | networkd or NetworkManager |
wlan0 |
Network interface name | wlp3s0 (find out through ip a) |
dhcp4 |
Enabling DHCP for IPv4 | true or false (for static IP) |
access-points |
List of access points | "my_wifi": { password: "12345678" } |
If the connection does not appear after applying the settings, check the logs via journalctl -xe — there may be YAML syntax errors or driver issues.
5. Setting up a static IP address (optional)
By default netplan uses DHCP to obtain an IP address. If you need static IP, modify the configuration:
network:version: 2
renderer: networkd
wifis:
wlan0:
dhcp4: no
addresses: [192.168.1.100/24]
gateway4: 192.168.1.1
nameservers:
addresses: [8.8.8.8, 1.1.1.1]
access-points:
"your_SSID":
password: "your_password"
Replace 192.168.1.100/24 to the desired IP (make sure it does not conflict with other devices on the network), and 192.168.1.1 — to the address of your router.
- 🌐 DNS servers: Can be used
8.8.8.8(Google) or1.1.1.1(Cloudflare). - 🔒 Subnet mask:
/24equivalent255.255.255.0. - ⚡ Application: Don't forget to complete
sudo netplan applyafter the changes.
How to check for IP address conflicts?
Run the command ping 192.168.1.100 (replace with your IP) from another device on the network. If you receive responses, the address is already taken. In this case, select another IP from a free range (e.g., 192.168.1.101).
6. Troubleshooting and Common Errors
If Wi-Fi doesn't connect, follow this checklist:
- Check the interface name: Make sure that in
netplanthe correct interface is specified (egwlan0,wlp3s0). You can find out through:ip a | grep wlan - Make sure the adapter is not blocked.:
rfkill listIf the output contains
Soft blocked: yes, unlock with the command:rfkill unblock wifi - Check the error log:
journalctl -u systemd-networkdLook for lines with
failedorerror. - Test the connection manually:
sudo wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf(pre-create
wpa_supplicant.confwith network settings).
Typical errors and solutions:
| Error | Possible cause | Solution |
|---|---|---|
Device not found |
Invalid interface name | Check it out ip a and correct in netplan |
Authentication failed |
Incorrect password or encryption type | Make sure that in netplan the correct one is indicated SSID And password |
Connection activated but no IP |
Problems with DHCP or static IP | Check your router settings or enter a static IP manually. |
⚠️ Attention: If you use Ubuntu Server 24.04, please note that the syntax may change in the new versionnetplanfor some parameters (for example,access-pointsmay require explicit specification of the security type). Always check the official documentation at the linkman netplan.
7. Security: How to secure your server's Wi-Fi connection
Connecting a server to Wi-Fi introduces additional security risks. Follow these recommendations:
- 🔐 Use WPA3, if your router supports this protocol. In
netplanplease specify:security:key-management: sae # for WPA3 - 🚫 Disable WPS on the router - this protocol is vulnerable to brute-force attacks.
- 🔄 Update your router firmware regularly and packages on the server (
sudo apt update && sudo apt upgrade). - 🛡️ Set up your firewall (
ufw) to restrict access to the server:sudo ufw allow from 192.168.1.0/24 to any port 22 # allow SSH only from the local network
If the server is used for mission-critical tasks (such as website hosting), consider:
- 🔌 Connections via Ethernet (even if you have to pull a cable).
- 📡 Usage VPN for remote control instead of direct access via Wi-Fi.
8. Alternative connection methods
If the standard methods don't work, try these options:
- 🐧 WPA_Supplicant manually:
Create a file
/etc/wpa_supplicant.conf:network={ssid="your_SSID"
psk="your_password"
}Then connect:
sudo wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.confsudo dhclient wlan0 - 🔌 USB tetring from phone:
If Wi-Fi doesn't work, you can temporarily share the Internet from your smartphone via USB and set up the network via
nmcliornetplan. - 🔄 Bridge mode:
If the server has an Ethernet port, connect it to the router and set up a bridge with Wi-Fi via
netplan(advanced method).
For complex scenarios (such as connecting to a hidden network or using Enterprise authentication), editing may be required. wpa_supplicant.conf with additional parameters such as scan_ssid=1 or eap=PEAP.
FAQ: Frequently asked questions about connecting Ubuntu Server to Wi-Fi
My Wi-Fi adapter isn't detected. What should I do?
Your adapter likely requires proprietary drivers. Find out your chipset model via lspci -knn | grep -iA3 net and find instructions for installing drivers. For example, for Broadcom may help:
sudo apt install firmware-b43-installer
If the drivers are not in the repositories, download them from the manufacturer's website and compile them manually.
How to connect to Wi-Fi without a password (open network)?
IN netplan just don't specify the parameter password:
access-points:
"open_network": {}
But remember that open networks are not secure—traffic can be intercepted.
Can Ubuntu Server be used as a Wi-Fi hotspot?
Yes, but it requires additional configuration. hostapd And dnsmasq. Main steps:
- Install packages:
sudo apt install hostapd dnsmasq. - Set up
hostapd.confwith network parameters (SSID, channel, security type). - Set up
dnsmasqfor distributing IP addresses. - Enable traffic forwarding:
sudo sysctl -w net.ipv4.ip_forward=1.
This is a topic for a separate article, as the process is more complicated than a regular connection.
Why doesn't Wi-Fi connect automatically after a reboot?
Possible reasons:
- Syntax error
netplan(check your YAML indentation!). - Service
systemd-networkdnot running (sudo systemctl enable --now systemd-networkd). - The adapter is blocked (
rfkill list).
Check the logs: journalctl -u systemd-networkd -b (flag -b shows logs of the current download).
How to check the Wi-Fi connection speed on a server?
Install the utility speedtest-cli:
sudo apt install speedtest-cli
speedtest-cli
To monitor signal quality, use:
iwconfig wlan0 | grep -i signal
Weak signal (below -70 dBm) may cause connection interruptions - move the server closer to the router or use an amplifier.