if_bridge with two subnets

H.fazaeli fazaeli at sepehrs.com
Mon May 12 15:33:02 UTC 2008



Jay L. T. Cornwall wrote:
> H.fazaeli wrote:
>
>> The bridge works as it should: It receives packets from
>> XX.XX.XXX.YYY on the interface connected to the switch, and
>> forwards them on the interface connected to the gateway.
>>
>> The problem is that forwarding between subnets is the responsibility
>> of your switch. The switch does its job, but since the two clients are
>> not on the same IP subnet, they can not reach each other w/o the help of
>> an intermediate router.
>
> Perhaps I am mixing up two separate networking concepts.
>
> On a machine configured to act as a gateway, I would expect a single 
> interface with more than one subnet to route packets correctly across 
> those subnets. That may not be how it works in practice.
>
> If it does not work, I would question why not. If it does work then I 
> would expect the same behaviour on each of a bridge's constituent 
> interfaces?
>
It does work. However, if I understand your setup correctly, the freebsd 
box
has been setup to act as a bridge, not as a router (routing is enabled with
sysctl net.inet.ip.forwarding=1). Bridging works when the forwarding is
between the same subnets.

For freebsd box to route between subnets:
- enable routing: sysctl net.inet.ip.forwarding=1
- clients must use the freebsd box as gateway.
- IP addresses must be removed from the bridge and assigned to
  the member interfaces. (the bridge is no longer needed).

You may have bridging & routing on the same box at the same time but
note that a single packet coming into the system either goes through
bridging _or_ routing code, but not both. The former case happens
if packet's destination MAC address is not that of box. The
latter case happens when destination MAC address is that of receiving
interface.

If you provide a network diagram along with your requirements,
we can better discuss the matter.

-- 


With best regards.

Hooman Fazaeli <fazaeli at sepehrs.com>
Technical Manager 
Sepehr S. T. Co. Ltd.

Web: http://www.sepehrs.com
Tel: (9821)88975701-2
Fax: (9821)88983352






More information about the freebsd-net mailing list