一、查看打开了哪些服务端口
[root@kache ~]# firewall-cmd --list-services
dhcpv6-client ssh
二、查看可以添加哪些服务的端口
[root@kache ~]# firewall-cmd --get=services
usage: see firewall-cmd man page
firewall-cmd: error: ambiguous option: --get=services could match --get-log-denied, --get-all-passthroughs, --get-icmptypes, --get-ipset-types, --get-all-rules, --get-ipsets, --get-rules, --get-zone-of-interface, --get-services, --get-entries, --get-zone-of-source, --get-protocols, --get-destinations, --get-modules, --get-automatic-helpers, --get-chains, --get-zones, --get-ports, --get-target, --get-active-zones, --get-description, --get-module, --get-helpers, --get-passthroughs, --get-source-ports, --get-family, --get-default-zone, --get-short, --get-all-chains, --get-destination
三、添加服务的端口
firewall-cmd --add-services=zabbix-agent
四、查看打开的服务
[root@kache conf]# firewall-cmd --zone=public --list-ports
46322/tcp 80/tcp 81/tcp 81/udp 80/udp
五、永久添加服务端口并生效
firewalld-cmd --permanent --add-services=zabbix-agent
添加
firewall-cmd --zone=public --add-port=80/tcp --permanent (--permanent永久生效,没有此参数重启后失效)
重新载入
firewall-cmd --reload
查看
firewall-cmd --zone=public --query-port=80/tcp
删除
firewall-cmd --zone=public --remove-port=80/tcp --permanent
有问题请加博主微信进行沟通!
全部评论