Configuring a wifi access point on ubuntu server with netplan

How to set up a netplan config for a wifi access point on ubuntu server.

#Ubuntu#Linux#Homelab

This is a home-server and homelab thing. I wouldn't run it in production.

Why put an access point on a server?

A few reasons. AP clients get their own IP range over DHCP, so I can write firewall rules that only let those addresses reach certain services. It's also a way back in: when the main router stops working, the server still broadcasts its own network, so I'm not locked out.

And if the server is small enough to carry around, it works on its own. I plugged mine in at a hotel and reached my data over its own wifi, so I didn't have to deal with the hotel network or carry a travel router.

Installing the required package
sudo apt-get install network-manager
Getting the name of a WiFi device
ls /sys/class/ieee80211/phy0/device/net/
Adding a configuration section to the netplan config
  renderer: NetworkManager
  wifis:
    wlx90de80f97ff1: # Replace with your wifi device name
      optional: true
      dhcp4: true
      addresses: [192.168.10.1/24] # DHCP ip range
      access-points:
        "drx3": # Wifi network name
          auth:
            key-management: psk
            password: "testpw" # Use a stronger pw
          mode: ap
          band: 5GHz
          networkmanager:
            passthrough:
              wifi-security.proto: "rsn"
Applying the new AP config
sudo netplan apply

The server now broadcasts its own WiFi and you can connect to it directly.