CentOS7使用firewalld防火墙配置端口
安装启用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防火墙配置端口的更多相关文章
- Centos7.5 firewalld防火墙配置
CentOS 7.0默认使用的是firewall作为防火墙 1.查看firewall服务状态 systemctl status firewalld 2.查看firewall的状态 firewall-c ...
- Centos7下Firewalld防火墙配置命令
前 言 服务端口日常被拦截,记录一下常用的命令便于查询 Firewalld服务管理 查看防火墙状态 1 systemctl status firewalld 开机启用/禁用防火墙 1 s ...
- CentOS7下Firewall防火墙配置用法详解
官方文档地址: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Security_Guide ...
- Centos7和Centos6防火墙开放端口配置方法(避坑教学)
▲这篇文章主要为大家详细介绍了Centos7防火墙开放端口的快速方法,感兴趣的小伙伴们可以参考一下! 一.CentOS 7快速开放端口: CentOS升级到7之后,发现无法使用iptables控制Li ...
- Firewalld防火墙:端口转发与流量均衡
firewalld和iptables的关系 firewalld自身并不具备防火墙的功能,而是和iptables一样需要通过内核的netfilter来实现,也就是说firewalld和iptables一 ...
- CentOS7使用firewalld防火墙
firewalld的基本使用 启动: systemctl start firewalld 关闭: systemctl stop firewalld 查看状态: systemctl status fir ...
- 【Linux】CentOS7 打开关闭防火墙及端口
一.centos7版本对防火墙进行加强,不再使用原来的iptables,启用firewalld1.firewalld的基本使用启动: systemctl start firewalld查状态:syst ...
- CentOS7使用iptables防火墙开放端口
背景:在CentOS上面安装了mysql.svn.tomcat等软件,发现访问不了,用telnet命令查看端口,发现都不通: telnet IP 端口 CentOS7 默认使用firewalld防火墙 ...
- centos7 开放/关闭防火墙和端口
--------------------------------------------------------------防火墙----------------------------------- ...
随机推荐
- QT获取本机IP和Mac地址
#include <QNetworkInterface> #include <QList> void MainWindow::getIPPath() { QString str ...
- (办公)MojoExecutionException
MojoExecutionException : mavan打包错误. 通过以下命令解决:mvn clean install (新改的内容生效)
- windows下安装virtualenv并且配置指定环境
下面是在windows下通过virtualenv创建虚拟环境, 包括 : 1. 安装virtualenv(使用pip可直接安装) 2. 使用virtualenv创建指定版本的虚拟环境 3. 进入虚拟环 ...
- SQL Server非域(跨域)环境下镜像(Mirror)的搭建步骤及注意事项
在实际的生产环境下,我们经常需要跨域进行数据备份,而创建Mirror是其中一个方案.但跨域创建Mirror要相对复杂的多,需要借助证书进行搭建. 下面我们将具体的步骤总结如下: 第一部分 创建证书 S ...
- UltraEdit 注册机
IDM-All-Products-KeyGen-v3.6UltraEdit 注册机 1.断开网络连接,运行UltraEdit软件后,点击“帮助”—“注册/激活”; 2.许可证ID填写“zd423”.密 ...
- 安装和使用git遇到的问题总结
一,centos7下安装(因为centos7下用yum安装git的版本太低了,所以只能下载源代码,然后用源代码安装) 下载编译工具 yum -y groupinstall "Developm ...
- SQLServer之创建LOGON触发器
LOGON触发器工作原理 登录触发器将为响应 LOGON 事件而激发存储过程. 与 SQL Server实例建立用户会话时将引发此事件. 登录触发器将在登录的身份验证阶段完成之后且用户会话实际建立之前 ...
- 读写锁ReentrantReadWriteLock的使用
package com.thread.test.Lock; import java.util.Random; import java.util.concurrent.locks.Lock; impor ...
- Linux系统中常见的目录名称以及相应内容
目录名称 应放置文件的内容 /boot 开机所需文件——内核.开机菜单以及所需配置文件等等 /dev 以文件形式存放任何设备与接口 /etc 配置文件 /home 用户家目录 /bin 存放单用户模式 ...
- volatile分析
volatile三大特性: 1. 内存可见性 2.不保证原子性 3. 禁止重排序内存屏障的概念:memory barrier是一个CPU指令.指令逻辑:a.确保一些特定操作执行顺序 b.影响一些数据的 ...