All guides
Small-flash Router

Set up an agent on a small-flash OpenWrt router

Router too small for the agent? The loader takes a few kilobytes and loads the agent into memory at every boot.

Before You Start

  • A MikRouter account with an agent created under Agents.
  • That agent's token and tunnel host, from its detail page. You'll paste them into the router.
  • A router already running OpenWrt, reachable over ssh as root — we don't install OpenWrt for you. Old releases are fine; proven on 18.06.
  • Almost no free space— this route is for routers that can't fit the agent at all. If df -h /overlay shows about 600 KB free or more, install the agent directly instead: Set up an agent on an OpenWrt router.
  • Internet access on the router. The agent dials out, so you don't open a port and don't need a public IP.
1

Connect to the router and confirm it is too small

Terminal
ssh root@192.168.1.1

Then check the free space:

OpenWrt (SSH)
df -h /overlay
OpenWrt (SSH)
root@OpenWrt:~# df -h /overlayFilesystem                Size      Used Available Use% Mounted on/dev/mtdblock3          320.0K    236.0K     84.0K  74% /overlay

320 KB in total, against an agent that needs about 480 KB. Deleting files won't help — that is exactly what the loader is for. If your router shows 600 KB or more available, use the normal route instead.

2

Paste the one-line installer

Paste this into the router's terminal and press Enter. Nothing needs installing first.
OpenWrt (SSH)
wget -qO- http://dl.mikrouter.com/installer/install-openwrt-loader.sh | sh
OpenWrt (SSH)
root@OpenWrt:~# wget -qO- http://dl.mikrouter.com/installer/install-openwrt-loader.sh | shResolving the newest loader ...Using the fallback download source (primary unreachable).Downloading 1.0.0 ...Checksum verified. Agent versionThis router downloads the agent at every boot, so this is what it will fetch.  1) 1.0.0   newest — recommended  or type "latest" to follow new releases automatically at every bootAgent version [1.0.0]: Agent version: 1.0.0 MikRouter agent setupPress Enter at any of them to leave it for the settings page later.    Its page will be at http://192.168.1.1:<port>/1. Settings page port [8080]:    The agent server on this agent's dashboard page.2. Tunnel host [not set]: test.mikrouter.com   The 48-character token on that same page.3. Device token [not set]: 0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x InstalledThe loader keeps ~18 KB on flash and fetches the agent into RAM at every boot.Open http://192.168.1.1:8080 on this network.  agent server   test.mikrouter.com  device token   configured  agent version  1.0.0  (fetched into RAM at every boot)   mikrouter-loader agent status     what is configured, and is it running  mikrouter-loader agent setup      change these settings from a terminal  logread -e mikrouter              watch the loader and the agent  /etc/mikrouter-loader.conf        which agent version, and where from

Yes, that address is plain http — here is why

A 4 MB OpenWrt router has no TLS at all, so it cannot open an https:// address — and we will not ask you to install packages onto a router with no room for them. So the download server answers on plain HTTP.

What that costs: this download is not encrypted, so anyone on the network path could swap what the router installs — and it runs as root. On a router you care about, support can give you the one setting that locks it to the exact build you expect.

A router that does have TLS uses it automatically, with nothing to set up.

3

Changing those settings later (only if you need to)

Nothing to do on a fresh install — the installer already asked. To change the agent server or the device token later, open the router's settings page in a browser: http://192.168.1.1:8080. The password starts as mikrouter.
Not Secure192.168.1.1:8080
MikRouter Agent

Relaying connections to this network

Status
Tunnelconnected
Active streams0 / 64
Agent servertest.mikrouter.com
Device tokenset
Connection

Agent server

test.mikrouter.com

Device token

0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x0x

Both are on the agent's page in the MikRouter dashboard. Emptying either one disconnects the tunnel.

Save
Settings page

Port

8080

This page moves as soon as you save, and the tunnel is not touched. Port 80 is normally LuCI's.

Change port
Password

Current password

••••••••

New password

at least four characters

Changing it signs this browser out.

Change password
Sign out

Wi-Fi, DHCP and firewall stay with OpenWrt — configure them in LuCI. This agent only relays connections.

Saving applies it straight away — the agent reconnects with the new settings. Nothing to restart, and nothing is downloaded again.

4

Confirm the router is Online in the dashboard

The router fetches the agent and connects on its own, at this restart and at every boot after it. Open Agents in the dashboard and pick your agent — it looks exactly like a normally-installed router, and the dashboard cannot tell the difference.
https://mikrouter.com/user/agents/…

Branch Router

OpenWrt 18.06.9Online
Last seen just now✎ Edit agent

Agent

Live status reported by the agent — only while it's online.

Server Manila · test.mikrouter.com

Hardware

OpenWrt 18.06.9 TP-Link TL-WR940N v6

Wi-Fi network

Wi-Fi signal

IP address

192.168.1.1

Firmware

v1.0.0

RAM available

12 MB

Active streams

0 / 64

Connected

just now

Removing the loader

Use the helper. It removes the loader, the agent it downloads and your settings.

OpenWrt (SSH)
mikrouter-loader uninstall

Removes everything, including your device token. Use this when the router is leaving your hands.

Every mikrouter-loader command

Anything about the tunnel goes through mikrouter-loader agent …, so every command from the main OpenWrt guide works here with that prefix.

Day to day

mikrouter-loader agent status

The agent's settings and tunnel state. Answers in about a second, with no internet needed.

mikrouter-loader agent setup

Asks for the agent server and device token.

mikrouter-loader agent set host <name>

Change one setting. Every set from the main OpenWrt guide works with this prefix.

logread -e mikrouter

The log for both. Add -f to follow it.

mikrouter-loader version

Print the loader's version.

The loader itself

mikrouter-loader fetch

Download and check the agent without starting it.

/etc/init.d/mikrouter-loader restart

Restart the agent — use this one, not the one the agent prints.

/etc/init.d/mikrouter-loader stop

Stop the agent. It comes back at the next boot.

mikrouter-loader uninstall

Remove everything, including your device token. The agent stays in your dashboard; delete it under Agents.

The router is connected — what's next

Nothing is reachable from the internet yet. Add a mapping on the agent's detail page for each device you want to reach. It works the same for every agent, and the Connect ESP32 agent guide covers it.