Raspberry PI as WiFi Access point

One of the useful thing we can do with our "Raspberries if to use them as WiFi access points. This will allow us to have signal in some places where our connection does not reach properly.

Fortunately, if we have a Raspberry Pi 3 or later and an Ethernet cable in the zone we want to provide signal to, we can configure it as an access point with the hostap software following these simple instructions (ensure you are following them using a Ethernet connection or the Raspi console or you will lose connectivity).

Install hostapd

First of all we need to install hostapd package. If our Raspberry PI OS is updated, we can just do it as follows:

sudo apt-get install hostapd

And enable the service to start with the system:

sudo systemctl unmask hostapd
sudo systemctl enable hostapd

Create bridge device between ethernet and WiFi

We need to create a network device that will allow network packets to flow between WiFi and Ethernet.

sudo vi /etc/systemd/network/bridge-br0.netdev

And insert inside:

[NetDev]
Name=br0
Kind=bridge

Now, we can add the members to the bridge:

sudo vi /etc/systemd/network/br0-member-eth0.network

And insert:

[Match]
Name=eth0

[Network]
Bridge=br0

Disable dhcp client for eth0

sudo vi /etc/dhcpcd.conf

At the end, add the following line:

denyinterfaces eth0 wlan0

Config br0 interface

sudo vi /etc/network/interfaces.d/br0

And insert:

auto br0
 
# Bridge setup
iface br0 inet dhcp
    bridge_ports eth0

Enable the networkd service

sudo systemctl enable systemd-networkd

Configure the access point

sudo vi /etc/hostapd/hostapd.conf

And in the content, change at least the values for the SSID name and passphrase

interface=wlan0
bridge=br0
driver=nl80211
ssid=MonkeyIsland3
auth_algs=1
wpa=2
wpa_passphrase=torpeo123
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

country_code=ES
macaddr_acl=0
ignore_broadcast_ssid=0

# N
hw_mode=g
ieee80211n=1
wmm_enabled=1
require_ht=1
channel=8
ht_capab=[SHORT-GI-20][HT40][DSSS_CCK-40]

Secure the file:

sudo chown root:root /etc/hostapd/hostapd.conf
sudo chmod 600 /etc/hostapd/hostapd.conf

Start the network for the bridge to be created and restart network

sudo systemctl start systemd-networkd && sudo systemctl restart networking

Final restart
Your Wifi Access Point is working in bridge mode, however, a last shutdown is advisable to ensure that the software is started automatically when the system start.

sudo shutdown -r now

Ensure that after restarting you can see the SSID in your nearby WiFis

Performance
I would like to share one last word in this article regarding the performance. Please, have always in mind the limitations that both the Ethernet interface and/or WiFi interface of our beloved Raspberri has depending on the model (Ethernet port in older models is limited by its link speed and interface to the main SoC, WiFi is limited by kind of standard supported, g,n,a, etc...) and so, this is a good use for older models (or newer if you want) but if you need high performance, you could need either to tweak the hostapd.conf parameters or even buy a dedicated HW for this.