CentOS 7 开放防火墙端口 命令(转载)
CentOS 7 开放防火墙端口 命令
最近公司新的server要求用CentOS7, 发现以前CentOS 6 系列中的 iptables 相关命令不能用了,查了下,发现Centos 7使用firewalld代替了原来的iptables。
使用方法如下:
>>> 关闭防火墙
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 #设置防火墙开机启动
最后重启系统使设置生效即可。
===============================================
安装ruby:
http://www.cnblogs.com/ssgeek/p/9223465.html
CentOS 7 开放防火墙端口 命令(转载)的更多相关文章
- 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 开放防火墙端口 命令
iptables防火墙 1.基本操作 # 查看防火墙状态 service iptables status # 停止防火墙 service iptables stop # 启动防火墙 servi ...
- CentOS 7 开放防火墙端口
我:最近在使 CentOS 7时发现在本地不能访问linux上8080端口,以上是我的操作,修改后访问成功 CentOS 7 开放防火墙端口 命令 最近公司新的server要求用CentOS7, 发现 ...
- Centos7 开放防火墙端口命令
Centos 7 使用firewalld代替了原来的iptables,使用方法如下: >>>关闭防火墙 systemctl stop firewalld.service ...
- centos7安装 ftp 组件与开放防火墙端口命令
Linux 安装 ftp 组件 安装完后,有/etc/vsftpd/vsftpd.conf 文件,是 vsftp 的配置文件. 1.执行 yum -y install vsftpd 2. 添加一个 f ...
- CentOS/Linux开放某些端口
CentOS/Linux开放某些端口 CentOS/Linux 装载系统的时候只开启了少数端口如22,80(有些连80都没有开放)等. 结果再装完Nginx+PHP+MySQL 后不能访问网站. 当然 ...
- Centos 7和 Centos 6开放查看端口 防火墙关闭打开
Centos 7 firewall 命令: 查看已经开放的端口: firewall-cmd --list-ports 开启端口 firewall-cmd --zone=public --add-por ...
- Centos 7 开放查看端口 防火墙关闭打开
Centos 7 firewall 命令: 查看已经开放的端口: firewall-cmd --list-ports 开启端口 firewall-cmd --zone=public --add-por ...
随机推荐
- xcode中的预定义宏
[xcode中的预定义宏] 1.SRCROOT,是定义本target的proj的路径. 2.OBJROOT,对象文件根路径,对象文件(即obj文件)就是中间的临时文件.中间文件输出目录的名字以“pro ...
- C# 文件打印
Process pr = new Process(); pr.StartInfo.FileName = “C:\test.xls”; ...
- 关于CountDownLatch控制线程的执行顺序
在上一篇文章中说过使用thread.join()方法.newSingleThreadExecutor单线程池来控制线程执行顺序.在文章的末尾我提出了一种构想,可否使用经典的生产者和消费者模型来控制执行 ...
- 【bzoj1015】星球大战starwar
1015: [JSOI2008]星球大战starwar Time Limit: 3 Sec Memory Limit: 162 MBSubmit: 5139 Solved: 2332[Submit ...
- ARCGIS空间叠加分析(转)
ARCGIS空间叠加分析 https://blog.csdn.net/gswwldp/article/details/66974465 (2)双击④处的Identity,打开Identity操作对话框 ...
- JSP标签 <meta> 的作用
meta标签: meta标签共有两个属性,它们分别是http-equiv属性和name属性. name 属性 : <meta name="Generator" contect ...
- SQL SERVER FOR XML PATH合并字符串
两种方式,效率立竿见影 ------------------------------------------------ SET STATISTICS TIME ON DECLARE @OrderSt ...
- CentOS7虚拟机安装Linux教程及安装后所遇到的问题
1.VMware Workstation15下载. 官方链接:http://download3.vmware.com/software/wkst/file/VMware-workstation-ful ...
- 在Global.asax文件的Application_BeginRequest中获取request请求内容
protected void Application_BeginRequest(object sender, EventArgs e) { try { string isLogRequest = Sy ...
- 如何将一个用utf-8编码的文本用java程序转换成ANSI编码的文本
jdk有一个关于UTF-8的bug所以加了一句 br.skip(1); bugID: http://bugs.java.com/view_bug.do?bug_id=4508058 public st ...