Written for RouterOS 7. Type the commands in the terminal (in Winbox, WebFig or over SSH). Every command here uses its full path, so it works from anywhere; you can also go into a menu, such as /ip address, and type just the last part. Turn on safe mode with Ctrl+X before changing bridges, VLANs or firewall rules, so a mistake undoes itself if you lose access. Interface names, addresses and names are examples, so swap in your own.
Official links: MikroTik documentation, RouterOS manual.
Getting around the CLI #
-
Turn on safe mode, so changes undo themselves if you lose the connectionMikroTik RouterOS
Ctrl+X -
Show the commands available hereMikroTik RouterOS
? -
Complete a command or show the choicesMikroTik RouterOS
Tab -
Go to a menu, such as IP addressesMikroTik RouterOS
/ip address -
Go back to the top levelMikroTik RouterOS
/ -
Show the items in the current menuMikroTik RouterOS
print -
Show every setting, including defaultsMikroTik RouterOS
print detail -
Show only matching itemsMikroTik RouterOS
/ip address print where interface=bridge1 -
Run a command from anywhere using its full pathMikroTik RouterOS
/ip route print -
Change an item using findMikroTik RouterOS
/interface set [find name=ether2] comment="Uplink" -
Undo the last changeMikroTik RouterOS
/undo -
Log outMikroTik RouterOS
/quit
First setup #
-
Name the routerMikroTik RouterOS
/system identity set name=rtr-home -
Set a password for the admin userMikroTik RouterOS
/password -
Add your own admin userMikroTik RouterOS
/user add name=gerard group=full password="ChangeMe-2026!" -
Disable the default admin user once your own worksMikroTik RouterOS
/user disable adminWarning: Check you can log in as your new user first, or you'll lock yourself out.
-
Add your SSH public key to a userMikroTik RouterOS
/user ssh-keys import public-key-file=id_ed25519.pub user=gerard -
Set the time zoneMikroTik RouterOS
/system clock set time-zone-name=Europe/Dublin time-zone-autodetect=no -
Turn on the NTP clientMikroTik RouterOS
/system ntp client set enabled=yes servers=0.pool.ntp.org,1.pool.ntp.org -
Show the time and NTP statusMikroTik RouterOS
/system clock print /system ntp client print -
Show the model, version, CPU and memoryMikroTik RouterOS
/system resource print -
Show the RouterBOARD model, serial number and firmwareMikroTik RouterOS
/system routerboard print -
Show the licence levelMikroTik RouterOS
/system license print -
Reset to factory settings with no default configMikroTik RouterOS
/system reset-configuration no-defaults=yes skip-backup=yesWarning: Wipes everything and reboots. With no-defaults=yes there's no LAN address either, so you'll need Winbox by MAC address or a console cable.
Interfaces and bridges #
-
List the interfacesMikroTik RouterOS
/interface print -
List the interfaces with traffic countersMikroTik RouterOS
/interface print stats -
Watch live traffic on an interfaceMikroTik RouterOS
/interface monitor-traffic ether2 -
Show link speed and cable status for a portMikroTik RouterOS
/interface ethernet monitor ether2 once -
Name a portMikroTik RouterOS
/interface ethernet set [find default-name=ether2] comment="NAS" -
Disable a portMikroTik RouterOS
/interface disable ether2 -
Enable a portMikroTik RouterOS
/interface enable ether2 -
Make a bridge (a switch made of ports)MikroTik RouterOS
/interface bridge add name=bridge1 -
Add a port to the bridgeMikroTik RouterOS
/interface bridge port add bridge=bridge1 interface=ether2 -
List the bridge portsMikroTik RouterOS
/interface bridge port print -
Show the MAC address tableMikroTik RouterOS
/interface bridge host print -
Bond two ports with LACPMikroTik RouterOS
/interface bonding add name=bond1 slaves=ether2,ether3 mode=802.3ad transmit-hash-policy=layer-2-and-3 -
Group interfaces into a LAN list for firewall rulesMikroTik RouterOS
/interface list member add list=LAN interface=bridge1 -
Put the internet port in the WAN listMikroTik RouterOS
/interface list member add list=WAN interface=ether1 -
Show the interface lists and membersMikroTik RouterOS
/interface list member print
VLANs #
-
Add a VLAN interface on the bridge, so the router can route itMikroTik RouterOS
/interface vlan add name=vlan10 vlan-id=10 interface=bridge1 -
Give the VLAN interface an addressMikroTik RouterOS
/ip address add address=192.168.10.1/24 interface=vlan10 -
Make a port an access port in a VLANMikroTik RouterOS
/interface bridge port set [find interface=ether2] pvid=10 frame-types=admit-only-untagged-and-priority-tagged -
Tag a VLAN on a trunk port and the bridgeMikroTik RouterOS
/interface bridge vlan add bridge=bridge1 vlan-ids=10 tagged=bridge1,ether3 -
Untag a VLAN on access portsMikroTik RouterOS
/interface bridge vlan add bridge=bridge1 vlan-ids=10 tagged=bridge1 untagged=ether2 -
Show the bridge VLAN tableMikroTik RouterOS
/interface bridge vlan print -
Turn on VLAN filtering on the bridgeMikroTik RouterOS
/interface bridge set bridge1 vlan-filtering=yesWarning: If the port you're connected through isn't set up for the right VLAN, you'll lose access. Turn on safe mode (Ctrl+X) first.
-
Check hardware offloading is on for the bridge portsMikroTik RouterOS
/interface bridge port print
IP addresses and routes #
-
Add an IP addressMikroTik RouterOS
/ip address add address=192.168.88.1/24 interface=bridge1 -
List the IP addressesMikroTik RouterOS
/ip address print -
Remove an IP addressMikroTik RouterOS
/ip address remove [find address="192.168.88.1/24"] -
Get an address from your ISP by DHCPMikroTik RouterOS
/ip dhcp-client add interface=ether1 disabled=no -
Show the DHCP client statusMikroTik RouterOS
/ip dhcp-client print detail -
Renew the DHCP lease from your ISPMikroTik RouterOS
/ip dhcp-client renew [find interface=ether1] -
Connect to the internet with PPPoEMikroTik RouterOS
/interface pppoe-client add name=pppoe-out1 interface=ether1 user="gerard" password="ChangeMe-2026!" add-default-route=yes use-peer-dns=yes disabled=no -
Add a default routeMikroTik RouterOS
/ip route add dst-address=0.0.0.0/0 gateway=192.168.1.1 -
Add a static routeMikroTik RouterOS
/ip route add dst-address=10.20.0.0/16 gateway=192.168.88.254 -
Show the routing tableMikroTik RouterOS
/ip route print -
Show only the active routesMikroTik RouterOS
/ip route print where active -
Show the ARP tableMikroTik RouterOS
/ip arp print -
Add an IPv6 address from your ISP's delegated prefixMikroTik RouterOS
/ipv6 address add address=::1/64 from-pool=isp-pool interface=bridge1
DHCP and DNS #
-
Run the DHCP server wizardMikroTik RouterOS
/ip dhcp-server setup -
Make an address poolMikroTik RouterOS
/ip pool add name=lan-pool ranges=192.168.88.100-192.168.88.200 -
Set the gateway and DNS handed outMikroTik RouterOS
/ip dhcp-server network add address=192.168.88.0/24 gateway=192.168.88.1 dns-server=192.168.88.1 -
Add a DHCP server on the bridgeMikroTik RouterOS
/ip dhcp-server add name=lan-dhcp interface=bridge1 address-pool=lan-pool lease-time=1d -
List the DHCP leasesMikroTik RouterOS
/ip dhcp-server lease print -
Make a lease permanentMikroTik RouterOS
/ip dhcp-server lease make-static [find address=192.168.88.10] -
Reserve an address for a MAC addressMikroTik RouterOS
/ip dhcp-server lease add address=192.168.88.10 mac-address=AA:BB:CC:DD:EE:FF server=lan-dhcp -
Set the DNS servers and answer queries from the LANMikroTik RouterOS
/ip dns set servers=1.1.1.1,1.0.0.1 allow-remote-requests=yesWarning: Block DNS from the WAN in the input chain, or the router becomes an open resolver.
-
Add a local DNS nameMikroTik RouterOS
/ip dns static add name=nas.home.arpa address=192.168.88.10 -
List the local DNS namesMikroTik RouterOS
/ip dns static print -
Show the DNS cacheMikroTik RouterOS
/ip dns cache print -
Clear the DNS cacheMikroTik RouterOS
/ip dns cache flush -
Turn on DNS over HTTPSMikroTik RouterOS
/ip dns set use-doh-server=https://cloudflare-dns.com/dns-query verify-doh-cert=yes
Firewall #
-
Show the filter rules with hit countsMikroTik RouterOS
/ip firewall filter print stats -
Accept established and related traffic to the routerMikroTik RouterOS
/ip firewall filter add chain=input connection-state=established,related,untracked action=accept comment="accept established" -
Drop invalid traffic to the routerMikroTik RouterOS
/ip firewall filter add chain=input connection-state=invalid action=drop comment="drop invalid" -
Allow ping to the routerMikroTik RouterOS
/ip firewall filter add chain=input protocol=icmp action=accept comment="accept ICMP" -
Drop everything to the router that isn't from the LANMikroTik RouterOS
/ip firewall filter add chain=input in-interface-list=!LAN action=drop comment="drop all not from LAN"Warning: Add it last, after the accept rules. If you manage the router from outside the LAN list, you'll lock yourself out.
-
Speed up established traffic with FastTrackMikroTik RouterOS
/ip firewall filter add chain=forward connection-state=established,related action=fasttrack-connection hw-offload=yes -
Accept established and related traffic through the routerMikroTik RouterOS
/ip firewall filter add chain=forward connection-state=established,related,untracked action=accept -
Drop new traffic from the internet that isn't port-forwardedMikroTik RouterOS
/ip firewall filter add chain=forward connection-state=new connection-nat-state=!dstnat in-interface-list=WAN action=drop -
Block traffic from an address listMikroTik RouterOS
/ip firewall filter add chain=input src-address-list=blocked action=drop place-before=0 -
Add an address to a listMikroTik RouterOS
/ip firewall address-list add list=blocked address=203.0.113.50 -
Add an address to a list for one day onlyMikroTik RouterOS
/ip firewall address-list add list=blocked address=203.0.113.50 timeout=1d -
Show an address listMikroTik RouterOS
/ip firewall address-list print where list=blocked -
Move a rule higher upMikroTik RouterOS
/ip firewall filter move 5 destination=1 -
Disable a ruleMikroTik RouterOS
/ip firewall filter disable 5 -
Log traffic hitting a ruleMikroTik RouterOS
/ip firewall filter set 5 log=yes log-prefix="DROP-IN" -
Reset the rule countersMikroTik RouterOS
/ip firewall filter reset-counters-all -
Show the current connectionsMikroTik RouterOS
/ip firewall connection print -
Count the current connectionsMikroTik RouterOS
/ip firewall connection print count-only
NAT #
-
Share the internet connection (masquerade)MikroTik RouterOS
/ip firewall nat add chain=srcnat out-interface-list=WAN action=masquerade -
Forward a port to a serverMikroTik RouterOS
/ip firewall nat add chain=dstnat in-interface-list=WAN protocol=tcp dst-port=443 action=dst-nat to-addresses=192.168.88.10 to-ports=443 -
Forward a different outside port to a serverMikroTik RouterOS
/ip firewall nat add chain=dstnat in-interface-list=WAN protocol=tcp dst-port=8443 action=dst-nat to-addresses=192.168.88.10 to-ports=443 -
Show the NAT rules with hit countsMikroTik RouterOS
/ip firewall nat print stats -
Let LAN devices reach a forwarded port by the public address (hairpin NAT)MikroTik RouterOS
/ip firewall nat add chain=srcnat src-address=192.168.88.0/24 dst-address=192.168.88.10 protocol=tcp dst-port=443 out-interface=bridge1 action=masquerade
Locking down management #
-
Show the management services and their portsMikroTik RouterOS
/ip service print -
Turn off services you don't useMikroTik RouterOS
/ip service disable telnet,ftp,www,api,api-ssl -
Only allow SSH and Winbox from the LANMikroTik RouterOS
/ip service set ssh,winbox address=192.168.88.0/24 -
Move SSH to another portMikroTik RouterOS
/ip service set ssh port=2222 -
Use strong SSH ciphers onlyMikroTik RouterOS
/ip ssh set strong-crypto=yes -
Only allow MAC Winbox from the LANMikroTik RouterOS
/tool mac-server mac-winbox set allowed-interface-list=LAN -
Turn off MAC telnetMikroTik RouterOS
/tool mac-server set allowed-interface-list=none -
Only announce the router to the LAN (neighbour discovery)MikroTik RouterOS
/ip neighbor discovery-settings set discover-interface-list=LAN -
Turn off the bandwidth test serverMikroTik RouterOS
/tool bandwidth-server set enabled=no -
Turn off the SOCKS and web proxiesMikroTik RouterOS
/ip socks set enabled=no /ip proxy set enabled=no -
Show who's logged inMikroTik RouterOS
/user active print -
List the usersMikroTik RouterOS
/user print
WireGuard VPN #
-
Make a WireGuard interfaceMikroTik RouterOS
/interface wireguard add name=wg0 listen-port=13231 -
Show the router's WireGuard public keyMikroTik RouterOS
/interface wireguard print -
Give the tunnel an addressMikroTik RouterOS
/ip address add address=10.10.10.1/24 interface=wg0 -
Add a peer, such as a phone or laptopMikroTik RouterOS
/interface wireguard peers add interface=wg0 public-key="Peer-public-key-base64=" allowed-address=10.10.10.2/32 -
Allow WireGuard in through the firewallMikroTik RouterOS
/ip firewall filter add chain=input protocol=udp dst-port=13231 action=accept comment="WireGuard" place-before=0 -
Treat the tunnel as part of the LANMikroTik RouterOS
/interface list member add list=LAN interface=wg0 -
Show peers and when they last connectedMikroTik RouterOS
/interface wireguard peers print detail
Wi-Fi #
-
List the Wi-Fi interfaces (RouterOS 7.13+ wifi package)MikroTik RouterOS
/interface wifi print -
Set the Wi-Fi name, country and WPA2/WPA3 passwordMikroTik RouterOS
/interface wifi set wifi1 disabled=no configuration.country=Ireland configuration.ssid=HomeNet security.authentication-types=wpa2-psk,wpa3-psk security.passphrase="ChangeMe-2026!" -
Show connected Wi-Fi clientsMikroTik RouterOS
/interface wifi registration-table print -
Scan for nearby networks and channelsMikroTik RouterOS
/interface wifi scan wifi1 -
List the Wi-Fi interfaces (older wireless package)MikroTik RouterOS
/interface wireless print -
Show connected clients (older wireless package)MikroTik RouterOS
/interface wireless registration-table print
Queues and bandwidth #
-
Limit a device or subnet's speedMikroTik RouterOS
/queue simple add name=guest target=192.168.88.0/24 max-limit=10M/50M -
Show the queues and their trafficMikroTik RouterOS
/queue simple print stats -
Turn on CAKE to fight bufferbloat on the WANMikroTik RouterOS
/queue type add name=cake-wan kind=cake /queue simple add name=wan-cake target=ether1 queue=cake-wan/cake-wan max-limit=10M/50M -
Show which hosts are using the bandwidthMikroTik RouterOS
/tool torch interface=ether1
OSPF and BGP #
-
Make an OSPF instanceMikroTik RouterOS
/routing ospf instance add name=default router-id=10.255.255.1 -
Add the backbone areaMikroTik RouterOS
/routing ospf area add name=backbone area-id=0.0.0.0 instance=default -
Run OSPF on a networkMikroTik RouterOS
/routing ospf interface-template add area=backbone network=192.168.88.0/24 -
Show OSPF neighboursMikroTik RouterOS
/routing ospf neighbor print -
Make a BGP instance with your AS numberMikroTik RouterOS
/routing bgp instance add name=bgp1 as=65001 router-id=10.255.255.1 -
Add an eBGP peerMikroTik RouterOS
/routing bgp connection add name=isp instance=bgp1 remote.address=192.0.2.1 local.role=ebgp -
Show BGP sessionsMikroTik RouterOS
/routing bgp session print -
Show all routes, including BGP and OSPFMikroTik RouterOS
/routing route print
Troubleshooting #
-
Ping an addressMikroTik RouterOS
/ping 1.1.1.1 count=4 -
Ping from a set source addressMikroTik RouterOS
/ping 1.1.1.1 src-address=192.168.88.1 count=4 -
Trace the route to an addressMikroTik RouterOS
/tool traceroute 1.1.1.1 -
Look up a nameMikroTik RouterOS
:put [:resolve example.com] -
Watch traffic on an interface by host and portMikroTik RouterOS
/tool torch interface=bridge1 src-address=0.0.0.0/0 port=any -
Capture packets on an interfaceMikroTik RouterOS
/tool sniffer quick interface=ether2 -
Save a packet capture to a file for WiresharkMikroTik RouterOS
/tool sniffer set file-name=capture.pcap filter-interface=ether2 /tool sniffer start -
Stop the packet captureMikroTik RouterOS
/tool sniffer stop -
Test throughput to another MikroTikMikroTik RouterOS
/tool bandwidth-test address=192.168.88.10 direction=both -
Show the logMikroTik RouterOS
/log print -
Follow the log liveMikroTik RouterOS
/log print follow -
Show only firewall log entriesMikroTik RouterOS
/log print where topics~"firewall" -
Show neighbouring devices (CDP, LLDP, MNDP)MikroTik RouterOS
/ip neighbor print -
Show the CPU use per processMikroTik RouterOS
/tool profile -
Show the temperature and voltageMikroTik RouterOS
/system health print
Backups, scripts and upgrades #
-
Export the config as textMikroTik RouterOS
/export file=rtr-home-2026-11-27 -
Export the config including passwords and keysMikroTik RouterOS
/export show-sensitive file=rtr-home-2026-11-27Warning: The file has your passwords and keys in plain text. Keep it somewhere safe.
-
Show the whole config on screenMikroTik RouterOS
/export -
Save a binary backup (same model only)MikroTik RouterOS
/system backup save name=rtr-home-2026-11-27 password="ChangeMe-2026!" -
Restore a binary backupMikroTik RouterOS
/system backup load name=rtr-home-2026-11-27.backup password="ChangeMe-2026!"Warning: Replaces the whole config and reboots.
-
Run a config script from a fileMikroTik RouterOS
/import file-name=rtr-home-2026-11-27.rsc -
List the files on the routerMikroTik RouterOS
/file print -
Add a scriptMikroTik RouterOS
/system script add name=nightly-backup source="/system backup save name=nightly; /export file=nightly" -
Run a scriptMikroTik RouterOS
/system script run nightly-backup -
Run a script every night at 2amMikroTik RouterOS
/system scheduler add name=nightly-backup interval=1d start-time=02:00:00 on-event=nightly-backup -
Check for a RouterOS updateMikroTik RouterOS
/system package update check-for-updates -
Download and install the update (reboots)MikroTik RouterOS
/system package update install -
Switch to the long-term release channelMikroTik RouterOS
/system package update set channel=long-term -
List the installed packagesMikroTik RouterOS
/system package print -
Upgrade the RouterBOARD firmware after a RouterOS updateMikroTik RouterOS
/system routerboard upgrade -
RebootMikroTik RouterOS
/system reboot