Tags: Raspberry Pi »»»» RaspAP
Raspberry Pi OS (Linux) can be configured to support high end WiFi router configurations. No software like OpenWRT or RaspAP is required, if you have the patience to configure it all yourself using the command-line tools.
We recently went over using OpenWRT and RaspAP to build a WiFi router from a Raspberry Pi. Either of those software packages make it easy to configure router settings. It is possible to build most WiFi router configurations with a few clicks of the mouse. But, those packages are built on top of capabilities inherent to Linux, meaning we could do everything with the existing tools and not require addon software.
If you wish to learn the commands, you can custom build a router that exactly suits your needs. Both OpenWRT and RaspAP are limited in that you can only implement what the authors of each package believed you need. Using the command-line tools you can build any configuration you like.
For earlier articles:
- Installing OpenWRT on Raspberry Pi 4 using USB boot device
- A portable WiFI router/NAS/Docker using RaspAP on Raspberry Pi 4 with USB/SSD boot device
Below is a video that goes over the Linux/Raspberry Pi OS commands required to setup a WiFi router on Raspberry Pi that has NAS capabilities. Our earlier article did this using RaspAP.
This is a summary of the commands:
- Turn off
rfkill
to allow turning on the WiFi system - Install
hostapd
-- Allows WiFi antenna to host an access point - Install
dnsmasq
-- Allows services like DNS and DHCP to be installed - Run:
sudo DEBIAN_FRONTEND=noninteractive apt install -y netfilter-persistent iptables-persistent
-- Sets upnetfilter
andiptables
so their settings persist across reboots - Run:
sudo systemclt unmask hostapd.service
- Run:
sudo systemclt enable hostapd.service
-- Enable the WiFi access point service - Edit
/etc/dhcpcd.conf
-- to set up DHCP service for the subnet we want to support from this router. See the discussion and settings in the video. - Edit
/etc/sysctl.d/routed-ap.conf
and enternet.ipv4.ip_forward=1
to configure forwarding of IPv4 addresses. How will IPv6 addresses be handled? - Run
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
to set up NAT routing from WiFi to ethernet - Run
sudo netfilter-persistent save
-- to save things - Run
sudo rm /etc/dnsmasq.conf
-- To remove existing DNSmasq configuration - Run
sudo touch /etc/dnsmasq.conf
-- To start a new file - Edit
/etc/dnsmasq.conf
to add the configuration described in the video - Run
sudo touch /etc/hostapd/hostapd.conf
- Edit
sudo touch /etc/hostapd/hostapd.conf
to add the configuration described in the video
That much enables the WiFi router. The number of commands and files involve explains to me why software packages like OpenWRT or RaspAP are so valuable.
He then configured Samba but didn't show the Samba configuration in the video.