(转)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) 即时生效,重启后失效 开 ...
随机推荐
- Bootstrap常用样板
http://blog.csdn.net/Star_449/article/details/76098292 1.图片样式 1.1..img-responsive: 直接为图片添加该样式,可以实现响应 ...
- Machine Learning 思维导图
Feature Enigneering 经用 sns.distplot 测试 一个Series 做 StandardScaler().fit_transform(Seriese) 之前和之后的图形形状 ...
- luogu P5322 [BJOI2019]排兵布阵
传送门 普及dp 设\(f_{i,j}\)表示前\(i\)个城堡,用\(j\)人的最大价值,转移枚举一个对手,如果这个对手在\(i\)这个城堡人数是第\(k\)小的,那么用\(2a_i+1\)人可以得 ...
- 关于Android8及以上版本自定义广播无法接收问题
高版本Android直接发送广播是无法接收的 e.g. sendBraodcast(intent); 需要在前面加上(前一个String为接收广播应用的项目地址,后一个为该广播类的地址) intent ...
- ZOJ 4110 Strings in the Pocket (马拉车+回文串)
链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=4110 题目: BaoBao has just found two s ...
- css悬浮提示框
效果图: code: <!DOCTYPE html> <html lang="en"> <head> <meta charset=&quo ...
- input 上报流程图
input 上报流程图 http://blog.chinaunix.net/uid-28320320-id-3389196.html
- ffmpeg推流方式采用TCP协议
ffmpeg默认推流方式采用UDP方式,若需要使用TCP协议,则需要修改. 1.使用命令时: ffmpeg 跟参数 -rtsp_transport tcp 2.编码时 AVFormatContext ...
- zabbix3.2利用自动发现功能对fastcgi模式的php状态进行集中监控
zabbix3.2利用自动发现功能对fastcgi模式的php状态进行集中监控 前端nginx虚拟主机引用后端多个php接口,为了方便监控,将后端服务器集中配置在nginx中,具体配置如下: [roo ...
- 不能忽视 php warning
2018-12-5 10:50:22 星期三 遇到一个问题: 前一行是取数组中的某一个值, 后一行是用heredoc输出一串javascript脚本; 因为取数组中值的时候键不存在, 导致后续输出的j ...