OpenStackUsage: setup_6to4_fedora.sh

File setup_6to4_fedora.sh, 1000 bytes (added by ypap, 2 years ago)
Line 
1#!/bin/bash
2
3## Parameter: choose one interface that has IPv4 connectivity (possibly through a modem/router)
4interface="br0"
5
6
7echo "|---------------------------------|"
8echo "| IPv6to4 Setup script for Fedora |"
9echo "|---------------------------------|"
10
11echo "Getting IP info..."
12ipv4_internal=$(/sbin/ifconfig $interface | grep "inet " | awk '{print $2}')
13echo "Interface IP: $ipv4_internal"
14ipv4_external=$(curl -sf http://ipecho.net/plain; echo)
15echo "External (ISP) IP: $ipv4_external"
16ipv4to6addr=$(printf "2002:%02x%02x:%02x%02x::1" `echo $ipv4_external | tr "." " "`)
17echo "External 6to4 IP: $ipv4to6addr"
18
19echo "Check that the above IPs are correct and press Enter to continue..."
20read
21
22set -e
23echo "Setting up links and routes..."
24/sbin/ip tunnel add tun6to4 mode sit remote any local $ipv4_internal
25/sbin/ip link set dev tun6to4 up
26/sbin/ip -6 addr add "$ipv4to6addr/16" dev tun6to4
27/sbin/ip -6 route add 2000::/3 via ::192.88.99.1 dev tun6to4 metric 1
28echo "All set up, enjoy!"
29
30exit 0