CentOS 配置防火墙操做实例(启、停、开、闭端口):编辑器
注:防火墙的基本操做命令:.net
查询防火墙状态:rest
[root@localhost ~]# service iptables statusblog
中止防火墙:ip
[root@localhost ~]# service iptables stop get
启动防火墙:table
[root@localhost ~]# service iptables start 配置
重启防火墙:iptables
[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端口就能够对外提供服务了。
七、其余端口的开放模式就是相似如此开放模式。