How to use iptables on Linux CentOS 7

CentOS7 iptables services ilustration

In this tutorial we will remove default firewalld service and install iptables-services. As you already know, CentOS 7 doesn’t use iptables service anymore. You can still use iptables, but only in running sessions … the moment you reboot your changes to netfilter will dissapear

In this demonstration i will use virtual server called CentOS 7 which is based on Red Hat. CentOS 7 uses firewalld service instead of iptables, and this is the main reason why you can’t save changes to your configuration.

You can still use iptables in your startup scripts … but such approach will only make more confusions and this is not a good idea.CentOS 7 comes with firewalld service which uses firewal-cmd tool for applying firewall rules, this tool is very easy to use.

The new firewall-cmd is much easier to use

In this video How to use iptables on Linux CentOS 7 you will learn many tricks which will help you to understand iptables.

Before we remove firewalld service, i will show you how to open port 80 using firewall-cmd  just to show you how easy it was. We will do the same using iptables to see the differences between this two approach.

Why using iptables on CentOS 7

There are still many questions left to answer . First one would be – why using iptables ? – this tool is very robust and complex, on the other hand firewall-cmd  is way more user friendly! How to use iptables on Linux CentOS 7 ?

– well … maybe you want to learn iptables for some kind of exam or certification, or you where using it before  – and you just want it back!!!

This post  is also related to my previous article called “What to do after install Linux Ubuntu 4” because we’ve discussed about virtualization so please read it if you wan to learn more.

There are plenty good articles on the internet regarding iptables, so you can also visit this link

https://wiki.centos.org/HowTos/Network/IPTables

 

 

Author: Krunoslav Kralj

Im Linux enthusiast from Croatia using Linux for 13 years! My first Linux was - Ubuntu 7.10 (Gutsy Gibbon), released on 18 October 2007. After some time iv'e switched to Centos 6. Im still using Ubuntu for my daily tasks, and i really miss my Centos 6 which reminds me to some older versions of Ubuntu.

Leave a Reply

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