Installing FirewallD on CentOS 8
Installing FirewallD
firewalld is installed by default on some Linux distributions, including many images of CentOS 8. However, it may be necessary for you to install firewalld yourself:
yum install firewalld
Enable FirewallD
After you install firewalld, you can enable it as a system service:
systemctl enable firewalld
systemctl start firewalld
firewall-cmd --state
Opening Ports and Services
Enable available services:
firewall-cmd --permanent --zone=public --add-service=cockpit --add-service=http --add-service=https
firewall-cmd --reload
firewall-cmd --zone=public --list-services
And open specific ports:
firewall-cmd --permanent --zone=public --add-port=12345/tcp
firewall-cmd --reload
firewall-cmd --zone=public --list-ports
For Docker
firewall-cmd --zone=public --change-interface=docker0 --permanent
firewall-cmd --zone=public --add-masquerade --permanent
firewall-cmd --reload
firewall-cmd --list-all