routeros
@deckyard/routeros drives a MikroTik router over the RouterOS binary API. Each guide covers one topic; the cheatsheet lists every function, constant and struct. MikroTik's RouterOS documentation describes the menus behind the paths.
This deck is part of Deckyard, community decks for Jennifer.
Conventions
Snippets assume a connection:
import "@deckyard/routeros/" as mt;
def c as mt.Client init mt.connect("192.168.88.1", "admin", "secret");
# ... snippet ...
mt.disconnect($c);- Errors. Input rejected locally throws
Error{kind: "routeros"}before anything is sent. Errors from the router or the connection throwError{kind: "mikrotik"}. Both carry a readablemessage. - Ids. RouterOS gives every list item an id like
"*3".add*functions return it, structs carry it in.id, and the generic verbs take it. Most helpers take a name or a comment instead, because ids change when an item is re-created. - Verbose mode.
$c = mt.setVerbose($c, true);prints every command sent, with credentials redacted;MT_VERBOSE=1sets it atconnect. See core.md.
Every topic has a read-only example in examples/: MT_HOST=... MT_USER=... MT_PASSWORD=... jennifer run examples/<topic>.j.
Guides
| Guide | Covers |
|---|---|
| core.md | connecting, the generic add/set/remove verbs, shared validation |
| interfaces.md | listing, enabling, renaming physical and virtual interfaces |
| interfacelist.md | interface lists: WAN/LAN groups for firewall matching |
| lte.md | LTE / cellular uplink: signal, APN, backup WAN |
| ethernet.md | port settings: speed, duplex, MTU, PoE, link state |
| bonding.md | link aggregation: LACP trunks, failover bundles |
| bridges.md | bridges and bridge ports (virtual switches) |
| switch.md | switch chip: hardware offload inventory and verification |
| vlans.md | 802.1Q tagged interfaces |
| firewall.md | filter rules: the builder, comment handles, shortcuts |
| nat.md | masquerade and port forwarding |
| upnp.md | UPnP: LAN devices open their own port forwards |
| trafficflow.md | NetFlow / IPFIX export to a collector |
| raw.md | firewall raw: pre-conntrack drop / notrack |
| addresslist.md | firewall address lists: one rule, living list |
| mangle.md | packet marking: queue marks, policy routing, MSS clamp |
| contrack.md | connection tracking: the live connection table |
| ip.md | IP addresses on interfaces |
| ipv6.md | IPv6: the stack switch, addresses, router advertisements |
| arp.md | the ARP table: who is on the LAN, pinned bindings |
| neighbor.md | neighbor discovery: what is on this segment (LLDP/CDP/MNDP) |
| dhcp.md | DHCP server, leases, and the WAN-side DHCP client |
| ppp.md | PPPoE dial-in WAN (DSL/fiber) |
| hotspot.md | the captive guest portal: vouchers, bypass, walled garden |
| vpn.md | remote-access VPN: L2TP, SSTP, OpenVPN, IKEv2, PPP users |
| dns.md | resolver settings and static DNS entries |
| routing.md | static routes and the default route |
| queues.md | bandwidth limiting with simple queues |
| wireless.md | WiFi: SSIDs, passwords, guest networks, clients (classic menu) |
| wifi.md | modern WiFi (wifiwave2/ax, RouterOS v7) |
| wireguard.md | WireGuard VPN tunnels (RouterOS v7) |
| eoip.md | EoIP: one LAN across two sites |
| gre.md | GRE: routed site-to-site links, any vendor |
| ipsec.md | IPsec: standards-based site-to-site, multi-vendor |
| vrrp.md | VRRP: two routers, one gateway, automatic failover |
| tools.md | ping, bandwidth test, fetch, e-mail alerting |
| sms.md | text messages over the cellular modem |
| netwatch.md | continuous host monitoring with on-change scripts |
| scheduler.md | scripts on a timer |
| script.md | the stored-script repository (run by name) |
| users.md | router accounts, groups, active sessions |
| services.md | management services: hardening the ways in |
| certificates.md | TLS: self-signed, Let's Encrypt, the acme flow |
| clock.md | clock and NTP: a router that knows what time it is |
| files.md | files and configuration backups |
| disk.md | storage devices: list, format, eject |
| cloud.md | MikroTik Cloud DDNS: a stable name for a dynamic WAN |
| snmp.md | SNMP: plug the router into monitoring |
| radius.md | RADIUS: central authentication for logins/VPN/hotspot |
| health.md | system health: temperature, voltage, fans |
| container.md | run OCI containers on the router (v7) |
| capsman.md | CAPsMAN: central management of many access points |
| log.md | reading the router log, routing what gets logged |
| system.md | packages, updates, firmware, reboot |
Disclaimer
MikroTik and RouterOS are trademarks of SIA Mikrotikls. routeros is an independent library, not affiliated with, endorsed or supported by SIA Mikrotikls. It changes the configuration of live network equipment. Use at your own risk; no warranty of any kind. Licensed LGPL-3.0-only, see LICENSE.