CentOS 配置防火墙实例(端口)

1、防火墙的基本操作命令:

查询防火墙状态:
[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
重启防火墙服务: #/etc/init.d/iptables restart  

查看防火墙信息: #/etc/init.d/iptables status  

关闭防火墙服务: #/etc/init.d/iptables stop

2、查看防火墙状态

[root@localhost ~]# service iptables status 

7D4582B285DB44CD91EB8CF19EE8639B

3、编辑/etc/sysconfig/iptables文件。我们要打开8080端口和9990端口

 vim  /etc/sysconfig/iptables 

7D4582B285DB44CD91EB8CF19EE8639B

4、复制其中一条,修改端口号为,我们要添加8080端口和9990端口

EFB9723935704DC08148FAC9C1Csdfdf639

5、保存/etc/sysconfig/iptables文件,并重启iptables服务

[root@localhost ~]# service iptables restart

EFB9723935704DC08148FAC9C1C7E639

6、查看防火墙状态

 [root@localhost ~]# service iptables status

2895D8E595454CB19225AA2D8C6E988B

7、服务器的8080和9990端口已经打开了。

 

原创文章,转载请注明: 转载自HSBLOG

本文链接地址: CentOS 配置防火墙实例(端口)