From 66e42879123808f49216e61111cb78704760501e Mon Sep 17 00:00:00 2001 From: spiritlhl <103393591+spiritLHLS@users.noreply.github.com> Date: Mon, 12 Jun 2023 23:27:24 +0800 Subject: [PATCH] Update build_nat_network.sh --- scripts/build_nat_network.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/build_nat_network.sh b/scripts/build_nat_network.sh index 8e880dc..ced9134 100644 --- a/scripts/build_nat_network.sh +++ b/scripts/build_nat_network.sh @@ -61,6 +61,7 @@ fi if [ -z "$interfaces_file" ]; then interfaces_file="/etc/network/interfaces" fi +chattr -i "$interfaces_file" if grep -q "vmbr0" "$interfaces_file"; then echo "vmbr0 已存在在 ${interfaces_file}" else @@ -107,6 +108,7 @@ iface vmbr1 inet static post-down iptables -t nat -D POSTROUTING -s '172.16.1.0/24' -o vmbr0 -j MASQUERADE EOF fi +chattr +i "$interfaces_file" # 加载iptables并设置回源且允许NAT端口转发 apt-get install -y iptables iptables-persistent