10.20 firewalld的9个zone

时间:2022-04-27
本文章向大家介绍10.20 firewalld的9个zone,主要内容包括Linux防火墙-firewalld、firewalld中查看所有zone、firewalld中查询默认的zone、firewalld中9个zone的区别、基本概念、基础应用、原理机制和需要注意的事项等,并结合实例形式分析了其使用技巧,希望通过本文能帮助到大家理解应用这部分内容。

Linux防火墙-firewalld

  • 打开firewalld
  • systemctl disable iptables
  • systemctl stop iptables
  • systemctl enable firewalld
  • systemctl start firewalld
  • firewalld默认有9个zone
  • 默认zone为public
  • firewall-cmd --get-zones //查看所有zone
  • firewall-cmd --get-default-zone//查看默认zone

firewalld防火墙机制

  • 因为之前禁掉了firewalld,打开了iptables,所以现在需要 打开firewalld,禁掉iptables
打开firewalld

[root@hf-01 ~]# systemctl disable iptables
[root@hf-01 ~]# systemctl stop iptables
[root@hf-01 ~]# systemctl enable firewalld
Created symlink from /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service to /usr/lib/systemd/system/firewalld.service.
Created symlink from /etc/systemd/system/basic.target.wants/firewalld.service to /usr/lib/systemd/system/firewalld.service.
[root@hf-01 ~]# systemctl start firewalld
[root@hf-01 ~]# 

这时用iptables -nvL和iptables -t nat -nvL查看规则,会看到增加了很多的链
  • firewalld默认有9个zone,zone是firewalld的一个单位,默认使用public zone——>每个zone就好比一个规则集
    • 规则集就是zone里面自带一些规则,比如:这个zone放行了80端口,放行了22端口,关闭了某某端口,这就是一个规则集

firewalld中查看所有zone

  • firewall-cmd --get-zones //查看所有zone
[root@hf-01 ~]# firewall-cmd --get-zones    //查看所有zone
block dmz drop external home internal public trusted work
[root@hf-01 ~]# 

firewalld中查询默认的zone

  • firewall-cmd --get-default-zone //查看默认zone
[root@hf-01 ~]# firewall-cmd --get-default-zone    //查看默认zone
public
[root@hf-01 ~]# 

firewalld中9个zone的区别