Redirecting your filtered IP

Written by BiRU Monday, 14 November 2016 11:45

Print

Sometimes it's not possible to use a GRE tunnel because you don't have root access over your destination server, running a Windows based server or simply don't want to go through the possible headache of it.

This guide will show you how to still redirect traffic from your filtered IP to a destination server.

NOTE #1 - Please realize that you will not see the users real IP when they connect with this method. Alas, it's a shortcoming you'll have to live with until you're able to setup a proper tunnel.

NOTE #2 - This method only supports TCP ports.

Supported Operating Systems

All operating systems are supported since there's no configuring required on the destination server. Please remember if you're redirecting traffic to a residential connection, you'll probably have to forward ports on your home router.

Prerequisites

Setup

You'll need to install redir.

On Debian/Ubuntu:

apt-get install redir

On CentOS you need to download redir from http://pkgs.repoforge.org/redir/ Get the package that matches your version of distribution as well as architecture. As an example:

wget http://pkgs.repoforge.org/redir/redir-2.2.1-1.2.el5.rf.i386.rpm
rpm -i redir-2.2.1-1.2.el5.rf.i386.rpm

After that, setup is very straight forward and consists of a single command.

redir --laddr=BUYVM_FILTERED_IP --lport=PORT_TO_FORWARD_FROM --caddr=DESTINATION_IP --cport=DESTINATION_PORT &

As an example:

redir --laddr=209.141.39.10 --lport=25565 --caddr=1.2.3.4 --cport=25565 &

This will redirect the standard Minecraft port to destination 1.2.3.4

Now just update your DNS or give your users your filtered IP and you're set.

You may want to add the redir line to your /etc/rc.local so it starts up on reboot.