Rinetd – redirects TCP connections from one IP address and port to another
Sponsored Link
Install rinetd in Ubuntu
sudo aptitude install rinetd
This will complete the installation
Configure rinetd
Once installed you'll find a configuration file located at /etc/rinetd.conf.By default no ports are configured for forwarding, and so the file will consist entirely of comments. A default configuration file would look something like this, to give you an idea of the configuration
#
# forwarding rules come here
#
# you may specify allow and deny rules after a specific forwarding rule
# to apply to only that forwarding rule
#
# bindadress bindport connectaddress connectport# logging information
logfile /var/log/rinetd.log# uncomment the following line if you want web-server style logfile format
# logcommon
rinetd example
Assume that you have a machine with the IP address 192.168.2.1 which has been running Apache, and that you'd like to move that to the IP address 192.168.2.3
You've already updated DNS to point visitors to the new IP address, but you want to ensure that people connecting to the old IP still continue to receive service.
To handle this example you should update the /etc/rinetd.conf file to read:
# bindadress bindport connectaddress connectport
192.168.2.1 80 192.168.2.3 80
192.168.2.1 443 192.168.2.3 443
Once you restart rinetd all incoming connections on port 80 and 443 will be seamlessly redirected from the old IP to the new one -- although you will need to restart rinetd after making the change to your configuration file.
sudo /etc/init.d/rinetd restart
Stopping internet redirection server: rinetd.
Starting internet redirection server: rinetd.
One more Example
Although responding on individual interfaces rather than on all interfaces is one of rinetd's primary features, sometimes it is preferable to respond on all IP addresses that belong to the server. In this situation, the special IP address 0.0.0.0 can be used. For example:
0.0.0.0 23 10.1.1.2 23
Would redirect all connections to port 23, for all IP addresses assigned to the server. This is the default behaviour for most other programs.
Thank u! Works fine!
`rein` tool. https://github.com/firstboot/rein
This program is used to efficiently redirect connections from one IP address/port combination to another.
It is useful when operating virtual servers, dockers, firewalls and the like. It was developed by golang.