File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -169,7 +169,7 @@ confirm_or_abort() {
169169show_header () {
170170cat << 'EOF '
171171
172- IKEv2 Script Copyright (c) 2020-2026 Lin Song 16 Mar 2026
172+ IKEv2 Script Copyright (c) 2020-2026 Lin Song 20 Mar 2026
173173
174174EOF
175175}
@@ -1178,11 +1178,12 @@ add_ikev2_connection() {
11781178 bigecho2 " Adding a new IKEv2 connection..."
11791179 XAUTH_POOL=${VPN_XAUTH_POOL:- ' 192.168.43.10-192.168.43.250' }
11801180 IP6_NET=${VPN_IP6_NET:- ' fddd:500:500:500::/64' }
1181+ IP6_PREFIX=$( printf ' %s' " $IP6_NET " | sed ' s|/[0-9]*$||; s|::$||' )
11811182 lsubnet=" 0.0.0.0/0"
11821183 rpool=" $XAUTH_POOL "
11831184 if [ -n " $VPN_PUBLIC_IP6 " ]; then
11841185 lsubnet=" 0.0.0.0/0,::/0"
1185- rpool=" $XAUTH_POOL ,$IP6_NET "
1186+ rpool=" $XAUTH_POOL ,${IP6_PREFIX} ::1000- ${IP6_PREFIX} ::1fff "
11861187 fi
11871188 if ! grep -qs ' ^include /etc/ipsec\.d/\*\.conf$' " $IPSEC_CONF " ; then
11881189 echo >> " $IPSEC_CONF "
Original file line number Diff line number Diff line change @@ -211,9 +211,9 @@ update_rclocal() {
211211 bigecho " Updating rc.local..."
212212 conf_bk " /etc/rc.local"
213213 if [ " $os_type " = " alpine" ]; then
214- sed -i ' /# Added by hwdsl2 VPN script/,+4d ' /etc/rc.local
214+ sed -i ' /# Added by hwdsl2 VPN script/,/)&$/d ' /etc/rc.local
215215 else
216- sed --follow-symlinks -i ' /# Added by hwdsl2 VPN script/,+4d ' /etc/rc.local
216+ sed --follow-symlinks -i ' /# Added by hwdsl2 VPN script/,/)&$/d ' /etc/rc.local
217217 fi
218218 fi
219219}
Original file line number Diff line number Diff line change @@ -579,13 +579,16 @@ enable_on_boot() {
579579 else
580580 echo ' #!/bin/sh' > /etc/rc.local
581581 fi
582- cat >> /etc/rc.local << 'EOF '
582+ ip6_fwd_rc=" "
583+ [ -n " $ip6 " ] && ip6_fwd_rc='
584+ echo 1 > /proc/sys/net/ipv6/conf/all/forwarding'
585+ cat >> /etc/rc.local << EOF
583586
584587# Added by hwdsl2 VPN script
585588(sleep 15
586589service ipsec restart
587590service xl2tpd restart
588- echo 1 > /proc/sys/net/ipv4/ip_forward)&
591+ echo 1 > /proc/sys/net/ipv4/ip_forward${ip6_fwd_rc} )&
589592EOF
590593 fi
591594}
Original file line number Diff line number Diff line change @@ -760,13 +760,16 @@ enable_on_boot() {
760760 else
761761 echo ' #!/bin/sh' > /etc/rc.local
762762 fi
763- cat >> /etc/rc.local << 'EOF '
763+ ip6_fwd_rc=" "
764+ [ -n " $ip6 " ] && ip6_fwd_rc='
765+ echo 1 > /proc/sys/net/ipv6/conf/all/forwarding'
766+ cat >> /etc/rc.local << EOF
764767
765768# Added by hwdsl2 VPN script
766769(sleep 15
767770service ipsec restart
768771service xl2tpd restart
769- echo 1 > /proc/sys/net/ipv4/ip_forward)&
772+ echo 1 > /proc/sys/net/ipv4/ip_forward${ip6_fwd_rc} )&
770773EOF
771774 fi
772775}
Original file line number Diff line number Diff line change @@ -725,13 +725,16 @@ EOF
725725 if uname -m | grep -qi ' ^arm' ; then
726726 rc_delay=60
727727 fi
728+ ip6_fwd_rc=" "
729+ [ -n " $ip6 " ] && ip6_fwd_rc='
730+ echo 1 > /proc/sys/net/ipv6/conf/all/forwarding'
728731cat >> /etc/rc.local << EOF
729732
730733# Added by hwdsl2 VPN script
731734(sleep $rc_delay
732735service ipsec restart
733736service xl2tpd restart
734- echo 1 > /proc/sys/net/ipv4/ip_forward)&
737+ echo 1 > /proc/sys/net/ipv4/ip_forward${ip6_fwd_rc} )&
735738exit 0
736739EOF
737740 fi
You can’t perform that action at this time.
0 commit comments