Difference between revisions of "Manual:System/Serial Console"

From MikroTik Wiki
Jump to: navigation, search
(Serial Console access of a Routerboard)
 
Line 1: Line 1:
== Serial Console communication with Routerboard ==
+
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.
  
  
Mikrotik documentation combines references to “serial console” with reference to connecting a computer to a routerboard via a serial cable to access the Routerboard control console '''and''' in reference to connecting a routerboard via a serial cable to some other serial device to exchange information (EG: UPS Monitor).
+
====Specifications====
  
So, this article attempts to clarify how to access the control console of today’s routerboards via the serial port from a computer running serial communications software such as Hyper Terminal.
+
*Packages required: system
 +
*License required: Level1
 +
*Submenu level: /system console, /system serial-terminal
 +
*Standards and Technologies: RS-232
  
 +
====Description====
  
'''Serial Cable Description'''
+
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 should be used for connecting to the serial port of the Routerboard. Pin-outs are described in the Mikrotik v2.9.51 documentation under Remote Administration/Serial Console and Terminal
+
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:
  
'''Serial Communications Configuration'''
+
*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
  
Connect the '''Null-Modem''' Serial Cable to the Routerboard serial port and to the serial port of your computer.  
+
With the serial-terminal feature of the MikroTik, up to 132 (and, maybe, even more) devices can be monitored and controlled.
  
Configure Hyper Terminal (or other serial communication program) to the relevant serial port (EG: Com1, Com2) with the following serial communication parameters: '''115200 bits per second; 8 data bits; no parity, 1 stop bit, hardware flow control.'''
+
==Serial Console Configuration==
  
Some older Routerboards may require a configuration of '''9600 bits per second; 8 data bits; no parity, 1 stop bit, hardware flow control'''.
+
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:
 +
<div class=manual>
 +
<table class="styled_table" style="width: 500px">
 +
<tr><td>Router Side (DB9f)</td><td>Signal</td><td> Direction</td><td>Side (DB9f)</td></tr>
 +
<tr><td>1, 6</td><td> CD, DSR</td><td> IN</td><td> 4</td></tr>
 +
<tr><td>2</td><td> RxD</td><td> IN</td><td> 3</td></tr>
 +
<tr><td>3</td><td> TxD</td><td> OUT</td><td> 2</td></tr>
 +
<tr><td>4</td><td> DTR</td><td> OUT</td><td> 1, 6</td></tr>
 +
<tr><td>5</td><td> GND</td><td> - </td><td> 5</td></tr>
 +
<tr><td>7</td><td> RTS</td><td> OUT </td><td> 8</td></tr>
 +
<tr><td>8</td><td> CTS</td><td> IN</td><td> 7</td></tr>
  
After establishing serial communication you should be prompted for the Login Name and Password. If not, try hitting the “Enter” key to illicit the response from the Routerboard.
+
</table>
 +
</div>
  
 +
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:
  
'''Access Routerboard BIOS Configuration'''
 
  
To access Routerboard BIOS configuration, reboot the Routerboard while observing the activity on the Serial Console. You will see the following prompt on the Serial Console “Press any key within 2 seconds to enter setup” indicating that you have a 1 or 2 second window of time when pressing any key will give you access to Routerboard BIOS configuration options.
+
<div class=manual>
 +
<table class="styled_table" style="width: 500px">
 +
<tr><td>Router Side (DB9f)</td><td> Signal</td><td> Direction</td><td> Side (DB9f)</td></tr>
 +
<tr><td>1, 4, 6</td><td> CD, DTR, DSR</td><td> LOOP</td><td> 1, 4, 6</td></tr>
 +
<tr><td>2</td><td> RxD</td><td> IN</td><td> 3</td></tr>
 +
<tr><td>3</td><td> TxD</td><td> OUT</td><td> 2</td></tr>
 +
<tr><td>5</td><td> GND</td><td> -</td><td> 5</td></tr>
 +
<tr><td>7, 8</td><td> RTS, CTS</td><td> LOOP</td><td> 7, 8</td></tr>
 +
</table>
 +
</div>
  
Among other things, BIOS configuration access is required for NetInstall of software.
+
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.
 +
 
 +
==Configuring Console==
 +
 
 +
*'''Submenu level''': ''/system console''
 +
 
 +
====Property Description====
 +
 
 +
*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
 +
 
 +
====Example====
 +
 
 +
To disable all virtual consoles (available through the direct connection with keyboard and monitor) extept for the first one:
 +
 
 +
<pre>
 +
[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>
 +
</pre>
 +
 
 +
To check if the configuration of the serial port:
 +
 
 +
<pre>
 +
[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>
 +
</pre>
 +
 
 +
==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.
 +
 
 +
====Property Description====
 +
 
 +
*'''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]'''
 +
 
 +
====Example====
 +
 
 +
To connect to a device connected to the serial1 port:
 +
 
 +
<pre>
 +
[admin@MikroTik] system> serial-terminal serial1
 +
 
 +
[Type Ctrl-Q to return to console]
 +
[Ctrl-X is the prefix key]
 +
</pre>
 +
 
 +
==Console Screen==
 +
 
 +
*'''Submenu level''': ''/system console screen''
 +
 
 +
This facility is created to change line number per screen if you have a monitor connected to router.
 +
 
 +
====Property Description====
 +
 
 +
*'''line-count''' (25 | 40 | 50) - number of lines on monitor
 +
 
 +
This parameter is applied only to a monitor, connected to the router.
 +
 
 +
====Example====
 +
 
 +
To set monitor's resolution from 80x25 to 80x40:
 +
 
 +
<pre>
 +
[admin@MikroTik] system console screen> set line-count=40
 +
[admin@MikroTik] system console screen> print
 +
    line-count: 40
 +
[admin@MikroTik] system console screen>
 +
</pre>

Revision as of 10:56, 22 April 2009

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.


Specifications

  • Packages required: system
  • License required: Level1
  • Submenu level: /system console, /system serial-terminal
  • Standards and Technologies: RS-232

Description

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 DirectionSide (DB9f)
1, 6 CD, DSR IN 4
2 RxD IN 3
3 TxD OUT 2
4 DTR OUT 1, 6
5 GND - 5
7 RTS OUT 8
8 CTS IN 7

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
2 RxD IN 3
3 TxD OUT 2
5 GND - 5
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.

Configuring Console

  • Submenu level: /system console

Property Description

  • 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

Example

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.

Property Description

  • 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]

Example

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]

Console Screen

  • Submenu level: /system console screen

This facility is created to change line number per screen if you have a monitor connected to router.

Property Description

  • line-count (25 | 40 | 50) - number of lines on monitor

This parameter is applied only to a monitor, connected to the router.

Example

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>