Skip to main content

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
tip

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:

OpenWrt terminal showing a successful Larktun installation

tip

If wget fails with a TLS certificate error or times out, verify three things:

  1. The router's system clock is synced via NTP (System > System > Time Synchronization in LuCI);
  2. ca-bundle / ca-certificates is installed;
  3. 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:

  1. Sign in to the Larktun Console and open your tenant.
  2. Go to Machines (Nodes) in the left navigation.
  3. Click Create Auth Key to generate a key for this OpenWrt router.
  4. 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:

  1. Approve the route in the console: open Routers and toggle the advertised LAN CIDR On.
  2. 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).
  3. Verify OpenWrt forwarding & firewall zones:
    • Confirm IPv4 forwarding is enabled (sysctl net.ipv4.ip_forward should return 1, 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 the lan zone.
    • 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 as 192.168.68.0/24) avoids this problem permanently.

Everyday OpenWrt Management Commands​

TaskCommand
Check node status and private IPlarktun status
Test direct P2P vs. relay pathlarktun ping <target-ip>
Restart the background daemon/etc/init.d/larktund restart
Inspect OpenWrt system logslogread | grep -i larktun
Preserve config across sysupgradeAdd the Larktun state directory under LuCI System > Backup / Flash Firmware > Configuration, or re-login with an Auth Key after flashing

Troubleshooting​

  • wget fails with TLS error or timeout: confirm outbound internet connectivity, verify date is accurate, and ensure ad-blockers or firewall rules are not blocking download2.larktun.com.
  • Out of storage space (No space left on device): check df -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 inspect logread | grep -i larktun.
  • Service does not start after reboot: run /etc/init.d/larktund enable && /etc/init.d/larktund start to register larktund with OpenWrt procd.
  • 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 logread output with support.

Next Steps​