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.

1
2
3
4

查看防火墙是否关闭

firewall-cmd –state

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

1
2
3

开启防火墙

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

1
2
3
4
5

关闭防火墙

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

1
2
3
4
5

禁止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.

1
2
3

这样设置的话,下次重启开机的时候就会禁止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.

1
2
3
4

这样设置之后,开机就会自动开启防火墙。
显示防火墙应用列表

[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 ~]#

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

使用firewall-cmd --add-service=ftp 之后,列表显示出多了一个ftp服务
---------------------
作者:黄宝康
来源:CSDN
原文:https://blog.csdn.net/huangbaokang/article/details/79923382
版权声明:本文为博主原创文章,转载请附上博文链接!

CentOS 7.0 防火墙操作的更多相关文章

  1. CentOS 7.0 防火墙

    CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙.firewall:systemctl start firewalld.service#启动firewalls ...

  2. CentOS 7.0防火墙设置

    CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙.1.关闭firewall:systemctl stop firewalld.servicesystemctl ...

  3. centos 7.0防火墙导致vagrant端口映射失败

    在vagrant上部署了centos7.0后,Vagrantfile端口转发设置后,宿主机访问客户机站点还是无法访问,问题出在:centos7.0以上版本默认会安装firewalld防火墙, fire ...

  4. Centos 7.0防火墙问题

    从Centos7开始,自带的防火墙从iptables更改成了firewall.一般在企业环境,出于人力和稳定性考虑,还是用成熟的技术比较稳妥. 以下是关闭firewall的方法 systemctl s ...

  5. CentOS 端口和防火墙操作

    Centos 7 端口和防火墙命令: 查看已经开放的端口:firewall-cmd --list-ports 开启端口:firewall-cmd --zone=public --add-port=80 ...

  6. (转)CentOS 7.0关闭默认防火墙启用iptables防火墙

    场景:在本地虚拟机上使用ftp软件需要进行相应的端口设置,不可避免要访问Cnetos的防火墙,默认firewall操作不方便,所以需要进行相应的替换. 1 配置防火墙,开启80端口.3306端口 1. ...

  7. CentOS 7.0关闭默认防火墙启用iptables防火墙

    转自:https://www.cnblogs.com/lixuwu/p/6087023.html 阅读目录 1 配置防火墙,开启80端口.3306端口 2 关闭SELINUX 3 CentOS 配置防 ...

  8. CentOS 7.0关闭默认firewall防火墙启用iptables防火墙

    操作系统环境:CentOS Linux release 7.0.1406(Core) 64位CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙步骤. 1.关闭f ...

  9. CentOS 7.0,启用iptables防火墙

    CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙. 1.关闭firewall: systemctl stop firewalld.service #停止fir ...

随机推荐

  1. ES6 模块化与 CommonJS 模块化

    ES6 模块化 import命令用于输入其他模块提供的功能;export命令用于规定模块的对外接口. export 可以有多个,export default 仅有一个 a.js 模块a文件 导出多个方 ...

  2. iOS中基于WebView的HTML网页离线访问技术的实现

    其实就是MVC模式,视图在在线.离线时可以共用,控制器在在线时是由服务器端实现的,而离线时则是由本地Obj-C代码实现.具体实现方式为采用Mongoose实现. 代码为: mongoose.h mon ...

  3. php下载远程大文件(获取远程文件大小)

    function download_file($url) { // $url = http://192.168.8.95/vm/download_file?downurl=http://192.168 ...

  4. 通过注解实现Spring 声明式事务管理

    小Alan接着上一篇Spring事务管理入门与进阶做一些补充,如果对Spring事务管理还不了解的可以看看上一篇文章. 实例 在我们开始之前,至少有两个数据库表是至关重要的,在事务的帮助下,我们可以实 ...

  5. axios 同步问题

    Axios 是一个基于 Promise 的 HTTP 库,可以用在浏览器和 node.js 中(这是官方文档给出的一个解释说明) 它的主要作用是向后台发起异步请求,还有在请求中做更多的可控功能 1. ...

  6. flask代码统计作业

    用户表: create table userInfo( id int not null unique auto_increment, name )not null, password ) not nu ...

  7. JDK自带工具native2ascii

    背景:在做Java开发的时候,常常会出现一些乱码,或者无法正确识别或读取的文件,比如常见的validator验证用的消息资源(properties)文件就需要进行Unicode重新编码.原因是java ...

  8. matplotlib.pyplot 导引

    matplotlib.pyplot 是采用 python 语言和使用数值数学库 numpy 数组数据的绘图库.其主要目标是用于数据的可视化显示. 输出图形组成 matplotlib.pyplot 模块 ...

  9. 适用于 Windows 的虚拟机扩展和功能

    Azure 虚拟机扩展是小型应用程序,可在Azure 虚拟机上提供部署后配置和自动化任务. 例如,如果虚拟机要求安装软件.防病毒保护或进行 Docker 配置,便可以使用 VM 扩展来完成这些任务. ...

  10. Ubuntu18.04 vmware环境下配置静态ip

    各种linux系统发行版本配置静态ip方法各不相同,dhcp获取的话ip可能会变动,如果用xshell等工具连接的时候还要改ip,很是麻烦: 参考了网上各种配置Ubuntu18.04配置静态ip的方法 ...