(转)CentOS7中防火墙的基本操作
学习apache安装的时候需要打开80端口,由于centos 7版本以后默认使用firewalld后,网上关于iptables的设置方法已经不管用了,想着反正iptable也不会用,索性直接搬官方文档,学习firewalld了,好像比iptables要简单点了。
1、firewalld简介
- drop:默认丢弃所有包
- block:拒绝所有外部连接,允许内部发起的连接
- public:指定外部连接可以进入
- external:这个不太明白,功能上和上面相同,允许指定的外部连接
- dmz:和硬件防火墙一样,受限制的公共连接可以进入
- work:工作区,概念和workgoup一样,也是指定的外部连接允许
- home:类似家庭组
- internal:信任所有连接
2、安装firewalld
# yum install firewalld firewall-config
3、运行、停止、禁用firewalld
# systemctl start firewalld# systemctl status firewalld 或者 firewall-cmd --state# systemctl disable firewalld# systemctl stop firewalld4、配置firewalld
$ firewall-cmd --version$ firewall-cmd --help$ firewall-cmd --state$ firewall-cmd --zone=dmz --list-ports$ firewall-cmd --get-active-zones$ firewall-cmd --get-zone-of-interface=eth0$ firewall-cmd --panic-on$ firewall-cmd --panic-off$ firewall-cmd --query-panic$ firewall-cmd --reload$ firewall-cmd --complete-reload--permanent,然后reload防火墙# firewall-cmd --zone=public --add-interface=eth0
# firewall-cmd --set-default-zone=public
5 打开端口
# firewall-cmd --zone=dmz --add-port=8080/tcp
# vi /etc/sysconfig/iptables-config # 也可能是iptables文件
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
# systemctl restart firewalld # 重启防火墙使配置生效
# systemctl enable firewalld # 设置防火墙开机启动
(转)CentOS7中防火墙的基本操作的更多相关文章
- CentOS7中防火墙的一些常用配置
# 启动 systemctl start firewalld # 查看状态 systemctl status firewalld # 停止关闭 systemctl disable firewalld ...
- centos7中防火墙转为iptables
1.关闭firewall systemctl stop firewalld.service #停止firewall systemctl disable firewalld.service #禁止fir ...
- CentOS7 中防火墙配置
systemctl stop firewalld.service #停止firewall systemctl disable firewalld.service #禁止firewall开机启动 开 ...
- CentOS7中firewall防火墙详解和配置,.xml服务配置详解
修改防火墙配置文件之前,需要对之前防火墙做好备份 重启防火墙后,需要确认防火墙状态和防火墙规则是否加载,若重启失败或规则加载失败,则所有请求都会被防火墙 1. firewall-cmd --state ...
- CentOS中防火墙相关的命令(CentOS7中演示)
CentOS中防火墙程序主要是firewall和iptables,CentOS7中firewall服务已经默认安装好了,而iptables服务需要自己用yum install iptabes-se ...
- 003 centos7中关闭防火墙
在centos7中,防火墙有了新的变化.下面是常用的几个命令. 1.查看状态 systemctl status firewalld 2.关闭防火墙 systemctl stop firewalld.s ...
- centos7 中如何查看、打开、关闭防火墙。
首先是看centos7的防火墙的状态,查看的命令为: sudo systemctl status firewalld. 查看后,看到active(running)就意味着防火墙打开了, 如果想关闭防火 ...
- CentOS7中安装MySQL(简便)及 网站的搭建
一.首先,我们需要配置CentOS7中网络环境的搭建,物理机IP为192.168.100.39,虚拟机IP为192.168.100.139,网络模式设置为桥接模式 ,再进入系统挂载光盘.输入命令 ...
- Linux中防火墙centos
一般的防火墙用下面这些简单的配置都能达到目的 1) 重启后生效 开启: chkconfig iptables on 关闭: chkconfig iptables off 2) 即时生效,重启后失效 开 ...
随机推荐
- python-类对象以字典模式操作
#类对象以字典模式操作 class Person: def __init__(self): self.cache={} def __setitem__(self, key, value): #增加或修 ...
- BLSTM的训练算法、解码算法以及模型的改进
摘要 BLSTM解码时,解码器需要等待整个音频到达后才开始解码,因为时间反方向的前向传播需要末尾的历史信息.BLSTM这一延时问题使其不适用与实时语音识别.context-sensitive-chun ...
- Supervisor的安装以及使用
1.supervisor的介绍 Supervisor 是用Python开发的一个client/server服务,是Linux/Unix系统下的一个进程管理工具,不支持Windows系统,通过配置可以实 ...
- 转载-Mac下iterm无法使用rz并提示waiting to receive.**B0100000023be50
原文链接:https://www.kissfree.cn/2530.html 安装rz sz 1 2 brew install lrzsz 运行rz会报类似错:rz会出现?z waiting ...
- “短路求值(Short-Circuit Evaluation)
// 逻辑与和逻辑或操作符总是先计算其做操作数,只有在仅靠左操作数的值无法确定该逻辑表达式的结果时,才会求解其右操作数. function aa() { if (null) { console ...
- CSS字体渐变 & 隐藏浏览器滚动条 & grid布局(转载)
字体渐变 https://www.zhangxinxu.com/study/201104/css3-text-gradient-2.html 隐藏浏览器滚动条 https://blog.csdn. ...
- 第十三节,OPenCV学习(二)图像的简单几何变换
图像的简单几何变换 几何变换不改变图像的像素值,只是在图像平面上进行像素的重新安排 适当的几何变换可以最大程度地消除由于成像角度.透视关系乃至镜头自身原因所造成的几何失真所产生的的负面影响. 一.图像 ...
- P5303 [GXOI/GZOI2019]逼死强迫症
题目地址:P5303 [GXOI/GZOI2019]逼死强迫症 这里是官方题解 初步分析 从题目和数据范围很容易看出来这是一个递推 + 矩阵快速幂,那么主要问题在于递推的过程. 满足条件的答案一定是以 ...
- Appnium-API-Dvice
Device Activity Start Activity Start an Android activity by providing package name and activity name ...
- centos命令安装
1.解决ifconfig命令失效:需要安装net-tools工具 yum install net-tools 2.免密码登录 (1)通过命令,产生公钥信息 ssh-keygen -t rsa 如果提示 ...