mirror of
https://github.com/hwdsl2/setup-ipsec-vpn.git
synced 2026-05-17 08:05:45 +03:00
Improve IPv6 setup
- Use a /116 subnet (4096 addresses) for IPv6. - Set IPv6 forwarding in rc.local, in addition to sysctl.conf. In some cases, setting it in sysctl.conf may not work reliably.
This commit is contained in:
@@ -169,7 +169,7 @@ confirm_or_abort() {
|
||||
show_header() {
|
||||
cat <<'EOF'
|
||||
|
||||
IKEv2 Script Copyright (c) 2020-2026 Lin Song 16 Mar 2026
|
||||
IKEv2 Script Copyright (c) 2020-2026 Lin Song 20 Mar 2026
|
||||
|
||||
EOF
|
||||
}
|
||||
@@ -1178,11 +1178,12 @@ add_ikev2_connection() {
|
||||
bigecho2 "Adding a new IKEv2 connection..."
|
||||
XAUTH_POOL=${VPN_XAUTH_POOL:-'192.168.43.10-192.168.43.250'}
|
||||
IP6_NET=${VPN_IP6_NET:-'fddd:500:500:500::/64'}
|
||||
IP6_PREFIX=$(printf '%s' "$IP6_NET" | sed 's|/[0-9]*$||; s|::$||')
|
||||
lsubnet="0.0.0.0/0"
|
||||
rpool="$XAUTH_POOL"
|
||||
if [ -n "$VPN_PUBLIC_IP6" ]; then
|
||||
lsubnet="0.0.0.0/0,::/0"
|
||||
rpool="$XAUTH_POOL,$IP6_NET"
|
||||
rpool="$XAUTH_POOL,${IP6_PREFIX}::1000-${IP6_PREFIX}::1fff"
|
||||
fi
|
||||
if ! grep -qs '^include /etc/ipsec\.d/\*\.conf$' "$IPSEC_CONF"; then
|
||||
echo >> "$IPSEC_CONF"
|
||||
|
||||
@@ -211,9 +211,9 @@ update_rclocal() {
|
||||
bigecho "Updating rc.local..."
|
||||
conf_bk "/etc/rc.local"
|
||||
if [ "$os_type" = "alpine" ]; then
|
||||
sed -i '/# Added by hwdsl2 VPN script/,+4d' /etc/rc.local
|
||||
sed -i '/# Added by hwdsl2 VPN script/,/)&$/d' /etc/rc.local
|
||||
else
|
||||
sed --follow-symlinks -i '/# Added by hwdsl2 VPN script/,+4d' /etc/rc.local
|
||||
sed --follow-symlinks -i '/# Added by hwdsl2 VPN script/,/)&$/d' /etc/rc.local
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user