Last active
January 27, 2016 07:22
-
-
Save jsarenik/7037f580138efb02b60d to your computer and use it in GitHub Desktop.
IPv6
This file contains hidden or 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 | |
# | |
# https://tunnelbroker.net/tunnel_detail.php?tid=$TID | |
TID=1234567 | |
HEUSER=login | |
HEPASS=Update_Key_from_Tunnel_Details/Advanced | |
CHECK_DNS=you.dns.he.dynamically.updated.domain | |
URL="https://$HEUSER:[email protected]/nic/update?hostname=$TID" | |
if | |
CURR=$(nc ipv4.test-ipv6.com 79 | grep -Eo '[\.0-9]+$') | |
DNSA=$(dig +short -t A $CHECK_DNS @ns1.he.net) | |
test x"$CURR" = x"$DNSA" | |
then | |
echo Everything fine. | |
else | |
echo Setting current IPv4 tunnel endpoint to $CURR | |
wget -4 -O /dev/null -q "$URL" && echo done | |
fi |
This file contains hidden or 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 | |
# | |
# nohup /root/checkloop.sh </dev/null >/tmp/checkloop.log 2>&1 & | |
while | |
true | |
do | |
ping6 -qc1 www.google.com >/dev/null || /root/check.sh | |
sleep 5 | |
exec $0 | |
done |
This file contains hidden or 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
domain-needed | |
no-resolv | |
no-poll | |
no-hosts | |
address=/.dev/127.0.0.1 | |
server=8.8.8.8 | |
server=8.8.4.4 | |
cache-size=250 | |
# IPv4 | |
#dhcp-range=192.168.0.121, 192.168.0.221, 1w | |
#dhcp-option=option:router, 192.168.0.253 | |
#dhcp-option=option:ntp-server, 0.0.0.0 | |
#dhcp-option=option:dns-server, 0.0.0.0, 8.8.8.8, 8.8.4.4 | |
# IPv6 | |
#enable-ra | |
#dhcp-range=::100, ::400, constructor:eth0, slaac |
This file contains hidden or 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
auto lo | |
iface lo inet loopback | |
auto eth0 | |
iface eth0 inet static | |
address 192.168.0.120 | |
netmask 255.255.255.0 | |
gateway 192.168.0.253 | |
mtu 1492 |
This file contains hidden or 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
# Generated by ip6tables-save v1.4.21 on Sat Dec 26 20:50:33 2015 | |
*mangle | |
:PREROUTING ACCEPT [0:0] | |
:INPUT ACCEPT [0:0] | |
:FORWARD ACCEPT [0:0] | |
:OUTPUT ACCEPT [0:0] | |
:POSTROUTING ACCEPT [0:0] | |
-A FORWARD -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu | |
COMMIT | |
# Completed on Sat Dec 26 20:50:33 2015 |
This file contains hidden or 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 | |
devname=he-ipv6 | |
remote=216.66.86.122 | |
PREFIX=2001:470:6e:633: | |
PREFIX_NET=2001:470:6f:633: | |
MYIPV6=$PREFIX:2/64 | |
MTU=1460 | |
modprobe ipv6 | |
sysctl -w net.ipv6.conf.all.disable_ipv6=0 | |
test "$1" = "-d" && { | |
shift | |
sysctl -w net.ipv6.conf.all.disable_ipv6=1 | |
ip link list | grep -q $devname && ip t d $devname \ | |
&& echo tunnel deleted | |
/etc/init.d/radvd stop | |
exit | |
} | |
ip tunnel delete $devname | |
routedev=`ip -4 route show | sed -n 's/.*default via \([0-9\.]\+\) dev \([a-z0-9]\+\) .*/\2/p'` | |
local=`ip -4 r show | sed -n "/dev $routedev/s/.* src \([0-9\.]\+\) .*/\1/p" | sed 1q` | |
echo $local | |
/root/check.sh | |
sysctl -w net.ipv6.conf.all.forwarding=0 | |
sysctl -w net.ipv4.ip_forward=0 | |
test "$1" = "-e" && exit | |
ip link list | grep -q $devname || { | |
ip tunnel add $devname mode sit \ | |
remote $remote \ | |
local $local \ | |
ttl 255 | |
} | |
ip link set $devname up mtu $MTU | |
ip addr add $MYIPV6 dev $devname | |
ip route add ::/0 dev $devname | |
ip -f inet6 addr | |
ip address add $PREFIX_NET:1/64 dev $routedev | |
ip6tables-restore < /root/ip6tables.state | |
sysctl -w net.ipv4.ip_forward=1 | |
sysctl -w net.ipv6.conf.all.forwarding=1 | |
#/etc/init.d/radvd restart |
This file contains hidden or 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
interface eth0 | |
{ | |
AdvSendAdvert on; | |
AdvHomeAgentFlag off; | |
prefix ::/64 | |
{ | |
AdvOnLink on; | |
AdvAutonomous on; | |
AdvRouterAddr off; | |
}; | |
}; |
This file contains hidden or 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
ip -6 a a 2a00:1028:8b40:3d5a::fec0/64 dev eth0 | |
ip -6 r a default via fe80::1 dev eth0 mtu 1492 | |
#echo Setting up IPv6 | |
#/root/ipv6-he.sh -ra | |
#nohup /root/checkloop.sh </dev/null >/tmp/checkloop.log 2>&1 & |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ls -l /var/cache/apt
lrwxrwxrwx 1 root root 8 Jan 3 09:47 /var/cache/apt -> /tmp/apt