Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 08 Nov 2019 01:30:10 -0600
From:      Mike Karels <mike@karels.net>
To:        Victor Gamov <vit@otcnet.ru>
Cc:        freebsd-net@freebsd.org
Subject:   Re: FreeBSD as multicast router
Message-ID:  <201911080730.xA87UAel076108@mail.karels.net>
In-Reply-To: Your message of Thu, 07 Nov 2019 17:17:48 %2B0300. <3334fa50-8a88-17b6-7e91-c09d22e11f7e@otcnet.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
> On 06/11/2019 05:41, Mike Karels wrote:
> >> On 05/11/2019 09:09, Mike Karels wrote:
> >>>> On 03/11/2019 08:22, Mike Karels wrote:
> >>>>>>>>> Hi All
> >>>>>>>>>
> >>>>>>>>> I have (noob) questions about multicast routing under FreeBSD.
> >>>>>>>>>
> >>>>>>>>> I have FreeBSD box with two (or more) multicast enabled interf=
aces (e.x.
> >>>>>>>>> vlan750 and vlan299).  vlan750 connected to multicast source.
> >>>>>>>>>
> >>>>>>>>> Then pimd installed and only this two interfaces enabled in pi=
md config.
> >>>>>>>>> Multicast routes successfully installed by pimd and listed by =
`netstat
> >>>>>>>>> -g -f inet`
> >>>>>>>>>
> >>>>>>>>> Then client on vlan299 send IGMP-Join (this Join received by F=
reeBSD on
> >>>>>>>>> vlan299)
> >>>>>>>>>
> >>>>>>>>> The question is:  who will forward muilticast from one interfa=
ce
> >>>>>>>>> (vlan750) to another (vlan299)?  Is it kernel specific job or =
I need
> >>>>>>>>> additional software?
> >>>>>>>
> >>>>>>>> Please read the manpage multicast(4) "man 4 multicast",
> >>>>>>>> you should need to build a custom kernel with the "options MROU=
TING"
> >>>>>>>> to enable the multicast forwarding in the kernel.
> >>>>>>>
> >>>>>>> If "netstat -g" shows routes, the kernel must have been built wi=
th "options
> >>>>>>> MROUTING".
> >>>>>
> >>>>>> Indeed.
> >>>>>
> >>>>>>>
> >>>>>>> The kernel does the forwarding, according to those routing table=
s installed
> >>>>>>> by pimd or another multicast routing program.  Is it not working=
?  It sounds
> >>>>>>> like you are very close.
> >>>>>
> >>>>>> Could it be sysctl net.inet.ip.forwarding?  Does that still apply=
 to mroutes?
> >>>>>
> >>>>> No, they are separate.  The test is just whether MROUTING is enabl=
ed, and
> >>>>> whether a multicast router like pimd is active.
> >>>>>
> >>>>> One other thing to check would be "netstat -gs" (multicast stats).
> >>>
> >>>> Oops!
> >>>
> >>>> =3D=3D=3D=3D=3D
> >>>> # netstat -f inet -gs
> >>>> No IPv4 MROUTING kernel support.
> >>>> =3D=3D=3D=3D=3D
> >>>
> >>> This looks like a bug in netstat; it is doing a test that is wrong f=
or
> >>> the loadable module.
> > =

> > I don't know how much the stats might help, but if you let me know wha=
t
> > version you are running, I can build a fixed netstat.  Or I can send
> > a source patch.
> > =

> >>>> But I have ip_mroute.ko loaded and netstat -g shows something like
> >>>
> >>>> =3D=3D=3D=3D=3D
> >>>> # netstat -f inet -g
> >>>
> >>>> IPv4 Virtual Interface Table
> >>>>     Vif   Thresh   Local-Address   Remote-Address    Pkts-In   Pkts=
-Out
> >>>>      0         1   A.A.A.A                           0          0
> >>>>      1         1   B.B.B.19                          0          0
> >>>>      2        10   10.199.199.102                          0       =
   0
> >>>>      3        15   10.200.200.6                        77440       =
   0
> >>>>      4         1   A.A.A.A                           0      77440
> >>>
> >>>> IPv4 Multicast Forwarding Table
> >>>>     Origin          Group             Packets In-Vif  Out-Vifs:Ttls
> >>>>     10.200.200.5    232.232.8.33        1844    3    4:1
> >>>>     10.200.200.5    232.232.8.171        1843    3    4:1
> >>>>     10.200.200.5    232.232.8.58         4609    3    4:1
> >>>>     10.200.200.5    232.232.8.154        1844    3    4:1
> >>>>     10.200.200.5    232.232.8.170        1844    3    4:1
> > =

> > I missed this before.  Looks like the last column should include 2:1 i=
n
> > each case if pimd saw the join.  The multicasts are only being sent to
> > Vif 4, the register-vif (see below); the Pkts-Out for it is the same
> > as the input on 3.  I'm not familiar enough with pimd to guess what is
> > wrong.


> I still have misunderstood here.  Pimd installs multicast routes and =

> this routes displayed by `netstat -g`.  So, the system knows interface =

> where multicast received.  When Join received  via interface 2 (vlan299)=
 =

> who must resend multicast from input interface 3 (vlan750) to output =

> interface 2 (vlan299)?  I guess it kernel-specific task  and kernel must=
 =

> resend multicast without any other helpers.  Is it wrong?

No, that is correct; the kernel should do the forwarding.  But something
is out of sync.  The join messages you showed were from 10.199.199.101,
which should be vif 2.  But the forwarding table shows an origin of
10.200.200.5, and the Pkts-In is 77K on vif3.  Is the source address
incorrect, or is there some other confusion as to which network is
which?


> P.S. I rebuild kernel with MROUTING option but
> =3D=3D=3D=3D=3D
> # netstat -gs -f inet
> No IPv4 MROUTING kernel support
> =3D=3D=3D=3D=3D

> still here

Oh, I see; that's another manifestation of the bug that makes netstat
fail with the loadable module.  It doesn't work if VNET is defined,
because then there isn't a single stats structure with the expected
name.  My fixed netstat would work.  Let me know what FreeBSD version
you are running, and I can build a fixed version; or I can send a patch.

> -- =

> CU,
> Victor Gamov

		Mike



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