跳到主要內容

刪除 iptables 裡的規則



1. 找出行號,方便刪除
root@cw2-netflow:~# iptables -L --line-numbers
Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination        
1    sshguard   all  --  anywhere             anywhere            

Chain FORWARD (policy ACCEPT)
num  target     prot opt source               destination        

Chain OUTPUT (policy ACCEPT)
num  target     prot opt source               destination        

Chain sshguard (1 references)
num  target     prot opt source               destination        
1    DROP       all  --  219.229.222.4        anywhere            
2    DROP       all  --  95.211.149.200       anywhere            
3    DROP       all  --  hosted-by.ecatel.net  anywhere            
4    DROP       all  --  refresh-bulleted.funfew.com  anywhere            
5    DROP       all  --  112.65.229.76        anywhere            
6    DROP       all  --  hosted-by.ecatel.net  anywhere            
7    DROP       all  --  222.77.190.33        anywhere            
8    DROP       all  --  195-154-133-119.rev.poneytelecom.eu  anywhere            
9    DROP       all  --  111.73.46.231        anywhere            
10   DROP       all  --  hosted-by.blazingfast.io  anywhere

2. 刪除 sshguard Chian 中的第一條規則
    說明:
      --delete  -D chain rulenum
                Delete rule rulenum (1 = first) from chain

     root@cw2-netflow:~# iptables -D sshguard 1

    就刪掉囉

留言