Raspberry Pi WAP Configuration

Before We Begin

Before we jump into this lab, you’ll need the following items:
  • 1 Raspberry Pi with power supply
  • A monitor with power supply
  • A keyboard
Note: Anything in this
fonts
or
fonts
means that you’ll be typing in the terminal or what you’ll be seeing in the terminal.
The Raspberry Pi OS (Debian Buster) now uses dhcpcd for controlling the network now instead of the interfaces file. These are current functional instructions:
Hook up the monitor, keyboard and power supply to the Raspberry Pi and attach power supply to the monitor. Boot up a Raspberry Pi and go into the terminal. This setup works best in Raspbian Lite with no desktop environment installed.

 

1.) Install packages

sudo apt update
sudo apt upgrade -y
sudo apt intall brige-utils
sudo apt install hostapd
sudo systemctl unmask hostapd
sudo systemctl enable hostapd
Hostapd will allow your pi to act as a WAP, and bridge-utils will bridge your wired connection to your wireless one, allowing Wi-Fi devices onto the network.

 

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-membre-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 is:
a = IEEE 802.11a (5 GHz) (Raspberry Pi 3B+ onwards)
b = IEEE 802.11b (2.4 GHz)
g = IEEE 802.11g (2.4 GHz)

Edit /etc/default/hostapd and change DAEMON_CONF to look like this:
DAEMON_CONF="/etc/hostapd/hostapd.conf"

Now edit hostapd:
sudo nano /etc/hostapd/hostapd.conf

And place these values in that file:
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
You can now connect your Wi-Fi 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.