Install A Network Device Driver
The first step is to check whether Ubuntu even recognises your wireless network card.
All of my Ubuntu servers are old Macs, mostly repurposed Mac minis. Whilst they make great servers, Ubuntu doesn’t tend to recognise the installed AirPort Extreme (Broadcom) wireless network cards.
Installing a driver is relatively simple, as described here at the Ubuntu help pages. It’s probably best to follow the process outlined there, but usually I find that building the proprietary STA drivers from source is the correct course of action.
sudo apt-get update
sudo apt-get --reinstall install bcmwl-kernel-source
If all goes well, when you reboot you’ll see the wireless device appear in
ip addr
Install WPA Supplicant
This is the step that most of the online tutorials miss out, which is curious as almost everyone is running WPA wireless networks of some sort.
By default, Ubuntu won’t connect to a WPA network access point, so you’ll need to install the WPA supplicant thus:
sudo apt install wpasupplicant
Configure Your WiFi Connection
This is actually quite simple once you get the hang of it. First, you’ll need to find the name of your WiFi device, which is listed when you run
ip addr
The output of this command on one of my servers includes the line
3: wlan0: mtu 1500 qdisc mq state UP group default qlen 1000
which indicates that the WiFi network card is called wlan0.
You now need to edit the Netplan configuration on your server, which can be found in a YAML file in /etc/netplan. It might be called config.yaml, or on more recent fresh installs (22.04) 00-installer-config.yaml.
Edit this file so that it has a wifis section for your wireless network, something like this:
network:
ethernets:
ens5:
optional: true
dhcp4: true
version: 2
wifis:
wlan0:
optional: true
access-points:
"Your wireless network name here":
password: "Your WPA password here"
dhcp4: true
Note that indentation is important here. Use two spaces for each level of indentation.
You may also need to add optional: true to the ethernets section as above if you’re intending to remove the ethernet cable once wifi is enabled.
Once you’ve saved the file, simply apply the changes thus:
sudo netplan --debug apply
I always add the debug switch here so that I can see whether the changes have been applied successfully.
Check That It’s Worked!
When you run
ip addr
now you should see your wireless network card has been allocated an IP address.