博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
CentOS7使用firewalld打开关闭防火墙与端口
阅读量:7242 次
发布时间:2019-06-29

本文共 1301 字,大约阅读时间需要 4 分钟。

1、firewalld的基本使用
启动: systemctl start firewalld
关闭: systemctl stop firewalld
查看状态: systemctl status firewalld 
开机禁用  : systemctl disable firewalld
开机启用  : systemctl enable 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

转载于:https://www.cnblogs.com/duaner92/p/9921690.html

你可能感兴趣的文章
数据库触发器,禁止DDL操作
查看>>
获取身份证号码信息
查看>>
Python之条件判断
查看>>
Ring0句柄表遍历
查看>>
AC日记——[SDOI2009]HH去散步 洛谷 P2151
查看>>
全天候提供引用媒体流直播
查看>>
严师出高徒VS名师出高徒
查看>>
JavaScript高级程序设计笔记之面向对象
查看>>
js静态方法
查看>>
《软件工程--实践者的指南》第一章笔记
查看>>
python tkinter窗口置顶
查看>>
C#生成XML的三种途径 (分享)
查看>>
[Wc2007]剪刀石头布
查看>>
bzoj千题计划191:bzoj2337: [HNOI2011]XOR和路径
查看>>
mac下node安装提示command not found
查看>>
屏蔽webbrowser的网页弹出是js错误。
查看>>
【转】MMORPG游戏服务器技能系统设计:表格字段与技能程序框架
查看>>
Linux文件系统初步
查看>>
阅读《软件工程—理论方法与实践》第三章心得体会
查看>>
有关计算机学习的思考
查看>>