Redirect TCP connections with rinetd

rinetd is a simple little redirection server which can redirect TCP connections from one IP:port to another IP:port. rinetd is simple enough to set up and run. I came across this while searching for a solution to make clients on my LAN to connect to my DC hub server running inside a virtual machine.
Installation is straightforward, download the source from here

tar xvzf rinetd.tar.gz
cd rinetd
make
sudo make install

Now, heading on to setting up some basic rules in /etc/rinetd.conf. Forwarding rules follow the format below

bindaddress bindport connectaddress connectport

This says rinetd to redirect all connections from bindaddress:bindport to connectaddress:connectport. It is quite straightforward to add allow and deny rules as well (see the man pages). In my case, the IP of my virtual machine was 192.168.56.101 and the DC hub was running on port 411. The virtual machine was connected to the host via a host-only network. The host, i.e. my laptop is connected to a local area network and has an ip 192.168.135.12. Therefore, my /etc/rinetd.conf has

192.168.135.12 411 192.168.56.101 411

Start the server with

sudo rinetd

and the desired shall happen. 🙂

Advertisements

How did you feel about this post? Push in your reply!

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s