添加端口
cd /usr/lib/firewalld/services
cp ssh.xml a.xml //文件
配置文件
vim a.xml
<?xml version="1.0" encoding="utf-8"?>
<service>
<short>web-80</short>
<description>HTTP is the protocol used to serve Web pages. If you plan to make your Web server publicly available, enable this option. This option is not required for viewing pages locally or developing Web pages.</description>
<port protocol="tcp" port="80"/>
</service>
添加服务
firewall-cmd --permanent --add-service=web-80
重启服务
systemctl restart firewalld
查看防火墙开放端口信息
netstat -tlunp
防火墙开机启动与关闭
systemctl start firewalld.service
systemctl stop firewalld.service
执行开机禁用防火墙自启命令
systemctl disable firewalld.service
防火墙随系统开启启动
systemctl enable firewalld.service