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

CentOS 配置防火墙操做实例(启、停、开、闭端口):服务器

 

注:防火墙的基本操做命令:编辑器

查询防火墙状态:ide

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

 

中止防火墙:rest

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

 

启动防火墙:it

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

 

重启防火墙:class

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

 

永久关闭防火墙:

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

 

永久关闭后启用:

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

 

 

一、查看防火墙状态

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


二、编辑/etc/sysconfig/iptables文件。咱们实例中要打开8080端口和9990端口

用编辑器打开/etc/sysconfig/iptables 


三、依葫芦画瓢,咱们添加8080端口和9990端口


四、保存/etc/sysconfig/iptables文件,并在终端执行

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


五、重新查看防火墙状态

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


六、这时候,服务器的8080和9990端口就能够对外提供服务了。

七、其余端口的开放模式就是相似如此开放模式。

相关文章
相关标签/搜索