CentOS7下,防火墙设置
CentOS中防火墙程序主要是firewall和iptables两种。
CentOS7中firewall服务已经默认安装好了,而iptables服务需要自己用yum install iptabes-services来安装。
1、firewall防火墙操作
1.1 基本操作
操作命令
启动 systemctl start firewalld
关闭 systemctl stop firewalld
查看状态 systemctl status firewalld
开机禁用 systemctl disable firewalld
开机启用 systemctl enable firewalld
查看版本 firewall-cmd --version
查看列表 firewall-cmd --list-all
1.2 开启一个防火墙端口
① 添加端口
firewall-cmd--add-port=3306/tcp --permanent
(--permanent永久生效,没有此参数重启后失效)
② 重新载入 firewall-cmd --reload
③ 查看所有打开的端口 firewall-cmd --list-ports
1.3 删除一个已开启的端口
firewall-cmd --remove-port=3306/tcp--permanent
2、iptables防火墙操作
2.1 切换到iptables首先应该关掉默认的firewalld,然后安装iptables服务。
#关闭firewall service firewalld stop
#禁止firewall开机启动 systemctl disablefirewalld.service
#安装iptables防火墙 yum install iptables-services
2.2 Iptables防火墙基本操作
操作命令
查看防火墙状态 service iptables status
停止防火墙 service iptables stop
启动防火墙 service iptables start
永久关闭防火墙 chkconfig iptables off
永久关闭后重启 chkconfig iptables on
2.3 编辑iptables防火墙配置
vi /etc/sysconfig/iptables
以下是配置文件示例,编辑自己的规则

依照其中22端口,添加自己需要的端口
:wq保存退出后重启防火墙
service iptablesrestart
CentOS7下,防火墙设置的更多相关文章
- Linux下防火墙设置
Linux下开启/关闭防火墙命令 1) 永久性生效,重启后不会复原 开启:chkconfigiptables on 关闭:chkconfigiptables off 2) 即时生效,重启后复原 开启 ...
- Centos7.5 防火墙设置
Centos7.5默认使用firewalld作为防火墙 1.查看firewalld服务状态 systemctl status firewalld 2.查看firewalld的状态 firewall-c ...
- centos7.3 防火墙设置
1.查看firewall服务状态 systemctl status firewalld 2.查看firewall的状态 firewall-cmd --state 3.开启.重启.关闭.firewall ...
- centos7.4 防火墙设置
1.关闭默认的firewall防火墙 systemctl stop firewalld.service #停止firewall systemctl disable firewalld.service ...
- Centos7下Redis设置开机自启动服务
有个同事说重启了服务器没有自启动redis,我看了一下,是以前手动编译安装的模式,没有配置开机启动的服务 这边做个笔记记录一下redis如何设置编译安装模式的开机自启动. 第一种方法: 1.编写red ...
- Centos7下chkconfig设置MySql自动启动
1.将服务文件拷贝到init.d下,并重命名为mysql cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql 2.赋予可执 ...
- Centos7关闭防火墙 设置开机启动
[root@nmserver-7 ~]# systemctl stop firewalld.service [root@nmserver-7 ~]# systemctl status firewall ...
- centos7开放端口和防火墙设置
centos7开放端口和防火墙设置. 查看防火墙状态: firewall-cmd --state 如果显示: not running 打开防火墙服务: systemctl start firewall ...
- (9)centos下防火墙firewalld设置
学习apache安装的时候需要打开80端口,由于centos 7版本以后默认使用firewalld后,网上关于iptables的设置方法已经不管用了,想着反正iptable也不会用,索性直接搬官方文档 ...
- CentOS7防火墙设置常用命令
目录 开/关/重启防火墙 查看所有开启的端口号 CentOS7环境下防火墙常用命令 开/关/重启防火墙 查看防火墙状态 firewall-cmd --state 启动防火墙 systemctl sta ...
随机推荐
- yii 执行流程
应用执行流程: 浏览器向服务器发送 Http Request | 控制器(protected/controllers) | |---> Action | 创建模型 (Model) | 检查$_P ...
- 看到了一个pipeline例子,
pipeline { agent any options { timestamps() } parameters { string(name: 'GIT_BRANCH', defaultValue: ...
- Sequelize-nodejs-5-Querying
Querying查询 Attributes To select only some attributes, you can use the attributes option. Most often, ...
- 删除iptables nat 规则
删除FORWARD 规则: iptables -nL FORWARD --line-numberiptables -D FORWARD 1 删除一条nat 规则 删除SNAT规则 iptables ...
- 【MongoDB】MongoDB与项目搭配启动进程
项目启动/数据连接命令 (20180701成功且不用再找正确关闭mongoDB的方式) 如上图在mongoDB的bin目录的同级新建mongo.config.mongostart.bat.mongo ...
- 填移动端坑系列一——如何让h5页面完美整屏显示
原创哟,转载请附上本文连接(http://www.cnblogs.com/AliceX-J/p/6707908.html),作者 印前 后续更简单 前言: 最近让做一个h5的活动专题,便让我浩浩荡荡进 ...
- Delphi在Android下使用Java库
本文将以Android的USB串口通讯库为例,介绍Delphi如何在Android中使用Java的库. USB串口通讯库地址: https://github.com/felHR85/UsbSerial ...
- 详解 Python3 正则表达式(五)
上一篇:详解 Python3 正则表达式(四) 本文翻译自:https://docs.python.org/3.4/howto/regex.html 博主对此做了一些注明和修改 ^_^ 非捕获组和命名 ...
- 使用HDFS来进行线上应用的文件存储
使用HDFS来进行线上应用的文件存储 分类: 云计算2011-07-06 17:57 721人阅读 评论(0) 收藏 举报 hadoop任务集群存储数据分析服务器 这段时间公司使用的hadoop组件h ...
- vue动态修改title
1.项目中,cmd下 ,运行:cnpm install vue-wechat-title --save 2.在 main.js 中,设置: import VueWechatTitle from 'vu ...