Rinetd is a daemon program for redirecting TCP connections.

It is a single-process server that handles any number of connections to the address/port pairs specified in /etc/rinetd.conf
Because rinetd runs as a single process using non-blocking I/O, it is capable of redirecting a large number of connections without severely affecting the machine
This makes it practical to run services on machines inside the IP firewall.

Let's start the installation.

sudo apt update  
sudo apt install rinetd  

Now create a configuration file for rinetd, using the nano editor:

nano /etc/rinetd.conf  

At the end of the document we need to add lines: 12341 1234 12342 1234 12343 1234 12344 1234 12345 1234  
  • 1st column - IP listened to by rinetd
  • 2nd column - port listened to by rinetd
  • 3rd column - IP to which we redirect traffic
  • 4th column - port to which we redirect traffic from the port from the second column.

The values should be inserted without brackets and with spaces. For each connection you must add a different line, in order.

Next, we will restart the service:

service rinetd restart  

This completes the configuration.

Updated July 29, 2019