Linux下的firewalld基本知識搭建

1.火牆介紹

1.netfilter
2.iptables
3.iptables|firewalld

2.火牆管理工具切換

在rhel8中默認使用的是firewalld

firewalld----->iptables

dnf install iptables-services -y 
systemctl stop firewalld 
systemctl disable firewalld 
systemctl mask firewalld 
systemctl enable --now iptables

iptales -------> fiewalld

systemctl stop iptables 
systemctl disable iptables 
systemctl mask iptables 
systemctl enable --now firewalld

3.iptables 的使用

/etc/sysconfig/iptables		##iptables 策略記錄文件

永久保存策略

iptales-save > /etc/sysconfig/iptables
service iptables save

4.火牆默認策略

默認策略中的5條鏈
input ##輸入
output ##輸出
forward ##轉發
postrouting ##路由之後
prerouting ##路由之前

默認的3張表
filter ##經過本機內核的數據(input output forward)
nat ##不經過內核的數據(postrouting,prerouting,input,output)
mangle ##當filter和nat表不夠用時使用(input output forward postrouting,prerouting,)

iptables命令
iptables

在這裏插入圖片描述

數據包狀態
RELATED ##建立過連接的
ESTABLISHED ##正在連接的
NEW ##新的

在這裏插入圖片描述

nat表中的dnat snat

snat

iptable -t nat -A POSTROUTING -o ens160 -j SNAT --to-source 192.168.0.20

dnat

iptables -t nat -A PREROUTING -i ens160 -j DNAT --to-dest 172.25.254.30
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章