MikroTik RouterOS commands

Console keys and typed commands for the MikroTik RouterOS v7 command line, taken from the RouterOS manual. Key rows are real keystrokes; every other row is text typed at the prompt, with the example values the manual prints. Menu paths are written with spaces, as in /ip address print; v7 accepts slashes as well. WinBox and WebFig steps, scripting syntax, wireless, routing protocols and VPN menus are left out. Help is on F1.

205 commands in 14 sections. Checked row by row against MikroTik RouterOS Manual (v7) on . Edited by Jay.

Console keys 24

Safe mode does not cover commands that need a reboot, such as resetting the configuration or restoring a backup.

ShortcutWhat it does
F1Show context helpExplains what can be typed at the cursor position; the login banner points to this key.
TabComplete the current wordFinishes a command, argument or item name; with several matches it fills in only their shared beginning.
TabthenTabList possible completionsOnce the shared part is typed, another press prints every match in compact form.
F3orCtrl+RSearch command historyOpens the console search prompt, which also looks through the RouterOS menus.
F4orCtrl+XToggle safe modeThe prompt shows SAFE; changes are rolled back if the session ends abnormally.
Ctrl+XthenCtrl+XClear safe mode action listWorth doing between batches, because safe mode switches itself off when history cannot hold every change.
F5orCtrl+LRepaint the screenThe terminal is reset before it is drawn again.
F7Toggle HotLock modeCommands complete themselves while you type; a doubled > in the prompt marks the mode.
F8Show whole multiline inputExpands a multiline command that was recalled from history.
Ctrl+CInterrupt the running commandReturns to the prompt; on a half-typed line it cancels the input and leaves the line empty.
Ctrl+DLog outWorks only on an empty prompt, and leaving this way undoes safe mode changes.
Ctrl+KDelete to end of lineRemoves everything from the cursor rightwards.
Ctrl+UDelete to start of lineRemoves everything in front of the cursor.
Ctrl+TSwitch to background task
Ctrl+\Split line at cursorStarts a new input line at that point; afterwards the cursor sits at the line end.
Ctrl+BorLeftMove back one character
Ctrl+ForRightMove forward one character
Ctrl+PorUpPrevious line or history entryInside multiline input it moves up a line; from the top line it recalls the earlier command.
Ctrl+NorDownNext line or history entryInside multiline input it moves down a line; from the bottom line it recalls the following command.
Ctrl+AorHomeGo to start of linePressed again at the start, it jumps to the first line of a multiline input.
Ctrl+EorEndGo to end of linePressed again at the end, it jumps to the last line of a multiline input.
DeleteDelete character at cursor
Ctrl+HorBackspaceDelete previous character
#Send a chat messageType the text after the symbol; every administrator logged in at that moment sees it.

General item commands 19

Item numbers are assigned by print and last only for the session. The manual tells script writers to select items with find instead.

ShortcutWhat it does
addAdd an itemTakes the same properties as set; copy-from clones an existing entry and place-before chooses its position.
setChange item propertiesNames the item by number or name, then one or more property=value pairs.
set 0 !portUnset a propertyAn exclamation mark in front of the name clears that value on item 0.
/interface set 0,1,2 mtu=1460Change several items at onceA comma-separated list of item numbers applies one change to all of them.
removeRemove an item
enableEnable an item
disableDisable an item
commentComment an itemThe text can later be matched in find and print where expressions.
moveReorder list itemsFirst comes what to move, then the entry it lands before; without a target it goes last.
findFind matching itemsGives back internal numbers that set, remove and similar commands accept in square brackets.
/ip route remove [find comment="WAN1"]Remove items found by commentThe bracketed find runs first and hands its result to remove.
getRead a property valueNothing is shown on screen unless the call is wrapped in :put.
:put [/system resource get version]Print the RouterOS versionThe pattern for showing a single property: get wrapped in :put.
editEdit a property in an editorMeant for long values such as scripts; a full-screen or one-line editor opens, depending on the terminal.
resetReset properties to defaultsNew values may follow on the same line, so an item is reset and configured together.
exportExport this menuCovers the current menu with its sub-menus; with a file name the output becomes an .rsc file.
/undoUndo the last changeReverses the newest action recorded in system history, whether it came from the CLI or a GUI.
/redoRedo an undone changeApplies once more the action that undo just reversed.
/system history printList recorded changesEach entry is flagged undoable, redoable or floating-undo; detail shows the exact commands.

Export and import 14

An export never contains system user passwords, installed certificates or SSH keys, with or without show-sensitive.

ShortcutWhat it does
/exportExport the whole configurationFrom the root menu it prints every menu as a script; user passwords, certificates and SSH keys are never included.
/export file=backup-step3Export everything to a fileThe script is stored with the .rsc extension among the router files instead of being printed.
/ip address export file=addressExport one menu to a fileAn export run inside a menu covers just that menu and whatever lies below it.
/export path=/ip/firewall,!/ip/firewall/natExport selected menusLists the menus to include; an exclamation mark excludes one, here the NAT rules.
ip firewall address-list export where list=mylistExport part of a menuFrom RouterOS 7.13 a where clause limits the export to matching entries.
export compactExport changed settings onlyAlready the default behaviour, so a plain export gives identical output.
export verboseExport including defaultsEvery parameter and item is written, not just what was changed.
export terseExport one command per lineEach line is a full command that carries its own menu path.
export show-sensitiveInclude passwords and keysWithout this parameter sensitive values stay out of the output.
import address.rscRun a script fileRoot-menu command that executes every console command found in the .rsc file.
import test.rsc verbose=yes dry-runTest a script without applyingErrors are reported with their line and the configuration stays untouched; dry-run needs verbose mode.
import verbose=yesImport line by lineEach line is executed on its own and the import halts at the first problem, showing where it is.
import from-lineStart at a given lineTakes a line number and, like dry-run, works in verbose mode only.
import file-nameName the script fileParameter for the .rsc script; the manual example passes the name directly after import.

Backup and reset 9

ShortcutWhat it does
/system backup save name=testSave a binary backupCreates test.backup among the router files; the manual example also sets a password.
/system backup load name=testRestore a binary backupAsks for the password and a confirmation, then restores the configuration and reboots.
/file printList files on the routerWhere saved backups and exports show up with their type, size and creation time.
/system reset-configurationReset to default configurationWipes everything including the login, reboots and loads the factory defaults; a backup file is stored first.
/system reset-configuration no-defaults=yesReset to an empty configurationThe step the manual prescribes before importing a script that replaces an existing setup.
/system reset-configuration no-defaults=yes skip-backup=yesReset without automatic backupA hard reset: no default settings come back and no backup file is written beforehand.
reset-configuration keep-usersKeep users during resetExisting accounts stay in place while everything else is cleared.
reset-configuration run-after-resetRun a script after resetLoads your own .rsc file once the wipe is done; it has to finish within two minutes.
reset-configuration caps-modeReset into CAPs modeStarts the caps-mode script as soon as the reset has finished.

Addresses, routes and DNS 9

ShortcutWhat it does
/ip address printList IP addressesShows each address with its network and interface, flagged when disabled, invalid or dynamic.
/ip address add address=192.168.88.1/24 interface=bridge1Add an IP addressAssigns the address with its prefix length to the named interface, here the LAN bridge.
/ip route printShow the routing tableFlags mark every route as active, dynamic, static or connected.
/ip route add gateway=1.2.3.1Add a default routeThe static-IP setup creates its default route through the ISP gateway this way.
/ip dns set servers=1.1.1.1,9.9.9.9Set upstream DNS serversThe router tries these before the dynamic servers it received from the ISP.
/ip dns set allow-remote-requests=yesAnswer DNS queries from clientsOpens port 53 on every router address, so block it from the internet side.
/ip dns static add name=nas.lan address=192.168.88.20Add a local DNS nameA static entry is answered by the router itself, handy for devices in your network.
/ip dns cache printShow cached DNS answersAnswers stay cached for their time to live.
/ip dns cache flushEmpty the DNS cacheRun it after changing a record so old answers are not served.

DHCP 8

ShortcutWhat it does
/ip dhcp-client add interface=ether1Add a DHCP clientTypical for the port facing the ISP: address and network settings arrive from the upstream server.
/ip dhcp-client print detailShow the DHCP client leaseDisplays the lease that was obtained and the settings that came with it.
/ip dhcp-server setupRun the DHCP server wizardPrompts for each setting in turn and proposes values to confirm or change.
/ip pool add name=dhcp_pool0 ranges=192.168.88.2-192.168.88.254Create an address poolHolds the addresses to hand out; leave the router address outside the range.
/ip dhcp-server network add address=192.168.88.0/24 dns-server=192.168.88.1 gateway=192.168.88.1Define DHCP network settingsClients in this subnet are told the gateway and DNS server given here.
/ip dhcp-server add address-pool=dhcp_pool0 interface=bridge1 name=dhcp1Add a DHCP serverLast manual step: the server runs on the interface and leases from the pool.
/ip dhcp-server lease printList DHCP leasesThe D flag marks dynamic leases, and the status column shows which are bound.
/ip dhcp-server lease make-static 0Make a lease staticConverts dynamic lease number 0; a rate limit can be set on static leases only.

Firewall and NAT 14

ShortcutWhat it does
/ip firewall filter printList firewall filter rulesNumbers each rule and flags the disabled, invalid and dynamic ones.
/ip firewall filter add action=accept chain=input connection-state=established,relatedAccept established connectionsThe manual opens every rule set with it, so known connections are accepted first.
/ip firewall address-list add address=192.168.88.2-192.168.88.254 list=allowed_to_routerCreate an address listPuts an address range under one name that filter rules can match.
/ip firewall filter add action=accept chain=input src-address-list=allowed_to_routerAccept a trusted address listOnly sources on the named list may open new connections to the router.
/ip firewall filter add action=accept chain=input protocol=icmpAccept ICMP to the routerKeeps ping to the router working from any address.
/ip firewall filter add action=drop chain=inputDrop all other inputGoes last: whatever the earlier input rules did not accept is discarded.
/ip firewall filter add chain=input in-interface-list=WAN protocol=udp dst-port=53 action=dropDrop DNS queries from WANKeeps the router from being an open resolver; a second rule does it for protocol=tcp.
/ip firewall filter add chain=forward action=fasttrack-connection connection-state=established,relatedFastTrack established connectionsBelongs at the top of the filter, and needs the matching accept rule after it.
/ip firewall filter add chain=forward action=accept connection-state=established,relatedAccept established forwardingThe companion that the FastTrack rule requires.
/ip firewall filter add chain=forward place-before=[find where comment=CommentX]Insert a rule before anotherLooks the target up by its comment and puts the new rule in front of it.
/ip firewall nat add chain=srcnat out-interface=ether1 action=masqueradeMasquerade outgoing trafficPrivate source addresses are replaced by the public one; name the real WAN interface, such as a PPPoE or LTE one.
/ip firewall nat add chain=srcnat out-interface-list=WAN ipsec-policy=out,none action=masqueradeMasquerade by interface listUses the WAN list in place of one port name, which the manual calls more flexible.
/ip firewall nat add chain=srcnat src-address=10.0.0.0/24 action=src-nat to-addresses=172.16.16.1 out-interface=WANSource NAT to a fixed addressHides the 10.0.0.0/24 network behind one public IP; masquerade suits addresses that change.
/ip firewall nat add chain=dstnat action=dst-nat protocol=tcp dst-port=3389 to-addresses=192.168.88.254 to-ports=3389Port-forward to a LAN hostSends incoming TCP 3389 to the internal PC; a strict filter must also allow it in the forward chain.

Interfaces and bridges 14

ShortcutWhat it does
/interface printList interfacesShows name, type and MTU with flags for disabled, dynamic and running.
/interface print statsShow interface countersByte and packet totals per interface, plus transmit queue drops.
/interface print stats-detailShow detailed interface countersAdds link-down counts and the times of the last link changes.
/interface monitor-traffic [find]Watch live traffic ratesPacket and bit rates of every interface side by side, refreshed in real time.
/interface set X disabled=yesDisable an unused interfaceX stands for the number the interface has in the print output.
/interface list add name=WANCreate an interface listA named group of interfaces that NAT and firewall rules can refer to.
/interface list member add list=WAN interface=ether1Add an interface to a listEvery external interface goes into the WAN list.
/interface bridge add name=bridge1Create a bridgeFirst step of a manual setup, before ports and an IP address are attached.
/interface bridge port add interface=ether2 bridge=bridge1Add a port to a bridgeMakes ether2 a member; wireless interfaces need the same step to give LAN access.
/interface bridge port printList bridge portsFlags show which ports are inactive, dynamic or hardware-offloaded.
/interface bridge port move 3 0Move a bridge port entryEntry 3 is placed in front of entry 0.
/interface bridge host print where !localShow learned MAC addressesThe host table without local entries; with VLAN filtering on, each address also shows its VLAN ID.
/interface bridge vlan printShow the bridge VLAN table
/interface bridge set bridge1 vlan-filtering=yesEnable VLAN filteringDo it last, once every VLAN setting is in place.

System 23

ShortcutWhat it does
/system resource printShow system resourcesUptime, RouterOS version, memory and disk usage in one overview.
/system identity set name=Riga-Office-GWSet the router nameThe name appears in the prompt, in neighbor discovery and as the SNMP system name; 64 characters at most.
/system identity printShow the router name
/system clock printShow date and timeAlso reports the time zone, the GMT offset in use and whether daylight saving is active.
/system clock set date=2026-10-01Set the date manuallySet the date first; the time goes in a command of its own.
/system clock set time=10:00:00Set the time manuallyRun it after the date command, never combined with it.
/system clock set time-zone-autodetect=no time-zone-name=Europe/RigaSet the time zoneSwitches automatic detection off and selects a named zone, the choice the manual prefers.
/system ntp client set enabled=yes servers=192.168.88.1Enable the NTP clientThe router clock is then synchronized with the listed server or servers.
/system package printList installed packagesFlags mark disabled packages and those available on the server but not downloaded.
/system package update set channel=stableChoose the update channelThe same command sets the download protocol, IP version and certificate check.
/system package update check-for-updatesCheck for a new versionQueries the MikroTik upgrade servers on the configured channel.
/system package update installInstall the available updateThe scheduled script from the manual runs it when the status reports a new version.
/system package update install ignore-missingUpdate despite missing packagesSkips a package whose upgrade file is no longer available.
/system package enable gps,zerotier,containerEnable extra packagesOnly scheduled at first; apply-changes carries it out.
/system package uninstall gps,containerUninstall packagesScheduled like other package changes and carried out by apply-changes.
/system package unschedule containerCancel a scheduled package changeWithdraws a pending uninstall or disable before it is applied.
/system package apply-changesApply package changesAsks for confirmation, then reboots to carry out everything that was scheduled.
/system routerboard upgradeUpgrade the bootloaderRecommended after each RouterOS update; a reboot completes it.
/system rebootReboot the routerAsks for confirmation; uploaded package files are installed during the restart.
/system scheduler add name=nightly-backup start-time=03:00:00 interval=1d on-event=nightly-backupSchedule a daily scriptRuns the script called nightly-backup every day at 03:00.
/system scheduler print detailList scheduled tasksnext-run tells when an entry fires next, and run-count how often it ran since startup.
/system sup-outputCreate a supout.rif fileWrites the diagnostic file for MikroTik support and reports progress in percent.
/tool fetch url=https://download.mikrotik.com/routeros/7.16.1/routeros-7.16.1-arm.npkDownload a file to the routerFetch can pull packages from the MikroTik site, for example ahead of a local upgrade.

Users and services 19

ShortcutWhat it does
/user add name=myname password=mypassword group=fullAdd an administratorCreate an account with a name of your own before retiring the default admin.
/user disable adminDisable the default adminOne of two ways the manual retires the default account once a custom one exists.
/user remove adminDelete the default adminBest done after the replacement administrator has been verified to work.
/user group add name=managers policy=ssh,read,write,passwordCreate a user groupLists the policies its members get; users are then added to the group.
/user set john password="NewStrongPass456"Change another user passwordThe administrator route; users change their own with the password command.
/passwordChange your own passwordRuns interactively or on one line; the group needs the password policy.
/user expire-password johnForce a password changeThe user must choose a new password at the next login.
/user set john address=192.168.88.0/24Restrict a user by source addressLogins for this account are accepted from the given prefix only.
/user ssh-keys import public-key-file=mykey.pub user=johnImport an SSH public keyOnce a key is assigned, SSH stops accepting the password for that user.
/user active printShow logged-in sessionsLists who is connected, from which address and through which service.
/user active remove [find name=john-remote]Close a user sessionfind selects the sessions of that user and remove ends them.
/ip service print where dynamicShow listening portsDynamic entries are the ports that features listen on and the open connections to services.
/ip service disable telnet,ftp,www,apiDisable unused servicesSeveral management services can be named in one comma-separated list.
/ip service set ssh port=2200Change the SSH portA non-default port reduces exposure to automated brute-force attempts.
/ip service set winbox available-from=192.168.88.0/24Limit a service by sourceFirewall rules remain the preferred control, since they stop a connection before it reaches the service.
/ip ssh set strong-crypto=yesRequire strong SSH cryptoThe server stops offering the weaker ciphers, MACs and SHA-1 key exchanges.
/tool mac-server set allowed-interface-list=noneClose MAC server accessFirst of three commands the manual gives for shutting MAC-Telnet, MAC-WinBox and MAC-Ping in production.
/ip neighbor discovery-settings set discover-interface-list=noneTurn off neighbor discoveryStops the MikroTik discovery protocol on all interfaces.
/system ssh 192.168.88.1 user=lalaOpen SSH to another hostWithout user= the router logs in under the name of the current session.

Diagnostics 19

ShortcutWhat it does
/ping 8.8.8.8Ping an addressThe first connectivity test after WAN setup; a ping to a name then checks DNS.
/ping 1.1.1.1 count=3Send a fixed number of pingsStops after three requests and sums up sent, received, loss and round-trip times.
/tool ping address=159.148.147.251Ping with the full tool pathThe form the upgrade guide uses to check that the update server answers.
/ping 198.51.100.10 size=1500 do-not-fragment count=2Test the path MTUsize counts the whole IP packet; with do-not-fragment an oversized packet is refused, not split.
/ping 192.168.2.10 src-address=192.168.88.1 count=3Ping from a chosen sourceFor tests that must come from a LAN address, for example through an IPsec tunnel.
/ping 192.168.88.20 arp-ping=yes interface=bridge count=2ARP ping a local hostFinds hosts that drop ICMP: the reply shows the MAC address that answered.
/tool traceroute 198.51.100.10 count=3Trace the path to a hostThree rounds of probes with loss and round-trip statistics for each hop.
/tool traceroute server.example.com count=3 use-dns=yesTrace with host namesEach hop appears under its reverse DNS name where a record exists.
/tool traceroute 198.51.100.10 size=1500 do-not-fragment count=1Find the hop with smaller MTUThe router that cannot pass the full-size probe replies with a fragmentation error.
/tool traceroute 198.51.100.10 src-address=192.168.88.1Trace from a chosen sourceShows the path as traffic from that network sees it, routing rules included.
/tool torch bridgeWatch traffic on an interfaceLive flows grouped by address, protocol and port with their rates, until Ctrl + C.
/tool torch bridge src-address=192.168.88.21/32Watch one hostOn a LAN interface, select hosts with src-address, the far side of the interface.
/tool torch bridge ip-protocol=tcp port=443Watch one protocol or portport matches source or destination and takes a single value, not a list.
/tool sniffer quick interface=ether1 port=bootps,bootpc duration=10sWatch packets livePrints matching packets as they arrive without touching the sniffer settings; Q ends it early.
/tool sniffer start interface=bridge ip-address=192.168.88.50/32Start a packet captureAlways give a filter: an unfiltered capture takes everything and quickly fills the memory.
/tool sniffer stopStop the captureCaptured packets stay in memory for ten minutes or until the next start.
/tool sniffer save file-name=capture.pcapSave the capture to a fileThe file is pcapng whatever its extension, ready for Wireshark.
:put [:resolve mikrotik.com]Resolve a name on the routerTests the DNS lookup of the router itself.
/system telnet 159.148.147.251 port=443Test a TCP portA Connected line means the port is reachable; here it checks the update server.

Logs 10

ShortcutWhat it does
/log printShow the logEntries held in memory, oldest first; the default buffer keeps the newest 1000.
/log print where topics~"interface|dhcp"Filter the log by topicThe pattern after topics~ is matched against the topics of each entry; message~ does that for the text.
/log print follow-only where topics~"critical"Watch for failed loginsOnly new critical entries are printed, as they arrive.
SpacePrint a separator lineAvailable while a followed log print is running; Ctrl + C stops the watch.
/log print with-extra-info where message~"login failure"Show extra log fieldsAdds user, service and source address to login and firewall entries.
/log print without-pagingPrint the whole log at onceThe upgrade guide uses it to look for errors after a failed upgrade.
/log print where buffer=dhcpdebug file=dhcp-debugSave log entries to a fileWrites the entries of one buffer to a file before the debug rule is removed.
/log warning "syslog test"Write a test log entryCreates an entry yourself, for example to check that a syslog server receives the log.
/system logging add topics=info action=diskKeep the log on diskThe memory log is lost at reboot; add one such rule for each topic worth keeping.
/system logging add topics=dhcp,debug action=dhcpdebugLog debug messages of a topicSelects DHCP debug messages only and sends them to a separate memory buffer.

Notes

Paths, help and safe mode

RouterOS commands live in a menu tree. /ip route typed alone moves into that menu, .. goes up one level and / returns to the root; a full path such as /ip route print runs from anywhere. The v7 manual writes the same paths with slashes (/ip/route/print), and both spellings are accepted. Tab completes commands, arguments and item names, and F1 shows what can be typed at the cursor. Before a change that could cut your own connection, press F4 / Ctrl + X: in safe mode every change is undone if the session ends abnormally. Safe mode keeps about 100 actions and does not protect commands that reboot the router.

Exporting the configuration

/export prints the configuration as a script of RouterOS commands, readable and portable in a way a binary backup is not. export compact is the default and leaves out settings that match the defaults; export verbose writes every parameter and export terse writes each item as one full command per line. A file= argument saves an .rsc file on the router instead of printing, path= limits the export to chosen menus, and export show-sensitive includes the sensitive values that are hidden otherwise. System user passwords, installed certificates and SSH keys are never exported, so they must be set again after a restore.

Importing and resetting

import address.rsc runs a saved .rsc script from the root menu. Adding verbose=yes executes it line by line, and import test.rsc verbose=yes dry-run only simulates the run, which catches syntax errors in a hand-edited export; from-line starts at a given line and also needs verbose mode. /system reset-configuration takes the reset parameters: no-defaults=yes leaves the router empty instead of loading the default configuration, keep-users preserves the accounts, skip-backup=yes avoids writing an automatic backup first, and run-after-reset runs an .rsc file after the reset, which has to finish within two minutes.

Reading the current state

/interface print, /ip address print and /ip route print are the first three commands on an unfamiliar router; /ip firewall filter print lists the filter rules with their numbers and flags, and /system resource print shows uptime, memory, disk usage and the RouterOS version. Any print command accepts where for filtering, print detail for every property and print count-only for a plain count. Item numbers shown by print are valid only for the current session.

Questions

What is the difference between export and backup?

export writes a readable command script (.rsc) that can be edited and imported on another router; a backup is a binary file that also holds the MAC addresses and is meant to be loaded on the same device, on the same RouterOS version.

Why are passwords missing from my export?

Sensitive values are hidden by default; export show-sensitive includes them. System user passwords, installed certificates and SSH keys are never exported at all, so recreate them after an import.

How do I test an .rsc file before applying it?

Run the import with verbose=yes and dry-run, for example import test.rsc verbose=yes dry-run. The script is parsed, errors are reported with their line, and nothing is changed. dry-run works in verbose mode only.

How do I reset a router and apply my own configuration?

Upload the .rsc file, then run /system reset-configuration with no-defaults=yes and the run-after-reset parameter naming that file. The script must finish within two minutes or it fails with a runtime limit error.

Which key shows help in the RouterOS v7 console?

F1. It shows what can be typed at the cursor position, with explanations; pressing Tab twice gives the same choices in compact form. The login banner of v7 reads "Press F1 for help".

Is /ip address print the same as /ip/address/print?

Yes. The manual states that each word in a path can be separated by a space or by a slash. Its v7 pages print mostly the slash form, while this page uses spaces.

What does safe mode do in the RouterOS console?

F4 or Ctrl+X turns it on and the prompt shows SAFE. If the session then ends abnormally, for example because a change cut your connection, every change made in safe mode is undone. Leaving with Ctrl+D also undoes them, /quit does not.

Sources and checks

25 more source pages

Every row on this page was matched to a line in the documentation above on . A binding that could not be found there is not listed.

Found a wrong or missing key? Tell us and it gets checked against the source. How we verify describes the process and its limits.