Jessie wifi access point: Difference between revisions

From embeddedTS Manuals
(Removed haveged blurb. Will add to products that need it manually.)
m (FTP links auto-updated (http://wireless.kernel.org/en/users/Documentation/hostapd →‎ https://wireless.wiki.kernel.org/en/users/documentation/hostapd))
 
(4 intermediate revisions by one other user not shown)
Line 1: Line 1:
First, hostapd needs to be installed in order to manage the access point on the device.
This section will discuss setting up the WiFi device as an access point that is bridged to an ethernet port. That is, clients can connect to the AP and will be connected to the ethernet network through this network bridge. The ethernet network must provide a DHCP server; this will be passed through the bridge to WiFi client devices as they connect.
 
It is also possible to run a DHCP client on the platform itself. In this case the <source inline>hostapd.conf</source> file needs to be set up without bridging and a DHCP server needs to be configured. Refer to [https://wiki.debian.org/DHCP_Server Debian's documentation for more details on DHCP server configuration].
 
The 'hostapd' utility is used to manage the access point of the device. This is usually installed by default, but can be installed with:


<source lang=bash>
<source lang=bash>
Line 5: Line 9:
</source><br>
</source><br>


{{Note|The install process may start an unconfigured hostapd process.  This process must be killed before moving foward.}}
{{Note|The install process may start an unconfigured 'hostapd' process.  This process must be killed before moving forward.}}




Edit /etc/hostapd/hostapd.conf to have the following lines:
Modify the file "/etc/hostapd/hostapd.conf" to have the following lines:
<source lang=bash>
<source lang=bash>
ssid=YourWiFiName
ssid=YourWiFiName
Line 26: Line 30:
wpa_pairwise=TKIP CCMP
wpa_pairwise=TKIP CCMP
</source>
</source>
{{Note|Refer to the [http://wireless.kernel.org/en/users/Documentation/hostapd kernel's hostapd documentation] for more wireless configuration options.}}
{{Note|Refer to the [https://wireless.wiki.kernel.org/en/users/documentation/hostapd kernel's hostapd documentation] for more wireless configuration options.}}




Line 37: Line 41:
'''Systemd auto-start with bridge to eth0'''
'''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.
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 Wi-Fi 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 Wi-Fi clients an IP address.  This setup will allow Wi-Fi clients access to the same network as the ethernet port, and the bridge interface will allow the platform itself to access the network.




'''Set up hostapd'''
'''Set up hostapd'''


First, create the file /etc/systemd/system/hostapd_user.service with the following contents:
First, create the file "/etc/systemd/system/hostapd_user.service" with the following contents:
<source lang=bash>
<source lang=bash>
[Unit]
[Unit]
Line 66: Line 70:
<source lang=bash>
<source lang=bash>
systemctl enable hostapd_user.service
systemctl enable hostapd_user.service
systemctl enable systemd-networkd
</source>
</source>


Line 74: Line 79:




/etc/systemd/network/br0.netdev
"/etc/systemd/network/br0.netdev"
<source lang=bash>
<source lang=bash>
[NetDev]
[NetDev]
Line 82: Line 87:




/etc/systemd/network/br0.network
"/etc/systemd/network/br0.network"
<source lang=bash>
<source lang=bash>
[Match]
[Match]
Line 92: Line 97:




/etc/systemd/network/bridge.network
"/etc/systemd/network/bridge.network"
<source lang=bash>
<source lang=bash>
[Match]
[Match]

Latest revision as of 01:21, 18 January 2021

This section will discuss setting up the WiFi device as an access point that is bridged to an ethernet port. That is, clients can connect to the AP and will be connected to the ethernet network through this network bridge. The ethernet network must provide a DHCP server; this will be passed through the bridge to WiFi client devices as they connect.

It is also possible to run a DHCP client on the platform itself. In this case the hostapd.conf file needs to be set up without bridging and a DHCP server needs to be configured. Refer to Debian's documentation for more details on DHCP server configuration.

The 'hostapd' utility is used to manage the access point of the device. This is usually installed by default, but can be installed with:

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 forward.


Modify the file "/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 Wi-Fi 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 Wi-Fi clients an IP address. This setup will allow Wi-Fi clients access to the same network as the ethernet port, and the bridge interface will allow the platform 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
systemctl enable systemd-networkd


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