Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Mar 2018 13:13:58 -0700 (PDT)
From:      "Rodney W. Grimes" <freebsd-rwg@pdx.rh.CN85.dnsmgr.net>
To:        Grzegorz Junka <list1@gjunka.com>
Cc:        freebsd-net@freebsd.org
Subject:   Re: Incorrect route interface
Message-ID:  <201803122013.w2CKDwSH080298@pdx.rh.CN85.dnsmgr.net>
In-Reply-To: <24596951-6fe8-b308-344d-636fecabe36b@gjunka.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> On 12/03/2018 18:04, Rodney W. Grimes wrote:
> >> On 11/03/2018 20:57, Marek Zarychta wrote:
> >>> On Sun, Mar 11, 2018 at 05:46:52PM +0000, Grzegorz Junka wrote:
> >>>> On 11/03/2018 06:04, Eugene Grosbein wrote:
> >>>>> 11.03.2018 7:01, Grzegorz Junka wrote:
> >>>>>
> >>>>>>> Just do not assign addresses from same network 10.20.0.0/16 to different network interfaces
> >>>>>>> and you will be fine. Assign them all to right interface:
> >>>>>>>
> >>>>>>> ifconfig_em0="inet 10.20.2.14 netmask 255.255.0.0"
> >>>>>>> ifconfig_em0_alias0="inet 10.20.2.15/32"
> >>>>>>> ifconfig_igb0_alias0="inet 10.20.2.16/32"
> >>>>> Interfaces meant to be all equal, last line should be:
> >>>>>
> >>>>> ifconfig_em0_alias1="inet 10.20.2.16/32"
> >>>>>
> >>>> OK, I see. So this is in case I want many IPs assigned to the same
> >>>> interface. What if I want one IP assigned to multiple interfaces (i.e.
> >>>> so that the additional igb0-3 effectively work as a 4-port switch)?
> >>>>
> >>> Please consider bonding all NICs as one bridge(4) interface. Then
> >>> multiple IPs could be assigned to such interface.
> >>>
> >> Many thanks Eugene and Marek for your suggestions. I will now need to
> >> decide if I want to fragment the network into subnets or bridge the
> >> interfaces.
> >> GregJ
> > I believe some of the problem you are experincing is addressed
> > in this differential:
> > https://reviews.freebsd.org/D14547
> >
> > Your original configuration was(is) valid, just not common,
> > and I have not seen this done in more than a decade, but it
> > seems as if rstone@ also has someone doing this "multiple IP's
> > into same subnet on seperate interfaces".
> >
> 
> Thanks for the link. That's interesting. According to this post that 
> configuration shouldn't be valid:
> 
> https://forums.freenas.org/index.php?threads/multiple-network-interfaces-on-a-single-subnet.20204/

I'll disagree with the claims it is not valid.  I shall however support
the claims that it is non-standard, and non-trivial to understand just
what it is that occurs in *BSD when you do this.  I have seen this
"claimed to be invalid" coniguration in use several times over the
past 30 years.

Where people seem to get this "invalid" from is expecting the traffic
to be bound to an IP to go both in and OUT that interface is what is
not invalid, but a wrong assertion.  Traffic WELL come in that interface,
as that is how ethernet macs, arp's an IP work.  However it WELL go
out the interface that is selected by the routing table.  If you
can seperate in your mind that this is how IN and OUT interfaces
are decided the rest becomes simply mechanical.

Simple typical *BSD installs end up with all traffic going out just
one of the interfaces, but I can write route rules that change that
artifact.  And this is where the usage of this odd configuration
sometimes comes about.

With modern implimentations of *BSD that now have multiple fib's,
and things like netgraph, and ipfw one can get very creative in
what actually happens.  And none of it is invalid, just often
miss understood.  I can actually casue that traffic bound to
a specific IP to go in and out that specific interface.  Ipfw's
ability to cause a packet to use an alternate fib is how.

ipfw add allow ip from ${ip_of_nicX} to any setfib ${fib_for_nicX}

-- 
Rod Grimes                                                 rgrimes@freebsd.org



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