Source Issues Download Donation

Building a Router with RPI5

Author(s): Louis Ouellet


A compact, high-performance home/SMB router built on Raspberry Pi 5 with the Radxa Dual 2.5G Router HAT. Runs on Raspberry Pi OS with a lean Linux stack (ifupdown + iptables + dnsmasq) and optional services like Pi-hole, Unbound (recursive DNS), and a Wi-Fi AP. The project includes shell scripts and documentation to reproduce the setup end-to-end, including NVMe migration for reliability and speed.

Features

Network Topology

               Internet
                  │
               [eth0]  WAN  ← DHCP/PPPoE
   ┌───────────── RPi 5 ─────────────┐
   │                                 │
[eth1] LAN 192.168.10.0/24      [eth2] DMZ 192.168.20.0/24
GW: 192.168.10.1                 GW: 192.168.20.1
   │                                 │
 Switch / PCs / NAS              Servers / Public apps

Optional Wi-Fi:
- Guest AP (routed): wlan0 → 192.168.30.0/24 (isolated by default)
- Bridged AP: br0 = eth1 + wlan0 (Wi-Fi extends the LAN at L2)

Defaults & Behavior

Quick Start

Requires Raspberry Pi OS (Bookworm), RPi5 with Radxa Dual 2.5G HAT, and basic console access.

# 1) Get the installer
curl -fsSL https://raw.githubusercontent.com/LaswitchTech/router-pi5/stable/install.sh -o install.sh
chmod +x install.sh
 
# 2) Run base router setup (ifupdown + iptables + dnsmasq)
sudo ./install.sh
 
# 3) (Optional) Add services later
#   Pi-hole DNS front-end
sudo ./add-pihole.sh
#   Unbound recursive resolver
sudo ./add-unbound.sh
#   Guest Wi-Fi AP (routed)
sudo ./add-ap-wifi-guest.sh
#   Bridged Wi-Fi AP (LAN extender)
sudo ./add-ap-wifi-bridge.sh

Heads-up: if you already installed Pi-hole, it binds port 53. The system dnsmasq used for DHCP must be moved to port 5353 (the scripts handle this). To diagnose conflicts: sudo ss -lunp '( sport = :53 or sport = :5353 )'

Documentation

Review the full documentation including:

Hardware, Parts & Costs

Brand Part Vendor Qty Price
Raspberry Pi 5 (4–8 GB) Amazon 1 143.00 $CAD
Raspberry Pi 5 Active Cooler Amazon 1 17.31 $CAD
Radxa Dual 2.5G Router HAT AliExpress 1 60.68 $CAD
Radxa Power DC12 60W AliExpress 1 17.89 $CAD
Total 238.88 $CAD

Roadmap

Troubleshooting Snippets

# Who's using port 53 / 5353?
sudo ss -lntup '( sport = :53 or sport = :5353 )'
sudo ss -lunp  '( sport = :53 or sport = :5353 )'
 
# Pi-hole DNS reload + logs
sudo pihole reload dns
journalctl -u pihole-FTL -n 50 --no-pager
 
# dnsmasq status & lease file
systemctl status dnsmasq
cat /var/lib/misc/dnsmasq.leases

License & Credits

Code and docs are in the repo; see LICENSE file for details. Thanks to the Raspberry Pi, Radxa, and open-source communities.


Tags