Raspberry Pi WAP Configuration
User documentation
07/18/2018
- Last Updated: 08/10/2018
Raspberry Pi WAP Configuration¶
Updated Instructions - thanks to Gary Boyce at Telpage for this recipe:
The Raspberry Pi OS (Debian Buster) now uses dhcpcd for controlling the network now instead of the interfaces file. These are current functional instructions:
1. Install packages:
sudo apt update sudo apt upgrade -y sudo apt install hostapd sudo systemctl unmask hostapd sudo systemctl enable hostapd
2. Create a bridge device and populate the bridge
Add a bridge network device named br0 by creating a file using the following command, with the contents below:
sudo nano /etc/systemd/network/bridge-br0.netdev
File contents:
[NetDev] Name=br0 Kind=bridge
In order to bridge the Ethernet network with the wireless network, first add the built-in Ethernet interface (eth0) as a bridge member by creating the following file:
sudo nano /etc/systemd/network/br0-member-eth0.network
File contents:
[Match] Name=eth0 [Network] Bridge=br0
Now enable the systemd-networkd service to create and populate the bridge when your Raspberry Pi boots:
sudo systemctl enable systemd-networkd
Disable DHCP requests on the eth0 interface and add the bridge to dhcpcd.conf. You can setup a static by adding a static configuration to the bridge
Let get a dynamic address by just adding br0.
sudo nano /etc/dhcpcd.conf
add denyinterfaces eth0 to the beginning of the file:
denyinterfaces eth0 #disables dhcp requests on this interface
add this to the bottom of the file:
interface br0 static ip_address=172.30.60.201/24 static routers=172.30.60.1
or to get a dynamic ip address:
interface br0 # bridge gets dynamic address
3. configure the WAP
To use the 5 GHz band, you can change the operations mode from hw_mode=g to hw_mode=a. Possible values for hw_mode are:
a = IEEE 802.11a (5 GHz) (Raspberry Pi 3B+ onwards) b = IEEE 802.11b (2.4 GHz) g = IEEE 802.11g (2.4 GHz)
sudo nano /etc/hostapd/hostapd.conf
country_code=US interface=wlan0 bridge=br0 ssid=NameOfNetwork #change this to the name you want the WiFi to be called hw_mode=g channel=7 #choose an appropriate channel for your environment macaddr_acl=0 auth_algs=1 ignore_broadcast_ssid=0 wpa=2 wpa_passphrase=AardvarkBadgerHedgehog #choose a WiFi password. At least 8 characters wpa_key_mgmt=WPA-PSK wpa_pairwise=TKIP
4. reboot and test
If you run into problems check if the hostapd is running properly
sudo systemctl status hostapd
and to make sure dhcpcd service is working properly
sudo systemctl status dhcpcd
Old instructions:¶
Boot up a Raspberry Pi and go into the terminal. This setup works best in Raspbian Lite with no desktop environment installed. You can use nano as your editor. First, install a few programs:
root@lab-wap 15:51:59 > ~/server-sync # apt install hostapd bridge-utils
Hostapd will allow your pi to act as a wap, and bridge-utils will bridge your wired connection to your wireless one, allowing wifi devices onto the network.
Next, edit the /etc/network/interfaces file to bridge the connections:
auto eth0 iface eth0 inet manual auto wlan0 iface wlan0 inet manual auto br0 iface br0 inet dhcp bridge_ports eth0 wlan0
Then, edit /etc/default/hostapd and change DAEMON_CONF to look like this:
DAEMON_CONF="/etc/hostapd/hostapd.conf"
Finally, you can edit your actual hostapd configuration at /etc/hostapd/hostapd.conf
ctrl_interface=/var/run/hostapd ############################### # Basic Config ############################### macaddr_acl=0 auth_algs=1 # Most modern wireless drivers in the kernel need driver=nl80211 driver=nl80211 ########################## # Local configuration... ########################## interface=wlan0 bridge=br0 hw_mode=g ieee80211n=1 channel=6 ssid=lab-wap macaddr_acl=0 auth_algs=1 ignore_broadcast_ssid=0 wpa=2 wpa_passphrase=[YOUR_PASSPHRASE_HERE] wpa_key_mgmt=WPA-PSK wpa_pairwise=TKIP rsn_pairwise=CCMP
Make sure to change the wpa_passphrase appropriately. Now, enable hostapd at startup and start everything up:
root@lab-wap 16:01:02 > ~ # systemctl enable hostapd root@lab-wap 16:01:02 > ~ # service networking restart root@lab-wap 16:01:02 > ~ # service hostapd restart
You can now connect your wifi device to the network! Remember, this can be used for much more than just voip systems. You now have a fully functioning WAP that you can connect to one of your networks on PFSense. Look into PFSense plugins. You can do some really cool things with it.
If it isn't working, you can use this command to check if hostapd is running:
ps ax | grep hostapd
If it's running, you can use "kill <pid>" command to kill it and restart the service. If it's not, try restarting the service again or rebooting the pi.