Centos 7 关于防火墙的命令
有些人安装的linux的系统默认防火墙不是iptables,而是firewall,那就得使用以下方式关闭防火墙了。
>>>关闭防火墙
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
>>>开启端口
firewall-cmd --zone=public --add-port=80/tcp --permanent
命令含义
--zone #作用域
--add-port=80/tcp #添加端口,格式为:端口/通讯协议
--permanent #永久生效,没有此参数重启后失效
>>>重启防火墙
firewall-cmd --reload
其他常用命令:
firewall-cmd --state ##查看防火墙状态,是否是running
firewall-cmd --reload ##重新载入配置,比如添加规则之后,需要执行此命令
firewall-cmd --get-zones ##列出支持的zone
firewall-cmd --get-services ##列出支持的服务,在列表中的服务是放行的
firewall-cmd --query-service ftp ##查看ftp服务是否支持,返回yes或者no
firewall-cmd --add-service=ftp ##临时开放ftp服务
firewall-cmd --add-service=ftp --permanent ##永久开放ftp服务
firewall-cmd --remove-service=ftp --permanent ##永久移除ftp服务
firewall-cmd --add-port=80/tcp --permanent ##永久添加80端口
iptables -L -n ##查看规则,这个命令是和iptables的相同的
man firewall-cmd ##查看帮助
更多命令,使用 firewall-cmd --help 查看帮助文件
>>> CentOS 7.0默认使用的是firewall作为防火墙,使用iptables必须重新设置一下
1、直接关闭防火墙
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
2、设置 iptables service
yum -y install iptables-services
如果要修改防火墙配置,如增加防火墙端口3306
vi /etc/sysconfig/iptables
增加规则
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
保存退出后
systemctl restart iptables.service #重启防火墙使配置生效
systemctl enable iptables.service #设置防火墙开机启动
Centos 7 关于防火墙的命令的更多相关文章
- CentOS 7 开放防火墙端口命令
CentOS 7 开放防火墙端口 命令 最近公司新的server要求用CentOS7, 发现以前CentOS 6 系列中的 iptables 相关命令不能用了,查了下,发现Centos 7使用fire ...
- CentOS 7 开放防火墙端口 命令(转载)
CentOS 7 开放防火墙端口 命令 最近公司新的server要求用CentOS7, 发现以前CentOS 6 系列中的 iptables 相关命令不能用了,查了下,发现Centos 7使用fire ...
- linux 安装禅道 和 CentOS 7 开放防火墙端口 命令
linux 安装禅道链接: https://www.cnblogs.com/maohuidong/p/9750202.html CentOS 7 开放防火墙端口 命令 链接:https://www. ...
- CentOS 7中防火墙 firewall-cmd命令
在 CentOS 7 iptable 防火墙已经被 firewall替代 1.暂时开放FTP服务 firewall-cmd --add-service=ftp 2.永久开放FTP服务 firewall ...
- CentOS 7 开放防火墙端口 命令
iptables防火墙 1.基本操作 # 查看防火墙状态 service iptables status # 停止防火墙 service iptables stop # 启动防火墙 servi ...
- CentOS 7 开放防火墙端口
我:最近在使 CentOS 7时发现在本地不能访问linux上8080端口,以上是我的操作,修改后访问成功 CentOS 7 开放防火墙端口 命令 最近公司新的server要求用CentOS7, 发现 ...
- CentOS 7.0关闭服务器的防火墙服务命令
1.直接关闭防火墙systemctl stop firewalld.service #停止firewallsystemctl disable firewalld.service #禁止firewall ...
- centos 防火墙相关命令
防火墙关闭: systemctl stop firewalld systemctl disable firewalld 重启防火墙: systemctl enable firewalld system ...
- linux(centos) 项目部署阶段相关命令汇总
1.ssh免密码登陆主要命令cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys-->添加公钥service sshd restart -- ...
- 161118、linux(centos) 项目部署阶段相关命令汇总
1.ssh免密码登陆 主要命令 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys-->添加公钥 service sshd restart ...
随机推荐
- 如何配置 maven 编译插件的 JDK 版本
普通maven项目配置编译器版本 参考maven官方文档 Setting the -source and -target of the Java Compiler maven有2种方法设置编译JDK版 ...
- Common.Logging+log4net搭建项目日志框架
原文参考链接:https://www.cnblogs.com/heys/p/5787123.html Common.Logging+(log4net/NLog/) common logging是一 ...
- 使用JAVA8 filter对List多条件筛选
记录项目开发的过程中遇到的一些问题及解决方法,由于公司操作数据库都是统一使用工具生成的存在一些多表查询模糊查询,这些操作只能在集合方面下手了,比如发送邮件记录方面查询,对用户的名字及邮件模糊检索 年龄 ...
- hbase - [06] rowkey的设计
HBase是三维有序存储的,通过rowkey(行键),column key(column family和qualifier)和TimeStamp(时间戳)这三个维度可以对HBase中的数据进行快速定位 ...
- php查询结果汉字乱码解决方法
问题描述:使用php查询数据显示,显示的结果中所有汉字乱码 问题及解决:这种情况是编码造成的,检查数据库及页面编码是否一致,也可在页面增加: header('Content-Type:text/htm ...
- CICFlowMeter 使用方法
前言 因实验需要提取流量特征,就找到了这个较为著名的流量特征提取工具 CICFlowMeter .例如 CIC-IDS-2017 数据集就是通过这个工具提取而来. 网络上的教程众说纷纭,但我始终是无法 ...
- 分布式锁—7.Curator的分布式锁
大纲 1.Curator的可重入锁的源码 2.Curator的非可重入锁的源码 3.Curator的可重入读写锁的源码 4.Curator的MultiLock源码 5.Curator的Semaphor ...
- mac ping IP+端口的方法
nc -vz -w 2 192.168.1.104 3306
- Golang 入门 : 字符串及底层字符类型
字符串 基本使用 在 Go 语言中,字符串是一种基本类型,默认是通过 UTF-8 编码的字符序列,当字符为 ASCII 码时则占用 1 个字节,其它字符根据需要占用 2-4 个字节,比如中文编码通常需 ...
- Linux下启动Oracle命令
1.进入LInux,切换到Oracle用户权限,输入数据库密码.su - oracle 1在这里插入图片描述2.输入sqlplus "/as sysdba" 1在这里插 ...