CentOS防火墙配置

由于防火墙的存在,大部分端口是不能使用的,包括tomcat等,所以要配置防火墙策略。

CentOS是用的firewall而不是iptables,直接配置firewall即可。

firewall-cmd --state #查看防火墙状态

防火墙默认是开启的,即running状态,在此状态下,添加需要开放的端口

firewall-cmd --permanent -zone=public --add-port=8080/tcp

--permanent 表示永久开放该端口

firewall-cmd --reload    #重启防火墙,加载配置
firewall-cmd --permanent --zone=public --list-ports    #查看开启的端口

 

posted @ 2020-07-24 10:18  一叶孤舟随浪起  阅读(58)  评论(0)    收藏  举报