Ubuntu Server has traditionally been used for wired server tasks, but modern realities require flexibility. Wireless networks are becoming an integral part of infrastructure—whether it's a home media server, IoT projects, or temporary deployments without Ethernet access. setting up Wi-Fi on Ubuntu Server It has its nuances: the lack of a graphical interface, the peculiarities of drivers and network managers create barriers for beginners.
Many administrators encounter problems when trying to connect a server to Wi-Fi: the system doesn't detect the adapter, doesn't save settings after a reboot, or requires manual command entry at each startup. In this article, we'll look into these issues. all current connection methods — from a temporary solution with iwconfig to permanent adjustment through netplan, as well as diagnostics of typical errors. We will pay special attention to Ubuntu Server 22.04 LTS and 24.04 LTS, where network management mechanisms have undergone changes.
⚠️ Important: Network interface configuration in Ubuntu Server depends on the distribution version. Older releases (before 17.10) used /etc/network/interfaces, and modern versions have switched to netplanMake sure you're using the latest documentation for your version!
1. Checking Wi-Fi adapter compatibility
Before setting up a connection, make sure your Wi-Fi adapter is supported by the Linux kernel. Many USB adapters are based on chips Realtek (For example, RTL8188EU or RTL8812AU) require the installation of proprietary drivers, while adapters on Intel (AX200, 8265) or Broadcom (BCM43xx) often work "out of the box".
To check the detected adapters, run the command:
lspci -knn | grep -iA3 net
For USB adapters use:
lsusb
If the adapter is not detected, you will need to install a driver. For example, for a popular chip RTL8812AU:
sudo apt updatesudo apt install dkms git
git clone https://github.com/aircrack-ng/rtl8812au.git
cd rtl8812au
sudo make dkms_install
2. Temporary connection via iwconfig And wpa_supplicant
The fastest way to connect to Wi-Fi is to use utilities iwconfig And wpa_supplicant Manually. This method is suitable for one-time tasks, but the settings will be reset after a reboot.
First, find out the name of the wireless interface (usually wlan0, wlp3s0):
ip a
Next, create a configuration file for wpa_supplicant:
sudo nano /etc/wpa_supplicant.conf
Add to it:
network={ssid="Your_Network_Name"
psk="network_password"
}
Now connect to the network:
sudo wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf
sudo dhclient wlan0
Check your connection:
ping -c 4 8.8.8.8
What to do if the team dhclient doesn't give out IP?
If dhclient hangs or does not receive an address, try:
1. Specify the interface explicitly: sudo dhclient -v wlan0
2. Restart the networking service: sudo systemctl restart systemd-networkd
3. Check if your firewall is blocking DHCP (for example, ufw)
4. Manually assign IP: sudo ip addr add 192.168.1.100/24 dev wlan0
3. Continuous tuning through netplan (Ubuntu 18.04+)
Modern versions of Ubuntu Server use netplan for network management. This method ensures that settings are preserved after a reboot.
Open the configuration file netplan (usually located in /etc/netplan/01-netcfg.yaml or /etc/netplan/50-cloud-init.yaml):
sudo nano /etc/netplan/01-netcfg.yaml
Example configuration for Wi-Fi:
network:version: 2
renderer: networkd
wifis:
wlan0:
dhcp4: true
access-points:
"Network_name":
password: "network_password"
Apply settings:
sudo netplan apply
⚠️ Attention: If after application netplan the connection is lost, check:
- 🔹 Correct indentation in the YAML file (use spaces, not tabs)
- 🔹 Package availability
wpasupplicant(sudo apt install wpasupplicant) - 🔹 Compatibility
renderer(for some systems you need to specifyrenderer: NetworkManager)
The interface name (wlan0) matches the real one|YAML indents are made with spaces (2 or 4)|SSID and password are specified without quotes (if there are no special characters)|File saved with the extension .yaml (not .txt)-->
4. Setting up a static IP address for Wi-Fi
If your network requires a static IP, modify the configuration netplan:
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:
"Network_name":
password: "network_password"
After application (sudo netplan apply) check the routing:
ip route
Critical detail: If you specify a static IP address within your router's DHCP range (e.g., 192.168.1.2–192.168.1.100), an address conflict may occur. Always reserve a static IP address in your router settings or use addresses outside the DHCP pool.
5. Diagnosing connection problems
If Wi-Fi is not working, follow this diagnostic algorithm:
- Hardware detection check:
iwconfigYour adapter should show up. If not, there's a driver issue. - Network scan:
sudo iwlist wlan0 scan | grep ESSID— checks the visibility of your network. - Logs
wpa_supplicant:journalctl -u wpa_supplicant -f— will show authentication errors. - DHCP Test:
sudo dhclient -v wlan0— If the IP is not assigned, the problem is in the router or firewall.
Typical errors and solutions:
| Error | Possible cause | Solution |
|---|---|---|
Device not found V iwconfig |
The driver is not loaded or the adapter is faulty | Install the driver (see section 1) or test the adapter on another device |
Authentication failed |
Incorrect password or encryption type | Check the password case and security type (WPA2/WPA3) in your router |
| IP address is not issued | DHCP is disabled on the router or blocked by a firewall. | Set up a static IP or check your router settings |
| The connection is broken after a few minutes. | Adapter power saving or weak signal | Disable power saving: iwconfig wlan0 power off |
6. Alternative connection methods
If standard methods don't work, consider alternatives:
- 🔄 Bridge mode: Connect the server to the router via Ethernet, and then distribute Wi-Fi from the router. Set up a bridge between the router and the server.
eth0Andwlan0. - 🔌 USB tethering: Use your smartphone as a modem via USB (setup via
usb0interface). - 📡 4G/5G modem: USB modems (for example, Huawei E3372) are often defined as network interfaces and configured via
netplan. - 🔗 VPN over Ethernet: If you only need Wi-Fi to access local resources, set up a VPN server on your router and connect via a wired connection.
Configuration example for USB modems netplan:
network:version: 2
renderer: networkd
modems:
usb0:
dhcp4: true
apn: internet.beeline.ru # Replace with your operator's APN
7. Wi-Fi connection security on the server
Ubuntu Server with Wi-Fi requires special attention to security:
- 🔐 Disable WPS: A vulnerable protocol that can be hacked in hours. Disable it in your router settings.
- 🛡️ Use WPA3: If your router supports it, select
WPA3-SAEinstead ofWPA2-PSK. - 🔄 Update your router firmware regularly: Vulnerabilities in routers (for example, CVE-2023-1389 For TP-Link) allow traffic to be intercepted.
- 🚫 Block MAC addresses: In your router settings, allow connections only for your server's MAC address.
⚠️ Attention: If your server is accessible from the internet (e.g., via port forwarding), never use Wi-Fi for remote administration. Attackers can intercept traffic even with WPA3. Always use SSH. wired connection or VPN.
8. Automate connection at boot
To ensure Wi-Fi connects automatically when the system starts, make sure that:
- File
netplancorrectly configured (see section 3). - Service
systemd-networkdactive:sudo systemctl enable systemd-networkd. - If you use
NetworkManager, turn it on:sudo systemctl enable NetworkManager.
To debug auto-connection, check the logs:
journalctl -u systemd-networkd -b
If the connection is not established automatically, add a delay in netplan (relevant for slow USB adapters):
network:version: 2
renderer: networkd
wifis:
wlan0:
dhcp4: true
access-points:
"Network_name":
password: "network_password"
# Add a delay before connecting
configure-without-carrier: true
How do I check if the adapter is ready to connect?
Use the command dmesg | grep -i firmwareIf you see messages like this firmware: failed to load, which means the kernel can't load the firmware for the adapter. Solution:
1. Install the package linux-firmware: sudo apt install linux-firmware
2. For some adapters (eg. Broadcom BCM43xx) an additional package will be required: sudo apt install firmware-b43-installer
3. Restart the server.
FAQ: Frequently asked questions about connecting Ubuntu Server to Wi-Fi
My Wi-Fi adapter isn't detected. What should I do?
1. Check the output lsusb or lspci — is the adapter visible as a device?
2. If the adapter is visible, but iwconfig If it doesn't show, install the driver (see section 1).
3. For USB adapters, try a different port (some USB 3.0 ports are not compatible with older adapters).
4. Check if the adapter is disabled in BIOS/UEFI (relevant for built-in adapters).
How to connect to a hidden Wi-Fi network?
In the configuration netplan add parameter hidden: true:
access-points:"Hidden_Network_Name":
password: "password"
hidden: true
For manual connection via wpa_supplicant use:
sudo wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf -D nl80211,wext
Is it possible to use Wi-Fi and Ethernet at the same time?
Yes, but you will need to configure route metrics to avoid conflicts. Example for netplan:
network:version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: true
routes:
- to: 0.0.0.0/0
via: 192.168.1.1
metric: 100
wifis:
wlan0:
dhcp4: true
routes:
- to: 0.0.0.0/0
via: 192.168.1.1
metric: 200
Here traffic will go via Ethernet by default (metric: 100), and Wi-Fi will be a backup channel.
How to update Wi-Fi adapter driver?
1. Remove the old driver (if installed manually):
sudo dkms remove module/version --all
sudo rm -rf /usr/src/module-version
2. Download the latest version of the driver from the official repository (for example, for RTL88x2BU: git clone https://github.com/cilynx/rtl88x2bu.git).
3. Install dependencies and build the module:
sudo apt install dkms git build-essentialcd rtl88x2bu
make
sudo make install
sudo modprobe 88x2bu
Why is the Wi-Fi speed on the server slower than on other devices?
Possible causes and solutions:
- 📶 Weak signal: Check your signal level (
iwconfig wlan0 | grep Signal). If below-70 dBm, move the server closer to the router. - 🔧 Adapter Limitations: USB adapters often operate in the mode
802.11n(max 150 Mbps). For speeds >300 Mbps, you need an adapter that supports it.802.11ac. - ⚙️ Router settings: Set a fixed channel (e.g. 48 for 5 GHz) instead
auto. - 🛑 CPU Limit: WPA3 encryption requires resources. Check your CPU usage (
htop) during data transfer.