Update port-forward.sh

This commit is contained in:
iVampireSP.com 2023-07-21 01:49:16 +08:00 committed by GitHub
parent 7023e2a5e9
commit e72a84d95d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -38,9 +38,6 @@ ip=${ip%.*}
# portPerHost + 1
portPerHost=$((portPerHost + 1))
# 启用IP转发
echo 1 > /proc/sys/net/ipv4/ip_forward
# 清除旧的iptables规则
iptables -t nat -F
iptables -t nat -X
@ -54,6 +51,9 @@ iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
# 启用IP转发
echo 1 > /proc/sys/net/ipv4/ip_forward
# 计算每个主机号的端口范围
function calculatePortRanges() {
hostNumber=$1