Centos7查看防火墙状态、开放指定端口
查看防火墙状态:
systemctl status firewalld
开启防火墙:
systemctl start firewalld
关闭防火墙:
systemctl stop firewalld
开放端口(修改后需要重启防火墙方可生效):
firewall-cmd --zone=public --add-port=8080/tcp --permanent
关闭端口:
firewall-cmd --zone=public --remove-port=8080/tcp --permanent
开放指定ip和端口访问(开放10.114.5.100的13306端口)
firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="10.114.5.100" port protocol="tcp" port="13306" accept"
查看开放的端口:
firewall-cmd --list-ports
查看所有规则:
firewall-cmd --list-all
重启防火墙:
firewall-cmd --reload
设置防火墙开机启动:
systemctl enable firewalld
禁用防火墙开机启动:
systemctl disable firewalld