莫小安

CentOS7使用firewalld打开关闭防火墙与端口

1、firewalld的基本使用

启动: systemctl start firewalld

查看状态: systemctl status firewalld

停止: systemctl disable firewalld

禁用: systemctl stop firewalld

2.systemctl是CentOS7的服务管理工具中主要的工具,它融合之前service和chkconfig的功能于一体。

启动一个服务:systemctl start firewalld.service
关闭一个服务:systemctl stop firewalld.service
重启一个服务:systemctl restart firewalld.service
显示一个服务的状态:systemctl status firewalld.service
在开机时启用一个服务:systemctl enable firewalld.service
在开机时禁用一个服务:systemctl disable firewalld.service
查看服务是否开机启动:systemctl is-enabled firewalld.service
查看已启动的服务列表:systemctl list-unit-files|grep enabled
查看启动失败的服务列表:systemctl --failed

3.配置firewalld-cmd

查看版本: firewall-cmd --version

查看帮助: firewall-cmd --help

显示状态: firewall-cmd --state

查看所有打开的端口: firewall-cmd --zone=public --list-ports

更新防火墙规则: firewall-cmd --reload

查看区域信息:  firewall-cmd --get-active-zones

查看指定接口所属区域: firewall-cmd --get-zone-of-interface=eth0

拒绝所有包:firewall-cmd --panic-on

取消拒绝状态: firewall-cmd --panic-off

查看是否拒绝: firewall-cmd --query-panic

那怎么开启一个端口呢

添加

firewall-cmd --zone=public --add-port=80/tcp --permanent    (--permanent永久生效,没有此参数重启后失效)

重新载入

firewall-cmd --reload

查看

firewall-cmd --zone= public --query-port=80/tcp

删除

firewall-cmd --zone= public --remove-port=80/tcp --permanent

转载于:https://blog.51cto.com/topping/1934672

Centos 7 防火墙相关推荐

  1. CentOS 配置防火墙操作实例(启、停、开、闭端口)

          CentOS 配置防火墙操作实例(启.停.开.闭端口):   注:防火墙的基本操作命令: 查询防火墙状态: [root@localhost ~]# service   iptables s ...

  2. linux 防火墙设置ftp端口,CentOS 配置防火墙操作实例(启、停、开、闭端口)CentOS Linux-FTP/对外开放端口(接口)TomCat相关...

    CentOS 配置防火墙操作实例(启.停.开.闭端口): 注:防火墙的基本操作命令: 查询防火墙状态: [root@localhost ~]# service   iptables status 停止 ...

  3. linux防火墙状态centos5,Linux实战案例(5)关闭Centos的防火墙

    1.检查防火墙的状态 [root@LxfN1 ~]# service iptables status 表格:filter Chain INPUT (policy ACCEPT) num target ...

  4. CentOS 8防火墙配置

    概述 CentOS的防火墙通常是打开的,如果想从外部访问CentOS 内部的端口,首先需要在linux系统上开放对应的端口. 防火墙配置 查看防火墙状态 systemctl status firewa ...

  5. centos关闭防火墙命令

    centos关闭防火墙命令:1.临时关闭,代码为[systemctl stop firewalld]:2.禁止开机启动,代码为[systemctl disable firewalld]. 操作系统:c ...

  6. 【CentOS 7 防火墙配置】

    CentOS 7 防火墙配置 文章目录 CentOS 7 防火墙配置 前言 一.防火墙(Firewall)是什么? 二.使用步骤 1.外置防火墙 (1)在桌面右上角>>应用程序>&g ...

  7. Centos 7防火墙开放端口方法

    Centos 7防火墙开放端口方法 看到不少的网友还是有使用的是CentOS7版本的,比如我们较多的还是用到可视化面板宝塔面板建站.如果我们用的可视化面板建站环境的,防火墙的设置还是相对简单,我们直接 ...

  8. Centos 7_防火墙策略配置

    Centos 7防火墙策略配置指南 -- 清听凌雪慕忆 文章目录 1. 开启防火墙 1.1 user切换到root用户 1.2 查看防火墙服务状态 1.3 查看firewall的状态 1.4 启动/关 ...

  9. centos 7防火墙

    2019独角兽企业重金招聘Python工程师标准>>> 由于centos版本不同,开启端口号方式也不一样,centos6是iptables,centos7是firewall.下面主要 ...

  10. Linux实战案例(5)关闭Centos的防火墙

    1.检查防火墙的状态 [root@LxfN1 ~]# service iptables status 表格:filter Chain INPUT (policy ACCEPT) num target ...

最新文章

  1. C++中的类加多线程代码修炼之二
  2. 页面的缓存与不缓存设置
  3. docker-compose命令介绍和使用【官方英文文档翻译】【附加案例】
  4. HTML+CSS+JS实现 ❤️h5酷炫的天体木星动画特效❤️
  5. bz2解压命令_Java压缩技术 - tar.bz2解压缩
  6. SpringBoot整合Mybatis,并实现事务控制
  7. ios如何清理缓存?
  8. unix/linux命令参考
  9. linux fdisk,df,mount挂载及查看磁盘信息
  10. 斐讯k3 搭建php环境,斐讯K3刷机教程官改V2.1D或者其它版本教程
  11. Groovy入门教程
  12. 杂评 360和腾讯之争
  13. mac下安装破解版adobe photoshop cs6
  14. 服务器cpu支持4通道什么意思,Intel 10nm服务器CPU曝光 LGA4189接口、八通道内存
  15. 使用TP5开发微信服务商支付
  16. NOIP备战题解集(11.10)
  17. 威胁手游安全,这些知识点你要了解看看!
  18. grafana bar gauge使用问题
  19. 1.《剑指Java面试-Offer直通车》--计算机网络
  20. 北京拓保世纪:以硬技术为根本,用专业力量传递价值!

热门文章

  1. Android-上传图片(-)_HttpURLConnection
  2. C++五子棋(二)——游戏界面与棋子渲染
  3. 数据结构-队(C语言代码)
  4. CSS基础_Day03
  5. 聊城大学计算机学院韩玉艳,人工蜂群优化及其在资源管理中的应用.doc
  6. redmine 配置
  7. js解析url query_js如何解析url
  8. 非确定性算法_使用最坏情况提高基于MPC的避障算法对参数不确定性的鲁棒性
  9. 2020-12-14 Python PyCharm新建项目自动添加介绍和utf-8编码
  10. 我的世界服务器物品绑定插件,我的世界灵魂绑定插件详解