Skip to content

Firewall commands (firewalld) - CentOS 7+

Lists of firewall commands for the CentOS 7+ default firewall.

Note that CentOS 7+ no longer uses iptables but firewalld.

IP Addresses

Enable IP address on cloud.ianculovici.com

firewall-cmd --permanent --zone=internal --add-source=50.175.149.198/32
firewall-cmd --permanent --zone=internal --remove-source=50.175.149.198/32
firewall-cmd --zone=public --add-port=10005/tcp --permanent
firewall-cmd --zone=public --add-port=10004/tcp --permanent

Block IP address=

Check for blocked IP addresses

firewall-cmd --list-all

Add IP address to blocked list

firewall-cmd --permanent --add-rich-rule="rule family='ipv4' source address='115.207.4.151' reject"

Port

firewall-cmd  --permanent --delete-port 5904-5905/tcp

Service

firewall-cmd --permanent --zone=public --add-service=vnc-server