Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Summary

There are many ways how to use ports on the routers. Most obvious one is to use serial port for initial RouterOS configuration after installation (by default serial0 is used by serial-terminal).

Serial and USB ports can also be used to:

  • connect 3G modems;
  • connect to another device through a serial cable
  • access device connected to serial cable remotely.

General

Sub-menu: /port

Menu lists all available serial and USB ports on the router and allows to configure port parameters, like baud-rate, flow-control, etc.

Below you can see default port configuration on RB493. 

Code Block
languageros
[admin@RB493G] /port> print 
Flags: I - inactive 
# NAME CHANNELS USED-BY BAUD-RATE
0 serial0 1 serial-terminal 115200 


Note

List of the ports are maintained automatically by the RouterOS.

Properties

PropertyDescription
baud-rate (integer | auto; Default: auto)Baud rate (speed) used by the port. If set to auto, then RouterOS tries to detect baud rate automatically.
data-bits (7 | 8; Default: )The number of data bits in each character.
  • 7 - true ASCII
  • 8 - any data (matches the size of a byte)
dtr (on | off; Default: )Whether to enable RS-232 DTR signal circuit used by flow control.
flow-control (hardware | none | xon-xoff; Default: )method of flow control to pause and resume the transmission of data.
name (string; Default: )Name of the port.
parity (even | none | odd; Default: )Error detection method. If enabled, extra bit is sent to detect the communication errors. In most cases parity is set to none and errors are handled by the communication protocol.
rts (on | off; Default: )Whether to enable RS-232 RTS signal circuit used by flow control.
stop-bits (1 | 2; Default: )Stop bits sent after each character. Electronic devices usually uses 1 stop bit.

Read-only properties

PropertyDescription
channels (integer)Number of channels supported by the port.
inactive (yes | no)
line-state ()
used-by (string)Shows what is using current port. For example, by default Serial0 is used by serial-console.

Firmware

Sub-menu: /port firmware

This submenu allows to specify directory where drivers for 3g modems can be uploaded and used.

Remote Access

Sub-menu: /port remote-access

If you want to access serial device that can only talk to COM ports and is located somewhere else behind router, then you can use remote-access.

As defined in RFC 2217 RouterOS can transfer data from/to a serial device over TCP connection.

Enabling remote access on RouterOS is very easy: 

Code Block
languageros
/port remote-access add port=serial0 protocol=rfc2217 tcp-port=9999


Note

By default serial0 is used by serial-terminal. Without releasing the port, it cannot be used by remote-access or other services

Properties

PropertyDescription
allowed-addresses (IP address range; Default: 0.0.0.0/0)Range of IP addresses allowed to access port remotely.
channel (integer [0..4294967295]; Default: 0)Port channel that will be used. If port has only one channel then channel number should always be 0.
disabled (yes | no; Default: no)
local-address (IP address; Default: )IP address used as source address.
log-file (string; Default: "")Name of the file, where communication will be logged. By default logging is disabled.
port (string; Default: )Name of the port from Port list.
protocol (raw | rfc2217; Default: rfc2217)RFC 2217 defines a protocol to transfer data from/to a serial device over TCP. If set to raw, then data is sent to serial as is.
tcp-port (integer [1..65535]; Default: 0)TCP port on which to listen for incoming connections.

Read-only properties

PropertyDescription
active (yes | no)Whether remote access is active and ready to accept connection.
busy (yes | no)Whether port is currently busy.
inactive (yes | no)
logging-active (yes | no)Whether logging to file is currently running
remote-address (IP address)IP address of remote location that is currently connected.

/port

Serial ports

edit

Edit items

...

Item number

...

enum [baud-rate | data-bits | flow-control | name | parity | stop-bits]

...

Name of editable property
Enum parameters:
  • baud-rate - Baud rate (bits/s)

export

Print or save an export script that can be used to restore configuration

...

Type: switch
value: True

...

Only exports user-changed settings without defaults

...

Type: string

...

File name
Name of the file that will be stored in FTP access area.

...

Type: switch
value: True

...

Hides sensitive information like passwords from beeing printed

...

Type: switch
value: True

...

Creates export with output without line wraps

...

Type: switch
value: True

...

Creates output with all RouterOS settings (including the default ones)

find

Find items by value

...

Type: query_arg
query: True

...

Generates output depending on values supplied (used mainly for scripting)

get

Gets value of item's property

...

Item number

...

enum [baud-rate | channels | data-bits | device | flow-control | inactive | line-state | name | parity | stop-bits | used-by]

...

Name of the value you want to get
Enum parameters:
  • baud-rate - Baud rate (bits/s)

print

...

Type: switch
value: True

...

Controls if print to file overwrites or appends to content of an existing file

...

Type: switch
interesting: False
value: True

...

Prints out output as value (used in scripting)

...

Type: switch
value: True

...

Displays brief description

...

Type: switch
value: True

...

Shows only the count of special login users

...

Type: switch
sysc: 3
value: True

...

Type: switch
value: True

...

Displays detailed information

...

Type: string

...

Print the content of the submenu into specific file

...

Type: switch
value: True

...

Updates output in real-time

...

Type: switch
value: True

...

Will output changes that have occured after invoking command

...

Type: switch
value: True

...

Print parameters only from specified item

...

Displays information and refreshes it in selected time interval

...

Type: obj_arg
+arg: {'producer': 'enum_arg', 'sub': [{'key': '#mapping', 'value': {'producer': '', 'sub': [{'key': '', 'value': {'producer': 'const_mapping', 'sub': [{'key': 'data', 'value': {'producer': '', 'sub': [{'key': 'baud-rate', 'value': 4}, {'key': 'channels', 'value': 3}, {'key': 'data-bits', 'value': 5}, {'key': 'device', 'value': 2}, {'key': 'flow-control', 'value': 8}, {'key': 'inactive', 'value': 20}, {'key': 'line-state', 'value': 11}, {'key': 'name', 'value': 0}, {'key': 'parity', 'value': 6}, {'key': 'stop-bits', 'value': 7}, {'key': 'used-by', 'value': 1}]}}, {'key': 'help', 'value': {'producer': '', 'sub': [{'key': 0, 'value': 'New port name'}, {'key': 1, 'value': 'Shows the user of the port'}, {'key': 4, 'value': 'Baud rate (bits/s)'}, {'key': 5, 'value': 'Number of bits for data'}, {'key': 6, 'value': 'Parity'}, {'key': 7, 'value': 'Number of bits for control'}, {'key': 8, 'value': 'Type of flow control'}, {'key': 11, 'value': 'The name of signal'}, {'key': 20, 'value': 'Inactive port'}]}}]}}]}}, {'key': 'acc', 'value': {'producer': '"ufd0007"', 'sub': []}}, {'key': 'hint', 'value': 'Name of the value you want to get'}, {'key': 'setUnsetAcc', 'value': {'producer': '"bfd0008"', 'sub': []}}]}

...

Names of properties

...

Type: switch
value: True

...

Prints static IDs for selected submenu

...

Type: switch
value: True

...

Shows statistics on ports

...

Type: switch
interesting: False
value: True

...

Show details in compact and machine friendly format

...

Type: switch
interesting: False
value: True

...

Show properties one per line

...

Type: query_arg
query: True

...

Generates output depending on values supplied (used mainly for scripting)

...

Type: switch
value: True

...

Displays information in one piece

remove

Remove item

...

List of item numbers

set

Change item properties

...

enum [1000000 | 110 | 115200 | 1152000 | 1200 | 134 | 150 | 1500000 | 1800 | 19200 | 200 | 2000000 | 230400 | 2400 | 2500000 | 300 | 3000000 | 3500000 | 38400 | 4000000 | 460800 | 4800 | 50 | 500000 | 57600 | 576000 | 600 | 75 | 921600 | 9600]

...

Baud rate (bits/s)

...

enum [7 | 8]

...

Number of bits for data

...

enum [hardware | none | xon-xoff]

...

Type of flow control

...

Type: string

...

New port name

...

List of item numbers

...

enum [even | none | odd]

...

Parity

...

enum [1 | 2]

...

Number of bits for control

/port/remote-access

add

Create a new item

...

Type: ip_range_arg
acc1: {'producer': '"be u3"', 'sub': []}
acc2: {'producer': '"be u4"', 'sub': []}

...

ID of item to make a copy from

...

Defines whether item is ignored or used

...

Type: ipAddr

...

Type: string

...

enum [raw | rfc2217]

...

disable

Disable items

...

List of item numbers

edit

Edit items

...

Item number

...

enum [allowed-addresses | channel | local-address | log-file | port | protocol | tcp-port]

...

Name of editable property

enable

Enable items

...

List of item numbers

export

Print or save an export script that can be used to restore configuration

...

Type: switch
value: True

...

Only exports user-changed settings without defaults

...

Type: string

...

File name
Name of the file that will be stored in FTP access area.

...

Type: switch
value: True

...

Hides sensitive information like passwords from beeing printed

...

Type: switch
value: True

...

Creates export with output without line wraps

...

Type: switch
value: True

...

Creates output with all RouterOS settings (including the default ones)

find

Find items by value

...

Type: query_arg
query: True

...

Generates output depending on values supplied (used mainly for scripting)

get

Gets value of item's property

...

Item number

...

enum [active | allowed-addresses | busy | channel | disabled | inactive | local-address | log-file | logging-active | port | protocol | remote-address | tcp-port]

...

Name of the value you want to get

print

Print values of item properties

...

Type: switch
value: True

...

Controls if print to file overwrites or appends to content of an existing file

...

Type: switch
interesting: False
value: True

...

Prints out output as value (used in scripting)

...

Type: switch
value: True

...

Displays brief description

...

Type: switch
value: True

...

Shows only the count of special login users

...

Type: switch
sysc: 3
value: True

...

Type: switch
value: True

...

Displays detailed information

...

Type: string

...

Print the content of the submenu into specific file

...

Type: switch
value: True

...

Updates output in real-time

...

Type: switch
value: True

...

Will output changes that have occured after invoking command

...

Type: switch
value: True

...

Print parameters only from specified item

...

Displays information and refreshes it in selected time interval

...

Type: obj_arg
+arg: {'producer': 'enum_arg', 'sub': [{'key': '#mapping', 'value': {'producer': '', 'sub': [{'key': '', 'value': {'producer': 'const_mapping', 'sub': [{'key': 'data', 'value': {'producer': '', 'sub': [{'key': 'active', 'value': 17}, {'key': 'allowed-addresses', 'value': 2}, {'key': 'busy', 'value': 18}, {'key': 'channel', 'value': 1}, {'key': 'disabled', 'value': 20}, {'key': 'inactive', 'value': 16}, {'key': 'local-address', 'value': 3}, {'key': 'log-file', 'value': 6}, {'key': 'logging-active', 'value': 19}, {'key': 'port', 'value': 0}, {'key': 'protocol', 'value': 5}, {'key': 'remote-address', 'value': 7}, {'key': 'tcp-port', 'value': 4}]}}, {'key': 'help', 'value': {'producer': '', 'sub': [{'key': 20, 'value': 'Defines whether item is ignored or used'}]}}]}}]}}, {'key': 'acc', 'value': {'producer': '"ufd0007"', 'sub': []}}, {'key': 'hint', 'value': 'Name of the value you want to get'}, {'key': 'setUnsetAcc', 'value': {'producer': '"bfd0008"', 'sub': []}}]}

...

Names of properties

...

Type: switch
value: True

...

Prints static IDs for selected submenu

...

Type: switch
interesting: False
value: True

...

Show details in compact and machine friendly format

...

Type: switch
interesting: False
value: True

...

Show properties one per line

...

Type: query_arg
query: True

...

Generates output depending on values supplied (used mainly for scripting)

...

Type: switch
value: True

...

Displays information in one piece

remove

Remove item

...

List of item numbers

set

Change item properties

...

Type: ip_range_arg
acc1: {'producer': '"be u3"', 'sub': []}
acc2: {'producer': '"be u4"', 'sub': []}

...

Defines whether item is ignored or used

...

Type: ipAddr

...

Type: string

...

List of item numbers

...

enum [raw | rfc2217]

...

unset

Unsets and removes user-set value to specified submenu object
ParameterTypeDescriptionAdditional Notesnumbersarg_node
List of item numbers
value-name
enum [local-address]
Name of property that can be unset