添加端口
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>
添加服務(wù)
firewall-cmd --permanent --add-service=web-80
重啟服務(wù)
systemctl restart firewalld
查看防火墻開放端口信息
netstat -tlunp
防火墻開機(jī)啟動與關(guān)閉
systemctl start firewalld.service
systemctl stop firewalld.service
執(zhí)行開機(jī)禁用防火墻自啟命令
systemctl disable firewalld.service
防火墻隨系統(tǒng)開啟啟動
systemctl enable firewalld.service