Table of Contents |
---|
You can also connect to the router using a standard DB9 or RJ45 serial null-modem cable from any PC. 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:
Code Block | ||||
---|---|---|---|---|
| ||||
MikroTik v7.0
Login: admin
Password: |
The password can be changed with the /password
command.
Code Block | ||||
---|---|---|---|---|
| ||||
[admin@MikroTik] > password
old password:
new password: ************
retype new password: ************ |
Overview
The Serial Console and Serial Terminal are tools, used to communicate with devices and other systems that are interconnected via the 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. 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 disable it to free the port 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 linuxLinux) is required to access the serial console from another computer. Default Default settings of the router's serial port are 115200 are 115200 bits/s (for x86 default is 9600 bits/s), 8 data bits, 1 stop bit, no parity, hardware (RTS/CTS) flow control.
...
With the serial-terminal feature of the MikroTik, up to 132 (and, maybe, even more) devices can be monitored and controlled.
Serial Console
...
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:
...
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:
...
Connections
Serial communications between devices are done with RS232, it is one of the oldest and most widely spread communication methods in the computer world. It was used for communication with the modems or other peripheral devices DTE/DCE. In the modern world, the main use of serial communication is DTE/DTE communication (Data Terminal Equipment) e.g. using a null-modem cable. There are several types of null modem cables and some of them may not work with RouterBoards at all.
Null Modem Without Handshake
This cable does not utilize handshake pins at all:
Side1 (DB9f) | Side2 (DB9f) | Function |
---|---|---|
2 | 3 | Rx ← Tx |
3 | 2 | Tx → Rx |
5 | 5 | GND |
It allows data-only traffic on the cross-connected Rx/Tx lines. Hardware flow control is not possible with this type of cable. The only way to perform flow control is with software flow control using the XOFF and XON characters.
Null Modem With Loopback Handshake
The problem with the first cable is when connected to a device on which hardware flow control is enabled software may hang when checking modem signal lines.
Null modem cable with loop back handshake fixes the problem, its main purpose is to fool well-defined software into thinking there is handshaking available:
Side1 (DB9f) | Side2 (DB9f) | Function |
---|---|---|
2 | 3 | Rx ← Tx |
3 | 2 | Tx → Rx |
5 | 5 | GND |
1+4+6 | - | DTR → CD + DSR |
- | 1+4+6 | DTR → CD + DSR |
7+8 | - | RTS → CTS |
- | 7+8 | RTS → CTS |
Hardware flow control is not possible with this cable. Also if remote software does not send its own ready signal to DTR output communication will hang.
Null Modem With Partial Handshake
This cable can be used when flow control enabled without being incompatible with the original way flow control was used with DTE/DCE communication.
This type of cable is not recommended for use with RouterOS.
Side1 (DB9f) | Side2 (DB9f) | Function |
---|---|---|
1 | 7+8 | RTS2 → CTS2 + CD1 |
2 | 3 | Rx ← Tx |
3 | 2 | Tx → Rx |
4 | 6 | DTR → DSR |
5 | 5 | GND |
6 | 4 | DSR ← DTR |
7+8 | 1 | RTS1 → CTS1 + CD2 |
Null Modem With Full Handshake
Used with special software and should not be used with RouterOS.
Side1 (DB9f) | Side2 (DB9f) | Function |
---|---|---|
2 | 3 | Rx ← Tx |
3 | 2 | Tx → Rx |
4 | 6 | DTR → DSR |
5 | 5 | GND |
6 | 4 | DSR ← DTR |
7 | 8 | RTS → CTS |
8 | 7 | CTS ← RTS |
Null Modem Compatibility
Summary tables below will allow you to choose the proper cable for your application.
No handshake | Loopback | Partial | Full handshake | |
---|---|---|---|---|
RouterBoards with limited port functionality | Y | Y | N* | N |
RouterBoards with full functionality | Y | Y | Y | N |
* - may work only when hardware flow control is disabled
No handshake | Loopback | Partial | Full handshake | |
---|---|---|---|---|
Software flow control only | Y | Y* | Y** | Y** |
Low-speed DTE/DCE compatible hardware flow control | N | Y | Y* | N |
High-speed DTE/DCE compatible hardware flow control | N | Y | Y** | N |
High speed communication using special software | N | N | Y* | Y |
* - will work as an alternative
** - will work but not recommendedNote 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, CCR2xxx and CRS series devices, sometimes called "Cisco style" serial port.
RJ45 to DB9 Cable Pinout:
Signal | Console Port (DTE) RJ-45 | RJ-45 Rolled Cable RJ-45 Pin | Adapter DB-9 Pin | Adapter DB-25 Pin | Signal |
---|---|---|---|---|---|
RTS | 1 | 8 | 8 | 5 | CTS |
DTR | 2 | 7 | 6 | 6 | DSR |
TxD | 3 | 6 | 2 | 3 | RxD |
Ground | 4 | 5 | 5 | 7 | Ground |
Ground | 5 | 4 | 5 | 7 | Ground |
RxD | 6 | 3 | 3 | 2 | TxD |
DSR | 7 | 2 | 4 | 20 | DTR |
CTS | 8 | 1 | 7 | 4 | RTS |
RB M33G
...
Additional Serial Header
For RBM33G additional serial header can be attached on GPIO pins U3_RXD, GND, U3_TXD, and 3V3
Note: 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 pin-out of that connector:
Serial Terminal Usage
RouterOS allows to communicate with devices and other systems that are connected to the router via the serial port using a /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 the 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):
Code Block | ||
---|---|---|
| ||
/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.
Warning |
---|
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:
|
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:
Code Block | ||
---|---|---|
| ||
/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
Code Block | ||
---|---|---|
| ||
/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:
Code Block | ||
---|---|---|
| ||
/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 the Ctrl-A character to a 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.
Warning |
---|
Do not connect to devices at an incorrect speed and avoid dumping binary data. |
Special Login
Special login can be used to access another device (like a switch, for example) that is connected through a serial cable by opening a telnet/ssh session that will get you directly on this device (without having to login to RouterOS first).
For demonstration we will use two RouterBoards and one PC.
Routers R1 and R2 are connected with serial cable and PC is connected to R1 via ethernet. Lets say we want to access router R2 via serial cable from our PC. To do this you have to set up serial interface proxy on R1. It can be done by feature called special-login.
Info |
---|
By default console is bound to serial port. |
First task is to unbind console from serial simply by disabling entry in /system console menu:
Code Block | ||
---|---|---|
| ||
[admin@MikroTik] /system console> print
Flags: X - disabled, U - used, F - free
# PORT TERM
0 X serial0 vt102 |
Next step is to add new user, in this case serial, and bind it to the serial port
Code Block | ||
---|---|---|
| ||
[admin@MikroTik] > /user add name=serial group=full
[admin@MikroTik] > /special-login add user=serial port=serial0 disabled=no
[admin@MikroTik] > /special-login print
Flags: X - disabled
# USER PORT
0 serial serial0 |
Now we are ready to access R2 from our PC.
Code Block | ||
---|---|---|
| ||
maris@bumba:/$ ssh serial@10.1.101.146
[Ctrl-A is the prefix key]
R2 4.0beta4
R2 Login:
[admin@R2] > |
To exit special login mode press Ctrl+A and Q
Code Block | ||
---|---|---|
| ||
[admin@MikroTik] >
[Q - quit connection] [B - send break]
[A - send Ctrl-A prefix] [R - autoconfigure rate]
Connection to 10.1.101.146 closed. |
Warning |
---|
After router reboot and serial cable attached router may stuck at Bootloader main menu |
To fix this problem you need to allow access bootloader main menu from <any> key to <delete>:
- enter bootloader menu
- press 'k' for boot key options
- press '2' to change key to <delete>
What do you want to configure?
d - boot delay
k - boot key
s - serial console
n - silent boot
o - boot device
u - cpu mode
f - cpu frequency
r - reset booter configuration
e - format nand
g - upgrade firmware
i - board info
p - boot protocol
b - booter options
t - call debug code
l - erase license
x - exit setup
your choice: k - boot key
Select key which will enter setup on boot:
* 1 - any key
2 - <Delete> key only
your choice: 2