On the journey of exploring the newly releaed CentOS 7 . I found another interesting thing. This is related to iptables. In previous CentOS versions, we used to stop iptables service by using the command service iptables stop or /etc/init.d/iptables stop

On newly shined CentOS 7 / Red Hat 7 , with systemctl command we can control the service status.

To start/stop/restart/reload the iptables on CentOS 7 / RHEL 7 , follow the given below steps

Step 1 : Install iptables-services

For installing the iptables, use the yum command in RHEL 7/CentOS 7.

yum install iptables-services

Step 2 : Manage iptables with systemctl

By using the systemctl command we can manage the iptable process in the system.

Use the given below syntax”
systemctl [stop|start|restart|reload] iptables

To start iptables

For starting the iptables service, use the given below command.

systemctl start iptables

To stop iptables

To stop the iptables service, use the given below command.

systemctl stop iptables

To restart iptables

By using following command , stop the iptables service.

systemctl restart iptables

To reload iptables

For reloading the iptables, here is the command.

systemctl reload iptables

As you are working on iptables, it is in general practice and very important to take the backup of iptables. Learn more about how to backup and restore iptables on Linux Systems.

You might be also interested to learn how to protect from port scanning and smurf attack by iptables.

Recommendation

We strongly suggest to use firewalld instead of iptables going forward. The firewalld is the new firewall tool in the Linux Operating System.

Read Some More Articles

6 Comments

  1. you also need to run systemctl enable iptables. Because in RHEL/CentOS 7 no chkconfig command as well.

    1. Thankyou Dipanjan,

      Awesome
      You are correct. “systemctl enable iptables” is for enabling the iptables service at runlevels .
      In coming soon post, systemctl command will be written with more details and example. I will also include this example in it.
      Regards
      Sharad

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.