centos 7 :

添加

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

centos 6:

可在 /et/etc/sysconfig/iptables 配置,之后重启防火区即可:

如图示: -A INPUT -p tcp -m state --state NEW -m tcp --dport 8082 -j ACCEPT

Linux防火墙开放端口

    防火墙命令:

    查看防火墙状态: service iptables status

     开启                :service iptables start

     关闭                :service iptables stop

   注:cent os7如果出现 redirecting to systemctl ...Failed to ...not loaded. 可通yum 安装:

    yum install iptables-services
 systemctl enable iptables.service //设置开机启动

 

相关文章:

  • 2021-12-24
  • 2021-12-09
  • 2021-07-18
  • 2021-11-24
  • 2022-02-06
  • 2021-11-30
  • 2022-02-11
  • 2022-03-01
猜你喜欢
  • 2022-02-09
  • 2022-01-07
  • 2021-12-26
  • 2022-01-30
  • 2022-12-23
  • 2022-03-02
相关资源
相似解决方案