Linux学习笔记之CentOS 7系统使用firewalld管理防火墙端口
2024-09-07 15:33:35
0x00 firewalld的基本使用
# 启动: systemctl start firewalld
# 查看状态: systemctl status firewalld
# 停止: systemctl disable firewalld
# 禁用: systemctl stop firewalld
0x01 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
0x02 配置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
最新文章
- 通过Maven插件发布JaveEE项目到tomcat下
- Linux下PHP的完全卸载
- 【Composer】实战操作一:使用库
- R语言画图布局摆放(layout)
- 使用FIDDER 抓包构建请求
- 正确编写Designated Initializer的几个原则
- [POJ2828]Buy Tickets(线段树,单点更新,二分,逆序)
- 自定义的string类
- C++编程理论学习笔记
- CF1153E Serval and Snake
- 解决 Invalid character found in method name. HTTP method names must be tokens 异常信息
- sqlserver2008查询性能优化(文摘)
- Qt ------ WAV 音频文件介绍
- Material Designer的低版本兼容实现(七)—— Rectange Button
- 解决虚拟机vmware虚拟机安装64位系统“此主机支持 Intel VT-x,但 Intel VT-x 处于禁用状态”的问题
- Find The Multiple--POJ1426
- ansible with_subelements
- git push时报错fatal: Could not read from remote repository.
- 无聊,纯css写了个评分鼠标移入的效果
- 20165324 《Java程序设计》 第六周
热门文章
- 【前端_js】jQuery动态设置元素的样式
- Codeforces D. The Sum of the k-th Powers(拉格朗日插值)
- webuploader大文件分片,多线程总结
- django rest framework 解析器组件 接口设计,视图组件 (2)
- vue使用swiper模块滑动时报错:[Intervention] Ignored attempt to cancel a touchmove event with cancelable=false, for example becaus
- Python并发编程内容回顾
- NOIP 2013 火柴排队
- ANSI Common lisp1
- Margin和padding失效
- java 构造实例