防火墙增加端口号
·
方法一:
(1)systemctl restart firewalld
(2)firewall-cmd --zone =public --add-port=80/tcp --permanent
(3)firewall-cmd --reload
(4)firewall-cmd --state
(5)firewall-cmd --list-ports
方法二:
到/etc/firewalld/zones目录下,打开public.xml文件,增加如下字段,保存后重启防火墙。
<port protocol="tcp" port="80"/>
[root@localhost /]# cd /etc/firewalld/zones [root@localhost zones]# ll 总用量 8 -rw-r--r-- 1 root root 459 2月 19 14:38 public.xml -rw-r--r--. 1 root root 424 2月 19 14:38 public.xml.old [root@localhost zones]# vi public.xml<?xml version="1.0" encoding="utf-8"?> <zone> <short>Public</short> <description>For use in public areas. You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.</description> <service name="ssh"/> <service name="dhcpv6-client"/> <port protocol="tcp" port="9200"/> <port protocol="tcp" port="9300"/> <port protocol="tcp" port="22"/> <port protocol="tcp" port="80"/> </zone>
更多推荐
所有评论(0)