linux – Iptables – Bridge和Forward链

linux – Iptables – Bridge和Forward链,第1张

概述我已经设置了以太网桥br0,它包含两个接口eth0和tap0 brctl addbr br0brctl addif eth0brctl addif tap0ifconfig eth0 0.0.0.0 promisc upifconfig tap0 0.0.0.0 promisc upifconfig br0 10.0.1.1 netmask 255.255.255.0 broadcast 我已经设置了以太网桥br0,它包含两个接口eth0和tap0
brctl addbr br0brctl addif eth0brctl addif tap0ifconfig eth0 0.0.0.0 promisc upifconfig tap0 0.0.0.0 promisc upifconfig br0 10.0.1.1 netmask 255.255.255.0 broadcast 10.0.1.255

我的默认FORWARD链策略是DROP

iptables -P FORWARD DROP

当我不添加以下规则时,流量不会通过桥接.

iptables -A FORWARD -p all -i br0 -j ACCEPT

据我所知,iptables只负责IP层.

ebtables应负责过滤以太网桥上的流量.

那么为什么我必须在iptable的FORWARD链中添加ACCEPT规则?

解决方法 由于br-nf代码可用作linux 2.4的补丁并在linux 2.6中使用:

The br-nf code makes brIDged IP
frames/packets go through the iptables
chains. Ebtables filters on the
Ethernet layer,while iptables only
filters IP packets.

由于你正在使用的流量是ip,iptables规则仍然适用,因为br-nf将桥接数据包传递给iptables.

This是阅读有关交互的一个很好的资源,this one详细介绍了br-nf代码的功能,包括如何禁用所有或部分功能(即不将桥接流量传递给iptables).

总结

以上是内存溢出为你收集整理的linux – Iptables – Bridge和Forward链全部内容,希望文章能够帮你解决linux – Iptables – Bridge和Forward链所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/1044336.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-24
下一篇 2022-05-24

发表评论

登录后才能评论

评论列表(0条)

保存