# Ensure iptables Rules Are Flushed When Using nftables

- Source: https://support.icompaas.com/support/solutions/articles/62000235336-ensure-iptables-rules-are-flushed-when-using-nftables
- Section: [Solutions](https://support.icompaas.com/support/solutions) › [CIS Amazon Linux 2 Benchmark v3.0.0](https://support.icompaas.com/support/solutions/62000112696) › [CIS Amazon Linux 2 Benchmarks](https://support.icompaas.com/support/solutions/folders/62000169265)
- Last updated: 2026-05-29
- Publisher: iCompaas, Inc. (https://www.icompaas.com)

**Profile Applicability:** • Level 1

**Description:**  
 When migrating from iptables to nftables, it is important to flush existing iptables rules to avoid conflicts and ensure that nftables rules operate correctly. Manually flushing iptables ensures a clean firewall state, preventing rule overlap or unintended access.

**Rationale:** Flushing iptables rules prevents conflicts between legacy iptables rules and nftables configurations, maintaining consistent and predictable firewall behavior.

**Impact:** Pros:

-   Eliminates potential rule conflicts.  
    
-   Ensures nftables firewall policies are effectively enforced.  
    

Cons:

-   Manual process requires careful execution to avoid temporary loss of firewall protection.  
    

**Default Value:** iptables rules are not automatically flushed when nftables is enabled.

**Pre-requisites:**

-   Root or sudo privileges to manage firewall configurations.  
    

**Remediation:**

### **Test Plan:**

**Using Linux command line:**

1\. List current iptables rules:  

iptables -L -v -n

2\. Confirm presence of active iptables rules.  

### **Implementation Plan:**

**Using Linux command line:**

1\. Flush all iptables rules:  

iptables -F  
iptables -X  
iptables -t nat -F  
iptables -t nat -X  
iptables -t mangle -F  
iptables -t mangle -X  
iptables -t raw -F  
iptables -t raw -X

2\. Save iptables configuration if applicable:  

service iptables save  # or equivalent on your system

3\. Verify iptables rules are flushed:  

iptables -L -v -n

### **Backout Plan:**

**Using Linux command line:**

1\. Restore iptables rules from backup if required:  

service iptables restore  # or load saved rules

2\. Verify firewall status and connectivity.  

**References:**

-   CIS Amazon Linux 2 Benchmark v3.0.0  
    
-   iptables Documentation  
    
-   nftables Migration Guide

## Related compliance guidance

- [SOC 2 compliance: a practical implementation guide for cloud-native SaaS teams](https://support.icompaas.com/compliance/soc-2-trust-services-criteria): Configuration checks like this one are the technical half of a SOC 2 / ISO 27001 programme — the guide shows where they fit, what else an auditor expects, and how to evidence them.
- [ISO/IEC 27001:2022 compliance: a practical implementation guide](https://support.icompaas.com/compliance/iso-27001-2022): ISO 27001 Annex A.8 (technological controls) is where cloud hardening evidence lands; the guide shows how to run the ISMS around it.
