How do i configure iptables on redhat?



  • This is not for firewalld, which is the recommended way of using packet filtering on redhat 7 and later version of centos & fedora.

    The redhat 6/7 configuration files are located at /etc/sysconfig/ip6tables-config & /etc/sysconfig/iptables-config

    In there you can configure things such as saving the rules on stopping iptables and restoring them on starting.

    This section says you need to use /etc/sysconfig/iptables for IPv4 and /etc/sysconfig/ip6tables for IPv6 to store your rules.

    # Save current firewall rules on stop.
    #   Value: yes|no,  default: no
    # Saves all firewall rules to /etc/sysconfig/iptables if firewall gets stopped
    # (e.g. on system shutdown).
    IPTABLES_SAVE_ON_STOP="no"
    

    If you edit the rules, they are not persistent across reboots, the commands below save to /etc/sysconfig/iptables & /etc/sysconfig/ip6tables, if you have configured your iptables configs to read these files on boot & restart, your rules will be applied.

    $ sudo iptables save
    
    $ sudo ip6tables save
    

Log in to reply
 

© Lightnetics 2024