mikrotik-routeros
Skill1 starsChanged 5 months agoMITView on GitHub
Use this skill for MikroTik RouterOS v7 — firewall chains (RAW/filter/mangle/NAT), Queue Tree and PCQ bandwidth management, bridge VLAN filtering with hardware offload, WireGuard VPN configuration, CAPsMAN wireless controller, OSPF/BGP routing, and RouterOS scripting. Activate for CRS switch config, CHR router VM setup, or any /ip /interface /routing command work.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- bastos/skillstheir own version, first seen Jan 30, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- bastos/skills★ 7same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository20 other files it gives its agents.
- cad-designSkill
- cloudflare-tunnelSkill
- context-engineeringSkill
- create-branchSkill
- create-releaseSkill
- digital-fabricationSkill
- docker-swarmSkill
- grafana-prometheusSkill
- k3s-kubernetesSkill
- linux-server-adminSkill
- merge-prSkill
- network-engineerSkill
- nextjs-deploymentSkill
- open-projectSkill
- open-prSkill
- proxmox-homelabSkill
- pr-reviewSkill
- python-fastapiSkill
- thai-dev-workflowSkill
- wireguard-vpnSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 81
Never use VLAN 1 for production.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
MikroTik RouterOS v7
Firewall Architecture
Chain selection by use case:
raw(prerouting/output) — fastest drop, bypasses conntrack. Use for DoS/flood mitigation at high PPS.filterinput — protect the router itself (management access, SSH, WinBox).filterforward — filter routed traffic between networks.mangle— mark packets/connections for QoS, policy routing, MSS clamp.natsrcnat/dstnat — masquerade, port forwarding.
Hardened stateful firewall blueprint:
/ip firewall filter
add action=accept chain=input connection-state=established,related,untracked
add action=drop chain=input connection-state=invalid
add action=accept chain=input protocol=icmp
add action=accept chain=input src-address-list=admin-subnets
add action=drop chain=input comment="drop all other input"
add action=fasttrack-connection chain=forward connection-state=established,related
add action=accept chain=forward connection-state=established,related,untracked
add action=drop chain=forward connection-state=invalid
add action=accept chain=forward out-interface-list=WAN
add action=drop chain=forward comment="drop all other forward"RAW table for DoS mitigation (before conntrack):
/ip firewall raw
add action=drop chain=prerouting src-address-list=blacklist
add action=drop chain=prerouting protocol=tcp tcp-flags=fin,synAddress-list dynamic blocking:
/ip firewall filter
add action=add-src-to-address-list address-list=blacklist address-list-timeout=1h \
chain=input dst-port=22 protocol=tcp connection-limit=5,32Bridge VLAN Filtering (Hardware Offloaded)
Modern method — replaces legacy /interface vlan on separate interfaces.
/interface bridge
add name=bridge-lan vlan-filtering=yes hw=yes
# Trunk port (switch-to-switch, switch-to-hypervisor)
/interface bridge port
add bridge=bridge-lan interface=sfp-sfpplus1 comment="Trunk to upstream"
# Access ports
add bridge=bridge-lan interface=ether1 pvid=10 comment="VLAN 10 access"
add bridge=bridge-lan interface=ether2 pvid=20 comment="VLAN 20 access"
# VLAN membership
/interface bridge vlan
add bridge=bridge-lan tagged=bridge-lan,sfp-sfpplus1 untagged=ether1 vlan-ids=10
add bridge=bridge-lan tagged=bridge-lan,sfp-sfpplus1 untagged=ether2 vlan-ids=20
# L3 interfaces on bridge
/interface vlan
add interface=bridge-lan name=vlan10 vlan-id=10
add interface=bridge-lan name=vlan20 vlan-id=20
/ip address
add address=192.168.10.1/24 interface=vlan10
add address=192.168.20.1/24 interface=vlan20Rules:
- Enable
vlan-filtering=yesonly AFTER assigning ports — enabling first drops all L2 traffic. - Trunk port frame-type:
admit-only-vlan-tagged; access port:admit-only-untagged-and-priority-tagged. - Never use VLAN 1 for production; never use native VLAN = management VLAN (VLAN hopping).
Queue Tree — Bandwidth Management
PCQ (Per-Connection Queue) for fair sharing:
/queue type
add kind=pcq name=pcq-download pcq-classifier=dst-address pcq-rate=0
add kind=pcq name=pcq-upload pcq-classifier=src-address pcq-rate=0
/queue tree
add name=download parent=global packet-mark=download-marked queue=pcq-download max-limit=100M
add name=upload parent=global packet-mark=upload-marked queue=pcq-upload max-limit=50MMangle marks for Queue Tree:
/ip firewall mangle
add action=mark-connection chain=forward connection-state=new in-interface=WAN \
new-connection-mark=download-conn passthrough=yes
add action=mark-packet chain=forward connection-mark=download-conn \
new-packet-mark=download-marked passthrough=noPer-peer VPN limit (Queue Tree, not PCQ):
# Mangle: mark per peer
/ip firewall mangle
add action=mark-packet chain=forward src-address=10.9.0.2 new-packet-mark=peer-02 passthrough=no
# Queue Tree: per peer child queue
/queue tree
add name=wg-clients parent=global
add name=peer-02 parent=wg-clients packet-mark=peer-02 max-limit=20MBurst config (short spikes above limit):
add name=peer-02 parent=wg-clients packet-mark=peer-02 max-limit=20M \
burst-limit=40M burst-threshold=15M burst-time=10sMulti-WAN Failover (Recursive Routing)
# 1. Test routes via each ISP gateway
/ip route
add dst-address=8.8.8.8/32 gateway=ISP1_GW scope=10 check-gateway=ping comment="WAN1 probe"
add dst-address=1.1.1.1/32 gateway=ISP2_GW scope=10 check-gateway=ping comment="WAN2 probe"
# 2. Default routes using probe hosts as virtual hops
add dst-address=0.0.0.0/0 gateway=8.8.8.8 distance=1 target-scope=30 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=1.1.1.1 distance=2 target-scope=30 check-gateway=pingWireGuard VPN
/interface wireguard
add name=wg0 listen-port=51820 mtu=1420
# Generate and display keypair
/interface wireguard print
/ip address
add address=10.9.0.1/24 interface=wg0
# Add peer (road-warrior client)
/interface wireguard peers
add interface=wg0 public-key="CLIENT_PUBKEY" \
allowed-address=10.9.0.2/32 \
comment="laptop"
# Firewall: allow WireGuard input
/ip firewall filter
add action=accept chain=input protocol=udp dst-port=51820 comment="WireGuard"MTU for double-tunnel (VPS relay): set mtu=1340 to avoid MSS issues.
MSS clamp when MTU bug suspected (ping works, TCP stalls):
/ip firewall mangle
add action=change-mss chain=forward protocol=tcp tcp-flags=syn \
new-mss=clamp-to-pmtu passthrough=yesWireGuard QR export (ROS 7.21+):
/interface wireguard peers export-config [find comment="laptop"] qr-codeCAPsMAN Wireless Controller
# Enable CAPsMAN
/caps-man manager
set enabled=yes
# Security profile
/caps-man security
add name=wpa3-psk authentication-types=wpa3-psk passphrase="YOUR_PASSPHRASE"
# Channel
/caps-man channel
add name=ch-5ghz band=5ghz-n/ac/ax control-channel-width=20mhz
# Configuration profile
/caps-man configuration
add name=cfg-main ssid="MyNetwork" security=wpa3-psk channel=ch-5ghz
# Provisioning rule: match all APs, assign config
/caps-man provisioning
add action=create-dynamic-enabled master-configuration=cfg-main comment="all APs"Two forwarding modes:
local— AP routes data itself (lower latency, AP needs DHCP).manager— all traffic tunneled to CAPsMAN (central control, adds latency).
OSPF / BGP
OSPF (single area):
/routing ospf instance
add name=ospf-main router-id=192.168.1.1 version=2
/routing ospf area
add instance=ospf-main name=backbone area-id=0.0.0.0
/routing ospf interface-template
add networks=192.168.10.0/24 area=backboneBGP (eBGP peering):
/routing bgp connection
add name=isp-peer remote.address=203.0.113.1/32 remote.as=64500 \
local.role=ebgp output.default-originate=always
/routing filter rule
add chain=bgp-in rule="if (dst in 0.0.0.0/0) { accept }"BGP soft reset (never hard reset in production):
/routing bgp session reset [find] softScripting
Error handling + iteration:
:onerror e in={
/tool fetch url="https://api.example.com/update" output=none
} do={
:log error "fetch failed: $e"
}
:foreach peer in=[/interface wireguard peers find] do={
:local pk [/interface wireguard peers get $peer public-key]
:log info "peer: $pk"
}Cloudflare DDNS:
:local CFToken "CLOUDFLARE_API_TOKEN"
:local CFZone "CLOUDFLARE_ZONE_ID"
:local CFRecord "CLOUDFLARE_RECORD_ID"
:local Domain "home.example.com"
:local WAN "ether1"
:local CurrentIP [:pick [/ip address get [find interface=$WAN] address] 0 \
[:find [/ip address get [find interface=$WAN] address] "/"]]
:local ResolvedIP [:resolve $Domain]
:if ($CurrentIP != $ResolvedIP) do={
/tool fetch http-method=put \
url="https://api.cloudflare.com/client/v4/zones/$CFZone/dns_records/$CFRecord" \
http-header-field="Authorization: Bearer $CFToken,Content-Type: application/json" \
http-data="{\"type\":\"A\",\"name\":\"$Domain\",\"content\":\"$CurrentIP\",\"ttl\":120}" \
output=none
}Common Gotchas
- Enable
vlan-filteringonly AFTER assigning bridge ports — early enable drops all traffic. Layer-7matcher is CPU-expensive — applies to first 10 packets only; use sparingly.FastTrackbypasses mangle and queue rules; put QoS mangle before FastTrack, or disable FastTrack on QoS traffic.- OSPF
networkstatement uses wildcard masks like Cisco — NOT subnet masks. - MTU mismatch signature:
pingworks,curl/sshhangs → MSS clamp needed. write memoryequivalent in ROS: config is always live, use/system backup savefor file backup.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

