CentOS 7 中firewall-cmd命令
firewall常用:
安装firewalld 防火墙yum install firewalld
开启服务systemctl start firewalld.service
关闭防火墙systemctl stop firewalld.service
开机自动启动systemctl enable firewalld.service
关闭开机制动启动systemctl disable firewalld.service
查看状态:firewall-cmd --state
开启某个端口:
//永久
firewall-cmd --permanent --zone=public --add-port=8080-8081/tcp firewall-cmd --zone=public --add-port=8080-8081/tcp //临时
查看开启的端口和服务:
//服务空格隔开 例如 dhcpv6-client https ss
firewall-cmd --permanent --zone=public --list-services
//端口空格隔开 例如 8080-8081/tcp 8388/tcp 80/tcp
firewall-cmd --permanent --zone=public --list-ports