centos use a firewall command

 First, the firewall is turned on, turn off, disable command

(1) Setting a power-enable the firewall: systemctl enable firewalld.service

(2) set the boot disable the firewall: systemctl disable firewalld.service

(3) start the firewall: systemctl start firewalld

(4) turn off the firewall: systemctl stop firewalld

(5) Check the firewall status: systemctl status firewalld 

Second, the use configuration port firewall-cmd

(1) View firewall status: firewall-cmd --state

(2) reload the configuration: firewall-cmd --reload

(3) View open ports: firewall-cmd --list-ports

(4) open the firewall port: firewall-cmd --zone = public --add-port = 9200 / tcp --permanent

  Command Meaning:

  -zone # Scope

  -add-port = 9200 / tcp # Add port, the format is: port / protocol

  -permanent # permanent, this parameter does not restart after failure

 

(5) off the firewall port: firewall-cmd --zone = public --remove-port = 9200 / tcp --permanent

Note: After you add the port, must be reloaded with the command firewall-cmd --reload again take effect

Guess you like

Origin www.cnblogs.com/xsdf/p/11265549.html