安装启用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. mysql安装出现问题(The service already exists)

    1.管理员身份运行cmd(系统win10) 2.输入命令cd /d F:\mysql-5.7.19-win32\bin(此为mysql要安装的目录) 3.输入安装命令mysqld install 出现 ...

  2. selenium-弹窗操作(八)

    本次以笔者公告栏的 打赏 弹窗为例 对弹窗中的一些操作进行封装后,在测试中使用 作用:减少对弹窗反复操作时进行定位的麻烦,以后使用中都直接调用即可达到目的 # coding=utf-8 from se ...

  3. Cherrypy文件上传非ASCII文件名乱码问题解决

    Cherrypy 版本: 18.0.1 由于某些特殊原因(可能是与标准兼容的问题),Cherrypy对上传文件的原文件名使用 ISO-8859-1 编码方式解码,导致非 ASCII 的文件名显示为乱码 ...

  4. Java 位运算符和 int 类型的实现

    Java 位运算符和 int 类型的实现 其他运算符 # 算术运算符 +.-.*./.++i.i++.--i.i-- # 关系运算符 ==.!=.>.<.>=.<= # 逻辑运 ...

  5. Bootstrap -- 文本,背景,其他样式

    Bootstrap -- 文本,背景,其他样式 1. 文本样式:展示了不同的文本颜色 使用文本样式: <!DOCTYPE html> <html> <head> & ...

  6. LeetCode算法题-Search in a Binary Search Tree(Java实现)

    这是悦乐书的第295次更新,第314篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第163题(顺位题号是700).给定一个二叉搜索树(BST)的和正整数val. 你需要在 ...

  7. Java开发学习心得(二):Mybatis和Url路由

    目录 Java开发学习心得(二):Mybatis和Url路由 1.3 Mybatis 2 URL路由 2.1 @RequestMapping 2.2 @PathVariable 2.3 不同的请求类型 ...

  8. PHP跨域jsonp方式

    <?php header('Access-Control-Allow-Origin:*');//注意!跨域要加这个头 上面那个没有 $arr = array ('a'=>1,'b'=> ...

  9. git添加/删除远程仓库

    注意:仓库只有管理员建的你才有权限上传,不然自己建的也没用,没权限上传 1.远程仓库路径查询 git remote -v 2.添加远程仓库 git remote add origin <你的项目 ...

  10. copy 和 deepcopy的区别

    import copy a = [1, 2, 3, 4, ['a', 'b']] b = a # 引用,除非直接给a重新赋值,否则a变则b变,b变则a变 c = copy.copy(a) # 浅复制, ...