Initial commit: OpenWrt firewall management scripts

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-08 18:19:24 +08:00
commit 0359abb7dc
6 changed files with 560 additions and 0 deletions

14
update_tw_ip.sh Executable file
View File

@@ -0,0 +1,14 @@
#!/bin/sh
# 下載最新台灣 IP 清單
curl -s https://www.ipdeny.com/ipblocks/data/countries/tw.zone > /tmp/tw.zone
# 更新集合 (fw4 會自動處理 auto-merge)
nft flush set inet fw4 taiwan_ips
for ip in $(cat /tmp/tw.zone); do
nft add element inet fw4 taiwan_ips { $ip }
done
# 萬一你的 VPS IP 沒被網段涵蓋,這邊可以手動補強 (選配)
# nft add element inet fw4 taiwan_ips { 211.23.141.206 }
logger "Firewall: Taiwan IP set updated."