Set up IPv4 to IPv6 portforwarder on vServer

To be used of you are behind a DS-Lite Cable/DSL-Connection and only have a fixed IPV6 (and a floating NATed IPv4).
Same service like offered by Universal Portmapper from e.g. feste-ip.net

Login as root
apt-get install 6tunnel

e.g. for OpenVPN running on remote host
6tunnel localport remotehost remoteport
6tunnel 1194 homeserver.remote 1194
or
6tunnel 10000 homeserver.remote 1194

Show running processes of 6tunnel
ps aux | grep 6tunnel

Create bootup-start/stop-script:
nano /etc/init.d/6tunnel
Insert:

#! /bin/sh
### BEGIN INIT INFO
# Provides: 6tunnel
# Required-Start: networking
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: 6tunnel server daemon
# Description: 6tunnel server daemon
### END INIT INFO

PARAM="/usr/bin/6tunnel 10000 homeserver.remote 1194"
USER="root"

start_daemon () {
start-stop-daemon --start --background --oknodo --chuid $USER --exec $PARAM
}

stop_daemon () {
start-stop-daemon --stop --name 6tunnel
}

# Switch case
case "$1" in
start)
# On start
echo "Start 6tunnel"
start_daemon
;;

stop)
# On stop
echo "Stop 6tunnel"
stop_daemon
;;

restart)
# On restart
echo "Restart 6tunnel"
start_daemon
stop_daemon
;;
*)
# Default action
echo "(start|stop|restart)"
;;
esac

exit 0

chmod +x /etc/init.d/6tunnel

Test with:
/etc/init.d/6tunnel start
netstat -tulpen
/etc/init.d/6tunnel stop

systemctl daemon-reload
systemctl enable 6tunnel

Advertisements

Leave a 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