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

转自:https://www.cnblogs.com/wliangde/p/3803891.htmlhtml

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

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

 

注:防火墙的基本操做命令:spa

查询防火墙状态:.net

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

 

中止防火墙:htm

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

 

启动防火墙:ip

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

 

重启防火墙:

[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端口就能够对外提供服务了。

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

相关文章
相关标签/搜索