组播测试

A multicast IP address will be in the range 224.0.0.0 to 239.255.255.255.

This post is just a reminder to me what checks to do at the linux level:

 

加入组播
iperf -s -u -B 224.0.0.1 -p 5004

查看 netstat -g

UAT [root@bruatwls001 ~]$ netstat -g
IPv6/IPv4 Group Memberships
Interface RefCnt Group
--------------- ------ ---------------------
lo 1 all-systems.mcast.net
eth0 2 224.0.0.1
eth0 1 all-systems.mcast.net

 

检验

#tcpdump -i eth0  igmp -s 0 -vv

是否有数据

#tcpdump -i eth0 host 224.0.0.1

 

Multicast

Multicast packets send the same data to multiple network devices at the same time within the same packet stream. A common situation in which Multicast is used is to distribute real time audio and video.

Configuring the Kernel for multicast

To use multicast, the kernel configuration requires the CONFIG_IP_MULTICAST option to be set.

Enable or disable all-multicast mode with ifconfig

Use ifconfig to enable and disable all-multicast mode.

  1. Disable promisc by running ifconfig eth0 -promisc
  2. Enable allmulti mode with the command ifconfig eth0 allmulti
  3. As a test, ping any multicast IP address from a remote machine:

    ping -I eth0 <multicast_ip_addr>
  4. On the target enabled with allmulti mode, check the RX packets count.
  5. Disable allmulti by running ifconfig eth0 -allmulti on the target.

If allmulti is enabled, the ifconfig eth0 output displays the keyword ALLMULTI in the second line.

 

Testing multicast

First, make sure that the kernel does not ignore all ICMP ECHO and TIMESTAMP requests sent to it using either broadcast or multicast.

On the target, execute the following:

target# echo 0 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts

This sets all class D (that is, multicast) IP routes to use "eth0":

target#  route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0

To join a multicast group, execute the following:

target# ./mjoin eth0 224.1.0.37

The mjoin C source can be obtained from here.

Ping multicast IP address:

host# ping -r -I eth0 224.1.0.37

To display the multicast group membership information on the target:

target# netstat -g
IPv6/IPv4 Group Memberships
Interface       RefCnt Group
--------------- ------ ---------------------
lo              1      224.0.0.1
eth0            1      224.1.0.37
eth0            1      224.0.0.1
<code>


参考:
http://www.stlinux.com/howto/network/short-guide
http://www.ixiacom.com/sites/default/files/resources/whitepaper/multicast.pdf
http://www-personal.umich.edu/~bdr/et/mcast-windows.html

posted on 2015-07-14 19:36  偏爱省略号  阅读(701)  评论(0编辑  收藏  举报

导航