CentOS 7.0默认使用的是firewall作为防火墙,之前版本是使用iptables。
所以在CentOS 7执行下面命令是无法查看防火墙状态的。

[root@localhost ~]# service iptables status
Redirecting to /bin/systemctl status iptables.service
Unit iptables.service could not be found.

查看防火墙是否关闭

firewall-cmd --state

[root@localhost ~]# firewall-cmd --state
not running
[root@localhost ~]#

开启防火墙

[root@localhost ~]# systemctl start firewalld
[root@localhost ~]# firewall-cmd --state
running
[root@localhost ~]#

关闭防火墙

[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# firewall-cmd --state
not running
[root@localhost ~]#

禁止firewall开机启动

[root@localhost ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
这样设置的话,下次重启开机的时候就会禁止firewall的启动,即关闭状态。

设置firewall开机启动

[root@localhost ~]# systemctl enable firewalld
Created symlink from /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service to /usr/lib/systemd/system/firewalld.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/firewalld.service to /usr/lib/systemd/system/firewalld.service.
这样设置之后,开机就会自动开启防火墙。

显示防火墙应用列表

[root@localhost ~]# firewall-cmd --list-all

public (active)
target: default
icmp-block-inversion: no
interfaces: ens33
sources: 
services: ssh dhcpv6-client
ports: 
protocols: 
masquerade: no
forward-ports: 
source-ports: 
icmp-blocks: 
rich rules:

[root@localhost ~]# firewall-cmd --add-service=ftp
success
[root@localhost ~]# firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: ens33
sources: 
services: ssh dhcpv6-client ftp
ports: 
protocols: 
masquerade: no
forward-ports: 
source-ports: 
icmp-blocks: 
rich rules:

[root@localhost ~]#

使用firewall-cmd --add-service=ftp 之后,列表显示出多了一个ftp服务。

 

CENTER OS7关闭防火墙的更多相关文章

  1. center os7.2 apache+php+mysql环境配置并设置https访问

    本人阿里云购买的center os7.2系统,小程序只支持https,因此需要配置https 安装apache yum -y install httpd systemctl start httpd a ...

  2. CentOS7使用firewalld打开关闭防火墙与端口(转载)

    1.firewalld的基本使用 启动: systemctl start firewalld 查看状态: systemctl status firewalld 停止: systemctl disabl ...

  3. Centos7 关闭防火墙

    CentOS 7.0默认使用的是firewall作为防火墙,使用iptables必须重新设置一下 1.直接关闭防火墙 systemctl stop firewalld.service #停止firew ...

  4. linux下如何关闭防火墙?如何查看防火墙当前的状态

    从配置菜单关闭防火墙是不起作用的,索性在安装的时候就不要装防火墙查看防火墙状态:/etc/init.d/iptables status暂时关闭防火墙:/etc/init.d/iptables stop ...

  5. Centos7 关闭防火墙(转)

    转载地址:http://www.cnblogs.com/silent2012/archive/2015/07/28/4682770.html CentOS 7.0默认使用的是firewall作为防火墙 ...

  6. 导入一些常用命令比如(rz),关闭防火墙外面可以访问

     yum -y install lrzsz-----------导入常用命令 我在虚拟机上面启动了一个项目 这个原因是防火墙造成的,关闭防火墙  iptables -L 查看下 service ipt ...

  7. Centos7设置关闭防火墙

    CentOS 7.0默认使用的是firewall作为防火墙,要想使用iptables必须重新设置一下. 1.关闭防火墙 [root@localhost ~]# systemctl stop firew ...

  8. centos关闭防火墙

    Centos7 关闭防火墙 CentOS 7.0默认使用的是firewall作为防火墙,使用iptables必须重新设置一下 1.直接关闭防火墙 systemctl stop firewalld.se ...

  9. Centos7 关闭防火墙(Firewalld ),使用防火墙(iptables)

    1.直接关闭防火墙 systemctl stop firewalld.service: #停止firewall systemctl disable firewalld.service: #禁止fire ...

随机推荐

  1. Server Tomcat v8.5 Server at localhost failed to start.

    问题描述:新建了一个项目,建立servlet文件然后改了下@WebServlet("floorButtonServlet")映射的路径,重启debug之后服务器启动失败. 在网上查 ...

  2. Windows 程序设计--(六)键盘

    6.2 击键消息 当按下一个键时,Windows把WM_KEYDOWN或者WM_SYSKEYDOWN消息放入有输入焦点的窗口的消息队列:当您释放一个键时,Windows把WM_KEYUP或者WM_SY ...

  3. VS code 生成html模板快捷键

    第一步:在空html文档中输入   ! 第二步:按下tab键.

  4. Java JNA (三)—— 结构体使用及简单示例

    JNA简介 JNA全称Java Native Access,是一个建立在经典的JNI技术之上的Java开源框架(https://github.com/twall/jna).JNA提供一组Java工具类 ...

  5. Backend事后诸葛亮

    事后诸葛亮 设想和目标 我们的软件要解决什么问题?是否定义得很清楚?是否对典型用户和典型场景有清晰的描述? 我们的软件想解决初学编程语言的入门困难.定义的不算太清楚,没有仔细地调查用户入门的困难之处. ...

  6. smbstatus - 报告当前 samba 的联接状态

    总览 smbstatus [-b] [-d] [-L] [-p] [-S] [-s configuration file] [-u username] 描述 此程序是 samba 套件的一部分. sm ...

  7. FTP客户端遇到150连接超时错误的处理办法

    环境:阿里云ECS,win server 2012 R2 / FTP Server(FileZilla 0.9.41) 问题描述:账号连接正常,但无法列出目录,提示150连接超时. 解决过程: 1.关 ...

  8. 【LeetCode】智商题 brainteaser(共3题)

    [292]Nim Game [319]Bulb Switcher [777]Swap Adjacent in LR String (2019年2月13日,谷歌tag) 给了两个字符串start 和en ...

  9. Sass函数-comparable 判断两个数是否可进行加减、合并

    comparable() 函数主要是用来判断两个数是否可以进行“加,减”以及“合并”.如果可以返回的值为 true,如果不可以返回的值是 false: >> comparable(2px, ...

  10. java 字符串的截取、转换、分割

    1.截取 package java07; /* 字符串的截取方法: public String substring(int index):截取从参数位置一直到字符串末尾,返回新字符串 public S ...