Port Proxying with Rinetd
Rinetd redirects TCP connections from one IP address and port to another, with basic IP-based access control
Rinetd is a lightweight TCP proxy for VPS and dedicated servers that redirects traffic from one IP and port to another, ensuring stable operation of your services.
It runs as a single-process server, handling any number of connections to the address/port pairs specified in the /etc/rinetd.conf file. Since Rinetd operates as a single process using non-blocking I/O, it can forward a large number of connections without putting significant load on the machine. This makes it practical to run services on servers behind a firewall or with IP masking.
Let's start the installation:
sudo apt update
sudo apt install rinetd
Next, create the Rinetd configuration file using the nano editor:
nano /etc/rinetd.conf
At the end of the file, add the following lines:
85.85.85.85 12341 192.168.1.5 1234
85.85.85.85 12342 192.168.1.6 1234
85.85.85.85 12343 192.168.1.7 1234
85.85.85.85 12344 192.168.1.8 1234
85.85.85.85 12345 192.168.1.9 1234
- Column 1 — the IP that Rinetd listens on
- Column 2 — the port that Rinetd listens on
- Column 3 — the IP to which the traffic will be forwarded
- Column 4 — the port to which the traffic will be forwarded from the second column
Enter the values without brackets, separated by spaces. Add a separate line for each connection in order.
Then restart the service:
service rinetd restart
The setup is now complete.