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: defaulticmp-block-inversion: nointerfaces: ens33sources: services: ssh dhcpv6-clientports: protocols: masquerade: noforward-ports: source-ports: icmp-blocks: rich rules: [root@localhost ~]# firewall-cmd --add-service=ftp
success
[root@localhost ~]# firewall-cmd --list-all
public (active)target: defaulticmp-block-inversion: nointerfaces: ens33sources: services: ssh dhcpv6-client ftpports: protocols: masquerade: noforward-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服务。

centos7 防火墙(关闭、开启、开机关闭、开机自启等)相关推荐

  1. Linux Centos7 防火墙(开启、关闭、重启、状态、端口)

    快速通道 什么是防火墙 防火墙功能 重要性 总结 开启关闭防火墙 启动防火墙 关闭防火墙 禁用防火墙 重启防火墙 查看防火墙的状态 当前版本 查看帮助 当前状态 查看当前状态 开放防火墙端口 端口开放 ...

  2. centos关闭php服务,linux(centos)防火墙的开启与关闭的方法

    本篇文章记录一下在linux(centos)系统下的防火墙的开启,关闭的方法.具体有两种方法: 一.执行"setup"命令启动文字模式配置实用程序,在"选择一种工具&qu ...

  3. Ubuntu中设置防火墙的开启与关闭

    今天在做 SVN 检出与提交的时候,一直失败,后来查找了多方面原因,是防火墙的问题.我用的 Ubuntu 是纯命令行界面的,所以需要通过命令进行开启与关闭. 这里介绍一下 Ubuntu 关于防火墙的设 ...

  4. Linux防火墙的开启、关闭、重启、查看永久处理防火墙(需重启系统后才能生效)

    1.概念: 防火墙它具备一定的防护功能,比如说端口的开放和禁止,也可做数据的转发(类似路由功能),策略及其他功能. 临时处理防火墙:如果系统重启,那么防火墙将恢复到之前的状态.此时就需要永久处理防火墙 ...

  5. Ubuntu防火墙的开启、关闭、查看

    查看防火墙状态: sudo ufw status #inactive状态是防火墙关闭状态 active是开启状态. 打开防火墙: sudo ufw status #状态为active 说明防火墙开启成 ...

  6. CentOS 7+查看防火墙状态开启或关闭防火墙命令

    CentOS 7+系统下查看防火墙状态的方法,CentOS 7系统下载开启和关闭防火墙的命令: CentOS 7+查看防火墙状态命令 命令:systemctl status firewalld 执行上 ...

  7. 计算机无线模块怎样关闭,开启或关闭计算机的无线网卡

    经常有同学的电脑不能上无线网了来找我帮忙装驱动或者重装系统,一来二去遇到不少问题,也学会了一些技巧和方法.这次整了一个中午弄得觉也没睡,有些晕了,不过还是总结一下,将这篇比较全面的对付"无线 ...

  8. Centos7防火墙常用操作打开关闭端口

    CentOS7 端口的开放关闭查看都是用防火墙来控制的,具体命令如下:一.打开/关闭某个端口 查看防火墙状态:(active (running) 即是开启状态) # systemctl status ...

  9. Centos防火墙的一键开启与关闭

    知识铺垫 一.防火墙的开启.关闭.禁用命令 (1)设置开机启用防火墙:systemctl enable firewalld.service (2)设置开机禁用防火墙:systemctl disable ...

  10. centos7 防火墙命令

    centos7 防火墙命令 防火墙的开启.关闭.禁用命令 防火墙端口命令 防火墙的开启.关闭.禁用命令 启动防火墙服务 [root@localhost jinjia523]# systemctl st ...

最新文章

  1. html5中的dom中的各种节点的层次关系是怎样的
  2. 如何在Java地毯下有效地清除问题
  3. 如何设置Active Directory域控制器
  4. 实用必备xp框架模块_两款实用工具类软件,是你的日常必备!
  5. SAP License:最近解决的一些SAP问题
  6. 总结 部署 Kubernetes+Heapster+InfluxDB+Grafana 详解
  7. Windows驱动之电源管理
  8. 我太机智了……30条关于数据行业内涵笑话漫画
  9. 第一次JAVA作业(ZLY)
  10. 认识netlogon服务
  11. 《网络攻防》 免杀原理与实践
  12. kettle效率提升
  13. 2021计算机一级新增知识点,2021年全国计算机等级考试改革有哪些内容
  14. java内省的意思,java内省机制 + 内省是什么 + 内省实现方式 + 和反射的区别
  15. 一个典型的代码走查检查单
  16. 我该怎么跟老板开口说辞职?
  17. BZOJ1128: [POI2008]Lam
  18. 增强型脉宽调制ePWM实验
  19. PS动作怎么做出水墨散开GIF动态图片效果
  20. Android6.0 无法锁屏

热门文章

  1. 荣耀magic5pro参数配置 荣耀magic5pro评测
  2. 两台电脑之间共享文件
  3. 【golang音频库】发现了一个特别棒的音频库,beep,使用docker方式驱动设备,可以使用golang进行控制音频设备,播放音乐。
  4. TX Text Control 31.X for WinForm Crack-new
  5. Photoshop创建新的填充或调整图层有什么用?
  6. 如何把powerpoint幻灯片大小改为标准或宽屏教程【图文】
  7. mkdir 创建目录
  8. 魅族16支持html吗,魅族16支持无线充电吗?
  9. ubuntu 安装雅黑字体
  10. 【三维CAD设计经验分享】CrownCAD设计:导航入门