linux – Iptables – Bridge和Forward链

我已经设置了以太网桥br0,它包含两个接口eth0和tap0
brctl addbr br0
brctl addif eth0
brctl addif tap0
ifconfig eth0 0.0.0.0 promisc up
ifconfig tap0 0.0.0.0 promisc up
ifconfig 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中的ARP防火墙主要用于防御ARP欺骗攻击,其效果取决于多...
insmod和modprobe加-f参数导致Invalid module format错误 这...
将ArchLinux安装到U盘 几个月前入门Arch的时候上网搜了不少安...
1、安装Apache。 1)执行如下命令,安装Apache服务及其扩展包...
一、先说一下用ansible批量采集机器信息的实现办法: 1、先把...
安装配置 1. 安装vsftpd 检查是否安装了vsftpd # rpm -qa | ...