Pages

Sunday, June 29, 2014

Remote console with a Mikrotik

I was testing the remote console feature on my Mikrotik (RB951G-2HnD). Detailed information posted on Mikrotik wiki on Manual:Port.

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 Mikrotik is  easy , see the steps below.



PLUG IN THE USB-TO-SERIAL ADAPTER

As soon as you plug in the USB-to-Serial Adapter you will see all available port and how they are used.  



In case you need to change the baud rate to 115200 for example , use the commands below.
 port set usb1 baud-rate=115200   

Also check with the CLI command " system resource usb print" to see the vendor of the USB to serial adapter and tha transfer speeds.


REMOTE ACCCESS

Type the remote access command defining the USB port to be used  the RFC protocol and the TCP port.
 port remote-access add port=usb1 protocol=rfc2217 tcp-port=9999   

VERIFYING REMOTE ACCCESS

Connecting to the Mikrotik using port 9999 as defined earlier, will give me console access to the serial equipment I am connected to (switch DLS1).
 $ telnet 192.168.0.1 9999   
 Trying 192.168.0.1...   
 Connected to 192.168.0.1.   
 Escape character is '^]'.   
 DLS1>   



RESTRICTED REMOTE ACCCESS 

Issuing the remote access command again but this time restricting access to a specific the IP address pool will restrict access to specific IP addresses.
 port remote-access set numbers=0 port=usb1 allowed-addresses=192.168.0.8/30   





VERIFYING RESTRICTED REMOTE ACCCESS

Testing from a computer with IP address 192.168.0.99 , the connection will drop .
 $ telnet 192.168.0.1 9999   
 Trying 192.168.0.1...   
 Connected to 192.168.0.1.   
 Escape character is '^]'.   
 Connection closed by foreign host.  

No comments: