rinetd - another bouncer for TCP
Translation of the original in Catalan. Read it in: CatalàCastellano
In April 2007 I already talked about
which allowed doing the same as
. Obviously they have some functional differences; in my opinion rinetd is more professional since it integrates, from a configuration file, the possibility of redirecting a TCP port on any of the IPs that we are publishing on the host where the service is launched. In addition the configuration file already says everything you need to know about how it works:
# bindadress bindport connectaddress connectport
1.2.3.4 80 4.3.2.1 80
1.2.3.4 443 4.3.2.1 443
Some other features I have liked a lot are the possibility of making an ACL list of allowed and non-allowed IP ranges. As if that were not enough it supports
logging
. We can also find it as a package of the linux distributions: gentoo, ubuntu and debian. Maybe there are other distributions that have it but the truth is that I don't use them. I also take the opportunity to remind you that if you need to do things of this style with windows you can read this article:
Redirecting ports with Windows (Port Forwarding, DNAT, NAPT)
.
If you are familiar with iptables and want to do a redirection use a bit of ingenuity and you will be able to do it with rules as simple as this one:
YourIP=1.2.3.4
YourPort=80
TargetIP=2.3.4.5
TargetPort=22
iptables -t nat -A PREROUTING --dst $YourIP -p tcp --dport $YourPort -j DNAT --to-destination $TargetIP:$TargetPort
iptables -t nat -A POSTROUTING -p tcp --dst $TargetIP --dport $TargetPort -j SNAT --to-source $YourIP
iptables -t nat -A OUTPUT --dst $YourIP -p tcp --dport $YourPort -j DNAT --to-destination $TargetIP:$TargetPort