Jessie wifi access point

From embeddedTS Manuals
Revision as of 14:54, 12 December 2017 by Kris (talk | contribs) (Removed haveged blurb. Will add to products that need it manually.)

First, hostapd needs to be installed in order to manage the access point on the device.

apt-get update && apt-get install hostapd -y


Note: The install process may start an unconfigured hostapd process. This process must be killed before moving foward.


Edit /etc/hostapd/hostapd.conf to have the following lines:

ssid=YourWiFiName
wpa_passphrase=Somepassphrase
interface=wlan0
bridge=br0
auth_algs=3
channel=7
driver=nl80211
hw_mode=g
logger_stdout=-1
logger_stdout_level=2
max_num_sta=5
rsn_pairwise=CCMP
wpa=2
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
Note: Refer to the kernel's hostapd documentation for more wireless configuration options.


The access point can be started and tested by hand:

hostapd /etc/hostapd/hostapd.conf


Systemd auto-start with bridge to eth0

It is possible to configure the auto-start of hostapd through systemd. The configuration outlined below will set up a bridge with eth0, meaning the WiFi connection is directly connected to the ethernet network. The ethernet network is required to have a DHCP server present and active on it to assign WiFi clients a DHCP address. This setup will allow WiFi clients access to the same network as the ethernet port, and the bridge interface will allow the Device itself to access the network.


Set up hostapd

First, create the file /etc/systemd/system/hostapd_user.service with the following contents:

[Unit]
Description=Hostapd IEEE 802.11 AP
Wants=network.target
Before=network.target
Before=network.service
After=sys-subsystem-net-devices-wlan0.device
After=sys-subsystem-net-devices-br0.device
BindsTo=sys-subsystem-net-devices-wlan0.device
BindsTo=sys-subsystem-net-devices-br0.device

[Service]
Type=forking
PIDFile=/run/hostapd.pid
ExecStart=/usr/sbin/hostapd /etc/hostapd/hostapd.conf -P /run/hostapd.pid -B

[Install]
WantedBy=multi-user.target

Then enable this in systemd:

systemctl enable hostapd_user.service


Set up bridging

Create the following files with the listed contents.


/etc/systemd/network/br0.netdev

[NetDev]
Name=br0
Kind=bridge


/etc/systemd/network/br0.network

[Match]
Name=br0

[Network]
DHCP=yes


/etc/systemd/network/bridge.network

[Match]
Name=eth0

[Network]
Bridge=br0