莫小安 CentOS7使用firewalld打开关闭防火墙与端口
2024-09-26 18:41:07
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
最新文章
- MySQL5.7 新增配置
- Vs2013 html5开发WP8.1 APP之alert
- PRML读书后记(一): 拟合学习
- MySQL 字段常用操作 添加,修改,删除,调整字段顺序
- 2016022607 - redis配置文件
- 7.1 Backup and Recovery Types 备份和恢复类型
- 30款javascript脚本插件 jquery插件大全
- C++编程命名规范
- linu下C语言之BMP图片操作编程(上)
- combination sum、permutation、subset(组合和、全排列、子集)
- MySql 从SQL文件导入
- 初学angular项目中遇到的一些问题
- Java基于opencv实现图像数字识别(三)—灰度化和二值化
- percona-xtrabackup工具实现mysql5.6.34的主从同步复制
- 【linux基础】关于ARM板子使用O3编译选项优化
- Linux驱动之中断处理体系结构简析
- esp32的GPIO操作
- 附2 hystrix详述(2)- 配置
- 工具函数:cookie的添加、获取、删除
- [SP1825] Free tour II
热门文章
- AC日记——Array Queries codeforces 797e
- J.U.C并发框架源码阅读(十三)ThreadPoolExecutor
- FZU-2214 Knapsack problem(DP使用)
- jenkins笔记:手动更新插件
- POJ 2836 Rectangular Covering(状压DP)
- 透视投影(Perspective Projection)变换推导
- Winform打砖块游戏制作step by step第7节---碰撞检测
- Debian下载地址
- JAVA常见算法题(八)
- [置顶]
 kubernetes资源类型--RC和RS