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 ...
随机推荐
- 【bzoj2186】[Sdoi2008]沙拉公主的困惑
2186: [Sdoi2008]沙拉公主的困惑 Time Limit: 10 Sec Memory Limit: 259 MBSubmit: 3303 Solved: 1129[Submit][S ...
- WebFlux01 webflux概念、异步servlet、WebFlux意义
1 概念 待更新...... 2 异步servlet 2.1 同步servlet servlet容器(如tomcat)里面,每处理一个请求会占用一个线程,同步servlet里面,业务代码处理多久,se ...
- 在CentOS6.x下安装Compiz——桌面立方体,特效种种
很多人貌似认为compiz必须要emerland,但事实上,没这个必要. compiz+gnome,实用,而又华丽,是个不错的选择. compiz需要显卡驱动,一般情况下不成问题(别忘了这是很新的ce ...
- 现代C++学习笔记之一资料篇(C++ 11)
最近看网上一些开源的源代码,发现尽多不认识的符号,好吧.开始学习新的C++. C++经典书籍 C++ Primer,第五版开始有了对C++ 11的讲解 C++ Primer Plus,第六版有对C++ ...
- bash/shell的字符串trim实现
#!/bin/sh trim() { trimmed=$1 trimmed=${trimmed%% } trimmed=${trimmed## } echo $trim ...
- (转)关于Update语句的锁
原文地址:http://www.cnblogs.com/wdfrog/p/3144020.html 环境:MSSQL2005,在Read Committed级别 语句A:begin tranUpdat ...
- XE改变图标颜色
放一个image,load 一张png/..图片 再放一个FillRGBEffect, 将此控价拖到image下 改变FillRGBEffect的Color,就改变了image图标上的颜色. 原图为黑 ...
- 《Andorid开源》greenDao 数据库orm框架
一 前言:以前没用框架写Andorid的Sqlite的时候就是用SQLiteDatabase ,SQLiteOpenHelper ,SQL语句等一些东西,特别在写SQL语句来进行 数据库操作的时 ...
- asp.net mvc 中通过url字符串获取controller和action
在项目中遇到需要通过url字符串获取controller和action的情况,百度了 一下找到了一个可以用的方法 ,在这里分享和记录一下 这个方法是在博客园的博问里看到的 原文地址是http://q. ...
- Android学习笔记 Toast屏幕提示组件的使用方法
activity_main.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android&qu ...