mirror of
https://github.com/thelittlerocket/pve.git
synced 2025-03-03 17:27:17 +08:00
Update build_nat_network.sh
This commit is contained in:
parent
90aeeb0fd5
commit
966dd4c865
1 changed files with 2 additions and 1 deletions
|
@ -62,6 +62,7 @@ if ! command -v iptables &> /dev/null; then
|
|||
fi
|
||||
iptables -t nat -A POSTROUTING -j MASQUERADE
|
||||
sysctl net.ipv4.ip_forward=1
|
||||
sysctl_path=$(which sysctl)
|
||||
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
|
||||
|
@ -69,7 +70,7 @@ if grep -q "^net.ipv4.ip_forward=1" /etc/sysctl.conf; then
|
|||
else
|
||||
echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf
|
||||
fi
|
||||
sysctl -p
|
||||
${sysctl_path} -p
|
||||
|
||||
# 重启配置
|
||||
service networking restart
|
||||
|
|
Loading…
Reference in a new issue