Network and edge
  • Blog
  • /
  • HomeLabNetworkAndEdge

Network and edge

The HomeLab connects a 2 Gbit/s fibre service to a NanoPi R6S running FriendlyWrt. The WAN link negotiates at 2.5 GbE, and the two LAN ports feed the office and the house. The office’s three 2.5 GbE switches are connected in sequence across the office for Proxmox cluster nodes and workstations to be physically connected to the network. The 1 GbE LAN port is then for the house’s four switches, again chained together across the house, also providing a hard-wired backbone for the three Tenda Nova Wi-Fi mesh nodes in bridge mode.

2 Gbit/s fibre
└── NanoPi R6S (2.5 GbE WAN) / FriendlyWrt
    ├── Docker
    │   ├── Primary Pi-hole/Unbound
    │   └── Nginx Proxy Manager
    ├── Office (2.5 GbE LAN)
    │   └── Entry 5-port 2.5 GbE switch
    │       ├── Proxmox Node n1
    │       └── Desk 5-port 2.5 GbE switch
    │           ├── Management Host (Debian 13 / Xfce desktop)
    │           ├── Surface Laptop Dock
    │           └── Back 5-port 2.5 GbE switch
    │               ├── Proxmox Node n2
    │               └── Proxmox Node n3
    └── House (1 GbE LAN)
        └── Router 5-port 1 GbE switch
            ├── Secondary Pi-hole/Unbound On Raspberry PI 3b
            └── TV 5-port 2.5 GbE switch
                ├── Main/Living Room Wi-Fi mesh node (in bridge mode)
                └── Kitchen 8-port 2.5 GbE switch
                    ├── Second/Kitchen Wi-Fi mesh node
                    └── Upstairs 5-port 2.5 GbE switch
                        └── Third/Upstairs Wi-Fi mesh node

Both wired branches share a LAN bridge. FriendlyWrt acts as the default gateway, firewall and DHCP server, and advertises both Pi-hole addresses to clients. The house shares a 1 GbE uplink for traffic to the internet or office, even though some links farther down the chain support 2.5 GbE.

Maintaining FriendlyWrt on the NanoPi R6S

The R6S runs FriendlyElec’s Docker-capable FriendlyWrt build, which hosts the primary Pi-hole and the reverse proxy. Before an upgrade, the running firmware, network driver and installed packages provide a baseline for comparison. The commands below use eth2, the WAN interface on this router. The NanoPi R6S wiki covers port mapping, eMMC Tools and recovery. Firmware and checksums are available from FriendlyWrt releases.

ubus call system board
uname -a
ip -br link
ethtool eth2
ethtool -i eth2
apk info > /tmp/friendlywrt-packages.txt
sysupgrade -b /tmp/friendlywrt-config.tar.gz
tar -tzf /tmp/friendlywrt-config.tar.gz

The configuration archive from sysupgrade -b and the package list are kept off the router, alongside a separate backup of the Docker stacks and their persistent data. A bootable microSD card provides a recovery path. The firmware check compares the downloaded image’s SHA-256 with the checksum published for that release.

sha256sum ./friendlywrt-r6s-image.tgz

The eMMC installation is maintained through System → eMMC Tools in LuCI, using a FriendlyElec archive that matches the R6S and its partition layout. The vendor tool offers a data-preserving option for compatible minor upgrades. The lab’s last upgrade booted with factory settings, which required selectively restoring network and service settings and remounting the Docker data. Post-upgrade checks cover the kernel and Ethernet driver, WAN routing, both DNS servers and HTTPS.

FriendlyWrt 25.12 uses apk. The apk update command refreshes the package index, and apk list --upgradable shows available package updates. System-wide updates come through a compatible firmware image, keeping the kernel, Realtek 2.5 GbE driver and packages on the same build. Package management is covered in the OpenWrt APK guide.

WireGuard between the NanoPi and Azure

A WireGuard tunnel carries HTTPS from Nginx Proxy Manager on the NanoPi to the private Istio frontend in Azure Kubernetes Service (AKS). Terraform provisions the Azure WireGuard VM and its fixed outbound IP. The VM initiates the tunnel to the NanoPi's WAN address and sends a keepalive every 25 seconds. The NanoPi learns the endpoint from Azure's authenticated handshake. Non-production is active, and production has a separate interface and key pair staged with its WAN port closed. WireGuard's quick start covers key generation and keepalives.

On FriendlyWrt, the non-production tunnel uses a dedicated WireGuard interface with its own tunnel address and UDP listening port. Each peer keeps its private key locally and shares its public key with the other. The router's WAN firewall allows traffic to the listener only from the Azure VM's fixed outbound IP. The tunnel sits in a separate firewall zone that permits router-originated traffic and rejects new incoming and forwarded connections.

The Azure peer's AllowedIPs on the NanoPi contain two host routes (/32), one for the Azure peer's tunnel address and one for the private Istio frontend. The route to Istio uses the NanoPi's tunnel address as its source. The Azure VM forwards the HTTPS traffic and translates its source to the VM's virtual network address, which is the only source allowed by the private Azure load balancer. The default internet route and the separate NordVPN policy routes continue to serve their usual traffic.

The router checks below show the handshake, transfer counters and route to the private frontend. The sample frontend address should be replaced with the address assigned by Azure. A direct HTTPS request from NPM using the site's hostname then verifies both the tunnel path and the origin certificate before the proxy upstream is switched.

wg show cbd_wg_np latest-handshakes
wg show cbd_wg_np transfer
ip route get 10.50.4.120

Nginx Proxy Manager on the NanoPi

Nginx Proxy Manager (NPM) gives internal services readable hostnames and terminates public HTTPS for the CodeBuildDeploy dev sites. NPM uses host networking to reach the private Istio frontend in Azure Kubernetes Service over the router’s WireGuard tunnel. The proxy listens on ports 80 and 443, and the admin interface on port 81 is intended for LAN access only. More detail is available in the Nginx Proxy Manager setup guide and the Docker host networking documentation.

NPM runs in a separate Compose stack under /opt/stacks/npm. The data directory contains the configuration and SQLite database, and letsencrypt stores certificate material.

services:
  npm:
    image: jc21/nginx-proxy-manager:2.17.1
    network_mode: host
    restart: unless-stopped
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt
cd /opt/stacks/npm
docker compose config --quiet
docker compose up -d
docker compose ps
docker compose exec npm nginx -t

Each proxy host in the admin UI maps a hostname to a backend address and has a certificate selected on the SSL tab. The CodeBuildDeploy dev sites use HTTPS on port 443 to the private upstream. The Advanced tab contains the settings that send the upstream TLS server name and verify its certificate. In the example, dev.example.org represents the name on that certificate. The options are documented in the Nginx upstream TLS directives.

proxy_ssl_server_name on;
proxy_ssl_name dev.example.org;
proxy_ssl_verify on;
proxy_ssl_verify_depth 3;
proxy_ssl_trusted_certificate /etc/ssl/certs/ca-certificates.crt;

An NPM upgrade starts with a review of the release notes and a backup while the service is stopped. The archive captures the Compose file and both data directories, so the SQLite database and certificates can be restored as a set. The stack administrator creates the archive and keeps a copy off the router.

cd /opt/stacks/npm
umask 077
backup="$HOME/npm-before-$(date +%Y%m%d-%H%M%S).tar.gz"
docker compose stop npm
tar -czf "$backup" docker-compose.yml data letsencrypt
tar -tzf "$backup"

After verification of the backup, the pinned image tag changes and Compose pulls the new image and recreates the service. If the backup fails, docker compose start npm brings the existing service back while the backup issue is resolved. The process is covered in the Nginx Proxy Manager upgrade guide.

docker compose config --quiet
docker compose pull npm
docker compose up -d --no-deps npm
docker compose exec npm nginx -t
docker compose logs --tail=30 npm

# From a LAN client, test HTTPS at the proxy using the real site name
curl --fail --silent --show-error --output /dev/null \
    --resolve dev.example.org:443:192.168.50.1 https://dev.example.org/

The local HTTPS check targets the proxy directly. A separate check from outside the home network uses the site’s public hostname without --resolve to exercise public DNS, the edge certificate, the WireGuard path and the application response together.

Two Pi-hole DNS servers

The primary Pi-hole runs in Docker on the NanoPi, alongside an Unbound container on the same Docker bridge. The secondary runs directly on a Raspberry Pi 3B with its own Unbound service on loopback. Each Pi-hole filters requests and sends public lookups to its own recursive resolver. Clients can use either server, so both have matching local DNS records and filtering policies. Updating one at a time keeps a DNS server available during maintenance. The examples below use sample addresses and hostnames.

Primary Pi-hole on the NanoPi

The primary DNS stack lives under /opt/stacks/pihole. The example pins the images to versions used in the lab. Pi-hole publishes DNS on TCP and UDP port 53 and its dashboard on port 8088, leaving ports 80 and 443 for the proxy. Pi-hole reaches Unbound on a Docker bridge with a subnet separate from the LAN and VPN. The Compose example reads PIHOLE_PASSWORD from a private .env file alongside docker-compose.yml. Container settings are documented in the Pi-hole Docker guide.

services:
  pihole:
    image: pihole/pihole:2026.11.0
    restart: unless-stopped
    ports:
      - "192.168.50.1:53:53/tcp"
      - "192.168.50.1:53:53/udp"
      - "192.168.50.1:8088:80/tcp"
    environment:
      TZ: Europe/London
      FTLCONF_webserver_api_password: "${PIHOLE_PASSWORD:?Set PIHOLE_PASSWORD in .env}"
      FTLCONF_dns_listeningMode: ALL
      FTLCONF_dns_upstreams: "172.30.53.2#53"
    volumes:
      - ./etc-pihole:/etc/pihole
    networks:
      dns:
    depends_on:
      - unbound
  unbound:
    image: klutchell/unbound:v1.26.2-20261119
    restart: unless-stopped
    networks:
      dns:
        ipv4_address: 172.30.53.2
networks:
  dns:
    ipam:
      config:
        - subnet: 172.30.53.0/24

Pi-hole needs TCP and UDP port 53 on the router’s LAN address. If dnsmasq already handles DNS on that address, its DNS listener can move or be disabled while DHCP stays enabled. DHCP option 6 advertises the two resolver addresses. With the sample addresses, this appears in LuCI as 6,192.168.50.1,192.168.50.16. Renewing a client lease makes it possible to verify that both addresses were received.

cd /opt/stacks/pihole
chmod 600 .env
docker compose config --quiet
docker compose up -d
docker compose ps
docker compose exec pihole pihole status

A Teleporter export and an off-router copy of the Compose file and persistent data provide a backup before a Docker update. The update changes the pinned image tag and recreates the affected container. The commands show a Pi-hole update, and the same pull and recreate sequence applies to the unbound service. A DNS query after each update confirms that the resolver is answering.

docker compose config --quiet
docker compose pull pihole
docker compose up -d --no-deps pihole
docker compose exec pihole pihole version
docker compose logs --tail=30 pihole

Secondary Pi-hole on the Raspberry Pi

The Raspberry Pi has a stable LAN address, represented here by 192.168.50.16, while FriendlyWrt continues to serve DHCP. Unbound is installed through APT and configured in /etc/unbound/unbound.conf.d/pi-hole.conf to listen on loopback at port 5335. The example checks that the resolver answers before installing Pi-hole. The configuration and installer are documented in the Unbound configuration guide and Pi-hole installation guide.

sudo apt update
sudo apt install unbound dnsutils

# After saving the Unbound configuration from the guide
sudo unbound-checkconf
sudo systemctl enable --now unbound
sudo systemctl restart unbound
dig @127.0.0.1 -p 5335 example.org

curl -fsSL https://install.pi-hole.net -o basic-install.sh
less basic-install.sh
sudo bash basic-install.sh
sudo pihole-FTL --config dns.upstreams '["127.0.0.1#5335"]'
sudo systemctl restart pihole-FTL
sudo pihole status

Maintenance starts with an export of the secondary Pi-hole’s settings. Pi-hole uses its native update command, while Unbound is updated through APT.

sudo pihole -up
sudo apt update
sudo apt install --only-upgrade unbound
sudo systemctl is-active pihole-FTL unbound

Both Pi-holes carry the same local DNS records, including names that point to the reverse proxy on the NanoPi. The sample queries check public resolution over UDP and TCP from another LAN machine, and show whether both servers return the same address for a local name.

for dns in 192.168.50.1 192.168.50.16; do
    dig "@$dns" example.org
    dig "@$dns" +tcp example.org
    dig "@$dns" app.home.arpa +short
done
About the author:
Mark Pollard

Mark Pollard

I am a senior software engineering and technical leader / Microsoft technologies technical architect, with a strong passion for continuous delivery. I am a firm believer in empowered teams with true DevOps cultures. I encourage responsibility over role, high quality and full stack engineers, showing ownership of the software and its behaviour, end to end, from requirements maturing all the way through to its continual and successful running in Production.