Last active
December 28, 2016 03:10
-
-
Save Blaok/3110f1b596aa732a94b8 to your computer and use it in GitHub Desktop.
Manual ISATAP setup script for Tsinghua University. Tested and used under Arch Linux @ Raspberry Pi.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Manual ISATAP setup script for Tsinghua University | |
# Tested and used under Arch Linux @ Raspberry Pi | |
V4_REMOTE="166.111.21.1" | |
V6_REMOTE="2402:f000:1:1501:200:5efe" | |
V6_LOCAL="fe80::200:5efe" | |
IFACE4=eth0 | |
IFACE6=isatap | |
IPF=/run/isatap.ip4 | |
case $1 in | |
start) | |
touch $IPF | |
CURRENT_IP4=`ip addr show dev $IFACE4 | sed -e's/^.*inet \([^ ]*\)\/.*$/\1/;t;d'` | |
PREVIOUS_IP4=`cat $IPF` | |
if [ "$CURRENT_IP4" != "$PREVIOUS_IP4" ]; then | |
ip tunnel add $IFACE6 mode sit remote $V4_REMOTE local $CURRENT_IP4 && | |
ifconfig $IFACE6 up && | |
ifconfig $IFACE6 add ${V6_LOCAL}:${CURRENT_IP4}/64 && | |
ifconfig $IFACE6 del fe80::${CURRENT_IP4}/64 && | |
ifconfig $IFACE6 add ${V6_REMOTE}:${CURRENT_IP4}/64 && | |
ip route add ::/0 via ${V6_REMOTE}:${V4_REMOTE} && | |
echo $CURRENT_IP4|tee $IPF | |
fi | |
;; | |
stop) | |
ip tunnel del $IFACE6 | |
rm $IPF;; | |
restart) $0 stop;$0 start;; | |
*) echo "Usage: $0 {start|stop|restart}" | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks! This solved my issues I was having with isatapd, not sure why yet though.