mirror of
https://github.com/thelittlerocket/pve.git
synced 2025-02-01 10:38:22 +08:00
Update build_nat_network.sh
This commit is contained in:
parent
cc2d26906d
commit
90aeeb0fd5
1 changed files with 8 additions and 0 deletions
|
@ -62,6 +62,14 @@ if ! command -v iptables &> /dev/null; then
|
||||||
fi
|
fi
|
||||||
iptables -t nat -A POSTROUTING -j MASQUERADE
|
iptables -t nat -A POSTROUTING -j MASQUERADE
|
||||||
sysctl net.ipv4.ip_forward=1
|
sysctl net.ipv4.ip_forward=1
|
||||||
|
if grep -q "^net.ipv4.ip_forward=1" /etc/sysctl.conf; then
|
||||||
|
if grep -q "^#net.ipv4.ip_forward=1" /etc/sysctl.conf; then
|
||||||
|
sed -i 's/^#net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/' /etc/sysctl.conf
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf
|
||||||
|
fi
|
||||||
|
sysctl -p
|
||||||
|
|
||||||
# 重启配置
|
# 重启配置
|
||||||
service networking restart
|
service networking restart
|
||||||
|
|
Loading…
Reference in a new issue