CentOS8基础篇15:防火墙命令配置

一、防火墙服务
1、启动、关闭、重启防火墙服务。
    systemctl start  firewalld.service
    systemctl stop  firewalld.service
    systemctl restart  firewalld.service
2、显示防火墙的状态。
    systemctl status firewalld.service
3、开机启动防火墙。
    systemctl enable firewalld.service
4、开机时禁用防火墙。
    systemctl disable firewalld.service
5、查看防火墙是否开机启动。
    systemctl  is-enabled  firewalld.service
6、查看已启动的服务列表。
    systemctl list-unit-files|grep enabled
7、查看启动失败的服务列表。
    systemctl  --failed
8、启动、停止、重启httpd服务。
    systemctl   start    httpd
    systemctl   stop     httpd
    systemctl   restart  httpd

二、防火墙配置
1、查看版本。
    firewall-cmd --version
2、查看帮助。
    firewall-cmd  --help
3、显示防火墙状态。
    firewall-cmd --state
4、查看所有打开的端口。
    firewall-cmd --zone=public --list-ports
5、查看区域信息
    firewall-cmd --get-active-zones
6、查看指定接口所属区域。
    firewall-cmd --get-zone-of-interface=eth0
7、拒绝所有包、取消拒绝状态、查看是否拒绝
    firewall-cmd --panic-on
    firewall-cmd --panic-off
    firewall-cmd --query-panic
8、开启3306端口,–permanent永久生效,没有此参数重启后失效。
    firewall-cmd --zone=public --add-port=3306/tcp --permanent   
9、重新载入,更新防火墙规则。
    firewall-cmd --reload
10、查看3306端口是否开放。
    firewall-cmd --zone=public --query-port=3306/tcp 
11、删除3306端口配置。
    firewall-cmd --zone=public --remove-port=3306/tcp --permanent 
 

  • 2
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

北方的流星

你的鼓励是我创作最大动力。

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值