====== Serial Tunneling ======
===== Introduction =====
The NetModule Router serial port server can forward serial lines to virtual COM ports of a PCs. This allows you to remotely access to PLCs and other serial attached devices.
{{:app-notes:serial-tunneling1.png?nolink&400|}}
===== Configuration =====
==== Router ====
* Enable device server on serial line on NetModule Router
* Configure "TCP raw" as protocol on IP port in Port Settings
* Set port number to 2000 (default)
* Set serial port settings to your needs
{{:app-notes:serial_tunneling2.png?nolink&400|}}
==== On Windows ====
* Downlad and install the TCP to Serial Port software [[https://freecomportredirector.com/|https://freecomportredirector.com/]]
* Create connection
* Connect serial port to remote host (Client)
* Serial Port e.g. COM1
* Remote IP from the router, e.g. 192.168.1.1
* Port number 2000
Another example:
{{:app-notes:free-com-port-redirector.png?400|}}
===== Test =====
* Connect serial line of the computer to the NetModule router serial interface
* Configure the serial line of the NetModule Router
* Use Putty to connect to the virtual COM10 and test the Serial Port over IP connection
* Use Putty to connect to the COM port of the physical serial line of the PC with the same paramters
==== On Linux ====
The socat tool can be used to access the serial interface tunnel via the console using TCP.
The first command is for the connection between IP address and ser2net server on the router
~ $ socat PTY,link=/dev/"virtual interface",echo=0,wait-slave TCP:"IP-adresse":"port-nummer",retry=5
In a second console, the virtual interface is then used for the connection to the serial interface.
~ $ socat STDIO,raw,echo=0,escape=0x03 /dev/“virtual interface“,raw,echo=0
NB2700 login: root
Password:
________________________________________________________________________________
NB2700 (c) 2004-2023, NetModule AG
________________________________________________________________________________
BusyBox v1.30.1 (2023-07-31 14:09:01 UTC) built-in shell (ash)
~ $