手工添加Linux防火墙端口

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

(如下命令操做均为root用户)ssh

一、编辑iptables文件tcp

# vi /etc/sysconfig/iptables.net

添加以下一行,能够参照已有的已经开启的ssh的22端口rest

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

(修改8080为其余端口,便可开启其余端口,如80,21等)ip

二、重启防火墙table

# service iptables restart配置

搞定 iptables

 

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<回车>

相关文章
相关标签/搜索