WireGuard Persistence on UISP Routers
Configure persistent WireGuard VPN on UISP Routers using startup scripts in /mnt/data/on_boot.d/
SOP-010: WireGuard Persistence on UISP Routers
Created: 2026-02-14
Status: Production Ready
Tested On: Moruca-Kumaka-UISP-R (firmware 5.4.2)
Overview
Problem: UISP Routers do NOT persist CLI changes across reboots. Commands like ip, wg set, iptables apply immediately but are lost on reboot. This is unlike EdgeRouters which have persistent /config/config.boot.
Solution: Startup scripts in /mnt/data/on_boot.d/. Scripts in this directory execute automatically on boot and /mnt/data/ persists across reboots and firmware upgrades.
Important: The UISP Router GUI does NOT support WireGuard Client configuration. GUI only supports IPsec Site-to-Site and WireGuard Server. You must use CLI and a startup script for WireGuard Client (site-to-site VPN).
Prerequisites
- UISP Router with SSH access
- WireGuard keys from WG Easy server
- VPN IP assigned (e.g.,
10.8.0.x) - LAN subnet defined (e.g.,
10.1.0.0/20) - Server public key, endpoint, preshared key
Server Constants
Procedure
Step 1: Gather Configuration from WG Easy
You will need: VPN IP, Private Key, Preshared Key, LAN Subnet.
Step 2: Find LAN Interface
Step 3: Create Startup Script
Replace these placeholders:
<ROUTER_NAME>— Router description<VPN_IP>— Router VPN IP (e.g.,10.8.0.54)<PRIVATE_KEY>— WireGuard private key<PRESHARED_KEY>— WireGuard preshared key<SERVER_PUBLIC_KEY>— [From Infisical/credentials/wireguard/]<LAN_SUBNET>— LAN subnet (e.g.,10.1.0.0/20)<LAN_INTERFACE>— LAN interface name (e.g.,switch0.1)
Step 4: Test Script
Step 5: Test Persistence (Reboot)
WARNING: This will briefly take the router offline.
Verification Checklist
- Script exists:
/mnt/data/on_boot.d/wireguard-startup.sh - Script is executable
- All placeholders replaced (no
<...>text remains) - Manual test: script runs without errors
- Manual test: handshake appears
- Manual test: ping
10.8.0.1succeeds - Reboot test: WireGuard auto-restores
Troubleshooting
No handshake after script runs:
- Wrong private or preshared key
- Firewall blocking UDP 51820
- DNS resolution failure for endpoint
- Router cannot reach endpoint IP
Can ping router but not LAN devices:
- Verify NAT MASQUERADE rule:
iptables -t nat -L POSTROUTING -n -v - Verify LAN interface is correct
Script lost after firmware upgrade:
/mnt/data/should persist normally- Some factory resets may wipe it — keep backup in
/home/karetech/scripts/<router>-wireguard-startup.sh
EdgeRouter vs UISP Router
| Feature | EdgeRouter (EdgeOS) | UISP Router (UbiOS) |
|---|---|---|
| Config Persistence | Automatic (commit + save) | CLI commands NOT persistent |
| Config File | /config/config.boot | No persistent config file |
| WireGuard GUI | Full WireGuard support | WireGuard Client not supported |
| Persistence Method | Built-in | Startup script in /mnt/data/on_boot.d/ |