天天看点

CentOS7防火墙CentOS7的firewall

CentOS7的firewall

防火墙重启

service firewalld restart

防火墙启动

service firewalld start

防火墙关闭

service firewalld stop

查看防火墙的清单

firewall-cmd --list-all

增加端口

firewall-cmd --zone=public --add-port=27017/tcp --permanent

删除端口

firewall-cmd --zone=public --remove-port=27017/tcp --permanent

查看端口

firewall-cmd --zone=public --query-port=27017/tcp

[[email protected] x]# firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: ens33
  sources: 
  services: ssh dhcpv6-client
  ports: 
  protocols: 
  masquerade: no
  forward-ports: 
  source-ports: 
  icmp-blocks: 
  rich rules: 

[[email protected] x]# service firewalld stop
Redirecting to /bin/systemctl stop firewalld.service
[[email protected] x]# service firewalld start
Redirecting to /bin/systemctl start firewalld.service
[[email protected] x]# service firewalld restart
Redirecting to /bin/systemctl restart firewalld.service
[[email protected] x]# firewall-cmd --zone=public --add-port=27017/tcp --permanent 
success
[[email protected] x]# service firewalld restart
Redirecting to /bin/systemctl restart firewalld.service
[[email protected] x]# firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: ens33
  sources: 
  services: ssh dhcpv6-client
  ports: 27017/tcp
  protocols: 
  masquerade: no
  forward-ports: 
  source-ports: 
  icmp-blocks: 
  rich rules: 

[[email protected] x]# firewall-cmd --zone=public --remove-port=27017/tcp --permanent
success
[[email protected] x]# service firewalld restart
Redirecting to /bin/systemctl restart firewalld.service
[[email protected] x]# firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: ens33
  sources: 
  services: ssh dhcpv6-client
  ports: 
  protocols: 
  masquerade: no
  forward-ports: 
  source-ports: 
  icmp-blocks: 
  rich rules: 

[[email protected] x]# firewall-cmd --zone=public --add-port=27017/tcp --permanent
success
[[email protected] x]# service firewalld restart
Redirecting to /bin/systemctl restart firewalld.service
[[email protected] x]# firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: ens33
  sources: 
  services: ssh dhcpv6-client
  ports: 27017/tcp
  protocols: 
  masquerade: no
  forward-ports: 
  source-ports: 
  icmp-blocks: 
  rich rules: 
[[email protected] x]# firewall-cmd --zone=public --list-ports
27017/tcp
[[email protected] x]# firewall-cmd --zone=public --query-port=27017/tcp
yes
           

继续阅读