Centos7 iptables firewalld防火墙与selinux配置
一.iptables防火墙
1.基本操作
# 查看防火墙状态
service iptables status
# 停止防火墙
service iptables stop
# 启动防火墙
service iptables start
# 重启防火墙
service iptables restart
# 永久关闭防火墙
chkconfig iptables off
# 永久关闭后重启
chkconfig iptables on
2.开启80端口
vim /etc/sysconfig/iptables
# 加入如下代码
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
保存退出后重启防火墙
service iptables restart
3.iptables配置操作
待续...
二、firewall防火墙
1.查看firewall服务状态
systemctl status firewalld
出现Active: active (running)切高亮显示则表示是启动状态。
出现 Active: inactive (dead)灰色表示停止,看单词也行。
2.查看firewall的状态
firewall-cmd --state
3.开启、重启、关闭、firewalld.service服务
# 开启
service firewalld start
# 重启
service firewalld restart
# 关闭
service firewalld stop
4.查看防火墙规则
firewall-cmd --list-all
5.firewall开放关闭端口
# 查询端口是否开放
firewall-cmd --query-port=8080/tcp
# 开放80端口
firewall-cmd --permanent --add-port=80/tcp
# 移除端口
firewall-cmd --permanent --remove-port=8080/tcp
#重启防火墙(修改配置后要重启防火墙)
firewall-cmd --reload
# 参数解释
1、firwall-cmd:是Linux提供的操作firewall的一个工具;
2、--permanent:表示设置为持久;
3、--add-port:标识添加的端口;
三.selinux
# 查看selinux状态
[root@localhost ~]# getenforce
Enforcing
# 临时关闭selinux状态
[root@localhost ~]# setenforce 0
[root@localhost ~]# getenforce
Permissive
# 永久关闭
[root@localhost ~]# vim /etc/sysconfig/selinux
SELINUX=enforcing 改为 SELINUX=disabled
Centos7 iptables firewalld防火墙与selinux配置的更多相关文章
- CentOS7使用firewalld防火墙配置端口
安装启用firewalld防火墙 CentOS7默认的防火墙是firewalld 如果没有firewalld防火墙,可以执行yum install firewalld 命令进行安装 firewalld ...
- Iptables&Firewalld防火墙
一.IPtables 1.IPtables入门简介 Netfilter/Iptables(以下简称Iptables)是unix/linux自带的一款优秀且开放源代码的完全自由的基于包过滤的防火墙工具, ...
- CentOS7使用firewalld防火墙
firewalld的基本使用 启动: systemctl start firewalld 关闭: systemctl stop firewalld 查看状态: systemctl status fir ...
- centos7之firewalld防火墙的配置与使用
firewalld是centos7开始提供的管理防火墙工具,提供了一个动态管理的防火墙,当然低层仍然调用的是 netfilter . 一.区域(zone)firewalld将网卡对应到不同的区域(zo ...
- Centos7下Firewalld防火墙配置命令
前 言 服务端口日常被拦截,记录一下常用的命令便于查询 Firewalld服务管理 查看防火墙状态 1 systemctl status firewalld 开机启用/禁用防火墙 1 s ...
- Centos7.5 firewalld防火墙配置
CentOS 7.0默认使用的是firewall作为防火墙 1.查看firewall服务状态 systemctl status firewalld 2.查看firewall的状态 firewall-c ...
- Centos7和Centos6防火墙开放端口配置方法(避坑教学)
▲这篇文章主要为大家详细介绍了Centos7防火墙开放端口的快速方法,感兴趣的小伙伴们可以参考一下! 一.CentOS 7快速开放端口: CentOS升级到7之后,发现无法使用iptables控制Li ...
- centos7 iptables/firewalld docker open port
here are multiple "hackish" ways to do it: scan kernel logs, as mentioned by Jiri (but you ...
- CentOS 7 打开关闭FirewallD防火墙端口命令
CentOS 7 使用firewalld代替了原来的iptables,使用方法如下: >>>关闭防火墙 systemctl stop firewalld.service ...
随机推荐
- django之orm的高级操作以及xcc安全攻击
查询用法大全: 1. 比较运算符 # id > 3 res = models.UserInfo.objects.filter(id__gt=3) # id >= 3 res = model ...
- BootStrap jQuery 在线cdn
Bootstrap 3.3.0 js 文件 <script src="http://cdn.bootcss.com/bootstrap/3.3.0/js/bootstrap.min.j ...
- 牛客小白赛4 C题
乘法逆元: 一个数a 乘上 b,在mod之后再还原成本来的数 a 这里就要用到乘法逆元,(a*b)%mod*inv(b,mod)==a ll exgcd(ll a,ll b,ll &x,ll ...
- 【Struts 文件上传下载】
RegisterAction package k.action; import k.domain.User; import k.form.UserForm; import k.service.User ...
- java 实现一段文字中,出现次数最多的字
代码如下: public static void main(String[] args) { String str = "大批量,之前都没怎么注意过,这个问题确实不会,网上参考了下别人的,大 ...
- 安装ubuntu18.04.3全过程
目录 一.安装ubuntu18.04.3操作系统 二.系统设置 三.非开发常用软件安装 四.开发常用软件安装 五.ubuntu相关知识 六.参考文章链接 正文 一.安装ubuntu18.04.3操作系 ...
- 新建maven工程运行出现Intellij idea 报错:Error : java 不支持发行版本5
Step1点击: 点击 保持一致: Step2点击 这样就可以了. 主要是运行时jdk版本不一致的问题
- 正确的上网姿势:ubuntu18.04使用clash
本文为本人将CFW(Clash For Windows)上的配置文件应用到ubuntu上面的操作备忘,仅供个人使用 首先下载已经打包的clash压缩包:https://github.com/Dream ...
- 《JavaScript高级程序设计》读书笔记(三)基本概念第五小节流程控制语句
内容---语法 ---数据类型 上一小节---流程控制语句 本小节---理解函数 语句--ECMA-262规定了一组语句,也称流程控制语句 if语句-- 条件可以是任意表达式,-- ECMAScrip ...
- CRS-1硬件维护
一.CRS-1硬件介绍CRS-1 路由器是Cisco 推出的新的大容量骨干路由器,是一个支持多机箱扩展的路由系统.其设计容量可以扩展至72 个线卡机箱.8 个矩阵机箱,总交换容量达到92Tbps,具有 ...