firewall-cmd

firewall-cmd is used to manage firewall (iptables). It is used by default on latest version of CentOS, RHEL.

Check firewall status

To see if firewall is running of not use

or

To disable firewalls

Open a port in firewall

To allow HTTP and HTTPS traffic, run

Permanent option make the changes permanant. You need to reload firewall after using –permanent. If you want to open a port in current session and make it permanant, run the command with and with out –permanent.

Open a port range in firewall

Close a port in firewall

To close a port, you can use command same as you open with –add replaced with –remove.

Whitelist an IP address

To remove an IP, use

Firewalld Zones

Zone is a collection of rules that can be applied to a specific interface. Some useful commands are

Zones are stored in /usr/lib/firewalld/zones

Services

Services are pre-made rules for a specific application. Some useful commands are

Services are stoed in /usr/lib/firewalld/services/ or /etc/firewalld/services/.

Save run time configuration into permanant

iptables

Need help with Linux Server or WordPress? We can help!

Leave a Reply

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