RedHat7系列(Centos/Debian) FireWall 防火墙 设置

RedHat 7 系列之后 系统把默认的iptables 换成了 Firewall 所以我们要适应 这个新的防火墙管理

-------------------服务相关-------------------

- 启动 : systemctl start firewalld.service

- 重启 : systemctl restart firewalld.service

- 停止 : systemctl stop firewalld.service

- 禁止开机启动 : systemctl disable firewalld.service 

-------------------操作相关-------------------

- 查看版本 : firewall-cmd --version

- 查看帮助 : firewall-cmd --help

- 查看FireWall状态 : firewall-cmd --state

- 查看区域信息 : firewall-cmd --get-active-zones

- 更新防火墙规则 :

        1firewall-cmd --reload 软重启不会断开端口链接

        2firewall-cmd --complete-reload 硬重启会断开端口链接

- 查看zong下打开的端口 : firewall-cmd --zone=(zone) --list-ports  // 这里的zong 可以更换成 : drop(丢弃)/block(阻塞)/public(公开)/external(外部)/dmz(隔离区)/work(工作)/home(家庭)/internal(内部)/trusted(受信任的)

 

-------------------常用端口-------------------

firewall-cmd --zone=public --add-port=80/tcp --permanent 开放80

firewall-cmd --zone= public --remove-port=80/tcp --permanent 关闭80

firewall-cmd --zone=public --add-port=3306/tcp --permanent 开放3306

 

转载于:https://www.cnblogs.com/l5gw/p/6399964.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值