
This will also look similar to the iptables rules configuration files, if you’ve ever used iptables-persistent or iptables save. A TCP -p tcp -m tcp -dport 22 -j ACCEPTĪs you can see, the output looks just like the commands that were used to create them, without the preceding iptables command. A INPUT -j REJECT -reject-with icmp-proto-unreachable A INPUT -p tcp -j REJECT -reject-with tcp-reset A INPUT -p udp -j REJECT -reject-with icmp-port-unreachable A INPUT -p icmp -m conntrack -ctstate NEW -j ICMP A INPUT -p tcp -m tcp -tcp-flags FIN,SYN,RST,ACK SYN -m conntrack -ctstate NEW -j TCP A INPUT -p udp -m conntrack -ctstate NEW -j UDP A INPUT -m conntrack -ctstate INVALID -j DROP A INPUT -m conntrack -ctstate RELATED,ESTABLISHED -j ACCEPT

To list out all of the active iptables rules by specification, run the iptables command with the -S option: $sudo iptables -S Example: Rule Specification Listing Flush all chains and tables, delete all chains, and accept all traffic.


While many iptables tutorials will teach you how to create firewall rules to secure your server, this one will focus on a different aspect of firewall management: listing and deleting rules. Iptables is a firewall that plays an essential role in network security for most Linux systems.
