fix:同步修复映射删除

This commit is contained in:
spiritlhl
2026-05-29 04:57:00 +00:00
parent c0e4a8d6b7
commit 59b8875b85
4 changed files with 100 additions and 32 deletions

View File

@@ -163,13 +163,31 @@ After the setup is completed, you can execute ```cat vmlog``` to view the inform
```shell
for vmid in $(qm list | awk '{if(NR>1) print $1}'); do qm stop $vmid; qm destroy $vmid; rm -rf /var/lib/vz/images/$vmid*; done
iptables -t nat -F
iptables -t filter -F
service networking restart
systemctl restart networking.service
systemctl restart ndpresponder.service
iptables-save | awk '{if($1=="COMMIT"){delete x}}$1=="-A"?!x[$0]++:1' | iptables-restore
iptables-save > /etc/iptables/rules.v4
if command -v nft >/dev/null 2>&1; then
for family in ip ip6 inet; do
for table in nat filter; do
nft list table "$family" "$table" >/dev/null 2>&1 && nft flush table "$family" "$table"
done
done
fi
if command -v iptables >/dev/null 2>&1; then
iptables -t nat -F 2>/dev/null || true
iptables -t filter -F 2>/dev/null || true
fi
if command -v ip6tables >/dev/null 2>&1; then
ip6tables -t nat -F 2>/dev/null || true
ip6tables -t filter -F 2>/dev/null || true
fi
if command -v systemctl >/dev/null 2>&1; then
systemctl restart networking.service 2>/dev/null || service networking restart
systemctl list-unit-files | grep -q '^ndpresponder.service' && systemctl restart ndpresponder.service
else
service networking restart
fi
if command -v iptables-save >/dev/null 2>&1 && command -v iptables-restore >/dev/null 2>&1; then
iptables-save | awk '{if($1=="COMMIT"){delete x}}$1=="-A"?!x[$0]++:1' | iptables-restore
iptables-save > /etc/iptables/rules.v4
fi
rm -rf vmlog
rm -rf vm*
```

View File

@@ -179,16 +179,32 @@ After the setup is complete, you can execute ```cat ctlog``` to view the informa
```shell
pct list | awk 'NR>1{print $1}' | xargs -I {} sh -c 'pct stop {}; pct destroy {}'
rm -rf ct*
iptables -t nat -F
iptables -t filter -F
ip6tables -t nat -F
ip6tables -t filter -F
if command -v nft >/dev/null 2>&1; then
for family in ip ip6 inet; do
for table in nat filter; do
nft list table "$family" "$table" >/dev/null 2>&1 && nft flush table "$family" "$table"
done
done
fi
if command -v iptables >/dev/null 2>&1; then
iptables -t nat -F 2>/dev/null || true
iptables -t filter -F 2>/dev/null || true
fi
if command -v ip6tables >/dev/null 2>&1; then
ip6tables -t nat -F 2>/dev/null || true
ip6tables -t filter -F 2>/dev/null || true
fi
rm -rf /usr/local/bin/ipv6_nat_rules.sh
service networking restart
systemctl restart networking.service
systemctl restart ndpresponder.service
iptables-save | awk '{if($1=="COMMIT"){delete x}}$1=="-A"?!x[$0]++:1' | iptables-restore
iptables-save > /etc/iptables/rules.v4
if command -v systemctl >/dev/null 2>&1; then
systemctl restart networking.service 2>/dev/null || service networking restart
systemctl list-unit-files | grep -q '^ndpresponder.service' && systemctl restart ndpresponder.service
else
service networking restart
fi
if command -v iptables-save >/dev/null 2>&1 && command -v iptables-restore >/dev/null 2>&1; then
iptables-save | awk '{if($1=="COMMIT"){delete x}}$1=="-A"?!x[$0]++:1' | iptables-restore
iptables-save > /etc/iptables/rules.v4
fi
```
## Creating Virtual Machines with Pure IPv6 Addresses

View File

@@ -194,13 +194,31 @@ curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt
```shell
for vmid in $(qm list | awk '{if(NR>1) print $1}'); do qm stop $vmid; qm destroy $vmid; rm -rf /var/lib/vz/images/$vmid*; done
iptables -t nat -F
iptables -t filter -F
service networking restart
systemctl restart networking.service
systemctl restart ndpresponder.service
iptables-save | awk '{if($1=="COMMIT"){delete x}}$1=="-A"?!x[$0]++:1' | iptables-restore
iptables-save > /etc/iptables/rules.v4
if command -v nft >/dev/null 2>&1; then
for family in ip ip6 inet; do
for table in nat filter; do
nft list table "$family" "$table" >/dev/null 2>&1 && nft flush table "$family" "$table"
done
done
fi
if command -v iptables >/dev/null 2>&1; then
iptables -t nat -F 2>/dev/null || true
iptables -t filter -F 2>/dev/null || true
fi
if command -v ip6tables >/dev/null 2>&1; then
ip6tables -t nat -F 2>/dev/null || true
ip6tables -t filter -F 2>/dev/null || true
fi
if command -v systemctl >/dev/null 2>&1; then
systemctl restart networking.service 2>/dev/null || service networking restart
systemctl list-unit-files | grep -q '^ndpresponder.service' && systemctl restart ndpresponder.service
else
service networking restart
fi
if command -v iptables-save >/dev/null 2>&1 && command -v iptables-restore >/dev/null 2>&1; then
iptables-save | awk '{if($1=="COMMIT"){delete x}}$1=="-A"?!x[$0]++:1' | iptables-restore
iptables-save > /etc/iptables/rules.v4
fi
rm -rf vmlog
rm -rf vm*
```

View File

@@ -197,16 +197,32 @@ curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt
```shell
pct list | awk 'NR>1{print $1}' | xargs -I {} sh -c 'pct stop {}; pct destroy {}'
rm -rf ct*
iptables -t nat -F
iptables -t filter -F
ip6tables -t nat -F
ip6tables -t filter -F
if command -v nft >/dev/null 2>&1; then
for family in ip ip6 inet; do
for table in nat filter; do
nft list table "$family" "$table" >/dev/null 2>&1 && nft flush table "$family" "$table"
done
done
fi
if command -v iptables >/dev/null 2>&1; then
iptables -t nat -F 2>/dev/null || true
iptables -t filter -F 2>/dev/null || true
fi
if command -v ip6tables >/dev/null 2>&1; then
ip6tables -t nat -F 2>/dev/null || true
ip6tables -t filter -F 2>/dev/null || true
fi
rm -rf /usr/local/bin/ipv6_nat_rules.sh
service networking restart
systemctl restart networking.service
systemctl restart ndpresponder.service
iptables-save | awk '{if($1=="COMMIT"){delete x}}$1=="-A"?!x[$0]++:1' | iptables-restore
iptables-save > /etc/iptables/rules.v4
if command -v systemctl >/dev/null 2>&1; then
systemctl restart networking.service 2>/dev/null || service networking restart
systemctl list-unit-files | grep -q '^ndpresponder.service' && systemctl restart ndpresponder.service
else
service networking restart
fi
if command -v iptables-save >/dev/null 2>&1 && command -v iptables-restore >/dev/null 2>&1; then
iptables-save | awk '{if($1=="COMMIT"){delete x}}$1=="-A"?!x[$0]++:1' | iptables-restore
iptables-save > /etc/iptables/rules.v4
fi
```
## 开设纯IPV6地址的虚拟机