首页 > 系统相关 >CentOS7使用firewalld打开关闭防火墙与端口

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

时间:2022-08-23 09:00:27浏览次数:61  
标签:service -- cmd firewalld 防火墙 CentOS7 firewall systemctl

1、firewalld的基本使用

    启动: systemctl start firewalld

    关闭: systemctl stop firewalld

    查看状态: systemctl status firewalld 

    开机禁用  : systemctl disable firewalld

    开机启用  : systemctl enable 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

4.那怎么开启一个端口呢

    添加

    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

标签:service,--,cmd,firewalld,防火墙,CentOS7,firewall,systemctl
From: https://www.cnblogs.com/1539136475-/p/16614917.html

相关文章

  • centos7 磁盘扩容
    环境:主机Centos7分区表类型GPT文件系统格式xfs双硬盘双系统(机械安装centos7,固态装win10)上次除了扩容到50G外,就是把/dev/sda中number4的分区end接......
  • docker jenkins centos7.9安装
    1、搜索jenkins镜像dockersearchjenkins---------------------NAMEDESCRIPTIONSTARSOFFICIALAUTOMATED......
  • centos7下tomcat部署jenkins版本升级
    jenkins升级步骤war包下载地址https://www.jenkins.io/download/点击PastReleases,选择war版本1.将要升级指定版本的jenkins的war包下载并解压到tomcat的webapp目录下w......
  • CentOS7安装MongoDB
    一、服务器说明系统环境版本:CentOSLinuxrelease7.3.1611(Core)MongoDB版本:5.0.11二、环境配置2.1、停止防火墙systemctlstatusfirewalld#查看fire......
  • Centos7安装Docker
    0.安装DockerDocker分为CE和EE两大版本。CE即社区版(免费,支持周期7个月),EE即企业版,强调安全,付费使用,支持周期24个月。DockerCE分为stabletest和nightly......
  • CentOS7 安装MySQL教程
    【0】保持网络畅通【1】查看是否已安装MySQLrpm-qa|grepmysql下面是我的操作,可见没有安装MySQL,那么直接进入【2】如果查看出来有东西,可以使用下面命令将其删除(x......
  • Centos7手动启用Swap分区
    Centos7手动启用Swap分区第一步、查看是否开启过swap分区cat/proc/swaps如果没有信息,就说明没有开启swap分区,如果有说明已经开启过swap分区了第二步、创建文件夹,创建swa......
  • Linux Centos 打开和关闭防火墙
      systemctlstatusfirewalld.service#查看防火墙状态systemctlstartfirewalld.service#开启防火墙systemctlstopfirewalld.service#关......
  • 防火墙技术
    防火墙概述防火墙是一种安全设备,用于保护一个网络区域免受来自另一个网络区域的攻击和入侵,通常被应用于网络边界,例如企业互联网出口、企业内部业务边界、数据中心边界等。......
  • ubuntu关于防火墙开放端口
    一、防火墙1、查看防火墙状态sudoufwstatus1系统提示:“Status:inactive”状态:不活跃上面提示表示没有开启防火墙,并不是没有安装防火墙注:如果没有安装防火墙,可以使用......