Centos防火墙的配置
Selinux的三种模式:enforcing,passive,disable
临时更改模式:setengorce 1|0 1:enforcing, 0:passive
[root@Centos7-Server html]#
[root@Centos7-Server html]# setenforce
[root@Centos7-Server html]# getenforce
Permissive
[root@Centos7-Server html]#
[root@Centos7-Server html]# setenforce
[root@Centos7-Server html]# getenforce
Enforcing
[root@Centos7-Server html]#
查询当前seLinux模式:getenforce
[root@Centos7-Server html]#
[root@Centos7-Server html]# getenforce
Enforcing
[root@Centos7-Server html]#
[root@Centos7-Server html]#
selinux 的服务是firewalld。
防火墙的预定义区域:
public:只允许访问本机的某几种服务,如ping,dhcp,ssh等。
block:阻塞所有来访的请求
drop:将所有来访的请求数据包丢弃。
trusted:允许所有的访问请求。
查看默认区域:
[root@Centos7-Server html]# firewall-cmd --get-default-zone
public
[root@Centos7-Server html]#
修改默认区域:
[root@Centos7-Server html]#
[root@Centos7-Server html]# firewall-cmd --set-default-zone=trusted
success
[root@Centos7-Server html]# firewall-cmd --get-default-zone
trusted
[root@Centos7-Server html]#
查看区域详细信息:
[root@Centos7-Server html]#
[root@Centos7-Server html]# firewall-cmd --zone=public --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: ens33
sources:
services: ssh dhcpv6-client ftp http
ports:
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules: [root@Centos7-Server html]#
向区域中添加服务:
[root@Centos7-Server html]#
[root@Centos7-Server html]# firewall-cmd --zone=public --add-service=dns
success
[root@Centos7-Server html]# firewall-cmd --zone=public --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: ens33
sources:
services: ssh dhcpv6-client ftp http dns
ports:
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules: [root@Centos7-Server html]#
重新加载防火墙的配置:
[root@Centos7-Server html]#
[root@Centos7-Server html]# firewall-cmd --reload
success
[root@Centos7-Server html]#
[root@Centos7-Server html]#
[root@Centos7-Server html]#
[root@Centos7-Server html]#
[root@Centos7-Server html]# firewall-cmd --zone=public --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: ens33
sources:
services: ssh dhcpv6-client
ports:
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules: [root@Centos7-Server html]#
永久配置防火墙策略:--permanent这个选项的作用是永久配置防火墙,配置后需要重新加载防火墙配置文件才能生效。
[root@Centos7-Server html]#
[root@Centos7-Server html]# firewall-cmd --permanent --zone=public --add-service=ftpsuccess
[root@Centos7-Server html]# firewall-cmd --permanent --zone=public --add-service=http
success
[root@Centos7-Server html]#
[root@Centos7-Server html]#
[root@Centos7-Server html]#
[root@Centos7-Server html]#
[root@Centos7-Server html]# firewall-cmd --zone=public --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: ens33
sources:
services: ssh dhcpv6-client
ports:
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules: [root@Centos7-Server html]# firewall-cmd --reload
success
[root@Centos7-Server html]# firewall-cmd --zone=public --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: ens33
sources:
services: ssh dhcpv6-client ftp http
ports:
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules: [root@Centos7-Server html]#
端口重定向:
服务器将访问端口转换成另一个端口,如:192。168.0.50:5324 --》192.168.0.50:80通过5324端口访问网页。
[root@Centos7-Server ~]# firewall-cmd --permanent --zone=public --add-forward-port=port=:proto=tcp:toport=
success
[root@Centos7-Server ~]#
[root@Centos7-Server ~]#
[root@Centos7-Server ~]#
[root@Centos7-Server ~]#
[root@Centos7-Server ~]# firewall-cmd --reload
success
[root@Centos7-Server ~]#
[root@Centos7-Server ~]#
[root@Centos7-Server ~]#
[root@Centos7-Server ~]#
[root@Centos7-Server ~]#
[root@Centos7-Server ~]#
[root@Centos7-Server ~]# firewall-cmd --zone=public --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: ens33
sources:
services: ssh dhcpv6-client ftp http
ports:
protocols:
masquerade: no
forward-ports: port=:proto=tcp:toport=:toaddr=
source-ports:
icmp-blocks:
rich rules: [root@Centos7-Server ~]#
[root@Centos7-Server ~]#
[root@Centos7-Server ~]#
Centos防火墙的配置的更多相关文章
- centos防火墙端口配置
增加防火墙配置,允许8080端口: # vi /etc/sysconfig/iptables 在允许ssh的下面增加一条: -A INPUT -m state --state NEW -m tcp - ...
- CentOS防火墙iptables的配置方法详解
CentOS系统也是基于linux中的它的防火墙其实就是iptables了,下面我来介绍在CentOS防火墙iptables的配置教程,希望此教程对各位朋友会有所帮助. iptables是与Linux ...
- CentOS 7 防火墙端口配置
CentOS 7 防火墙端口配置查看防火墙是否开启systemctl status firewalld 若没有开启则开启systemctl start firewalld 查看所有开启的端口firew ...
- CentOS 7 与老版本CentOS防火墙配置的区别
一.CentOS 7 以下版本防火墙的配置: 1.开放80,22,8080 端口/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT/sbin/ipt ...
- CentOS 6.9下的Setup工具(用于管理服务/防火墙/网络配置/验证服务)
说明:Setup工具套件好像是CentOS下特有的用于管理服务/防火墙/网络配置等,其实就是基于命令行模式界面的GUI工具.唯一特点就是方便. 安装: #安装Setup命令工具 yum -y inst ...
- Centos 7防火墙策略配置指南
Centos 7防火墙策略配置指南 -- 清听凌雪慕忆 @ 目录 1. 开启防火墙 1.1 user切换到root用户 1.2 查看防火墙服务状态 1.3 查看firewall的状态 1.4 启动/关 ...
- 解决宿主机不能访问虚拟机CentOS中的站点 | 更新CentOS防火墙设置开启80端口访问
前阵子在虚拟机上装好了centos6.0,并配好了nginx+php+mysql,但是本机就是无法访问.一直就没去折腾了. 具体情况如下 1.本机能ping通虚拟机 2.虚拟机也能ping通本机 3. ...
- centos防火墙操作
centos防火墙基本操作 #/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT#/sbin/iptables -I INPUT -p tcp -- ...
- Centos下安装配置LAMP(Linux+Apache+MySQL+PHP)
Centos下安装配置LAMP(Linux+Apache+MySQL+PHP) 关于LAMP的各种知识,还请大家自行百度谷歌,在这里就不详细的介绍了,今天主要是介绍一下在Centos下安装,搭建一 ...
随机推荐
- scss-@media
首先回顾下css3中的@media 定义和使用: 使用 @media 查询,你可以针对不同的媒体类型定义不同的样式. @media 可以针对不同的屏幕尺寸设置不同的样式,特别是如果你需要设置设计响应式 ...
- SQLAlchemy的使用---查询的更多操作
# 查询更多操作 from create_table import User, engine from sqlalchemy.orm import sessionmaker Session = ses ...
- 洛谷P1970 花匠(dp)
题意 题目链接 Sol 直接用\(f[i][0/1]\)表示到第\(i\)个位置,该位置是以上升结尾还是以下降结尾 转移的时候只需枚举前一个即可 #include<cstdio> #inc ...
- asp.net中<input type=button>无法调用后台函数
例如:用<input id="bt1" type="button" runat="server" Onclick="btnL ...
- SharePoint 2013 - Cross-domain Library
首先,参考链接:https://msdn.microsoft.com/en-us/library/office/fp179893.aspx?f=255&MSPPError=-214721739 ...
- C++之不带指针类的设计——Boolean
经典的类设计分类 带指针类 不带指针类 Header文件的布局 #ifndef __COMPLEX__ #define __COMPLEX__ #include <iostream.h> ...
- Linux中基于apache httpd的svn服务器搭建与配置
mod_dav_svn是apache连接svn的模块 yum install subversion mod_dav_svn httpd 配置文件简单说明, SVNParentPath 说明可以在指定的 ...
- Database 2 Day DBA guide_Chapter3
Chapter 3: Getting Started with Oracle Enterprise Manager 第三章:开始oracle企业管理器. Purpose(目的) This chapte ...
- February 24 2017 Week 8 Friday
If you fail, don't forget to learn your lesson. 如果你失败了,千万别忘了汲取教训. Frankly speaking, it is easy to ta ...
- oracle spatial下对wkt字符串操作遇到srid的解决方案
<span style="font-size:18px;">select fid from vgnss where SDO_WITHIN_DISTANCE(geom, ...