Linux中的火墙策略优化(iptables+firewalld)

实验环境设置

单网卡主机(内网)    172.25.254.10

 

双网卡主机(外网)    172.25.254.20

 

火墙切换方式

在rhel8中默认的火墙是firewalld

 

firewalld -----> iptables

dnf install iptables-services -y

systemctl stop firewalld

systemctl disable firewalld

systemctl mask firewalld

systemctl unmask iptables        第一次安装时不需使用此命令。若之前使用mask命令锁定过iptables,需用此命令解锁。

systemctl enable --now iptables


 

iptables ------> firewalld

dnf install firewalld -y      安装firewalld(rhel8中默认已安装)

systemctl stop iptables.service

systemctl disable iptables

systemctl mask iptables

systemctl unmask firewalld

systemctl enable --now firewalld

 

iptables的使用

1.火墙策略的永久保存

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

 

2.iptables中的常用命令

iptables

              -t                                     指定表名称(默认表格为filter)

              

              -n                                    不做解析

              -L                                    查看

              

              -A                                    添加策略

              -p                                    协议

              --dport                            目的地端口

              -s 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值