Linux中的火墙策略优化
实验环境:
两台主机
一台主机是双网卡
设定成两个网段
- 172.25.254.101
- 192.168.0.101
一台主机是单网卡(192网段) - 192.168.0.201
- 一台主机ip:
172.25.254.201 - 要求同一个网段要能互相ping通
1 火墙介绍
(1)netfilter
(2)iptables
(3)iptables|firewalld
2 火墙管理工具切换
在rhel8中默认使用是firewalld
(1) firewalld–切换–>iptables
systemctl disable --now firewalld
systemctl mask firewalld
dnf install iptables-services -y
systemctl enable --now iptables
(2) iptables–切换–>firewalld
dnf install firewalld -y
systemctl stop iptables
systemctl disable iptables
systemctl mask iptables
systemctl enable --now firewalld
firewalld
域
- 关于firewalld的域
- 备注:域:表示管理的集合
- 关于firewall的一些相关命令:
firewall-cmd --get-default-zone #查看默认域public
firewall-cmd --get-active-zones #查看活跃域
firewall-cmd --get-zones #查看能用的域
firewall-cmd --state #查看火墙状态
firewall-cmd --list-all
firewall-cmd --list-all --zone=trusted
firewall-cmd --get-services #所有服务
firewall-cm