[wireguard] correct masks

This commit is contained in:
Nico Schottelius 2023-04-20 13:51:56 +02:00
parent f76db6ea6b
commit dc641911d4
2 changed files with 4 additions and 3 deletions

View file

@ -10,7 +10,7 @@ if [ $# -lt 4 ]; then
echo " ipv6-network: which network to use for us (/48 expected)" echo " ipv6-network: which network to use for us (/48 expected)"
echo " private-key: specify wireguard key optionally" echo " private-key: specify wireguard key optionally"
exit 1 exit 1
fi qnfi
my_ip=$1; shift my_ip=$1; shift
vpn_endpoint_host=$1; shift vpn_endpoint_host=$1; shift

View file

@ -21,10 +21,12 @@ case "$v4v6" in
v6) v6)
sep=":" sep=":"
allowed_ips="::/0" allowed_ips="::/0"
gw_mask="/128"
;; ;;
v4) v4)
sep="." sep="."
allowed_ips="0.0.0.0/0" allowed_ips="0.0.0.0/0"
gw_mask="/32"
;; ;;
*) *)
@ -47,7 +49,6 @@ for ip in $(seq $start $end); do
cat <<EOF > $file cat <<EOF > $file
[Interface] [Interface]
PrivateKey = ${privkey} PrivateKey = ${privkey}
ListenPort = 51820
Address = ${addr} Address = ${addr}
[Peer] [Peer]
@ -60,7 +61,7 @@ EOF
[Peer] [Peer]
PublicKey = ${pubkey} PublicKey = ${pubkey}
AllowedIPs = ${addr} AllowedIPs = ${addr_nomask}${gw_mask}
EOF EOF