Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Jul 2001 17:44:05 -0500
From:      Steve Ames <steve@virtual-voodoo.com>
To:        Chris Dillon <cdillon@wolves.k12.mo.us>
Cc:        Matt Dillon <dillon@earth.backplane.com>, "Jonathan M. Slivko" <jslivko@blinx.net>, freebsd-hackers@FreeBSD.ORG
Subject:   Re: Why two cards on the same segment...
Message-ID:  <20010726174405.A36877@virtual-voodoo.com>
In-Reply-To: <Pine.BSF.4.32.0107261654170.2406-100000@mail.wolves.k12.mo.us>; from cdillon@wolves.k12.mo.us on Thu, Jul 26, 2001 at 05:24:43PM -0500
References:  <200107262136.f6QLaCX62360@earth.backplane.com> <Pine.BSF.4.32.0107261654170.2406-100000@mail.wolves.k12.mo.us>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jul 26, 2001 at 05:24:43PM -0500, Chris Dillon wrote:
> Hmm.. That hasn't been my experience at all.  I have _always_ seen
> outgoing connections use a source address of the closest interface
> address that exists on the same IP network as the destination, OR, if
> it is a non-local destination, then the source is whatever IP address
> is on the same IP network as the next-hop gateway.  If your next-hop
> gateway is an RFC1918 address, then your source address will be your
> RFC1918 address on the same subnet, unless you specify otherwise of
> course.

Agreed. And, really, isn't that the behavior you _expect_? Any other
behavior could be considered a non-POLA. In most situations the
source-IP can be determined logically. There are some situations
where it can't be determined and that's where random comes in
(at least on the Solaris stack, I hate to use that as an example
but I have yet to test it under FBSD or look up the code). A good
example is when you have multipe IPs on one card from the same
subnet and netmask. The only way to determine what _should_ be used
as the IP is to maybe use the one that isn't an alias. But what if
they are all aliases and the non-alias is RFC1918 but the gateway
is out of that public subnet? Under Solaris its potluck. Took me a
bit to figure that out. That's why under FBSD when we want multiple
IPs from the same subnet (virtual hosting and such) we encourage the
use of the 0xffffffff netmask. Then that IP cannot be part of the gateway
subnet so won't be used as the source IP. It is however reachable from
the outside world thanks to ARP.

A tricker question is with two NIC each with a public IP (from different
subnets). You can't have a seperate gateway for each NIC so most outgoing 
traffic is really going to go out one interface even if its coming in
both interfaces right? If the NICs have IPs from the same subnet then
I'm not sure how the outgoing interface (and source IP) is chosen but
logically both get used (round robin?). That question will actually take
some source delving to figure out as I don't have the tools to just
hook up a machine and watch.

-Steve

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010726174405.A36877>