Groesbeek, view of the 'National Liberation Museum 1944-1945' in Groesbeek. © Ton Kersten
Fork me on GitHub

Portforwarding without IPtables

2008-10-14 (4) by Ton Kersten, tagged as old

Live's good and the problem is simple. Having a Linux server at home with two virtual machines running within VMware server, I would like to have a tunnel to the host OS and forward ports for smtp, imap, rdp and maybe some others.

I thought this could simply be solved with IPtables, but that turned out to be a big pain in the *ss. It didn't work as I wanted, I locked myself out several times and still it didn't do exactly as I wanted.

Telling a coworker of mine (Thanks Jacco) he stumbled on a simple tool, called rinetd. It can only do one thing, but does that very well. It can forward an incoming TCP port request to another machine on any port. The configuration is so simple, anybody can understand it, even I did.

My config looks like:

logfile /var/log/rinetd.log
logcommon
0.0.0.0   25 192.168.63.8   25
0.0.0.0   83 192.168.63.8   83
0.0.0.0  143 192.168.63.8  143
0.0.0.0 3389 192.168.63.2 3389

Start the daemon with this config file and everything works. Could not be easier.

To bad nobody maintains this, my version is dated 2003-04-13. Maybe I will, when time permits.

Take a look at the rinetd homepage and be amazed.

Comments