You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Overview

After successful RouterOS software instalation (if it was needed) it is time to access the router for the first time. There are various ways how to connect to it:

  • Accessing Command Line Interface (CLI) via Telnet, ssh, serial cable or even keyboard and monitor if router has VGA card.
  • MAC Telnet
  • Accessing Web based GUI (WebFig)
  • Using WinBox configuration utility
  • Using mobile utility (TikApp)

Normally you connect to the router by IP addresses with any telnet or SSH client software (a simple text-mode telnet client is usually called telnet and is distributed together with almost any OS).

MAC-telnet is used to connect to a router when there is no other way to connect to it remotely if the router has no IP address or in case of misconfigured firewall. MAC-telnet can only be used from the same broadcast domain (so there should be no routers in between) as any of the router's enabled interfaces (you can not connect to a disabled interface). MAC-telnet program is a part of the Neighbor Viewer. Download it from www.mikrotik.com, unpack both files contained in the archive to the same directory, and run NeighborViewer.exe. A list of MikroTik routers working in the same broadcast domain will be showed double-click the one you need to connect to. Note that Winbox is also able to connect to routers by their MAC addresses, and has the discovery tool built-in.

You can also connect to the router using a standard DB9 serial null-modem cable from any PC. Default settings of the router's serial port are 9600 bits/s (for RouterBOARD 500 series - 115200 bits/s), 8 data bits, 1 stop bit, no parity, hardware (RTS/CTS) flow control. Use terminal emulation program (like HyperTerminal or SecureCRT in Windows, or minicom in UNIX/Linux) to connect to the router. The router will beep twice when booted up, and you should see the login prompt shortly before that (check cabling and serial port settings if you do not see anything in the terminal window).

When logging into the router via terminal console, you will be presented with the MikroTik RouterOS™ login prompt. Use 'admin' and no password (hit [Enter]) for logging in the router for the first time, for example:

MikroTik v7.0
Login: admin
Password:

The password can be changed with the /password command.

[admin@MikroTik] > password
old password:
new password: ************
retype new password: ************

Winbox


TikApp

TikApp is a small mobile utility (currently only on Android platform) that allows administration of Mikrotik RouterOS using the same features as WinBox including neighbor discovery and MAC connection.

Webfig

WebFig is a web based RouterOS utility which allows you to monitor, configure and troubleshoot the router. It is designed as an alternative of WinBox, both have similar layouts and both have access to almost any feature of RouterOS.

WebFig is accessible directly from the router which means that there is no need to install additional software (except web browser with JavaScript support, of course).

As Webfig is platform independent, it can be used to configure router directly from various mobile devices without need of a software developed for specific platform.

Command Line Interface

The console is used for accessing the MikroTik Router's configuration and management features using text terminals, either remotely using serial port, telnet, SSH or console screen within Winbox, or directly using monitor and keyboard. The console is also used for writing scripts. This manual describes the general console operation principles. Please consult the Scripting Manual on some advanced console commands and on how to write scripts.

Login Options

Console login options enables or disables various console features like color, terminal detection and many other.

Additional login parameters can be appended to login name after '+' sign.

    login_name ::= user_name [ '+' parameters ]
    parameters ::= parameter [ parameters ]
    parameter ::= [ number ] 'a'..'z'
    number ::= '0'..'9' [ number ]
  

If parameter is not present, then default value is used. If number is not present then implicit value of parameter is used.

Example: admin+c80w - will disable console colors and set terminal width to 80.

ParamDefaultImplicitDescription
"w"autoautoSet terminal width
"h"autoautoSet terminal height
"c"onoffdisable/enable console colors
"t"onoffdDo auto detection of terminal capabilities
"e"onoffEnables "dumb" terminal mode

Banner and Messages

Login process will display MikroTik banner and short help after validating user name and password.

  MMM      MMM       KKK                          TTTTTTTTTTT      KKK
  MMMM    MMMM       KKK                          TTTTTTTTTTT      KKK
  MMM MMMM MMM  III  KKK  KKK  RRRRRR     OOOOOO      TTT     III  KKK  KKK
  MMM  MM  MMM  III  KKKKK     RRR  RRR  OOO  OOO     TTT     III  KKKKK
  MMM      MMM  III  KKK KKK   RRRRRR    OOO  OOO     TTT     III  KKK KKK
  MMM      MMM  III  KKK  KKK  RRR  RRR   OOOOOO      TTT     III  KKK  KKK

  MikroTik RouterOS 6.22 (c) 1999-2014       https://www.mikrotik.com/

[?]             Gives the list of available commands
command [?]     Gives help on the command and list of arguments

[Tab]           Completes the command/word. If the input is ambiguous,
                a second [Tab] gives possible options

/               Move up to base level
..              Move up one level
/command        Use command at the base level
  

After the banner can be printed other important information, like system note set by another admin, last few crytical log messages, demo version upgrade reminder and default configuration description.

For example, demo license prompt and last crytical messages are printed

UPGRADE NOW FOR FULL SUPPORT
----------------------------
FULL SUPPORT benefits:
- receive technical support
- one year feature support
- one year online upgrades
    (avoid re-installation and re-configuring your router)
To upgrade, register your license "software ID"
on our account server www.mikrotik.com

Current installation "software ID": ABCD-456

Please press "Enter" to continue!


dec/10/2007 10:40:06 system,error,critical login failure for user root from 10.0.0.1 via telnet
dec/10/2007 10:40:07 system,error,critical login failure for user root from 10.0.0.1 via telnet
dec/10/2007 10:40:09 system,error,critical login failure for user test from 10.0.0.1 via telnet
  

Command Prompt

At the end of successful login sequence login process prints banner, shows command prompt and hands over control to the user.

Default command prompt, consists of user name, system identity, and current command path />

For example, change current path from root to interface then go back to root

  [admin@MikroTik] > interface [enter]
  [admin@MikroTik] /interface> / [enter]
  [admin@MikroTik] >
  

Use up arrow to recall previous commands from command history, TAB key to automatically complete words in the command you are typing, ENTER key to execute command, Control-C to interrupt currently running command and return to prompt and ? to display built-in help.

Easiest way to log out of console is to press Control-D at the command prompt while command line is empty (You can cancel current command and get an empty line with Control-C, so Control-C followed by Control-D will log you out in most cases).

It is possible to write commands that consist of multiple lines. When entered line is not a complete command and more input is expected, console shows continuation prompt that lists all open parentheses, braces, brackets and quotes, and also trailing backslash if previous line ended with backslash-whitespace.

    [admin@MikroTik] > {
    {... :put (\
    {(\... 1+2)}
    3
  

When you are editing such multiple line entry, prompt shows number of current line and total line count instead of usual username and system name.

line 2 of 3> :put (\

Sometimes commands ask for additional input from user. For example, command '/password' asks for old and new passwords. In such cases prompt shows name of requested value, followed by colon and space.

    [admin@MikroTik] > /password
    old password: ******
    new password: **********
    retype new password: **********
  

Hierarchy

The console allows configuration of the router's settings using text commands. Since there is a lot of available commands, they are split into groups organized in a way of hierarchical menu levels. The name of a menu level reflects the configuration information accessible in the relevant section.

For example, you can issue the /ip route print command:

[admin@MikroTik] > ip route print
Flags: X - disabled, A - active, D - dynamic,
C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme,
B - blackhole, U - unreachable, P - prohibit
#      DST-ADDRESS        PREF-SRC        G GATEWAY         DIS INTE...
0 A S  0.0.0.0/0                          r 10.0.3.1        1   bridge1
1 ADC  1.0.1.0/24         1.0.1.1                           0   bridge1
2 ADC  1.0.2.0/24         1.0.2.1                           0   ether3
3 ADC  10.0.3.0/24        10.0.3.144                        0   bridge1
4 ADC  10.10.10.0/24      10.10.10.1                        0   wlan1
[admin@MikroTik] >
  

Instead of typing ip route path before each command, the path can be typed only once to move into this particular branch of menu hierarchy. Thus, the example above could also be executed like this:

[admin@MikroTik] > ip route
[admin@MikroTik] ip route> print
Flags: X - disabled, A - active, D - dynamic,
C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme,
B - blackhole, U - unreachable, P - prohibit
#      DST-ADDRESS        PREF-SRC        G GATEWAY         DIS INTE...
0 A S  0.0.0.0/0                          r 10.0.3.1        1   bridge1
1 ADC  1.0.1.0/24         1.0.1.1                           0   bridge1
2 ADC  1.0.2.0/24         1.0.2.1                           0   ether3
3 ADC  10.0.3.0/24        10.0.3.144                        0   bridge1
4 ADC  10.10.10.0/24      10.10.10.1                        0   wlan1
[admin@MikroTik] ip route>
  

Notice that the prompt changes in order to reflect where you are located in the menu hierarchy at the moment. To move to the top level again, type " / "

[admin@MikroTik] > ip route
[admin@MikroTik] ip route> /
[admin@MikroTik] >
  

To move up one command level, type " .. "

[admin@MikroTik] ip route> ..
[admin@MikroTik] ip>
  

You can also use / and .. to execute commands from other menu levels without changing the current level:

[admin@MikroTik] ip route> /ping 10.0.0.1
10.0.0.1 ping timeout
2 packets transmitted, 0 packets received, 100% packet loss
[admin@MikroTik] ip firewall nat> .. service-port print
Flags: X - disabled, I - invalid
#   NAME                                                                PORTS
0   ftp                                                                 21
1   tftp                                                                69
2   irc                                                                 6667
3   h323
4   sip
5   pptp
[admin@MikroTik] ip firewall nat>
  

Item Names and Numbers

Many of the command levels operate with arrays of items: interfaces, routes, users etc. Such arrays are displayed in similarly looking lists. All items in the list have an item number followed by flags and parameter values.

To change properties of an item, you have to use set command and specify name or number of the item.

Item Names

Some lists have items with specific names assigned to each of them. Examples are interface or user levels. There you can use item names instead of item numbers.

You do not have to use the print command before accessing items by their names, which, as opposed to numbers, are not assigned by the console internally, but are properties of the items. Thus, they would not change on their own. However, there are all kinds of obscure situations possible when several users are changing router's configuration at the same time. Generally, item names are more "stable" than the numbers, and also more informative, so you should prefer them to numbers when writing console scripts.

Item Numbers

Item numbers are assigned by the print command and are not constant - it is possible that two successive print commands will order items differently. But the results of last print commands are memorized and, thus, once assigned, item numbers can be used even after add, remove and move operations (since version 3, move operation does not renumber items). Item numbers are assigned on a per session basis, they will remain the same until you quit the console or until the next print command is executed. Also, numbers are assigned separately for every item list, so ip address print will not change numbering of the interface list.

You can specify multiple items as targets to some commands. Almost everywhere, where you can write the number of item, you can also write a list of numbers.

[admin@MikroTik] > interface print
Flags: X - disabled, D - dynamic, R - running
  #    NAME                 TYPE             MTU
  0  R ether1               ether            1500
  1  R ether2               ether            1500
  2  R ether3               ether            1500
  3  R ether4               ether            1500
[admin@MikroTik] > interface set 0,1,2 mtu=1460
[admin@MikroTik] > interface print
Flags: X - disabled, D - dynamic, R - running
  #    NAME                 TYPE             MTU
  0  R ether1               ether            1460
  1  R ether2               ether            1460
  2  R ether3               ether            1460
  3  R ether4               ether            1500
[admin@MikroTik] >
  

General Commands

There are some commands that are common to nearly all menu levels, namely: print, set, remove, add, find, get, export, enable, disable, comment, move. These commands have similar behavior throughout different menu levels.

PropertyDescription
addThis command usually has all the same arguments as set, except the item number argument. It adds a new item with the values you have specified, usually at the end of the item list, in places where the order of items is relevant. There are some required properties that you have to supply, such as the interface for a new address, while other properties are set to defaults unless you explicitly specify them.

Common Parameters

  • copy-from - Copies an existing item. It takes default values of new item's properties from another item. If you do not want to make exact copy, you can specify new values for some properties. When copying items that have names, you will usually have to give a new name to a copy
  • place-before - places a new item before an existing item with specified position. Thus, you do not need to use the move command after adding an item to the list
  • disabled - controls disabled/enabled state of the newly added item(-s)
  • comment - holds the description of a newly created item

Return Values

  • add command returns internal number of item it has added
editThis command is associated with the set command. It can be used to edit values of properties that contain large amount of text, such as scripts, but it works with all editable properties. Depending on the capabilities of the terminal, either a fullscreen editor, or a single line editor is launched to edit the value of the specified property.
findThe find command has the same arguments as set, plus the flag arguments like disabled or active that take values yes or no depending on the value of respective flag. To see all flags and their names, look at the top of print command's output. The find command returns internal numbers of all items that have the same values of arguments as specified.
moveChanges the order of items in list. Parameters:
  • first argument specifies the item(-s) being moved.
  • second argument specifies the item before which to place all items being moved (they are placed at the end of the list if the second argument is omitted).
printhows all information that\'s accessible from particular command level. Thus, /system clock print shows system date and time, /ip route print shows all routes etc. If there\'s a list of items in current level and they are not read-only, i.e. you can c hange/remove them (example of read-only item list is /system history, which shows history of executed actions), then print command also assigns numbers that are used by all commands that operate with items in this list.

Common Parameters:

  • from - show only specified items, in the same order in which they are given.
  • where - show only items that match specified criteria. The syntax of where property is similar to the find command.
  • brief - forces the print command to use tabular output form
  • detail - forces the print command to use property=value output form
  • count-only - shows the number of items
  • file - prints the contents of the specific submenu into a file on the router.
  • interval - updates the output from the print command for every interval seconds.
  • oid - prints the OID value for properties that are accessible from SNMP
  • without-paging - prints the output without stopping after each screenful.
removeRemoves specified item(-s) from a list.
setAllows you to change values of general parameters or item parameters. The set command has arguments with names corresponding to values you can change. Use ? or double Tab to see list of all arguments. If there is a list of items in this command level, then set has one action argument that accepts the number of item (or list of numbers) you wish to set up. This command does not return anything.


Input Modes

It is possible to switch between several input modes:

  • Normal mode - indicated by normla command prompt.
  • Safe mode - safe mode is indicated by a word SAFE after command prompt. In this mode configuration is saved to disk only after safe mod eis turned off. Safe mode can bet turned on/off with Ctrl+c
  • Hotlock mode - indicated by additional yellow >. Hotlock mode auto completes commands and can be turned on/off with Ctrl+v

List of Keys

KeyDescription
Control-Ckeyboard interrupt
Control-Dlog out (if input line is empty)
Control-Kclear from cursor to the end of line
Control-Xtoggle safe mode
Control-Vtoggle hotlock mode mode
F6toggle cellar
F1or?show context sensitive help. If the previous character is \, then inserts literal ?.
Tabperform line completion. When pressed second time, show possible completions.
Deleteremove character at cursor
Control-HorBackspaceremove character before cursor and move cursor back one position.
Control-\split line at cursor. Insert newline at cursor position. Display second of the two resulting lines.
Control-BorLeftmove cursor backwards one character
Control-ForRightmove cursor forward one character
Control-PorUpgo to previous line. If this is the first line of input then recall previous input from history.
Control-NorDowngo to next line. If this is the last line of input then recall next input from history
Control-AorHomemove cursor to the beginning of the line. If cursor is already at the beginning of the line, then go to the beginning of the first line of current input
Control-EorEndmove cursor to the end of line. If cursor is already at the end of line, then move it to the end of the last line of current input
Control-LorF5reset terminal and repaint screen
  • No labels