在linux实际操作中经常需要对防火墙进行修改,比如经常要修改或添加相关端口,下面以添加运行Tomcat所需8080端口为例:

(以下命令操作均为root用户)

1、编辑iptables文件

# vi /etc/sysconfig/iptables

添加如下一行,可以参照已有的已经开启的ssh的22端口

-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT

(修改8080为其他端口,即可开启其他端口,如80,21等)

2、重启防火墙

# service iptables restart

搞定!

 

 

 

 

 

 

 

 

CentOS 配置防火墙操作实例(启、停、开、闭端口) 

http://blog.csdn.net/jemlee2002/article/details/7042991


注:防火墙的基本操作命令:

查询防火墙状态:

[root@localhost ~]# service   iptables status<回车>

 停止防火墙:

[root@localhost ~]# service   iptables stop <回车>

启动防火墙:

[root@localhost ~]# service   iptables start <回车>

 重启防火墙:

[root@localhost ~]# service   iptables restart <回车>

永久关闭防火墙:

[root@localhost ~]# chkconfig   iptables off<回车>

永久关闭后启用:

[root@localhost ~]# chkconfig   iptables on<回车>

相关文章:

  • 2021-12-10
  • 2021-12-31
  • 2022-12-23
  • 2022-12-23
  • 2021-11-29
  • 2022-12-23
  • 2021-10-12
猜你喜欢
  • 2021-07-25
  • 2022-12-23
  • 2021-12-04
  • 2021-08-27
  • 2022-01-09
  • 2022-01-30
相关资源
相似解决方案