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 开放/关闭防火墙和端口
--------------------------------------------------------------防火墙----------------------------------- ...
随机推荐
- 【Linux】SSH证书免密码远程登陆Linux(Putty)
1.前言 新购置一台便宜服务器做数据库服务器,减轻Web服务器的压力. 为了安全性,root密码设置的非常复杂(随机生成),厌倦了拷贝密码登陆的历史. Putty基本用法都不会的请先花10分钟自行学习 ...
- [spring transaction],service实现类中非事务方法直接调用自身事务方法导致事务无效的原因
首先,准备service接口,两个 public interface AccountService { public void createAccount(Account account, int t ...
- win10 系统 wifi自动断开连接 wifi热点不稳定
我的系统的电脑是win10系统,笔记本 下载了一个wifi共享大师,但是wifi总是自动断,于是就找了找问题所在 在网上看了许多方案,大多数都是 在 电源管理 把[允许计算机关闭此设备以节 ...
- 二叉搜索树的最近公共祖先的golang实现
给定一个二叉搜索树, 找到该树中两个指定节点的最近公共祖先. 百度百科中最近公共祖先的定义为:“对于有根树 T 的两个结点 p.q,最近公共祖先表示为一个结点 x,满足 x 是 p.q 的祖先且 x ...
- mysql创建唯一索引,避免数据重复插入
多台服务器使用一个数据库时,有时就会出现重复插入的情况,eg:people表中的姓名和身份证号 此时可以给姓名和身份证号创建唯一索引, 创建语句:alter table people add uniq ...
- Linux定是调用shell脚本删除文件
编写脚本 vi delbak.sh 代码如下: #!/bin/sh location="/home/mysql/backup/" find $location -mtime +7 ...
- Linux:Day13(下) GRUB
GRUB(Boot Loader): grub:GRand Unified Bootloader grub 0.x:grub legacy grub 1.x:grub2 grub legacy: st ...
- Linux系统中常见的目录名称以及相应内容
目录名称 应放置文件的内容 /boot 开机所需文件——内核.开机菜单以及所需配置文件等等 /dev 以文件形式存放任何设备与接口 /etc 配置文件 /home 用户家目录 /bin 存放单用户模式 ...
- Cursor: Pin S Wait On X In The Top 5 Wait Events
Wait Events , Posted in: Technical Track Tags: Group Blog Posts, Oracle, Technical Blog Lately, wait ...
- 修改xampp-apache访问目录
文章转自 https://my.oschina.net/u/3618644/blog/1569972 问题来源: 一般情况下,每个项目占用一个根目录,而不是一个根目录下面有多个项目. 比如说,安装xa ...