CentOS 7.0默认使用的是firewall作为防火墙

1、firewalld的基本使用
启动: systemctl start firewalld
查看状态: systemctl status firewalld 
停止: systemctl disable firewalld
禁用: systemctl stop firewalld
 
2.systemctl是CentOS7的服务管理工具中主要的工具,它融合之前service和chkconfig的功能于一体。

启动一个服务:systemctl start firewalld.service
关闭一个服务:systemctl stop firewalld.service
重启一个服务:systemctl restart firewalld.service
显示一个服务的状态:systemctl status firewalld.service
在开机时启用一个服务:systemctl enable firewalld.service
在开机时禁用一个服务:systemctl disable firewalld.service
查看服务是否开机启动:systemctl is-enabled firewalld.service
查看已启动的服务列表:systemctl list-unit-files|grep enabled
查看启动失败的服务列表:systemctl --failed

3.配置firewalld-cmd

查看版本: firewall-cmd --version
查看帮助: firewall-cmd --help
显示状态: firewall-cmd --state
查看所有打开的端口: firewall-cmd --zone=public --list-ports
更新防火墙规则: firewall-cmd --reload
查看区域信息:  firewall-cmd --get-active-zones
查看指定接口所属区域: firewall-cmd --get-zone-of-interface=eth0
拒绝所有包:firewall-cmd --panic-on
取消拒绝状态: firewall-cmd --panic-off
查看是否拒绝: firewall-cmd --query-panic
 
那怎么开启一个端口呢
添加
firewall-cmd --zone=public --add-port=80/tcp --permanent    (--permanent永久生效,没有此参数重启后失效)
重新载入
firewall-cmd --reload
查看
firewall-cmd --zone=public --query-port=80/tcp
删除
firewall-cmd --zone=public --remove-port=80/tcp --permanent

重启:shutdown -r now ← 立刻关闭系统并重启

批量添加区间端口

firewall-cmd --zone=public --add-port=4400-4600/udp --permanent
firewall-cmd --zone=public --add-port=4400-4600/tcp --permanent
关闭selinux

Redhat应用了SELinux去加强平安,永久封闭的举措为:

修改 /etc/selinux/config 文件
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
#SELINUXTYPE=targeted
然后重启。
 

Centos7管理selinux及使用firewalld管理防火墙的更多相关文章

  1. 腾讯云服务器CentOS 7防火墙firewalld管理

    在腾讯云上买了个服务器(centOS7),部署了Tomcat(8080),Apache(80),MySQL(3306)等,一开始按照百度教程配置是把防火墙关闭了的.最近一段时间服务器总是莫名的被人修改 ...

  2. centos7 && centos6.5部KVM使用NAT联网并为虚拟机配置firewalld && iptables防火墙端口转发

    centos7 && centos6.5 部KVM使用NAT联网并为虚拟机配置firewalld && iptables防火墙端口转发 一.准备工作: 1: 检查kvm ...

  3. RHEL简单管理SELINUX

    Security Enhanced Linux(SELinux)是一个额外的系统安全层,主要目的是防止已遭泄露的系统服务访问用户数据. 对于一个服务来说,要关注SELinux的三个方面,一是文件SEL ...

  4. CentOS 使用firewalld打开防火墙与端口

    CentOS 使用firewalld打开防火墙与端口 LinuxCentOS 基本使用 启动 : systemctl start firewalld 关闭 : systemctl stop firew ...

  5. 第二十三章 Firewalld的防火墙

    一.防火墙基本概述 在CentOS7系统中集成了多款防火墙管理工具,默认启用的是firewalld(动态防火墙管理器)防火墙管理工具,Firewalld支持CLI(命令行)以及GUI(图形)的两种管理 ...

  6. 一个CentOS7的开发环境部署,包括防火墙|VPN|多IP多网关|HTTP代理服务器设置等

    http://www.lenggirl.com/code/centos7.html layout: post title: "一个CentOS7的开发环境部署,包括防火墙|VPN|HTTP代 ...

  7. Spring AOP /代理模式/事务管理/读写分离/多数据源管理

    参考文章: http://www.cnblogs.com/MOBIN/p/5597215.html http://www.cnblogs.com/fenglie/articles/4097759.ht ...

  8. Spring学习8-Spring事务管理(编程式事务管理)

    一.Spring事务的相关知识   1.事务是指一系列独立的操作,但在概念上具有原子性. 比如转账:A账号-100, B账号+100,完成.这两个操作独立是没问题的. 但在逻辑上,要么全部完成,要么一 ...

  9. centos7 修改selinux 开机导致 faild to load SELinux policy freezing 错误

    centos7 修改selinux 开机导致 faild to load SELinux policy  freezing 错误 之前把selinux关闭了,这次想打开selinux,于是修改了 /e ...

随机推荐

  1. sublime text 格式化html css 与显示函数列表

    sublime 格式化html css 1.ctrl + shift + p 2.输入install package,选择install package 3.输入:HTML-CSS-JS Pretti ...

  2. 我的直播demo

    推流工具: ffmpeg 接收/转发流工具: nginx-rtmp 在线播放工具: video.js -------------------------------------- demo地址: ht ...

  3. Using Fast Weights to Attend to the Recent Past

    Ba, Jimmy, et al. "Using Fast Weights to Attend to the Recent Past." Advances In Neural In ...

  4. [Bayes] *Bayesian Deep Learning for Transparency Improvement

    为何有必要进修统计机器学习? 因为你没有那么多的数据 因为未知的东西最终还是需理论所解释 基于规则?基于概率? ---- 图灵奖得主.贝叶斯之父 Judea Pearl 谈深度学习局限,想造自由意志机 ...

  5. jqgrid的search

    2015-04-19 本人近期的博客都是和之前的随笔相关联的. 今天想和大家分享的是jqgrid中的search. 相信大家写代码用到jqgrid的时候都可能会在jqgrid中涉及查询,其实查询和 增 ...

  6. 天地币:所用到的 Android Socket 通讯编程技术试验

    1.为了开发"天地币"这个Android手机项目,须要用到Socket编程. 2.天地币是一种类似于比特币的虚拟货币. 3.为了赚取CSDN的C币,须要写篇博客. 4.干脆将调试S ...

  7. 边缘检测算子和小波变换提取图像边缘【matlab】

    Roberts边缘检测算子:根据一对互相垂直方向上的差分可用来计算梯度的原理,采用对角线方向相邻两像素之差. 小波变换的方法比较适用于展现夹带在正常信号中的瞬间反常现象,具有方向敏感性.所以可以边缘检 ...

  8. poj 2987(最大权闭合图+割边最少)

    题目链接:http://poj.org/problem?id=2987 思路:标准的最大权闭合图,构图:从源点s向每个正收益点连边,容量为收益:从每个负收益点向汇点t连边,容量为收益的相反数:对于i是 ...

  9. JavaScript------一元运算符+的使用

    var y = "5"; // y 是一个字符串 var x = + y; // x 是一个数字 var y = "John"; // y 是一个字符串 var ...

  10. Date类、DateFormat类和Calendar类

    1.Date类 常用方法:long getTime():返回1970年1月1日00:00:00以来的毫秒值,把日期对象转换成毫秒值 2.DateFormat类 DateFormat类是日期/时间格式化 ...