Jessie wifi access point: Difference between revisions
(Initial creation) |
m (FTP links auto-updated (http://wireless.kernel.org/en/users/Documentation/hostapd → https://wireless.wiki.kernel.org/en/users/documentation/hostapd)) |
||
(6 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
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> | ||
apt-get update && apt-get install hostapd | apt-get update && apt-get install hostapd -y | ||
</source><br> | </source><br> | ||
{{Note|The install process may start an unconfigured hostapd process. This process must be killed before moving | {{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: | |||
< | <source lang=bash> | ||
ssid=YourWiFiName | ssid=YourWiFiName | ||
wpa_passphrase=Somepassphrase | wpa_passphrase=Somepassphrase | ||
Line 24: | Line 29: | ||
wpa_key_mgmt=WPA-PSK | wpa_key_mgmt=WPA-PSK | ||
wpa_pairwise=TKIP CCMP | wpa_pairwise=TKIP CCMP | ||
</ | </source> | ||
{{Note|Refer to the [ | {{Note|Refer to the [https://wireless.wiki.kernel.org/en/users/documentation/hostapd kernel's hostapd documentation] for more wireless configuration options.}} | ||
Line 36: | 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 | 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> | ||
[Unit] | [Unit] | ||
Description=Hostapd IEEE 802.11 AP | Description=Hostapd IEEE 802.11 AP | ||
Line 60: | Line 65: | ||
[Install] | [Install] | ||
WantedBy=multi-user.target | WantedBy=multi-user.target | ||
</ | </source> | ||
Then enable this in systemd: | Then enable this in systemd: | ||
<source lang=bash> | <source lang=bash> | ||
systemctl enable hostapd_user.service | systemctl enable hostapd_user.service | ||
systemctl enable systemd-networkd | |||
</source> | </source> | ||
Line 73: | Line 79: | ||
/etc/systemd/network/br0.netdev | "/etc/systemd/network/br0.netdev" | ||
< | <source lang=bash> | ||
[NetDev] | [NetDev] | ||
Name=br0 | Name=br0 | ||
Kind=bridge | Kind=bridge | ||
</ | </source> | ||
/etc/systemd/network/br0.network | "/etc/systemd/network/br0.network" | ||
< | <source lang=bash> | ||
[Match] | [Match] | ||
Name=br0 | Name=br0 | ||
Line 88: | Line 94: | ||
[Network] | [Network] | ||
DHCP=yes | DHCP=yes | ||
</ | </source> | ||
/etc/systemd/network/bridge.network | "/etc/systemd/network/bridge.network" | ||
< | <source lang=bash> | ||
[Match] | [Match] | ||
Name=eth0 | Name=eth0 | ||
Line 98: | Line 104: | ||
[Network] | [Network] | ||
Bridge=br0 | Bridge=br0 | ||
</ | </source> |
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