Ready-to-paste RouterOS scripts for ISPs and networks, plus the live app/website catalog that powers SAMM's monitoring & QoS.
Paste this into the router terminal (RouterOS 6 and RouterOS 7, same line). It adds the
script securytik-ipdns-update and the scheduler securytik-ipdns-daily, which downloads
the latest IP Collector DNS catalog once a day (04:17) and replaces the old entries.
It downloads from GitHub and falls back to dl.securytik.com when GitHub is blocked.
:do {/tool fetch url="https://raw.githubusercontent.com/mhdhaidarah/RouterOS-Library/main/ipdns-updater/ipdns-install.rsc" dst-path=ipdns-install.rsc} on-error={/tool fetch url="https://dl.securytik.com/ipdns-install.rsc" dst-path=ipdns-install.rsc}; :delay 2s; /import file-name=ipdns-install.rsc
:put ""
Load the catalog now instead of waiting for the schedule:
/system script run securytik-ipdns-update
- RouterOS 7: DNS collectors (
/ip dns staticFWD withaddress-list), published IP ranges and game port collectors. - RouterOS 6: has no DNS collector, so each app domain becomes an address-list entry holding the name (the router resolves it), plus the same IP ranges and game collectors.
- No monitoring rules. The installer and the daily update never add traffic counters (mangle
passthroughUp/Down rules). Older versions did: the next update removes those. To monitor traffic per app, add the counters yourself (below). - Everything it adds has a comment starting with
IPDNS:. Only those entries are replaced; your own rules are never touched. If the download fails or is incomplete, the current entries stay as they are. - It does not change your DNS servers, NAT or filter rules. Clients must use the router as their DNS server for the collectors to learn addresses.
Up/Down traffic counters for every app (IPv4, plus IPv6 on RouterOS 7). Open
ipdns-updater/ipdns-monitor.rsc, copy all of it and paste it into
the router terminal. Safe to paste again (it replaces its own rules). Its rules are tagged IPDNS-MON:,
so the daily update never adds, changes or removes them. Remove them:
/ip firewall mangle remove [find where comment~"^IPDNS-MON:"]; :do {[[:parse "/ipv6 firewall mangle remove [find where comment~\"^IPDNS-MON:\"]"]]} on-error={}
:put ""
Remove it:
/system scheduler remove [find name="securytik-ipdns-daily"]; /system script remove [find name="securytik-ipdns-update"]; /ip firewall mangle remove [find where comment~"^IPDNS:"]; /ip firewall address-list remove [find where comment~"^IPDNS:"]; /ip dns static remove [find where comment~"^IPDNS:"]; :do {[[:parse "/ipv6 firewall mangle remove [find where comment~\"^IPDNS:\"]"]]} on-error={}
:put ""
A collection of battle-tested MikroTik (RouterOS) configuration snippets used by SecuryTik when deploying ISP, hotspot and enterprise routers — plus the IP Collector DNS script and its generator, which are the single source of truth for the app/website lists that SAMM (SecuryTik Active Mikrotik Manager) uses to identify and shape traffic.
Most files are plain RouterOS scripts: open them, review the values, and paste
into the MikroTik terminal (or /import them). They are templates — adjust
addresses, interfaces and credentials to your network before applying.
| File | What it does |
|---|---|
| IP Collector DNS | Auto-generated RouterOS script that collects per‑app/website IPs from live DNS lookups into address‑lists, with Up/Down traffic counters. Consumed by SAMM (Websites & App Filter → Update from repo) and usable stand‑alone. Do not edit by hand — see DNS Generator. |
| DNS Generator/ | Python tool + catalog.json that generate IP Collector DNS. Add an app in one place, regenerate, done. |
| ipdns-updater/ | Auto-generated router auto-updater: installer + the catalog as RouterOS 6 and RouterOS 7 hold it. See the top of this page. |
| Basic Router with Vlans | Full bootstrap for a single‑bridge, VLAN‑filtered router (Server / Office / Staff / Guest zones) with per‑VLAN gateways. |
| Basic ISP PPPoE Hotspot | PPPoE server + Hotspot starter with RADIUS and a ladder of rate‑limit profiles (1M–30M). |
| User Manager Radius Setup | RouterOS User Manager as the RADIUS source: rate limitations, priced/validity profiles and router binding. |
| DMA Radius Connect to Mikrotik | Wire a MikroTik to an external DMA RADIUS server — pools, PPPoE server, NAT, expired‑user redirect. |
| Multiple PPPoE | Ten MAC‑VLAN PPPoE clients on one SFP+ uplink, bundled into a WAN_List (multi‑session uplinks). |
| Mirktoik OSPF.txt | Minimal OSPF instance/area/interface templates (normal router + default‑route originator). |
| VPN Server | L2TP/IPsec + WireGuard server bootstrap with dual‑stack addressing. |
| DHCP Speed Limit | Paste‑in‑Terminal command: attaches a lease‑script to every DHCP server so each client gets its own parent‑less simple queue (default 2M/2M, one line to change). Verified on ROS 7.23. |
| Hotspot Shared User Speed Limit | Paste‑in‑Terminal command for a Hotspot user profile: every device logged in with the same username (a shared card) shares one speed — one simple queue named after the user, its target updated on each login/logout, removed when the last device leaves. Change the profile and the speed (default 1M up / 4M down) at the top. Needs shared-users above 1 on that profile; best with its rate-limit empty. Verified on ROS 7.24.4. |
| wgcf.zip | wgcf helper binary (generate WireGuard/Cloudflare WARP configs). |
Two ways to use them:
Security Firewall— the universal blocks in one paste, conflict-checked on real RouterOS. Covers Security 01–10; paste it and those are done.Security 01…10— the same protections as separate files if you want only some. Order-independent; the numbers just show the natural paste sequence.
Three files stay separate because they need per-site input: Security 11 (your WAN interface), Security 12 (per-bridge DHCP snooping + trusted ports, and it turns off bridge fast-path), and Port Knocking (an alternative to Security 06). Paste those on top as needed.
Every file was import-tested on RouterOS 7.23; the four attack scripts were verified with a real attacker (nmap, nping, a DHCP-starvation flood). All are interface-independent — no interface name, no interface list to build first — except 11, which needs to know the WAN and says so.
Put your own IP in the Trusted list before pasting the SSH block, and read
the top of each file.
| File | What it does |
|---|---|
| Security Firewall | All of 01–10 in one paste, in the correct order, conflict-free. The all-in-one. |
| Security 01 Connection Tracking | The base every firewall needs: accept established/related/untracked, drop invalid, on input and forward. |
| Security 02 Router Hardening | Turns off unused attack surface: telnet, ftp, www(-ssl), bandwidth-server, mac-ping, neighbour discovery, proxy, socks; SSH strong-crypto on. API (8728) kept for SAMM. |
| Security 03 Bogon Source Drop | Drops packets whose source is a reserved/martian range. RFC1918/CGNAT left out — add them only if every WAN is public. |
| Security 04 DNS Flood Attack | Stops the router being an open resolver: transit passes, DNS-CLIENTS (RFC1918 + CGNAT) rate-limited per source, flooders flagged 10m, everything else dropped (TCP + UDP). |
| Security 05 ICMP Policy | Rate-limited ping plus the ICMP types that must never drop (fragmentation-needed, TTL-exceeded). |
| Security 06 SSH Brute Force | Staged blacklist on SSH and WinBox (22, 8291): Trusted always allowed, three 1-minute stages, then a 1-day ban. Verified — it will lock you out if your IP isn't in Trusted. |
| Security 07 DDoS Connection Rate | Flags any source opening connections faster than 32/10s and drops it 10m — catches floods the SYN rules miss. |
| Security 08 SYN Attack | tcp-syncookies on, plus a syn-attack chain: SYN under 400/s returns (so it composes with the scan/DDoS detectors), the flood is dropped. Verified: 1 058 of a flood dropped. |
| Security 09 Port Scan Attack | PSD scan detector on input and forward; offenders land in Port-Scan for 1 day and are dropped. Verified against nmap -sS. |
| Security 10 DHCP Starvation Attack | Rate-limits DHCP DISCOVERs so a spoofed-MAC flood can't drain the pool, logs the flood (DHCP-FLOOD, with source MAC) and lets the pool self-heal (conflict-detection, optional short lease). Blunt mitigation — the real fix is authenticated leases (RADIUS/static). Verified: flood dropped + logged with source MAC. |
| Security 11 Unsolicited Forward Drop | Stateful edge — nothing new comes in from the WAN unless port-forwarded. The one file that needs your WAN interface (the interface-free form also drops your LAN's outbound UDP), so it's not in Security Firewall. |
| Security 12 DHCP Alert | DHCP snooping on every bridge: blocks rogue DHCP servers on untrusted ports and logs the offending port + MAC (bridge,warning). Skips DHCP-client bridges; a real upstream server needs its uplink port trusted. Not bundled (per-bridge setup + turns off bridge fast-path). Verified: rogue blocked & logged, router's own DHCP unaffected. |
| Security Port Knocking | Hides SSH + WinBox behind a 3-knock sequence (default 7555 → 9555 → 8555, change them). An alternative to 06 — use one, not both — so it's a separate file, not in the bundle. Verified: knock opened access, no knock stayed shut. |
IP Collector DNS turns each app/website into a RouterOS DNS‑static collector
that builds an address‑list ("<App> IPs") from real client lookups, then mangles
per‑app Traffic Up / Traffic Down counters. Two audiences consume the same
file at the same path:
- SAMM fetches it and pushes the DNS‑static, address‑list and mangle rules to managed routers automatically.
- Manual users paste the whole
.rscstraight onto RouterOS.
Anything that only manual users need — the DNS‑redirect preamble, anti‑bypass
rules, IPv6 counters, and the download packet‑mark rules — lives inside a
# SAMM skipped … # SAMM skipped end block, which SAMM's parser ignores. That
keeps the two use‑cases from stepping on each other.
The generator emits one disabled mark-packet rule per app/website on the
download direction (new-packet-mark="<App> download"). They're a ready‑made
starting point for a QoS queue tree: enable the rules you want and point a queue
at the matching packet mark. Because they sit in the # SAMM skipped block,
SAMM never touches them.
Don't hand‑edit IP Collector DNS. Everything lives in
DNS Generator/catalog.json:
# 1. add / edit an app in DNS Generator/catalog.json # 2. regenerate the RouterOS script at the repo root python3 "DNS Generator/generate.py" # 3. commit catalog.json + the regenerated IP Collector DNS
See DNS Generator/README.md for the catalog format
and the advanced settings block (anti‑bypass, IPv6 counters, download packet
marks).
- 🌐 SAMM — MikroTik AAA, monitoring & QoS: https://samm.securytik.com
- 🏢 SecuryTik — the company behind it: https://securytik.com
Maintained by Mohammed Haidar · Beirut, Lebanon · 📞 +961 81 507 933