Firewalld: Difference between revisions

From DISI
Jump to navigation Jump to search
(firewalld commands)
 
Line 9: Line 9:
   sudo firewall-cmd --list-all
   sudo firewall-cmd --list-all


Adding a service (opening a port) for firewalld:  
Permitting a service through firewall (opens port that corresponds with service):  
   sudo firewall-cmd --zone=public --add-service=<service-name> --permanent
   sudo firewall-cmd --zone=public --add-service=<service-name> --permanent
Opening a specific TCP/UDP port:
  sudo firewall-cmd --add-port=8080/tcp --permanent
Example: adding NFS to firewall-cmd
Example: adding NFS to firewall-cmd
   sudo firewall-cmd --zone=public --add-service=nfs --permanent
   sudo firewall-cmd --zone=public --add-service=nfs --permanent

Revision as of 18:28, 25 January 2019

Firewalld is the default firewall for CentOS 7. It replaces the CentOS 6 firewall, iptables.

Using firewalld

Starting and stopping firewalld:

 systemctl start firewalld
 systemctl stop firewalld

Listing current configuration for firewalld:

 sudo firewall-cmd --list-all

Permitting a service through firewall (opens port that corresponds with service):

 sudo firewall-cmd --zone=public --add-service=<service-name> --permanent

Opening a specific TCP/UDP port:

 sudo firewall-cmd --add-port=8080/tcp --permanent

Example: adding NFS to firewall-cmd

 sudo firewall-cmd --zone=public --add-service=nfs --permanent
 sudo firewall-cmd --zone=public --add-service=rpc-bind --permanent
 sudo firewall-cmd --zone-public --add-service=mountd --permanent

Reload the firewall after adding services to the firewall configuration:

 sudo firewall-cmd --reload