(转)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) 即时生效,重启后失效 开 ...
随机推荐
- python3 练手实例6 做一个简单日历
import calendar year = int(input('请输入要查询的年份:')) month = int (input('请输入要查询的月数:')) print (calendar.mo ...
- http升级https的时候,遇到一个问题
问题: Mixed Content: The page at 'https://api.xxxx.com/test' was loaded over HTTPS, but requested an i ...
- Python+Selenium+Unittest+HTMLTestRunner生成测试报告+发送至邮箱,记一次完整的cnblog登录测试示例,
测试思路:单个测试集.单个测试汇成多个测试集.运行测试集.生成测试报告.发送至邮箱. 第一步:建立单个测试集,以cnblog登录为例. 测试用例: cnblog的登录测试,简单分下面几种情况:(1)用 ...
- centos7 安装软件指南
1. 安装Scrapy: 首先确保依赖已经安装: yum groupinstall -y development tools yum install -y epel-release libxslt-d ...
- 开源mall学习
https://github.com/macrozheng/mall 学习知识点 1.Spring Security 2.@Aspect 3.logstash 4. es crud templete ...
- spring cloud分布式配置中心案例
这里仍然以Windows.jdk和idea为开发环境,按照下面的步骤打包-运行-访问就能看到效果:启动注册中心:java -jar F:\jars-config\register-0.0.1-SNAP ...
- MySQL5.7开启独立表空间参数innodb_file_per_table【原创】
今天在线上某个系统发现MySQL数据库使用的是共享表空间,想修改为独立表空间,操作如下: #因为是主从结构,在从库修改测试,先关闭binlog SET SQL_LOG_BIN=; show varia ...
- codeforces 813E 主席树
题意: 一个数列多组询问,每次询问[l,r]中最多能选多少个数字,其中每个数字的出现次数不超过k次 题解: 我们保存对于每个位置上,出现超过k次的位置,那么对于每次询问,我们就变成了查询区间[l,r] ...
- Light OJ 1266 - Points in Rectangle
题目 Link 就是查询矩形内有多少个点. 分析 二维树状数组维护就好了,. Code #include <bits/stdc++.h> const int maxn = 1000 + 1 ...
- JVM内存模型分析(一个程序运行的例子)
(.class字节码)类加载到内存之后,内存模型:(ps:.class文件可以通过javap 指令反编译成一个可读文件) 1.java栈,本地方法栈,程序计数器(每个线程私有) 看如下程序: 以该程序 ...