Skip to contentSkip to conversation

ebtables does not forward net request, help please.

DISCUSSION gmail 2 participants 4 messages Jul 8, 2012 – Jul 9, 2012 1 message not in the archive

lore
Share & tools
lore

gmail

author
#0 lore raw

Hi all,

I need some help of ebtables behavior. Here is my working environment. kernel : 2.6.35
we have 4 interfaces eth0/eth1/eth2/eth3 and added to br0 using brctl. brctl br0 eth0
brctl br0 eth2

Now I use ebtables to control packaging forwarding.
1, use ebtables to filter out all packaging except the special host mac.
ebtable -A FORWARD -s ! 00:11:22:33:44:55 -d ! 00:11:22::33:44:55 -j DROP
2, using ping tool to check the network connection from eth0 side to eth2 side. (This step it worked fine.)
3, using ebtables to deny all forwarding.
zero ebtables...
ebtables -P FORWARD DROP
4, using ping tool to check the network connection from eth0 side to eth2 side again. (This step, it all worked fine. it cannot connect each other from eth0 to eth2.)
5, Now again allow this specific mac to travel between eth0 and eth2.
ebtable -A FORWARD -s ! 00:11:22:33:44:55 -d ! 00:11:22::33:44:55 -j DROP
6, Now again, using ping tool to check network connectivity. (eth0-eth2).
The expected result is that network connection between eth0 and eth2 should be available. But unfortuntly sometimes the connectivity is not available. This happends about 2-3 times when I tried this for 10 times. This is a little strange to me. And the network is only available after the host send a ARP request through eth0, only then the network becomes available again. Please can anyone help about this? Thanks a lot.

Ivan

#1 lore raw
Quoted 5 lines · gmail

5, Now again allow this specific mac to travel between eth0 and eth2.
ebtable -A FORWARD -s ! 00:11:22:33:44:55 -d ! 00:11:22::33:44:55 -j DROP
6, Now again, using ping tool to check network connectivity. (eth0-eth2).
The expected result is that network connection between eth0 and eth2 should be available. But unfortuntly sometimes the connectivity is not available. This happends about 2-3 times when I tried this for 10 times. This is a little strange to me. And the network is only available after the host send a ARP request through eth0, only then the network becomes available again. Please can anyone help about this? Thanks a lot.

Did you forget about the ARP queries from the other boxes asking for the ip of the box with the mac 00:11:22:33:44:55?

They come from the query hosts mac and go to the broadcast (ff:ff:ff:ff:ff:ff), asking for the mac of ip a.b.c.d. Those get dropped with your above setup and never reaching your special host, so the other hosts do not know to which mac to send the packets.

c'ya
sven-haegar

Signature · 2 lines
Three may keep a secret, if two of them are dead.
- Ben F.

A message that is not in the archive (sent off-list or not yet received): CAGHLOKDWC-99cXnSPezVxnbYyW9Y4_b9-o27ncYF8O7Rc9G1aA@mail.gmail.com

author
#3 lore raw

Thanks for your reply. Below ebtables rules are the entire content I used. Actually it will allow ARP query request to forward. What I confused about is that why the second forwarding will only happen after the client trigger a ARP request (query MAC of target host)?

--allow client A(00:11:22:33:44:55)
ebtables -t nat -F
ebtalbes -t broute -F
ebtables -t filter -F
ebtables -t filter -P FORWARD ACCEPT
ebtables -A FORWARD -s ! 00:11:22:33:44:55 -d ! 00:11:22:33:44:55 -j DROP

--deny any net request forwarding
ebtables -t nat -F
ebtables -t broute -F
ebtables -t filter -F
ebtables -t filter -P FORWARD DROP

2012/7/8 Sven-Haegar Koch <[email protected]>

Quoted 5 lines · gmail

5, Now again allow this specific mac to travel between eth0 and eth2.
ebtable -A FORWARD -s ! 00:11:22:33:44:55 -d ! 00:11:22::33:44:55 -j DROP
6, Now again, using ping tool to check network connectivity. (eth0-eth2).
The expected result is that network connection between eth0 and eth2 should be available. But unfortuntly sometimes the connectivity is not available. This happends about 2-3 times when I tried this for 10 times. This is a little strange to me. And the network is only available after the host send a ARP request through eth0, only then the network becomes available again. Please can anyone help about this? Thanks a lot.

Did you forget about the ARP queries from the other boxes asking for the ip of the box with the mac 00:11:22:33:44:55?

They come from the query hosts mac and go to the broadcast (ff:ff:ff:ff:ff:ff), asking for the mac of ip a.b.c.d. Those get dropped with your above setup and never reaching your special host, so the other hosts do not know to which mac to send the packets.

c'ya
sven-haegar

--
Three may keep a secret, if two of them are dead.
- Ben F.

Signature · 1 line
Jin Zhang
author
#4 lore raw

Re: is it possiable to filter multiple MAC address using -s/-d ?

Hi All,

As subject states, is it possible to use ebtables to filter out multiple MAC address (both source and target) ? If possible, how to write ebtables rules? Thanks. (I know --among option can help this, but unfortuatly my ebtables moduel is not compiled with --among support).

Thanks,
Ivan.