Linux

来源:互联网 发布:fc2域名用不了2017 编辑:程序博客网 时间:2024/04/23 21:27

之所以称为CentOS6下操作防火墙,是因为CentOS7防火墙与之前版本不同,配置需要额外注意。

【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

【2】配置防火墙

命令如下:

vim /etc/sysconfig/iptables 

添加8656端口:

这里写图片描述


保存配置文件并执行如下命令使其生效:

[root@localhost ~]# service iptables restart