Skip to content

Instantly share code, notes, and snippets.

@Blaok
Last active December 28, 2016 03:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Blaok/3110f1b596aa732a94b8 to your computer and use it in GitHub Desktop.
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.
#!/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
@samos123
Copy link

Thanks! This solved my issues I was having with isatapd, not sure why yet though.

@Blaok
Copy link
Author

Blaok commented May 24, 2016

Glad that it helped :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment