6to4 Script with NAT Support

Aus Wiki Net6.AT
Version vom 18. Oktober 2013, 06:52 Uhr von Gery (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „== Erstellen von „6to4 Script with NAT Support“ == === README === Free IPv6 Connectivity for Servers over 6to4 by using the Public Gateway of net6.at b…“)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Zur Navigation springen Zur Suche springen

Erstellen von „6to4 Script with NAT Support“

README

Free IPv6 Connectivity for Servers over 6to4 by using the Public Gateway of net6.at 
by TamCore (admin@united-irc.eu)  modified by Gery (gery@net6.at)
- NAT-Support
- Auto-Tunnel Setup for 6to4 Pseudo Tunnels.
Usage: ./6to4 <IPv4> <device> <NAT-IP>
    e.g.  ./6to4 88.198.153.170 6to4 192.168.0.123

EXPLAIN:

IPv4 = IP-Address of your internetaccess
device = the device name of your tunnel
NAT-IP = LAN IP of the Tunnel Host, if behind a NAT

Script

#!/bin/bash
# Free IPv6 Connectivity for Servers over 6to4 by using the Public Gateway of net6.at 
# by TamCore (admin@united-irc.eu)  modified by Gery (gery@net6.at)
echo "Free IPv6 Connectivity for Servers over 6to4 by using the Public Gateway of net6.at"
echo "by TamCore (admin@united-irc.eu)  modified by Gery (gery@net6.at)"
if [ "$UID" != "0" ] ; then
        echo "You must be root!"
        exit 1
fi
if [ "$1" ] ; then
        IP="$1"
else
        echo "Usage: $0 <ipv4> <device> <NATv4>"
        echo "NOTE: <ipv4> must be an valid IPv4 Address!"
        echo "NOTE: <device> you must enter a tunnel device name!"
        echo "NOTE: <NATv4> if no LAN IPv4 given. Real IPv4 want to be set!"
        exit 1
fi
if [ "$2" ] ; then
        DEV="$2"
else
        echo "Usage: $0 <ipv4> <device> <NATv4>"
        echo "NOTE: <ipv4> must be an valid IPv4 Address!"
        echo "NOTE: <device> you must enter a tunnel device name!"
        echo "NOTE: <NATv4> if no LAN IPv4 given. Real IPv4 want to be set!"
        exit 1
fi
if [ "$3" ] ; then
         NAT="$3"
else
         NAT="$1"
fi
if [ "$IP" == "" ] ; then
        echo "No valid IPv4 has been given to script! exiting..."
        exit 1
fi
if [ "$DEV" == "" ] ; then
        echo "No valid Device name has been entered! exiting..."
        exit 1
fi
 IP6=`printf $IP | sed 's/\./ /g'`
 IP6=`printf "2002:%02x%02x:%02x%02x::1" $IP6`
 ip -6 route flush dev $DEV 2>/dev/null
 ip link set dev $DEV down 2>/dev/null
 ip tunnel del $DEV 2>/dev/null
 ip tunnel add $DEV mode sit ttl 64 remote any local $NAT
 ip link set $DEV up
 ip -6 addr add $IP6/48 dev $DEV
 ip -6 route add 2000::/3 via ::88.198.153.170 dev $DEV
 ip ad li $DEV
 echo "Your IPv4 IP: $IP"
 echo "Your IPv4 LAN: $NAT"
 echo "Your IPv6 IP: $IP6"

direkter Download

folgt in Kürze