EOF
fi
-if $ip6; then
+if [[ $ip6 ]]; then
cat >>$server_dir/server.conf <<EOF
push tun-ipv6 # legacy option that flidas needs, has no harm.
-ifconfig-ipv6 $ip6 $ip6_route
+ifconfig-ipv6 $ip6 $ip6route
EOF
+
+ sed -i --follow-symlinks '/^ *net.ipv6.conf.all.forwarding=.*/d' /etc/sysctl.conf
+ cat >>/etc/sysctl.conf <<'EOF'
+net.ipv6.conf.all.forwarding=1
+EOF
+
fi
# Be the default gateway for clients.
push "redirect-gateway def1"
EOF
- if $ip6; then
+ if [[ $ip6 ]]; then
cat >>$server_dir/server.conf <<'EOF'
push "route-ipv6 2000::/3"
EOF
fi
sed -i --follow-symlinks '/^ *net\.ipv4\.ip_forward=.*/d' /etc/sysctl.conf
-sed -i --follow-symlinks '/^ *net.ipv6.conf.all.forwarding=.*/d' /etc/sysctl.conf
cat >>/etc/sysctl.conf <<'EOF'
net.ipv4.ip_forward=1
-net.ipv6.conf.all.forwarding=1
EOF
sysctl -p /etc/sysctl.conf