The Serial Console and Terminal are tools, used to communicate with devices and other systems that are interconnected via serial port. The serial terminal may be used to monitor and configure many devices - including modems, network devices (including MikroTik routers), and any device that can be connected to a serial (asynchronous) port.
- Packages required: system
- License required: Level1
- Submenu level: /system console, /system serial-terminal
- Standards and Technologies: RS-232
The Serial Console feature is for configuring direct-access configuration facilities (monitor/keyboard and serial port) that are mostly used for initial or recovery configuration.
If you do not plan to use a serial port for accessing another device or for data connection through a modem, you can configure it as a serial console. The first serial port is configured as a serial console, but you can choose to unconfigure it to free it for other applications. A free serial port can also be used to access other routers' (or other equipment, like switches) serial consoles from a MikroTik RouterOS router. A special null-modem cable is needed to connect two hosts (like, two PCs, or two routers; not modems). Note that a terminal emulation program (e.g., HyperTerminal on Windows or minicom on linux) is required to access the serial console from another computer.
Several customers have described situations where the Serial Terminal (managing side) feature would be useful:
- on a mountaintop, where a MikroTik wireless installation sits next to equipment (including switches and Cisco routers) that can not be managed in-band (by telnet through an IP network)
- monitoring weather-reporting equipment through a serial port
- connection to a high-speed microwave modem that needed to be monitored and managed by a serial connection
With the serial-terminal feature of the MikroTik, up to 132 (and, maybe, even more) devices can be monitored and controlled.
Serial Console Configuration
A special null-modem cable should be used for connecting to the serial console from another computer. The Serial Console cabling diagram for DB9 connectors is as follows:
|Router Side (DB9f)||Signal||Direction||Side (DB9f)|
|1, 6||CD, DSR||IN||4|
Note that the above diagram will not work if the software is configured to do hardware flow control, but the hardware does not support it (e.g., some RouterBOARD models have reduced seral port functionality). If this is the case, either turn off the hardware flow control or use a null-modem cable with loopback, which will simulate the other device's handshake signals with it's own. The diagram for such cable is as follows:
|Router Side (DB9f)||Signal||Direction||Side (DB9f)|
|1, 4, 6||CD, DTR, DSR||LOOP||1, 4, 6|
|7, 8||RTS, CTS||LOOP||7, 8|
Note that although it is recommended to have 5-wire cable for this connection, in many cases it is enough to have 3 wires (for unlooped signals only), leaving both loops to exist only inside the connectors. Other connection schemes exist as well.
- Submenu level: /system console
- enabled (yes | no; default: no) - whether serial console is enabled or not
- free (read-only: flag) - console is ready for use
- port (name; default: serial0) - which port should the serial terminal listen to
- term (text) - terminal type
- used (read-only: flag) - console is in use
- vcno (read-only: integer) - number of virtual console - [Alt]+[F1] represents '1', [Alt]+[F2] - '2', etc.
- wedged (read-only: flag) - console is currently not available
To disable all virtual consoles (available through the direct connection with keyboard and monitor) extept for the first one:
[admin@MikroTik] system console> print Flags: X - disabled, W - wedged, U - used, F - free # PORT VCNO TERM 0 F serial0 MyConsole 1 U 1 linux 2 F 2 linux 3 F 3 linux 4 F 4 linux 5 F 5 linux 6 F 6 linux 7 F 7 linux 8 F 8 linux [admin@MikroTik] system console> disable 2,3,4,5,6,7,8 [admin@MikroTik] system console> print Flags: X - disabled, W - wedged, U - used, F - free # PORT VCNO TERM 0 F serial0 MyConsole 1 U 1 linux 2 X 2 linux 3 X 3 linux 4 X 4 linux 5 X 5 linux 6 X 6 linux 7 X 7 linux 8 X 8 linux [admin@MikroTik] system console>
To check if the configuration of the serial port:
[admin@MikroTik] system serial-console> /port print detail 0 name=serial0 used-by=Serial Console baud-rate=9600 data-bits=8 parity=none stop-bits=1 flow-control=none 1 name=serial1 used-by="" baud-rate=9600 data-bits=8 parity=none stop-bits=1 flow-control=none [admin@MikroTik] system serial-console>
Using Serial Terminal
- Command name: /system serial-terminal
The command is used to communicate with devices and other systems that are connected to the router via serial port.
All keyboard input is forwarded to the serial port and all data from the port is output to the connected device. After exiting with [Ctrl]+[Q], the control signals of the port are lowered. The speed and other parameters of serial port may be configured in the /port directory of router console. No terminal translation on printed data is performed. It is possible to get the terminal in an unusable state by outputting sequences of inappropriate control characters or random data. Do not connect to devices at an incorrect speed and avoid dumping binary data.
- port (name) - port name to use
The serial port to be used as a serial terminal needs to be free (e.g., there should not be any serial consoles, LCD or other configuration). Chack the previous chapter to see how to disable serial console on a particular port. Use /port print command to see if some other application is still using the port.
[Ctrl]+[Q] and [Ctrl]+[X] have special meaning and are used to provide a possibility of exiting from nested serial-terminal sessions:
To send [Ctrl]+[X] to to serial port, press [Ctrl]+[X] [Ctrl]+[X]
To send [Ctrl]+[Q] to to serial port, press [Ctrl]+[X] [Ctrl]+[Q]
To connect to a device connected to the serial1 port:
[admin@MikroTik] system> serial-terminal serial1 [Type Ctrl-Q to return to console] [Ctrl-X is the prefix key]
- Submenu level: /system console screen
This facility is created to change line number per screen if you have a monitor connected to router.
- line-count (25 | 40 | 50) - number of lines on monitor
This parameter is applied only to a monitor, connected to the router.
To set monitor's resolution from 80x25 to 80x40:
[admin@MikroTik] system console screen> set line-count=40 [admin@MikroTik] system console screen> print line-count: 40 [admin@MikroTik] system console screen>