安装启用firewalld防火墙

CentOS7默认的防火墙是firewalld

如果没有firewalld防火墙,可以执行yum install firewalld 命令进行安装

firewalld防火墙启用与关闭

启动systemctl start firewalld

关闭systemctl stop firewalld

查看状态systemctl status firewalld

查看状态firewall-cmd --state

开机启用systemctl enable firewalld

开机禁用systemctl disable firewalld

添加开放端口

查看开放了哪些端口

firewall-cmd --zone=public --list-ports

添加端口

firewall-cmd --add-port=443/tcp --permanent //永久添加443端口,协议为tcp
firewall-cmd --reload //重新加载

删除端口

firewall-cmd --zone=public --remove-port=80/tcp --permanent //删除tcp下的80端口

参数介绍:

firewall-cmd:是Linux提供的操作firewall的一个工具(注意没有字母“d”);

--permanent:表示设置为持久;

--add-port:标识添加的端口

--remove-port:标识删除的端口

配置文件

firewalld的默认区域配置文件位置在/etc/firewalld/zones/下的.xml文件中,如下图:

另外,firewall中有Zone的概念,可以将具体的端口制定到具体的zone配置文件中。

例如:添加8010端口

firewall-cmd --zone=public --permanent --add-port=8010/tcp
// --zone=public:指定的zone为public;

systemctl

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

CentOS7使用firewalld防火墙配置端口的更多相关文章

  1. Centos7.5 firewalld防火墙配置

    CentOS 7.0默认使用的是firewall作为防火墙 1.查看firewall服务状态 systemctl status firewalld 2.查看firewall的状态 firewall-c ...

  2. Centos7下Firewalld防火墙配置命令

    前    言 服务端口日常被拦截,记录一下常用的命令便于查询 Firewalld服务管理 查看防火墙状态   1 systemctl status firewalld 开机启用/禁用防火墙   1 s ...

  3. CentOS7下Firewall防火墙配置用法详解

    官方文档地址: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Security_Guide ...

  4. Centos7和Centos6防火墙开放端口配置方法(避坑教学)

    ▲这篇文章主要为大家详细介绍了Centos7防火墙开放端口的快速方法,感兴趣的小伙伴们可以参考一下! 一.CentOS 7快速开放端口: CentOS升级到7之后,发现无法使用iptables控制Li ...

  5. Firewalld防火墙:端口转发与流量均衡

    firewalld和iptables的关系 firewalld自身并不具备防火墙的功能,而是和iptables一样需要通过内核的netfilter来实现,也就是说firewalld和iptables一 ...

  6. CentOS7使用firewalld防火墙

    firewalld的基本使用 启动: systemctl start firewalld 关闭: systemctl stop firewalld 查看状态: systemctl status fir ...

  7. 【Linux】CentOS7 打开关闭防火墙及端口

    一.centos7版本对防火墙进行加强,不再使用原来的iptables,启用firewalld1.firewalld的基本使用启动: systemctl start firewalld查状态:syst ...

  8. CentOS7使用iptables防火墙开放端口

    背景:在CentOS上面安装了mysql.svn.tomcat等软件,发现访问不了,用telnet命令查看端口,发现都不通: telnet IP 端口 CentOS7 默认使用firewalld防火墙 ...

  9. centos7 开放/关闭防火墙和端口

    --------------------------------------------------------------防火墙----------------------------------- ...

随机推荐

  1. 【English】二、It作为代词,可以代指什么

    it的用法 一.用作人称代词: 1.指代事物: — What’s this? — It’s a cat.2.指代人:常用于不知对方性别时,比如:询问敲门人或打电话时询问对方是谁,或者用来指代婴儿. ( ...

  2. jsp用el表达式获取后台传来的值,或者获取session中的值

    <script type="text/javascript"> var usernameC = ${sessionScope.SESSION_USER_PROFILE. ...

  3. python粗谈面向对象(一)

    1.面向过程编程vs函数式编程 面向过程编程 以计算对象的元素个数为例. str_1 = 'abcdefg' count = 0 for i in str_1: # 统计字符串元素个数 count + ...

  4. win10系统的“USB选择性暂停设置”怎么打开

    Win10系统自带的“USB选择性暂停设置”功能开启后会帮助我们节省电源,这一项功能对于笔记本来说用处很大.那么怎样才能打开这一功能呢?下面小编就来告诉大家打开“USB选择性暂停设置”功能的方法. 1 ...

  5. LeetCode算法题-Island Perimeter(Java实现)

    这是悦乐书的第238次更新,第251篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第105题(顺位题号是463).您将获得一个二维整数网格形式的地图,其中1代表土地,0代 ...

  6. There Are Now 3 Apache Spark APIs. Here’s How to Choose the Right One

    See Apache Spark 2.0 API Improvements: RDD, DataFrame, DataSet and SQL here. Apache Spark is evolvin ...

  7. jenkins乱码解决问题

    1.jenkins控制台线上乱码解决 系统管理——系统设置,添加编码环境变量 zh.CH.UTF-8 2.java启动后,tomcat日志显示乱码,原因是环境变量没有带过去,因此shell脚本头部需要 ...

  8. 【Git】+安装+使用+配置

    Git安装及使用: https://www.cnblogs.com/ximiaomiao/p/7140456.html Git下载地址: http://git-scm.com/download/win ...

  9. SpringBoot使用JSP(官网Demo)

    最开始接触java的时候,前端页面基本都是用jsp来写,最近公司项目要使用SpringBoot重构,查看SpringBoot文档,发现SpringBoot不建议使用JSP,因为jsp在使用内嵌serv ...

  10. mac 利用svn下载远程代码出现Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.

    终端输出的信息:Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo. ...