firewall-cmd开放某个端口
[root@localhost ~]#firewall-cmd --add-port=3306/tcp --zone=public --permanent
[root@localhost ~]#firewall-cmd --reload
[root@localhost ~]#firewall-cmd --list-port
firewall-cmd关闭某一个端口
[root@localhost ~]#firewall-cmd --remove-port=3306/tcp --zone=public --permanent
[root@localhost ~]#firewall-cmd --reload
[root@localhost ~]#firewall-cmd --list-port
firewall-cmd开放某个服务
[root@localhost ~]#firewall-cmd --add-service=ssh --zone=public --permanent
[root@localhost ~]#firewall-cmd --reload
[root@localhost ~]#firewall-cmd --list-service
firewall-cmd关闭某一个服务
[root@localhost ~]#firewall-cmd --remove-service=ssh --zone=public --permanent
[root@localhost ~]#firewall-cmd --reload
[root@localhost ~]#firewall-cmd --list-service
评论区