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

Compare with Current View Page History

« Previous Version 7 Next »

In this article:

Overview

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.

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. 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. Default settings of the router's serial port are 115200 bits/s (for x86 default is 9600 bits/s), 8 data bits, 1 stop bit, no parity, hardware (RTS/CTS) flow control. 

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 Terminal Usage

RouterOS allows to communicate with devices and other systems that are connected to the router via serial port using /system serial-terminal  command. All keyboard input will be forwarded to the serial port and all data from the port is output to the connected device.

First you have to have a free serial port, if device has only one serial port (like all RouterBoards, WRAP/ALIX boards etc.) you will have to disable the system console on this serial port to be able to use it as Serial Terminal for connection to other equipment (switches, modems, etc):

/system console disable 0

Be sure to just disable the console rather than removing it, as RouterOS will recreate the console after the next reboot when you really remove it.

Note that there are some caveats you should be aware of! Take your time understanding those limits to avoid strange things to happen when connecting a device to a serial port on a RouterBoard:

  • By re-configuring port Serial0 on a RouterBoard as seen above, you will loose your serial console access to RouterOS. This means, that if you cannot access your RouterBoard over the network anymore, you might even have to reset the whole configuration of it to gain access again.
  • When rebooting a RouterBoard the boot loader (RouterBOOT) will always use the serial console (Serial0 on RouterBoards) to send out some startup messages and offer access to the RouterBOOT menu.

    Having text coming out of the serial port to the connected device might confuse your attached device. Furthermore in standard config you can enter RouterBOOT menu by pressing ANY key. So if your serial device sends any character to the serial port of your RouterBoard during boot time, the RouterBoard will enter the RouterBOOT menu and will NOT boot RouterOS unless you manually intervene!

    You can reconfigure RouterBOOT to enter the RouterBOOT menu only when a DEL character is received - use this to reduce the chance to get a router that's stuck when rebooting!

    Or if newer versions are used "Silent boot" feature can be used to suppress any output on the serial interface, including removal of booting sounds.



Next you will have to configure your serial port according to the serial port settings of the connected device. Using the following command you will set your serial port to 19200 Baud 8N1. What settings you need to use depends on the device you connect:

/port set serial0 baud-rate=19200 data-bits=8 parity=none stop-bits=1

You can also try to let RouterOS guess the needed baud rate by setting

/port set serial0 baud-rate=auto

Now's the time to connect your device if not already done. Usually you will have to use a null modem cable (the same thing as a cross-over-cable for Ethernet). Now we're ready to go:

/system serial-terminal serial0

This will give you access to the device you connected to port Serial0. Ctrl-A is the prefix key, which means that you will enter a small "menu". If you need to send Ctrl-A character to remote device, press Ctrl-A twice.

If you want to exit the connection to the serial device type Ctrl-A, then Q. This will return you to your RouterOS console.

Do not connect to devices at an incorrect speed and avoid dumping binary data.

Serial Console Connectors

A special null-modem cable should be used for connecting to the serial console from another computer.

DB9

The Serial Console cabling diagram for DB9 connectors is as follows:

Router Side (DB9f)SignalDirectionSide (DB9f)
1, 6CD, DSRIN4
2RxDIN3
3TxDOUT2
4DTROUT1, 6
5GND-5
7RTSOUT8
8CTSIN7


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 serial 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 a cable is as follows:



Router Side (DB9f)SignalDirectionSide (DB9f)
1, 4, 6CD, DTR, DSRLOOP1, 4, 6
2RxDIN3
3TxDOUT2
5GND-5
7, 8RTS, CTSLOOP7, 8


Note that although it is recommended to have a 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.

RJ45 Type Serial Port

This type of port is used on RouterBOARD 2011, 3011, 4011, CCR1072, CCR1036 r2 and CRS series devices, sometimes called "Cisco style" serial port.

RJ45 to DB9 Cable Pinout:



SignalConsole Port (DTE)
RJ-45
RJ-45 Rolled Cable
RJ-45 Pin
Adapter DB-9 PinAdapter DB-25 PinSignal
RTS1885CTS
DTR2766DSR
TxD3623RxD
Ground4557Ground
Ground5457Ground
RxD6332TxD
DSR72420DTR
CTS8174RTS

RB M33G Aditional Serial Header

For RBM33G additional serial header can be attached on GPIO pins U3_RXD, GND, U3_TXD, and 3V3

RouterOS 6.45.1+ and firmware are required!


CCR Serial Header

The Cloud Core Router series devices have a serial header on the PCB board, called J402 or 100

Here is the pinout of that connector:


  • No labels