Skip to content
Search

Firewalld

lastmod 2018-08-17created 2015-01-154 edits

CentOS 7 Firewalld

Note that the firewall commands changed in CentOS7. (iptables -> firewalld) 1

Configuration files live in /etc/firewalld/zones. The public.xml public configuration in that path is applied.

How to use

Well-known services can be added or removed as follows.

$ firewall-cmd --permanent --zone=public --add-service=https
$ firewall-cmd --permanent --zone=public --remove-service=ssh

To add a specific port number, enter the following.

$ firewall-cmd --permanent --zone=public --add-port=8022/tcp 

To remove rules:

$ firewall-cmd --permanent --zone=public --remove-service=http
$ firewall-cmd --permanent --zone=public --remove-port=3306/tcp

To apply the changes:

$ firewall-cmd --reload

See also

Favorite site

References