Ubuntu Server WiFi Access Point

Install Needed Packages

$ sudo apt install hostapd dnsmasq

Access Point Setup

Create a config file for hostapd at the following location /etc/hostapd/wlp3s0.conf

Insert the following in your config file. Substituting the interface name, ssid, and wpa_passphrase.

interface=wlp3s0
driver=nl80211
ssid=***yourwifinamehere***
hw_mode=g
channel=6
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=3
wpa_passphrase=***yourpasswordhere***
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

Enable and start systemd service for interface

$ sudo systemctl enable [email protected]
$ sudo systemctl start [email protected]

At this point you should have an access point available with the specified name. You can check by scaning for WiFi networks on a device other then the AP machine. You can connect to the access point but an IP address will not be asigned as the DHCP server isn't configured yet.

Assign Static IP to Wireless Interface

Edit netplan file to configure a static address on the wireless interface /etc/netplan/00-installer-config.yaml

network:
  version: 2
  ethernets:
    enp2s0:
      dhcp4: true
    wlp3s0:
      addresses: [192.168.0.1/24]
      nameservers:
        addresses: [192.168.0.1]

Test and apply the netplan configuration, follow prompt to accept changes.

$ sudo netplan try

Restart networing with the new config.

$ sudo systemctl restart systemd-networkd.service

The wireless interface should now have an IP of 192.168.0.1

$ sudo ip addr show wlp3s0
3: wlp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 38:b1:db:8c:1e:b3 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.1/24 brd 192.168.0.255 scope global wlp3s0
        valid_lft forever preferred_lft forever
    inet6 fe80::3ab1:dbff:fe8c:1eb3/64 scope link 
        valid_lft forever preferred_lft forever

The "inet" indicates the address and subnet mask

Prevent systemd from waiting on AP interface

I noticed that once a static address was set for the wireless interface I was experiencing slow boots. After investgating I found that systemd-networkd-wait-online.service was waiting for the wireless interface to connect. Since it's now configured as an access point it was hitting the timeout before moving on. We can instruct the service to ignore the wireless interface.

$ sudo systemctl edit systemd-networkd-wait-online.service

Insert the following lines in the file and save

[Service]
ExecStart=
ExecStart=/lib/systemd/systemd-networkd-wait-online --ignore=wlp3s0

Disable systemd stub resolver to avoid conflict with dnsmasq

edit /etc/systemd/resolved.conf and set the following option

DNSStublistener=no

Restart resolved

sudo systemctl restart systemd-resovled.service

Configure dnsmasq

Edit /etc/dnsmasq.conf ensuring the following options are set

interface=wlp3s0
dhcp-range=192.168.0.50,192.168.0.150,12h
expand-hosts
domain=local.net

Restart dnsmasq

$ sudo systemctl restart dnsmasq.service