firewall-cmd --reload 防火墙
防火墙重新加载配置firewall-cmd --reload
查看开放的端口 firewall-cmd --list-ports
1.命令行
添加端口2201:
firewall-cmd --zone=public --add-port=2201/tcp --permanent
删除端口2201:
firewall-cmd --zone=public --remove-port=2201/tcp --permanent
2.配置文件
nano /etc/sysconfig/iptables
-A IN_public_allow -p tcp -m tcp --dport 9001 -m conntrack --ctstate NEW -j ACCEPT
nano /etc/firewalld/zones/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 conn$ <service name="dhcpv6-client"/> <service name="ssh"/> <service name="openvpn"/> <port protocol="tcp" port="9001"/> </zone>