centos7防火墙的关闭
从centos7开始使用systemctl来管理服务和程序,包括了service和chkconfig。
#systemctl list-unit-files|grep firewalld.service
[root@localhost ~]#systemctl status firewalld.service
关闭防火墙:
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
启动一个服务: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;echo $? 查看已启动的服务列表:systemctl list-unit-files|grep enabled
Centos 7 firewall 命令:
查看已经开放的端口:
1
|
firewall-cmd --list-ports |
开启端口
1
|
firewall-cmd --zone=public --add-port=80 /tcp --permanent |
命令含义:
–zone #作用域
–add-port=80/tcp #添加端口,格式为:端口/通讯协议
–permanent #永久生效,没有此参数重启后失效
关闭防火墙
1) 永久性生效,重启后不会复原
开启: chkconfig iptables on
关闭: chkconfig iptables off
2) 即时生效,重启后复原
开启: service iptables start
关闭: service iptables stop
查看防火墙状态: service iptables status
entOS 7默认使用的是firewall作为防火墙,使用iptables必须重新设置一下
1、直接关闭防火墙
1
2
3
|
systemctl stop firewalld.service #停止firewall systemctl disable firewalld.service #禁止firewall开机启动 |
2、设置 iptables service
1
|
yum -y install iptables-services |
如果要修改防火墙配置,如增加防火墙端口3306
1
|
vi /etc/sysconfig/iptables |
增加规则
1
|
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT |
保存退出后
1
2
3
|
systemctl restart iptables.service #重启防火墙使配置生效 systemctl enable iptables.service #设置防火墙开机启动 |
最后重启系统使设置生效即可。
1
2
3
|
systemctl start iptables.service #打开防火墙 systemctl stop iptables.service #关闭防火墙 |
centos7防火墙的关闭的更多相关文章
- centos6和centos7防火墙的关闭
CentOS6.5查看防火墙的状态: [zh@localhost ~]$service iptable status 显示结果: [zh@localhost ~]$service iptable st ...
- 详解centos6和centos7防火墙的关闭
http://www.jb51.net/article/101576.htm http://www.myhack58.com/Article/48/66/2013/37314.htm http://w ...
- CentOs7 使用iptables防火墙开启关闭端口
CentOs7 使用iptables防火墙开启关闭端口 # 0x01介绍 iptables命令是Linux上常用的防火墙软件,是netfilter项目的一部分iptables文件设置路径:命令:v ...
- Centos7防火墙和SELinux的开启和关闭
在虚拟机里面开启多个服务,对应多个端口,在防火墙开启的情况下,就要对外开放端口,这样客户端才能正常访问,但比较繁琐,关闭更直接点. 防火墙 临时关闭防火墙 systemctl stop firewal ...
- Linux防火墙开启关闭查询
1.centos7防火墙 命令含义: –zone #作用域 –add-port=80/tcp #添加端口,格式为:端口/通讯协议 –permanent #永久生效,没有此参数重启后失效 服务与端口的启 ...
- Linux CentOS中防火墙的关闭及开启端口
注:CentOS7之前用来管理防火墙的工具是iptable,7之后使用的是Firewall 样例:在CentOS7上安装tomcat后,在linux本机上可以访问tomcat主页,http://ip: ...
- 详解centos6和centos7防火墙
CentOS6.5查看防火墙的状态: ? 1 [zh@localhost ~]$service iptable status 显示结果: ? 1 2 3 4 5 6 7 8 9 [zh@localho ...
- centos7 防火墙 开启端口 并测试
1.防火墙 CentOS升级到7之后,发现无法使用iptables控制Linuxs的端口,google之后发现Centos 7使用firewalld代替了原来的iptables.下面记录如何使用fir ...
- CentOS 6和CentOS 7防火墙的关闭
CentOS6.5查看防火墙的状态: 1 [linuxidc@localhost ~]$service iptable status 显示结果: 1 2 3 4 5 [linuxidc@localho ...
随机推荐
- 102.愤怒的LJF
2841 愤怒的LJF 时间限制: 1 s 空间限制: 32000 KB 题目等级 : 黄金 Gold 题解 查看运行结果 题目描述 Description LJF发现ZPC的积分比他高,他很愤 ...
- js 根据开始日期和结束日期显示倒计时
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Con ...
- maven项目修改项目名
修改pom文件下面三处
- Manthan, Codefest 16 G. Yash And Trees dfs序+线段树+bitset
G. Yash And Trees 题目连接: http://www.codeforces.com/contest/633/problem/G Description Yash loves playi ...
- Android——多线程之Handler
Why? 因为在Android系统中UI操作并不是线程安全的,如果多个线程并发的去操作同一个组件,可能导致线程安全问题.为了解决这一个问题, android制定了一条规则:只允许UI线程来修改UI组件 ...
- 【Rocket MQ】RocketMQ 在windows7 64位安装使用 +RocketMQ管理界面的安装
参考地址:https://blog.csdn.net/yucaifu1989/article/details/80960018 参考地址:https://blog.csdn.net/u01204090 ...
- unity3d-地图制作之云彩飘动
首先,我先声明,关于美工制作我是一点都不了解,甚至基本上没接触过,所以今天开始我就兼并这美工加程序来学习. 当然,我只是对unity中的美术比较感兴趣而已,仅此而已. 所以,如果我在文章中讲的不对的地 ...
- Linux/Unix C编程之的perror函数,strerror函数,errno
#include <stdio.h> // void perror(const char *msg); #include <string.h> // char *strerro ...
- InfluxDB写流程
Influxdb version1.8 HTTP: 0x00000000016d0ce3 in github.com/influxdata/influxdb/coordinator.(*PointsW ...
- SQLAlchemy中filter()和filter_by()的区别
1.filter引用列名时,使用“类名.属性名”的方式,比较使用两个等号“==” 2.filter_by引用列名时,使用“属性名”,比较使用一个等号“=” 3.在使用多条件匹配的时候,filter需要 ...