Illustrative WIUNIX Academy IT engineering workspace with server/network equipment and an instructional board: WireGuard hub and spoke with filtered BGP and FRRouting

WIUNIX ACADEMY

WireGuard hub and spoke with filtered BGP and FRRouting

Connect two branch LANs through a WireGuard hub, filter eBGP announcements with FRR, and check route withdrawal on Ubuntu, Debian, RHEL, Rocky, AlmaLinux, Arch and Manjaro.

Advanced105 min readUpdated
Make this guide yours

YOUR SYSTEM. YOUR STEPS.

Where are you working?

Choose your OS and version. The prerequisites, commands and troubleshooting follow your environment.

Rocky Linux 10.2Reviewed against official documentation ·

USE YOUR OWN VALUES

Configure this tutorial

Set the example values for your environment; related explanations and copy panels update together. Never enter passwords, private keys or tokens. Values stay in this tab and are not sent to the server or share links. Check actual DNS, certificates and network policy before running commands.

Different IP addresses, domains or ports? Open the settings below, change the values and select “Apply to tutorial”, then copy the updated commands.

Set values for my environment19 editable values

THE OUTCOME

What will you have at the end?

Route 10.71.10.0/24 ↔ 10.72.20.0/24 through AS65000 with explicit policies and observed withdrawal.

01A · AS6501010.71.10.0/24 → 10.254.1.2
02Hub · AS6500010.254.1.1 / 10.254.2.1 · eBGP over WireGuard
03B · AS6502010.254.2.2 → 10.72.20.0/24
Supported operating systems and versions

All 13 paths were reviewed against primary sources on 2026-11-05. They are documented paths, not executed OS-installation or reboot results. The dated namespace run covers a narrower historical runtime.

Before you begin

  • Three fresh Linux VMs, sudo/Bash, independent console, existing connected LANs and authenticated public-key exchange.
  • No overlapping management/LAN/tunnel routes; existing firewall owner prepared for exact encrypted peers and selected services.

Route two spokes through one hub

For administrators familiar with Linux routing and WireGuard. Build two separate encrypted point-to-point links, then let eBGP advertise only each spoke’s connected LAN. This hub has no local LAN to advertise and is a single point of failure. It is an IPv4 lab, not a production migration, internet transit service or redundant VPN design.

Choose public values before copying

Open the settings, edit, Apply, then copy. The dedicated absolute root /srv/academy-wgbgp must not exist or be a symlink. Interface names wg-ac-a and wg-ac-b must be unused on the hub. LANs 10.71.10.0/24 and 10.72.20.0/24 and the two /30 tunnel subnets must not overlap any real routes, management network or each other. The form checks represented relationships, not ownership or reachability. Keep management outside BGP. Values and custom progress stay in sessionStorage for this tab/language/article/environment; default progress uses localStorage. Nothing is added to shared URLs or written to the server. Never enter keys/passwords. Custom values are not executed tests.

AllowedIPs is not a BGP routing table

The kernel FIB chooses an output interface. On that interface, WireGuard selects a peer by destination AllowedIPs and validates received inner source addresses against the same peer’s AllowedIPs. FRR bgpd selects BGP paths; zebra installs approved learned routes in the kernel. Table = off prevents wg-quick from adding LAN routes from AllowedIPs. Connected /30 routes still exist because Address assigns the interface prefix. Do not add static remote LAN routes: they would conceal BGP withdrawal.

Two tunnel interfaces, three private ASNs

Hub AS65000 uses 10.254.1.1/30 on wg-ac-a and 10.254.2.1/30 on wg-ac-b. A is AS65010, 10.254.1.2/30, owning 10.71.10.0/24 with gateway 10.71.10.1. B is AS65020, 10.254.2.2/30, owning 10.72.20.0/24 with gateway 10.72.20.1. Unique private ASNs avoid same-AS rejection; this is eBGP, not a route reflector. Hub next-hop-self makes the other spoke use its directly reachable hub address. Each spoke’s single hub peer may carry the other LAN; the hub’s per-spoke peer carries only that spoke’s source LAN. No default or broad RFC1918 aggregate is permitted.

01

LET’S BUILD

Inspect three disposable VMs

Use three newly provisioned, disposable x86-64 Linux VMs with a separate management console. Stop if any FRR account, group, service, configuration, selected WireGuard file/interface or private build prefix already exists. Do not adapt these installation steps to an existing router. The hub needs reachable UDP at 198.51.100.10; spokes initiate and may use NAT. Your network manager must already provide each spoke's LAN gateway and exact connected LAN route. Inspect occupied ports and the actual firewall owner before continuing; the inventory does not automatically prove the selected ports are free. Keep management outside all lesson prefixes and BGP.

Keep ROLE in the current Bash terminal. Select it deliberately again in a new terminal. The source-build branch installs compilers only in these disposable VMs; the website does not execute the lesson's installation commands.

bash

Dedicated fresh lab gateways; Bash

set -eu
cat /etc/os-release
ip -br address
ip route show table all
sudo ss -lntup
if command -v nft >/dev/null; then sudo nft list ruleset; fi
for path in '/srv/academy-wgbgp' /etc/frr /etc/wireguard /opt/academy-wgbgp; do
 test ! -e "$path"; test ! -L "$path"
done
for file in '/etc/wireguard/wg-ac-a.conf' '/etc/wireguard/wg-ac-b.conf'; do
 test ! -e "$file"; test ! -L "$file"
done
test "$(systemctl show -p LoadState --value frr.service)" = not-found
if getent passwd frr >/dev/null; then printf '%s\n' 'Existing FRR identity: stop'; exit 1; fi
if getent group frr >/dev/null || getent group frrvty >/dev/null; then exit 1; fi
if ip link show 'wg-ac-a' >/dev/null 2>&1; then exit 1; fi
if ip link show 'wg-ac-b' >/dev/null 2>&1; then exit 1; fi
read -r -p 'Lab role (h/a/b): ' ROLE
case "$ROLE" in h|a|b) ;; *) exit 1;; esac
How do I know it worked?

The root, tunnel names and FRR configuration are absent; LAN/management routes are documented and UDP ports are free.

02

LET’S BUILD

Install the selected distribution packages

The five DEB paths use distribution FRR packages. The six enterprise Linux paths use AppStream FRR and its SELinux policy; no EPEL FRR package or cross-release RPM is needed. The two rolling paths build pinned upstream FRR and private libyang because FRR is absent from the official Arch package database reviewed on 2026-11-05. That branch has a separate prefix and launcher paths; it does not claim an official Arch FRR package.

Mask only the previously absent FRR unit before installing, so package scripts cannot start routing with a sample configuration. Keep it masked until configuration and firewall are ready. Record the package candidate and installed versions. These are documented paths; the historical namespace run is narrower evidence.

bash

Dedicated fresh lab gateways; Bash

set -eu
. /etc/os-release
test "$ID" = 'rocky'
test "$VERSION_ID" = '10.2'
test "$(cat /proc/sys/crypto/fips_enabled)" = 0
sudo systemctl mask frr.service
sudo dnf info frr frr-selinux wireguard-tools
curl_package=curl-minimal
if rpm -q curl >/dev/null 2>&1; then curl_package=curl; fi
sudo dnf install frr frr-selinux wireguard-tools nftables iproute iputils "$curl_package" python3 nano kmod policycoreutils-python-utils
rpm -q frr frr-selinux wireguard-tools
/usr/libexec/frr/bgpd --version
/usr/bin/wg --version
How do I know it worked?

The release guard passes; package or source versions are recorded and FRR remains stopped.

Explore all tutorials ↗