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
yum install iptables-services
Step 2 : Manage iptables with systemctl
Use the below given syntax
systemctl [stop|start|restart|reload] iptables
Example.
To start iptables
systemctl start iptables
To stop iptables
systemctl stop iptables
To restart iptables
systemctl restart iptables
To reload iptables
systemctl reload iptables
We strongly suggest to use firewalld instead of iptables.
Why do you strongly suggest firewalld instead of iptables?
“another interesting thing”, not “another intersting thing”.
Thank You Nan Xiao,
In very less word you really directed me to typo in this post.
Regards
Sharad
you also need to run systemctl enable iptables. Because in RHEL/CentOS 7 no chkconfig command as well.
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