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 RS232 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

To achieve communication between your devices, which are connected to routers through serial port, apply this configuration. In this example RS232 will act as both, Master and Slave. Configuration on both devices is almost identical except Client and Server part, where they are reversed. In order to find these settings in routers WebUI go to Services > RS232/RS485 > RS232

thumb]border

  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 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.