Filtre第2层组播数据包

时间:2016-06-16 13:31:17

标签: linux firewall iptables multicast ebtables

我尝试过滤GOOSE协议生成的第2层组播数据包(无IP头)。

enter image description here

使用以下命令(ebtable和iptables)但不起作用。有人可以请一些建议吗?

我使用了ebtables,因为我知道iptables无法打开没有ip头的数据包(最小层数为3)。数据包从机器A发送到机器B(客户端/服务器软件)。

一个。 ebtables -A INPUT -j DROP    ebtables -A OUTPUT -j DROP

湾iptables -A INPUT -m pkttype --pky-type multicast -j DROP    iptables -A OUTPUT -m pkttype --pky-type multicast -j DROP

我尝试了上面的所有命令,但我无法停止我的多播数据包(DROP仅用于测试目的)

先谢谢你...

1 个答案:

答案 0 :(得分:0)

对于将来遇到同样问题的人,我设法解决问题,首先,你应该知道iptables不能过滤那些不使用ip头的protocole ,所以在我的情况下,我的protocole是第2层(像arp),最好的工具就是ebtables。

我已经意识到的DROP测试没有用,因为我在一个normale inerface中使用了ebatbles,这对ebtables来说是一个问题,他不接受它,你应该在使用前配置一个桥接接口ebtables。

这是我输入创建桥梁的命令:

brctl addbr br0
brctl stp br0 off
brctl addif br0 eno16777736
ifconfig br0 10.0.0.131 netmask 255.255.255.0
ifconfig eno16777736 0 0.0.0.0
ip route add default via 10.0.0.1    

ebtables -t broute -A BROUTING -j DROP   

跳这将有助于将来某人