Skip to content

Instantly share code, notes, and snippets.

Last active Mar 7, 2020
What would you like to do?
Test 6in4 tunnel within single physical network
ip -6 route del fc00::/7 dev tun0
ip link del dum0
ip tunnel del tun0
sysctl -w net.ipv6.conf.all.forwarding=0
set -e
_ip4_local=$(hostname -I | cut -d' ' -f1)
echo "Working with local IPv4 address: $_ip4_local"
_ip4_remote="$(echo $_ip4_local | cut -d. -f1,2,3).??"
read -ei $_ip4_remote -p "Enter remote IP4 address: " _ip4_remote
_netid_local=$(hostname|md5sum|head -c 4)
sysctl -w net.ipv6.conf.all.forwarding=1
ip link add dum0 type dummy mtu 1480
ip addr add dev dum0 ${_ip6_dummy}/64
ip link set dum0 up
ip tunnel add tun0 mode sit local $_ip4_local remote $_ip4_remote
ip addr add dev tun0 ${_ip6_tunnel}/64
ip link set tun0 up
ip -6 route add fc00::/7 dev tun0
echo "Local dummy interface address: ${_ip6_dummy}"
# iperf test:
iperf -V --bind $_ip6_dummy --server
iperf -V --bind $_ip6_dummy --client <remote $_ip6_dummy> -d -t 300
# Tinyproxy (installed on the supporting host, not the host under test)
apt install tinyproxy
echo "Allow fc00::/7" >> /etc/tinyproxy/tinyproxy.conf
# Wget with proxy
export http_proxy="http://[$_ip6_remote]:8888"
export https_proxy="$http_proxy"
wget -v -O /dev/null <URL...>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment