summaryrefslogtreecommitdiff
path: root/ImmaeEu-up
blob: 95004f34bcf053d87527470e2b7ec07f5a9a0532 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/system/xbin/sh

SUBDOMAIN=$(cat /sdcard/.tinc/tinc_domaine | tr -c -d "[a-zA-Z0-9.]")

MYIPS=$(nslookup $SUBDOMAIN.immae.eu |sed -n "/$SUBDOMAIN.immae.eu/"',$p' | grep ^Address | sed -e "s/^[^:]*:[^0-9]*//" | tr '\n' ' ')
GWIP=$(nslookup vpn.immae.eu |sed -n "/vpn.immae.eu/"',$p' | grep ^Address | head -n1 | sed -e "s/^[^:]*:[^0-9]*//" | tr '\n' ' ')

echo -e "MYIPS=\"$MYIPS\"\nGWIP=\"$GWIP\"" > /sdcard/.tinc/vars
ip -6 link set vpn6 up mtu 1280
for MYIP in $MYIPS; do
	ip -6 addr add $MYIP/96 dev vpn6
done
ip -6 route add default via $GWIP