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. UVA 12034 Race (递推神马的)

    Disky and Sooma, two of the biggest mega minds of Bangladesh went to a far country. They ate, coded ...

  2. 关于selenium IDE找不到元素bug

    使用 selenium IDE 录制脚本,经常会发生 这样一种错误. 页面上,明明存在这个元素,就是找不到. 其实原理很简单   , 按钮 点击,没有时间延迟,但是页面加载,需要一段时间. 页面元素还 ...

  3. 玩转Win10的45个快捷键

    1Win10快捷键大全(第一部分) Win10发布已经快两个星期了,各项新功能也让小伙伴们兴奋不已.和之前系统一样,Win10也加入了很多经典的快捷键,同时还加入了全新触控手势.今天小编就将所有的Wi ...

  4. python+pandas+openpyxl下载xls illegalCharacterError

    仅仅是urllib2.unquote_plus解码是不够的,需要将特殊字符去掉 ILLEGAL_CHARACTERS_RE = re.compile(r'[\000-\010]|[\013-\014] ...

  5. 使用Fiddler调试线上JS代码

    在下面的命令框输入“select script”回车来筛选js请求 将HTTP请求重定向到本地的文件,进行web调试.这种调试方式不需要发布到线上再验证,避免了修改不成功.对用户造成影响的风险 左边一 ...

  6. 破解idea注册码

    添加 “0.0.0.0 account.jetbrains.com”到host, hosts位置:C:\Windows\System32\drivers\etc 获取注册码网址: http://ide ...

  7. linux 启动jar命令

    进入ECS目录jar 存放目录: 1.执行命令: linux:启动jar nohup java -jar qualityshop-api.jar>log.file 2>&1 &am ...

  8. Windows Server2008R2中导入Excel

    使用Microsoft.ACE.OLEDB对Excel进行操作: string strConn = "Provider=Microsoft.ACE.OLEDB.12.0;" + & ...

  9. 维纳滤波和编码曝光PSF去除运动模糊【matlab】

    编码曝光知识 - ostartech - 博客园 https://www.cnblogs.com/wxl845235800/p/8276362.html %%%%%%%%%%%%%%%%%%%%%%% ...

  10. linux中的etc目录

    etc不是什么缩写,是and so on的意思 来源于 法语的 et cetera 翻译成中文就是 等等 的意思. 至于为什么在/etc下面存放配置文件, 按照原始的UNIX的说法(linux文件结构 ...