【运维】iptables删除一条已有的iptables规则 最简方法


iptables L INPUT linenumbers 列出INPUT 链所有的规则 num target prot opt source destination 1 REJECT tcp anywhere anywhere tcp dpt:microsoftds rejectwith icmpp
iptables -L INPUT --line-numbers

列出INPUT 链所有的规则

num  target    prot opt source              destination       
1    REJECT    tcp  --  anywhere            anywhere            tcp dpt:microsoft-ds reject-with icmp-port-unreachable
2    REJECT    tcp  --  anywhere            anywhere            tcp dpt:135 reject-with icmp-port-unreachable
3    REJECT    tcp  --  anywhere            anywhere            tcp dpt:netbios-ssn reject-with icmp-port-unreachable
4    REJECT    udp  --  anywhere            anywhere            udp dpt:microsoft-ds reject-with icmp-port-unreachable
5    REJECT    udp  --  anywhere            anywhere            udp dpt:135 reject-with icmp-port-unreachable
...
...

删除指定的第4行规则:

iptables -D INPUT 4
2500举报0子龙•13年前

暂无评论