1
我有一些網絡過濾規則是這樣的:iptables:如何輕鬆組織鏈中的規則?
iptables -I INPUT -j NFQUEUE -p udp --dport 4444
iptables -t mangle -I INPUT -j MARK --set-mark 100 -p udp --dport 4444
iptables -I OUTPUT -j NFQUEUE -p udp --sport 4444
iptables -t mangle -I OUTPUT -j MARK --set-mark 200 -p udp --sport 4444
我需要一個簡單的方法,這組規則,目的是刪除它們放在一起,這樣
iptables -N MYCHAIN
iptables -I MYCHAIN -j NFQUEUE -p udp --dport 4444
iptables -t mangle -I MYCHAIN -j MARK --set-mark 100 -p udp --dport 4444
iptables -I MYCHAIN -j NFQUEUE -p udp --sport 4444
iptables -t mangle -I MYCHAIN -j MARK --set-mark 200 -p udp --sport 4444
# Fast deleting
iptables -F MYCHAIN
iptables -X MYCHAIN
但它沒有工作,當然,我必須連接默認鏈與MYCHAIN,但我不知道如何。有更好還是更簡單的解決方案?