Re: if_bridge with two subnets
- From: "Jay L. T. Cornwall" <jay@xxxxxxxxxxxxxxx>
- Date: Sun, 18 May 2008 21:27:20 +0100
H.fazaeli wrote:
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.
Thank you very much for your explanation. I had misunderstood precisely how routing and bridging are done in FreeBSD but it now makes sense.
If you provide a network diagram along with your requirements,
we can better discuss the matter.
I now have a working network configuration. For completeness I will explain how it's set up.
I have a small, publicly routable netblock to serve a larger LAN of machines. Thus some of the machines draw IPs from a non-routable private pool and are NAT'd to a one of the public IPs. It looks like this:
[Gateway] XX.XX.XXX.22
|
[FreeBSD] XX.XX.XXX.20-21
|
[L2 Switch]
|
PCs XX.XX.XXX.17-19
192.168.1.0/24
The gateway must have one of the public IPs to communicate with its upstream correctly. On the other side of the FreeBSD server the rest of those IPs are used. So a traditional gateway setup would not work here: it would imply that the FreeBSD server has two interfaces from two different subnets, rather than one split subnet. Perhaps a static route for the gateway would work, but it would be messy.
So I bridge the two interfaces to join the public subnet. Following your advice I have set the FreeBSD server to the network gateway - previously it was the .22 gateway - and now all of the LAN PCs can communicate without additional routing information. Inter-subnet packets will bounce off the FreeBSD server, rather than staying inside the L2 switch, but that's OK.
--
Jay L. T. Cornwall
http://www.jcornwall.me.uk/
_______________________________________________
freebsd-net@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "freebsd-net-unsubscribe@xxxxxxxxxxx"
- References:
- if_bridge with two subnets
- From: Jay L. T. Cornwall
- Re: if_bridge with two subnets
- From: H.fazaeli
- Re: if_bridge with two subnets
- From: Jay L. T. Cornwall
- Re: if_bridge with two subnets
- From: H.fazaeli
- if_bridge with two subnets
- Prev by Date: Re: connect(): Operation not permitted
- Next by Date: Re: kern/123796: FreeBSD 6.1+VPN+ipnat+ipf: port mapping does not work
- Previous by thread: Re: if_bridge with two subnets
- Next by thread: Re: kern/123559: [iwi] iwi periodically disassociates/associates [regression]
- Index(es):
Relevant Pages
|