Update build_nat_network.sh

This commit is contained in:
spiritLHLS 2023-04-10 14:56:29 +08:00 committed by GitHub
parent d7e77ea7e8
commit ce2459e392
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -56,10 +56,7 @@ EOF
fi
# 加载iptables并设置回源且允许NAT端口转发
if ! command -v iptables &> /dev/null; then
_green "iptables 未安装,正在安装..."
apt-get install -y iptables
fi
apt-get install -y iptables iptables-persistent
iptables -t nat -A POSTROUTING -j MASQUERADE
sysctl net.ipv4.ip_forward=1
sysctl_path=$(which sysctl)