Community discussions

MikroTik App
 
User avatar
Davis
Member Candidate
Member Candidate
Topic Author
Posts: 115
Joined: Mon Aug 01, 2011 12:27 pm
Location: Latvia, Riga
Contact:

Homemade USB to USB null modem for serial console access

Sun Feb 21, 2021 2:07 am

Although this is not very well known, MikroTik RouterOS supports several types of USB to serial adapters and some adapters are by default configured to act as serial console ports.

Serial console allows to access RouterOS command-line interface (just like SSH or Terminal tab in WinBox/WebFig over the network) if proper credentials (username and password) are known. It is an excellent way to recover a router if credentials are known, but the router is not accessible from the network (e.g. due to firewall or network misconfiguration). High-end MikroTik routers have dedicated RS-232 serial ports, but more simple routers usually have only USB ports (where USB to serial adapters can be plugged in).
A very simple option for accessing serial console on routers having USB ports is Woobm device.

Here I will describe another option - homemade USB to USB null modem cable with PL2303 USB-to-serial converter chips on both ends.
Model of USB to serial converter chip is very important here. Although RouterOS supports various such chips they are configured differently by default. For example FTDI FT232 USB-to-serial converter is supported by RouterOS, but is configured as USB cellular modem by default (automatically added under /port and /interface ppp-client). Probably some older 2G/3G modems used FT232 chips.
The Prolific PL2303 (that as mentioned here is used in Woobm) is configured as serial console by default (automatically added to /port with 115200 bps speed and to /system console when it is connected for the first time).
In my case I used PL2303HXD based USB to serial adapters from AliExpress (link, archived copy). I bought 2 adapters and connected them as follows (by desoldering the cable from one adapter and soldering end of other adapter's cable onto the circuit board):
  • GND to GND
  • RXD to TXD
  • TXD to RXD
  • RTS to CTS (probably not needed)
  • CTS to RTS (probably not needed)
  • +5V must NOT be connected (connecting any voltage/power supply lines can damage devices at one or both ends of the cable!)
Please note that signals from such adapters are not compatible with signals from RS-232 ports (the regular serial ports on routers and older PCs).
Please note that any power supply (voltage) lines (+5V, +3,3V, VCC, +3V3 etc.) must NOT be connected (connecting them might damage hardware on one or both ends of the USB-to-USB connection).
The maximum length of the cable might be very limited due to voltage levels, signaling type and cable quality (especially if there are sources of electromagnetic interference around). In my case 2m cable (both cables joined together) worked when doing the tests, however I shortened the cable to abound 1m (by removing one of the cables) in the final version (to be on the safe side).

For accessing the router over such cable on Windows PuTTY (Connection type: Serial; Serial line: the appropriate COM port - usually something ranging from COM1 to COM20; Speed: 115200) can be used.
On Linux a command like this can be used:
screen /dev/ttyUSB0 115200

P.S. Most likely factory made USB to USB null modem cables can be found on the Internet, however they don't seem to be very popular (and please note that for RouterOS serial console access cable with PL2303 chips should be used). I am actually a bit surprised that MikroTik doesn't manufacture such cables.

P.P.S. Tests were made on RouterOS 6.48.1 (latest at the moment). In many cases "risky" network configuration changes can be made less risky by using Safe Mode.
Last edited by Davis on Mon Feb 22, 2021 1:52 am, edited 1 time in total.
 
sindy
Forum Guru
Forum Guru
Posts: 6899
Joined: Mon Dec 04, 2017 9:19 pm

Re: Homemade USB to USB null modem for serial console access

Sun Feb 21, 2021 10:40 am

Thank you, a very useful info regarding different default treatment of different USB to serial chips in RouterOS. It explains why some people say it doesn't work out of the box and some (like me) have an opposite experience.

Other than that, what's the advantage as compared to a pair of "fully grown" USB to serial cables (with standard RS-232 connectors and signal voltages) with a "null-modem" box in between? Less space occupied in your service backpack? Or the total price?
Instead of writing novels, post /export hide-sensitive. Use find&replace in your favourite text editor to systematically replace all occurrences of each public IP address potentially identifying you by a distinctive pattern such as my.public.ip.1.
 
User avatar
Davis
Member Candidate
Member Candidate
Topic Author
Posts: 115
Joined: Mon Aug 01, 2011 12:27 pm
Location: Latvia, Riga
Contact:

Re: Homemade USB to USB null modem for serial console access

Mon Feb 22, 2021 2:58 am

Other than that, what's the advantage as compared to a pair of "fully grown" USB to serial cables (with standard RS-232 connectors and signal voltages) with a "null-modem" box in between? Less space occupied in your service backpack? Or the total price?
Apart from size and price/availability there aren't much advantages of homemade PL2303 USB-to-USB null modem cable in comparison with "full grown" USB to RS-232 converters (at least one of them PL2303 based) with RS-232 null modem cable.
The cable described in OP would also need an USB extension cord if the distance between router and computer would be more than 1 meter. A cable consisting of 2 USB cables with a circuit board box (containing both PL2303 chips) in the middle would have maximum length of 10 meters (2 times the 5 meter USB 2.0 limit) though.

Who is online

Users browsing this forum: Cablenut9, Lajci and 164 guests