Skip to contentSkip to conversation

routing question under invisible bridge

DISCUSSION Lennert Buytenhek 1 participant 1 message Mar 23, 2007 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 1 line · Bin He

Dear sir,

Hi,

Quoted 2 lines

I found your email address from kernel bridge source codes. I would appreciate if you could look into my question a little bit.

The netdev@ mailing list is a better forum to ask such questions, I've CC'ed this email there.

Quoted 3 lines

I have an invisible bridge (br0) which contains eth0 and eth1. None of them have an IP address because I want to it to be transparent to the existing network. So there is no entries in kernel routing table.

If you have an IP address assigned to br0, your kernel will likely have (at least) one entry in its routing table even if you didn't put any routes in there yourself.

Quoted 2 lines

The problem is how does it handle the routing, i.e., which eth interface will a packet be sent to?

(The decision which bridge sub-device to send a packet to isn't called 'routing', as it doesn't involve an IP routing decision -- that decision has already been made at that point.)

Quoted 5 lines

For example, I can create a packet and bind it to a device by SO_BINDTODEVICE socket option. I did some tests and found:
1) if the socket is bound to eth0 or eth1, the packet cannot be sent out.
2) if the socket is bound to br0, it seems that the packet is only sent out to eth0.

Check out your system's ARP table (run /sbin/arp) and your br0 bridge's MAC address table (run 'brctl showmacs br0' or something like that.)

When your machine wants to communicate with a remote IP address, it first sends an ARP packet to figure out what the ethernet address is that corresponds to that remote IP address.

When your machine then sends an IP packet on the br0 interface to that ethernet address, the bridge code checks the MAC address table to find out whether to send it to eth0 or eth1 (if the MAC address is a known MAC address) or to both (if we have never seen the MAC address before or if it has timed out.)

Quoted 1 line

So is there a way to send out a packet on a particular device?

I'm not sure exactly what you are trying to do?