ungleich-tools/openwrt/openwrt-add-jool-ipv4island.sh
2021-01-05 13:40:04 +01:00

31 lines
586 B
Bash
Executable file

#!/bin/sh
if [ $# -ne 3 ]; then
echo "$0 ip-address nat64-prefix"
echo " ip-address: where to find the OpenWRT device"
echo " nat64-prefix: which network to use for INCOMING NAT64 (often 2a0a:e5c1:XXX:b00::/96"
echo " ip4-address: where to map ipv6 traffic to (often: 192.168.1.42)"
exit 1
fi
my_ip=$1; shift
nat64_prefix=$1; shift
v4addr=$1; shift
cat <<EOF | ssh -t "root@${my_ip}"
set -x
opkg update
opkg install kmod-jool jool-tools
cat > /etc/rc.local << EO2
modprobe jool
jool -4 -a ${v4addr}
jool -6 ${nat64_prefix}
EO2
sh /etc/rc.local
EOF