[[email protected] ~]# firewall-cmd --version //查看版本
0.3.9
[[email protected] ~]# firewall-cmd --state //查看状态
running
[[email protected] ~]#
[[email protected] ~]# firewall-cmd --zone=public --list-ports //查看所有打开的端口
445/tcp 443/tcp 1080/tcp 135/tcp 22/tcp
[[email protected] ~]# firewall-cmd --get-active-zones //查看区域信息
public
interfaces: eth0
[[email protected] ~]#
[[email protected] ~]# firewall-cmd --panic-on //拒绝所有包
[[email protected] ~]# firewall-cmd --panic-off //取消拒绝状态
[[email protected] ~]# firewall-cmd --query-panic //查看是否拒绝
no
firewall-cmd --zone=public --add-port=22/tcp --permanent //开放端口
firewall-cmd --zone=public --add-port=443/tcp --permanent
firewall-cmd --zone=public --add-port=1080/tcp --permanent
firewall-cmd --zone=public --add-port=445/tcp --permanent
firewall-cmd --zone=public --add-port=135/tcp --permanent
[[email protected] ~]# firewall-cmd --reload //重新载入
success
原文地址:https://www.cnblogs.com/networking/p/10295792.html