User Tools

Site Tools


networking:firewall:firewalld

FirewallD

Firewall Status and Control

firewall-cmd --state

firewall-cmd --reload

firewall-cmd --complete-reload

firewall-cmd --get-zones

firewall-cmd --get-default-zone

firewall-cmd --get-services

firewall-cmd --get-services

firewall-cmd --get-icmptypes

firewall-cmd --list-all-zones

firewall-cmd --zone=public --list-all

firewall-cmd --zone=public --add-interface=eth0    # activate the (Public) firewall on ''eth0''

Allow a Service

Allow HTTP and HTTPS to a web server:

firewall-cmd --permanent --zone=public --add-service=http --add-service=https
firewall-cmd --reload

Change SSH Port

:!: You may need to install some tools on minimal installs:

yum -y install policycoreutils-python net-tools

Change the port in the SSH daemon configuration:

vim /etc/ssh/sshd_config

Fix selinux RBAC:

semanage port -a -t ssh_port_t -p tcp 2222

Modify the firewall:

firewall-cmd --permanent --zone=public --add-port=2222/tcp
firewall-cmd --reload

Restart the SSH service:

systemctl restart sshd.service

netstat -tapn
networking/firewall/firewalld.txt · Last modified: 2018/03/15 09:39 by gcooper