Template:Netvorking Creating Bidirectional communication between two serial devices over TCP/IP

From Teltonika Networks Wiki

Introduction

This article contains step-by-step instructions on how to set up bidirectional communication between two serial RS 232 devices over TCP/IP.

Prerequisites

You will need:

  • Two RUT955 devices with Public IP
  • Two end devices (PCs or RS232 devices able to send and receive data, here we will be using PCs with serial simulators)

Topology

End devices are connected to separate RUT955 routers through RS232 connection, and routers communicate to each other through ISP with Public IPs.

RUT955 configurations

When configuring routers in a way that devices connected through serial port, in this example two computers using RS232, could communicate with each other, acting as both, Master and Slave, you only need to configure section in Services > RS232/RS485 > RS232 section, configuration on both devices is almost identical except Client and Server part, where they are reversed.

  1. Enable Serial port
  2. Configure Serial port in accordance to connected device, these should match on both routers to avoid miscommunication
  3. Serial Type must be Over IP and protocol must match either TCP or UDP
  4. Mode Bidirect – lets device act as both Server and a Client
  5. Server address is other routers IP, in this example we are using Public IPs, it also works with Private IPs if routers are in same LAN
  6. Port used by Router1 to connect to server will be used as TCP port for Router2 and vice versa
  7. TCP port used by Router1 will be used by Router2 to connect to server and vice versa.

Add allowed interfaces

After finishing serial port configuration add interfaces through which routers will be communicating, You can add IP address that will be allowed to connect or enter 0.0.0.0/0 to allow all connections coming through correct port.

Testing configuration

If you followed configuration steps both end devices should be able to send and receive data from each other. In this example we use Hercules program on both computers and open serial communication with routers. Both of them are able to send and receive data through RS232 from other device.