Ubuntu Server is a powerful platform for deploying server solutions, but its minimalist default configuration doesn't include a graphical interface or automatic drivers for Wi-Fi adapters. Many administrators face a problem: how to connect a server to a wireless network if an Ethernet cable is unavailable, and the documentation only offers general recommendations? This article fills the gap—here you'll find step-by-step instructions taking into account the features of different versions of Ubuntu (22.04 LTS, 24.04 LTS) and types of Wi-Fi adapters.
We will cover not only basic commands like nmcli or iwconfig, but also the nuances of working with proprietary drivers (for example, for adapters Broadcom or Realtek RTL88x2bu), setting up a static IP via netplan, as well as diagnostics of typical errors such as "Device not ready"Particular attention is paid to security — You will learn how to encrypt passwords in configuration files and restrict access to the server via Wi-Fi.
If you've only worked with desktop versions of Ubuntu before, be prepared for the fact that setting up a network on the server edition requires a deep understanding of the terminal. There are no convenient graphical utilities like NetworkManager (although it can be installed later), and all changes are made through console commands or config editing. But don't be alarmed: our instructions are designed for users of all skill levels—from beginners to experienced system administrators who need to quickly deploy a server with limited infrastructure.
1. Checking Wi-Fi adapter compatibility with Ubuntu Server
Before attempting to connect to the network, make sure your Wi-Fi adapter is supported by the system. Server editions of Ubuntu often come without proprietary drivers, which may be required for some chips (e.g., Broadcom BCM43xx or Realtek RTL8188EU). Here's how to check compatibility:
Connect the adapter to the server (via USB or PCIe) and run the command:
lspci -knn | grep -iA3 net
For USB adapters use:
lsusb
Look for lines mentioning this in the output. Network controller or WirelessIf the adapter is detected, but there is a mark next to it Kernel driver in use: None — this means the driver is not loaded. In this case, you will need to install it (more on that in the next section).
Please note device identifiers (VID/PID) - these are useful for searching for drivers. For example, the line ID 0bda:8179 Realtek Semiconductor Corp. points to the chip RTL8188EU, which requires a separate driver.
2. Installing drivers for non-standard adapters
If your adapter isn't recognized or isn't detected without a driver, follow these instructions. Let's look at two common cases:
Case 1: Broadcom Adapters (BCM43xx)
For chips Broadcom a proprietary driver is often required bcmwl-kernel-source. Install it:
sudo apt update
sudo apt install --reinstall bcmwl-kernel-source
After installation, reboot the server or manually load the kernel module:
sudo modprobe wl
Case 2: Realtek adapters (RTL8188EU, RTL88x2bu, etc.)
For these chips, it is often necessary to compile drivers from source code. For example, for RTL8188EU:
sudo apt install git dkmsgit clone https://github.com/aircrack-ng/rtl8188eus.git
cd rtl8188eus
sudo make
sudo make install
sudo modprobe 8188eu
If the adapter still doesn't work after installing the driver, check the kernel logs:
dmesg | grep -i firmware
Often the problem lies in the absence of firmware files (firmware). They can be downloaded from the repository. linux-firmware:
sudo apt install linux-firmware
What to do if the driver does not compile?
If you see "implicit declaration of function" errors when compiling the driver, your kernel version is likely incompatible with the source code. Try:
1. Update the kernel to the latest version (sudo apt install --install-recommends linux-generic-hwe-22.04 for Ubuntu 22.04).
2. Use an alternative repository with drivers (for example, for RTL88x2bu, https://github.com/cilynx/rtl88x2bu is suitable).
3. Install the driver via DKMS for automatic recompilation when updating the kernel.
Important! After installing the drivers, check if the network interface appears:
ip a
Look for interfaces like wlan0, wlp3s0 or wlxIf they are not there, the driver was not installed correctly.
3. Setting up Wi-Fi via netplan (recommended method)
Ubuntu Server uses netplan for managing network connections. This is a modern tool that has replaced the outdated /etc/network/interfacesTo set up Wi-Fi via netplan, follow these steps:
1. Open the configuration file (usually it is located in /etc/netplan/):
sudo nano /etc/netplan/00-installer-config.yaml
2. Add a configuration for Wi-Fi. Example for a network with WPA2-PSK (the most common type of encryption):
network:version: 2
renderer: networkd
wifis:
wlan0:
dhcp4: true
access-points:
"your_ssid":
password: "your_password"
Replace:
- wlan0 to your network interface (find out through ip a).
- your_ssid to the name of your Wi-Fi network.
- your_password to the password.
3. Apply the changes:
sudo netplan apply
If you use static IP, replace the block dhcp4: true on:
addresses: [192.168.1.100/24]routes:
- to: default
via: 192.168.1.1
nameservers:
addresses: [8.8.8.8, 8.8.4.4]
- Make sure the interface name (wlan0) matches the real one
- Check the case of the SSID (it is case sensitive!)
- Remove all tabs in the file (netplan requires spaces)
- Save a backup copy of the original file (cp /etc/netplan/00-installer-config.yaml ~/netplan_backup.yaml)-->
Critical detail: if after the command sudo netplan apply If the connection failed and the server is no longer accessible via SSH, connect to it via the console (monitor and keyboard) and roll back the changes. A common error is incorrect indentation in the YAML file, which causes Netplan to refuse to apply the configuration.
4. Alternative connection methods: nmcli And wpa_supplicant
If netplan for some reason it doesn't fit (for example, you are using NetworkManager), you can use other tools. Let's consider both options.
Method 1: Connecting via nmcli (if NetworkManager is installed)
Make sure that NetworkManager installed:
sudo apt install network-manager
Then turn on Wi-Fi and connect to the network:
sudo nmcli radio wifi on
sudo nmcli dev wifi connect "your_ssid" password "your_password"
Method 2: Manual connection via wpa_supplicant
This method is universal and works even without NetworkManagerFirst, create a configuration file:
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
Add to it:
network={ssid="your_ssid"
psk="your_password"
}
Then connect:
sudo wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
sudo dhclient wlan0
To make the connection automatically at boot, add wpa_supplicant to startup:
sudo systemctl enable wpa_supplicant
5. Diagnosing and troubleshooting connection errors
Even with a properly configured Wi-Fi connection on Ubuntu Server, errors can still occur. Let's look at the most common issues and their solutions:
Error 1: "Device not ready" or interface not activating
Reasons:
- Driver not loaded (check lsmod | grep <driver_name>).
- The adapter is disabled by hardware (for example, by a button on the laptop case).
- Conflict with other network interfaces.
Solution:
sudo ip link set wlan0 up # Replace wlan0 with your interface
sudo rfkill unblock wifi # Unblock Wi-Fi if it's blocked
Error 2: Unable to obtain an IP address (DHCP)
If you don't have internet access after connecting to the network, check:
ip a show wlan0
If the interface does not have an IP address, manually request one from the DHCP server:
sudo dhclient wlan0
Error 3: Slow speed or frequent connection drops
This may be due to:
- Incorrect adapter operating mode (for example, it operates in 802.11b mode instead of 802.11n).
- Interference on the Wi-Fi channel.
- Weak signal.
Check the current mode and signal strength:
iwconfig wlan0
Search for lines Bit Rate (speed) and Signal level (signal level). If the signal is weak (-80 dBm), try moving the server closer to the router or using an amplifier.
sudo systemctl status systemd-networkd (for netplan) or sudo systemctl status NetworkManagerOften the problem is resolved by restarting the service: sudo systemctl restart systemd-networkd.-->
To diagnose interference, use the utility iw:
sudo iw wlan0 scan | grep -i "signal\|ssid"
This will display all available networks and their signal strength. If your network is on a congested channel (for example, channel 6 in the 2.4 GHz band), change the channel on your router through the web interface.
6. Wi-Fi connection security on the server
Connecting a server to Wi-Fi always carries risks, as wireless networks are more vulnerable than wired ones. Follow these recommendations to minimize threats:
1. Password encryption in configuration files
Don't store your Wi-Fi password in plain text. netplan or wpa_supplicant.confGenerate a password hash instead:
wpa_passphrase "your_ssid" "your_password"
This command will output the encrypted version of the password (in the field psk). Copy it into the configuration file instead of the open password.
2. Restricting access by MAC address
Configure MAC address filtering on your router, allowing connections only to your server's MAC address. You can find it here:
ip link show wlan0 | grep ether
3. Using VPN for remote administration
Never open SSH or RDP ports directly to the internet via Wi-Fi. Instead:
- Set up WireGuard or OpenVPN on the server.
- Connect to the server only via VPN.
4. Disable Wi-Fi when idle
If the server does not require a constant network connection, set up automatic Wi-Fi shutdown during non-working hours. For example, through cron:
0 22 * /sbin/ip link set wlan0 down
5. Monitoring suspicious activity
Install fail2ban To block suspicious connections:
sudo apt install fail2ban
And configure it to secure SSH:
sudo systemctl enable fail2ban
7. Optimizing Wi-Fi performance on the server
If the server is used for latency-sensitive tasks (such as a game server or streaming data), configure Wi-Fi for maximum performance.
1. Selecting the correct adapter operating mode
Check the current mode:
iw list | grep -A 10 "Supported interface modes"
If the adapter supports AP mode (access point) but you need a client connection, make sure it is working in mode managed:
sudo iwconfig wlan0 mode managed
2. Setting the transmission power
By default, many adapters operate at reduced power. Check your current power:
iwconfig wlan0 | grep "Tx-Power"
If the value is lower 20 dBm (100 mW), increase the power:
sudo iwconfig wlan0 txpower 20
Please be careful: exceeding the permitted transmit power may violate local laws (for example, in the EU the maximum is 20 dBm for 2.4 GHz).
3. Traffic prioritization (QoS)
If the server is running multiple services (e.g. web server + database), configure traffic priorities via tc (Traffic Control). Example for SSH prioritization:
sudo tc qdisc add dev wlan0 root handle 1: prio
sudo tc filter add dev wlan0 protocol ip parent 1:0 prio 1 u32 match ip dport 22 0xffff flowid 1:1
4. Using the 5 GHz band
If your adapter and router support 5 GHz, switch to this band. It's less crowded and provides faster speeds. To do this:
1. Set up a separate network in the 5 GHz range on your router.
2. Connect to it by specifying the SSID in the configuration file.
5. Disabling energy saving
Some adapters reduce performance to save power. Disable this:
sudo iw dev wlan0 set power_save off
FAQ: Frequently asked questions about setting up Wi-Fi on Ubuntu Server
My Wi-Fi adapter isn't detected by the system. What should I do?
1. Check if the adapter is detected in the system:
lsusb
or
lspci -knn | grep -iA3 net
2. If the adapter is visible but the driver is not loaded, find its identifiers (VID/PID) and look for a driver for your model. For example, for Realtek RTL8188EU a repository will do aircrack-ng/rtl8188eus.
3. If the adapter is not visible at all, check the physical connection (especially for USB adapters) or try a different port.
How to connect to a hidden Wi-Fi network (hidden SSID)?
For netplan add parameter hidden: true in configuration:
access-points:"your_hidden_ssid":
password: "your_password"
hidden: true
For wpa_supplicant add a line scan_ssid=1 in the block network={...}.
Can Ubuntu Server be used as a Wi-Fi hotspot?
Yes, but this will require:
- Install hostapd And dnsmasq:
sudo apt install hostapd dnsmasq - Tune
hostapd.confwith network parameters (SSID, channel, security type). - Tune
dnsmasqfor distributing IP addresses. - Enable traffic forwarding:
sudo sysctl -w net.ipv4.ip_forward=1
For detailed instructions, see the official documentation. hostapd.
How to update Wi-Fi adapter driver?
1. Remove the old driver (if installed):
sudo apt remove --purge <driver_package_name>
2. Update the package list:
sudo apt update
3. Install the new driver version. For proprietary drivers (e.g. Broadcom):
sudo ubuntu-drivers autoinstall
4. Restart the server.
If the driver is installed from source, download the latest version from the official repository and repeat the compilation process.
Why did Wi-Fi stop working after updating the kernel?
This is a typical problem for drivers installed from source (for example, for Realtek). Solutions:
- Recompile the driver for the new kernel:
cd /path/to/sourcessudo make clean
sudo make
sudo make install - Use
DKMSfor automatic recompilation:sudo apt install dkmssudo dkms add -m <module_name> -v <version>
sudo dkms install -m <module_name> -v <version> - Roll back to the previous kernel version (temporary solution).
Setting up Wi-Fi on Ubuntu Server can seem like a daunting task, especially if you're used to the graphical interfaces of desktop distributions. However, by following these instructions, you can connect your server to a wireless network even without console experience. The key is to carefully check each step and not skip error diagnostics. If something goes wrong, you can always roll back to a previous configuration or use a backup connection (such as Ethernet) to restore access.
For a more in-depth study of this topic, we recommend the official documentation:
- man netplan (netplan manual),
- man wpa_supplicant (manual Wi-Fi setup),
- man iwconfig (wireless interface management).
If your adapter isn't supported out of the box, don't despair—the Ubuntu community is actively developing drivers for most popular chips. Visit the forums. Ubuntu Forums or Ask Ubuntu, where you can find solutions for specific adapter models. And remember: safety first — Never connect the server to an unsecured Wi-Fi network without additional security measures (VPN, firewall, etc.).