openwrt/nat64: add stuff

This commit is contained in:
Nico Schottelius 2024-07-25 11:53:50 +02:00
parent a8bc794e47
commit c168fdc170

View file

@ -1,3 +1,4 @@
#!/bin/sh
# Nico Schottelius, 2024-07-22
# This script assumes a clean/newly setup openwrt device
@ -9,7 +10,7 @@
# - do not provide IPv4 or IPv6 dhcp/ra on any interface
if [ $# -lt 7 ] ; then
echo $0 "address hostname nat64prefix nat64route ipv4out asn routerid iBGPpeer1 [iBGPpeer2...]"
echo $0 "address hostname nat64prefix nat64route ipv4address ipv4gw asn routerid iBGPpeer1 [iBGPpeer2...]"
exit 1
fi
@ -17,7 +18,8 @@ address=$1; shift
hostname=$1; shift
nat64prefix=$1; shift
nat64route=$1; shift
ipv4out=$1; shift
ipv4address=$1; shift
ipv4gw=$1; shift
asn=$1; shift
routerid=$1; shift
ibgp_peers="$@"
@ -34,9 +36,20 @@ opkg install jool-tools-netfilter bird2 bird2c
# Do not announce ULA - we have GUA
uci delete network.globals.ula_prefix
# Remove IPv6 assign, we are using static IPv6
uci delete network.lan.ip6assign
# Disable firewalling effectively to allow traffic any direction
uci set firewall.@defaults[0].input=ACCEPT
uci set firewall.@defaults[0].forward=ACCEPT
# Set hostname
uci set system.@system[0].hostname="${hostname}"
# Set IPv4 address on LAN
uci set network.lan.ipaddr="${ipv4address}"
uci set network.lan.gateway="${ipv4gw}"
# Do something wireless (?)
# disable?
@ -83,15 +96,15 @@ cat >> /etc/jool/jool-nat64.conf.json <<BBB
"pool4": [
{
"protocol": "TCP",
"prefix": "${ipv4out}",
"prefix": "${ipv4address}",
"port range": "40001-65535"
}, {
"protocol": "UDP",
"prefix": "${ipv4out}",
"prefix": "${ipv4address}",
"port range": "40001-65535"
}, {
"protocol": "ICMP",
"prefix": "${ipv4out}",
"prefix": "${ipv4address}",
"port range": "40001-65535"
}
]