Bootstrap FreeKB - iptables - iptables-save command
iptables - iptables-save command

Updated:   |  iptables articles

On a Red Hat (RHEL) or CentOS system, the following command will display (but not save) your current iptables rules.



The prior command should display something like this.

-A INPUT -i lo -j ACCEPT
-A INPUT -s -p tcp -m tcp --dport 22 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT
-A OUTPUT -p tcp -m tcp --sport 22 -m conntrack --ctstate ESTABLISHED -j ACCEPT
# Completed on Mon Sep 21 04:55:18 2020


The following command will permanently save your iptables rules. This command simply redirects the output of the iptables-save to the /etc/sysconfig/iptables file (overwrites the file).

iptables-save > /etc/sysconfig/iptables


Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee


Add a Comment

Please enter e64be5 in the box below so that we can be sure you are a human.