~修复虚拟机、容器代理会意外导致网络中断及IP访问无法连接等问题

This commit is contained in:
juewuy
2025-12-10 14:24:10 +08:00
parent 8a3f32fdbc
commit 21089b46a7
2 changed files with 8 additions and 3 deletions

View File

@@ -1282,6 +1282,7 @@ start_nft_route() { #nftables-route通用工具
[ "$1" = 'prerouting_vm' ] && HOST_IP="$(echo $vm_ipv4 | sed 's/ /, /g')"
#添加新链
nft add chain inet shellcrash $1 { type $3 hook $2 priority $4 \; }
[ "$1" = 'prerouting_vm' ] && nft add rule inet shellcrash $1 ip saddr != {$HOST_IP} return #仅代理虚拟机流量
#过滤dns
nft add rule inet shellcrash $1 tcp dport 53 return
nft add rule inet shellcrash $1 udp dport 53 return