iptables - drop rule
                
            
            
            
            
            
            
                           
                
            
            
            
                
    
    
    
            
                
                    by
                    Jeremy Canfield  |  
                    Updated: September 21 2020
                    
                          |  iptables articles
                    
                    
                    
                
            
            The final rule that should be listed in each chain (INPUT, OUTPUT, FORWARD) is the DROP rule, to deny any request that does not match one of the ALLOW rules. It is very important here that the -A or --append option is used so that the DROP rule is appended to the very end of the chain. You would never want to use the -I or --insert option, as this would insert the DROP rule as the very first rule in the chain.
iptables -A INPUT -j DROP
iptables -A OUTPUT -j DROP
iptables -A FORWARD -j DROP
The -L or --list option can be used to display the rules to ensure the rule was added.
The iptables-save command will need to be used to permanently save iptables.
Did you find this article helpful?
If so, consider buying me a coffee over at 