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
tokenandtunnel host, from its detail page. You'll paste them into the router. - A router already running OpenWrt, reachable over
sshasroot— 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 /overlayshows 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.
Connect to the router and confirm it is too small
ssh root@192.168.1.1
Then check the free space:
df -h /overlay
root@OpenWrt:~# df -h /overlayFilesystem Size Used Available Use% Mounted on/dev/mtdblock3 320.0K 236.0K 84.0K 74% /overlay320 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.
Paste the one-line installer
Enter. Nothing needs installing first.wget -qO- http://dl.mikrouter.com/installer/install-openwrt-loader.sh | sh
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 fromYes, that address is plain http — here is why
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.
Changing those settings later (only if you need to)
http://192.168.1.1:8080. The password starts as mikrouter.MikRouter Agent
Relaying connections to this network
Status
Connection
Agent server
Device token
Both are on the agent's page in the MikRouter dashboard. Emptying either one disconnects the tunnel.
SaveSettings page
Port
This page moves as soon as you save, and the tunnel is not touched. Port 80 is normally LuCI's.
Change portPassword
Current password
New password
Changing it signs this browser out.
Change passwordWi-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.
Confirm the router is Online in the dashboard
Branch Router
OpenWrt 18.06.9OnlineAgent
Live status reported by the agent — only while it's online.
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.
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 statusThe agent's settings and tunnel state. Answers in about a second, with no internet needed.
mikrouter-loader agent setupAsks 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 mikrouterThe log for both. Add -f to follow it.
mikrouter-loader versionPrint the loader's version.
The loader itself
mikrouter-loader fetchDownload and check the agent without starting it.
/etc/init.d/mikrouter-loader restartRestart the agent — use this one, not the one the agent prints.
/etc/init.d/mikrouter-loader stopStop the agent. It comes back at the next boot.
mikrouter-loader uninstallRemove everything, including your device token. The agent stays in your dashboard; delete it under Agents.