Install Larktun on an OpenWrt Router
Installing Larktun directly on an OpenWrt router turns the router itself into an always-on node in your zero-trust network. Compared with installing agents on every single device, a router deployment is ideal as a LAN subnet router: cameras, printers, older NAS boxes, smart-home hubs, and industrial controllers behind the router become securely reachable remotely without opening a single public port or installing software on those endpoints.
This guide covers OpenWrt pre-flight checks, one-command installation, Auth Key login, subnet routing and firewall forwarding notes, service management, and troubleshooting.
Before You Start (Pre-Flight Checks)
Make sure you have the following ready:
- A router running OpenWrt with working outbound internet access.
- SSH access to the router (enable via LuCI under System > Administration > SSH Access, then connect with
ssh root@<router-ip>). - An active account in the Larktun Console.
- Verify your CPU architecture, available flash space, and system clock over SSH:
# Check CPU architecture and opkg architecture tags
uname -m
opkg print-architecture
# Check free overlay storage (10-15 MB free recommended)
df -h /overlay
# Confirm the system clock is accurate (clock skew breaks TLS handshakes)
date
On constrained routers (such as legacy 16 MB flash units), check df -h /overlay first and remove unused packages—or use extroot on USB/TF storage—before installing.
1. Install with the Online Script
After connecting to your OpenWrt router over SSH, download and execute the installer:
wget -O /tmp/larktun.sh https://download2.larktun.com/openwrt/install.sh && sh /tmp/larktun.sh
The script automatically detects the router's CPU architecture (such as aarch64_generic, x86_64, or mipsel) and OpenWrt release, fetches the matching .ipk package, installs larktun and larktund, and configures OpenWrt init.d / procd startup. Live progress is printed in your terminal.
Once complete, you will see a confirmation screen showing the login command format:

If wget fails with a TLS certificate error or times out, verify three things:
- The router's system clock is synced via NTP (System > System > Time Synchronization in LuCI);
ca-bundle/ca-certificatesis installed;- The router can resolve and reach
download2.larktun.com.
2. Generate an Auth Key in the Console
Create a dedicated Auth Key for your router:
- Sign in to the Larktun Console and open your tenant.
- Go to Machines (Nodes) in the left navigation.
- Click Create Auth Key to generate a key for this OpenWrt router.
- Security note: the full Auth Key is displayed only once. Copy it safely and never paste it into public chats, tickets, or screenshots.
3. Log In with the Auth Key
Back in the router's SSH terminal, replace <Your Auth Key> with the key from Step 2:
larktun up --login-server=https://hs.larktun.com --auth-key=<Your Auth Key>
--login-server must point to the Larktun control plane (https://hs.larktun.com, or the exact URL shown in your console).
If you want this OpenWrt router to immediately advertise your LAN subnet (for example 192.168.1.0/24) so remote devices can reach everything behind it, include --advertise-routes:
larktun up \
--login-server=https://hs.larktun.com \
--auth-key=<Your Auth Key> \
--advertise-routes=192.168.1.0/24
4. Verify Online Status and Autostart
Confirm both the local daemon state on OpenWrt and the node state in the console:
# Inspect online state, private Larktun IP, and peer list
larktun status
# Confirm boot-time autostart is enabled (init.d / procd)
/etc/init.d/larktund enabled && echo "autostart enabled"
# Inspect recent daemon logs
logread | grep -i larktun | tail -n 30
Refresh Nodes in the Larktun console and verify the OpenWrt router appears Online. Consider renaming it to a clear label such as home-openwrt.
5. Subnet Routing and OpenWrt Firewall Notes
To access LAN devices behind OpenWrt (NAS, IP cameras, printers, Home Assistant) from outside your home or office:
- Approve the route in the console: open Routers and toggle the advertised LAN CIDR On.
- Allow the subnet in ACLs: add an ACL rule granting your account or group access to the LAN CIDR and target ports (full walkthrough in Approve Subnet Routes).
- Verify OpenWrt forwarding & firewall zones:
- Confirm IPv4 forwarding is enabled (
sysctl net.ipv4.ip_forwardshould return1, which is default on OpenWrt). - If you can ping the router's Larktun IP (
100.64.x.y) but cannot reach LAN hosts behind it, inspect Network > Firewall in LuCI and confirm forwarding and return-path masquerading are permitted between the Larktun tunnel interface and thelanzone. - Avoid LAN CIDR collisions: if both your home router and a remote hotel/office Wi-Fi use
192.168.1.0/24, remote routing will collide locally. Using a less common home LAN CIDR (such as192.168.68.0/24) avoids this problem permanently.
- Confirm IPv4 forwarding is enabled (
Everyday OpenWrt Management Commands
| Task | Command |
|---|---|
| Check node status and private IP | larktun status |
| Test direct P2P vs. relay path | larktun ping <target-ip> |
| Restart the background daemon | /etc/init.d/larktund restart |
| Inspect OpenWrt system logs | logread | grep -i larktun |
| Preserve config across sysupgrade | Add the Larktun state directory under LuCI System > Backup / Flash Firmware > Configuration, or re-login with an Auth Key after flashing |
Troubleshooting
wgetfails with TLS error or timeout: confirm outbound internet connectivity, verifydateis accurate, and ensure ad-blockers or firewall rules are not blockingdownload2.larktun.com.- Out of storage space (
No space left on device): checkdf -h /overlay, clear unused packages/logs, or use extroot on small-flash routers. - Router stays offline after
larktun up: confirm the Auth Key has not expired or been consumed already, check--login-server=https://hs.larktun.com, and inspectlogread | grep -i larktun. - Service does not start after reboot: run
/etc/init.d/larktund enable && /etc/init.d/larktund startto registerlarktundwith OpenWrtprocd. - Can reach the router IP, but not LAN hosts behind it: verify the route is approved in Routers, permitted in ACLs, accepted on the remote client (
--accept-routes), and allowed through OpenWrt firewall zone forwarding. - Still stuck: see Common Issues and Diagnostics, or share your router model, OpenWrt version, and
logreadoutput with support.