Linux, FreeBSD, Juniper, Cisco / Network security articles and troubleshooting guides
https://forum.ivorde.com/

FreeBSD + IPERF sending IGMP v2 multicast group join / leave via specific interface
https://forum.ivorde.com/freebsd-iperf-sending-igmp-v2-multicast-group-join-leave-via-specific-interface-t14841.html
Page 1 of 1

Author:  mandrei99 [ Mon Jul 22, 2013 10:41 am ]
Post subject:  FreeBSD + IPERF sending IGMP v2 multicast group join / leave via specific interface

FreeBSD + IPERF sending IGMP v2 multicast group join / leave via specific interface

Before I start. The route for the multicast group is obvious default route:
Code:
# route get 239.1.1.1
   route to: 239.1.1.1
destination: default
       mask: default
    gateway: apollo-vl10.ivorde.ro
  interface: vlan10
      flags: <UP,GATEWAY,DONE,STATIC>
recvpipe  sendpipe  ssthresh  rtt,msec    rttvar  hopcount      mtu     expire
       0         0         0         0         0         0      1500         0

Let's say I need to send igmp group report/join out the "vlan120" interface:
Code:
# ifconfig vlan120
vlan120: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether 00:07:e9:a5:9b:fa
        inet 10.1.120.2 netmask 0xffffff00 broadcast 10.1.120.255
        media: Ethernet autoselect (1000baseTX <full-duplex>)
        status: active
        vlan: 120 parent interface: em0


1. First add a /32 route for the multicast group via a gateway on the subnet for the specific outgoing interfaces (my case: vlan120 on FreeBSD)
Code:
# route add 239.1.1.1/32 10.1.120.1
add net 239.1.1.1: gateway 10.1.120.1


2. Use Iperf to join a multicast group:
Code:
# iperf -s -B 239.1.1.1 -u         
------------------------------------------------------------
Server listening on UDP port 5001
Binding to local address 239.1.1.1
Joining multicast group  239.1.1.1
Receiving 1470 byte datagrams
UDP buffer size: 40.6 KByte (default)
------------------------------------------------------------

Quote:
-s, --server
run in server mode
-B, --bind <host>
bind to <host>, an interface or multicast address
-u, --udp
use UDP rather than TCP


And the result via tcpdump:
Code:
16:32:53.808311 IP (tos 0x0, ttl 1, id 51941, offset 0, flags [none], proto IGMP (2), length 32, options (RA))
    10.1.120.2 > 239.1.1.1: igmp v2 report 239.1.1.1
16:32:55.360766 IP (tos 0x0, ttl 1, id 5334, offset 0, flags [none], proto IGMP (2), length 32, options (RA))
    10.1.120.2 > 224.0.0.2: igmp leave 239.1.1.1


First packet in above tcpdump is the igmp group report (join) for 239.1.1.1 and the second is the leave packet (when iperf command is interrupted). It is noticeable that multicast packets have a source of the "vlan120" intended outgoing interface.

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/