Template:Netvorking Creating Bidirectional communication between two serial devices over TCP/IP
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
When configuring routers to allows devices connected through serial port, communicate with each other, in this example RS232, acting as both, Master and Slave, you only need to configure section in Services > RS232/RS485 > RS232. Configuration on both devices is almost identical except Client and Server part, where they are reversed.
- Enable Serial port
- Configure Serial port in accordance to connected device, these should match on both routers to avoid miscommunication
- Serial Type must be Over IP and protocol must match either TCP or UDP
- Mode Bidirect – lets device act as both Server and a Client
- 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
- Port used by Router1 to connect to server will be used as TCP port for Router2 and vice versa
- 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.