发布于 2017-01-05 06:23:24 | 172 次阅读 | 评论: 0 | 来源: 网友投递

这里有新鲜出炉的精品教程,程序狗速度看过来!

CentOS Linux操作系统

CentOS(Community Enterprise Operating System,中文意思是:社区企业操作系统)是Linux发行版之一,它是来自于Red Hat Enterprise Linux依照开放源代码规定释出的源代码所编译而成。


centos 7中防火墙是一个非常的强大的功能了。这篇文章主要介绍了CentOS7中防火墙的一些常用配置,需要的朋友可以参考下

centos 7中防火墙是一个非常的强大的功能了,但对于centos 7中在防火墙中进行了升级了,下面我们一起来详细的看看关于CentOS7中防火墙的一些常用配置。


# 启动 
systemctl start firewalld
# 查看状态
systemctl status firewalld
# 停止关闭
systemctl disable firewalld
systemctl stop firewalld
# 把一个源地址加入白名单,以便允许来自这个源地址的所有连接
# 这个在集群中使用常见
# 设置后利用firewall-cmd --reload更新防火墙规则
firewall-cmd --add-rich-rule 'rule family="ipv4" source address="192.168.1.215" accept' --permanent
firewall-cmd --reload
# 特定域内的用户通过ssh可以连接,24标识255.255.255.0
firewall-cmd --remove-service=ssh --permanent
firewall-cmd --add-rich-rule 'rule family=ipv4 source address=172.16.30.0/24 service name=ssh accept' --permanent 
firewall-cmd --reload
firewall-cmd --list-all 
# 将一个用户加入白名单
firewall-cmd --add-lockdown-whitelist-user=hadoop --permanent
firewall-cmd --reload
# 将用户id从白名单中去掉
firewall-cmd --remove-lockdown-whitelist-uid=uid
firewall-cmd --reload
# 查看所有打开的端口:
firewall-cmd --list-ports
# 在某个区域打开端口
firewall-cmd --zone=public --add-port=8080/tcp --permanent
# 关闭端口
firewall-cmd --remove-port=465/tcp 
# 打开服务,参见/etc/firewalld 目录下services文件夹中的服务,可以配置
firewall-cmd --permanent --zone=public --add-service=samba
firewall-cmd --add-service=http --permanent 
firewall-cmd --reload
# 关闭服务
firewall-cmd --zone=public --remove-service=samba
firewall-cmd --reload

官方文档以及常用参考:

https://access.redhat.com/documentation/zh-CN/Red_Hat_Enterprise_Linux/7/html/Security_Guide/sec-Using_Firewalls.html

https://www.server-world.info/en/note?os=CentOS_7&p=firewalld

以上所述是小编给大家介绍的CentOS7中防火墙的一些常用配置介绍,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对PHPERZ网站的支持!



最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务