Wednesday, December 29, 2010

Multicast



history

In 1988, for the first time in its Deering Steve doctoral thesis put forward in IP multicast concept. In March 1992 in Internet scope first test IETF IETF meeting of multicast voice, when more than 20 outlets can be heard simultaneously meeting of voice.

Network communication of multicast

IPv6 packets to a multicast is three basic types of the destination address, multicasting is point-to-multipoint communication, without using IPv4 IPv6 the multicast terms, but will broadcast as multicast of a special case.

IP multicast (also called multi-access radio or multicast) technology, it is a kind of allowed one or multiple hosts (multicast source) send a single packet to multiple hosts (once, at the same time) TCP/IP network technology. Multicast as point-to-multipoint communication, save network bandwidth is one of the effective approaches. In the network video/audio broadcast applications, when need to put a node of the signals to multiple nodes, whether by repeated peer-to-peer communication mode, still USES radio way, will be serious waste network bandwidth, only multicast is the best choice. Multicast can make one or more multicast source only send to specific packets to a multicast group, while only join the multicast group host can receive packets. At present, IP multicast technology has been widely used in network audio/video broadcast, the AOD/VOD, network video conference, multimedia remote education, "shall we" technology (such as stock prices, etc) and virtual reality games, etc.

Some applications will have so of requirement: some distribution everywhere in the process of the way needs to group work together, in the group process usually want to send messages of all other members. Namely have such a way to give some well-defined group sending messages, and these group member number though many, but compared with the whole network size but very small. Such a group of sending messages called dots transmitted, referred to as multicast.

A, IP multicast technology introduction

1. IP multicast addresses and multicast group

IP multicast communication must rely on IP multicast address, it is a in IPv4 D class IP address, ranging from 224.0.0.0 to 239.255.255.255, and is divided into local link multicast address, obligate multicast addresses and management authority multicast address three categories. Among them, the local link multicast address range in 224.0.0.0 ~ 224.0.0.255, this is for routing protocol and other USES the address, the router is not retained forwarding belong to this range of IP packets, Obligate multicast address for 224.0.1.0 ~ 238.255.255.255, and can be used in the global range (such as the Internet) or network protocol, Management authority multicast address for 239.0.0.0 ~ 239.255.255.255, available for organization for internal use, similar to the private IP address and cannot be used in Internet, can restrict multicast range.

Use the same IP multicast address receive multicast data packets for all the host constitute a main unit, also known as multicast group. A multicast group members are always changing, host computer can always join or leave a multicast group and multicast group in the number and the geographical position is unlimited, the host computer also can belong to several multicast group. In addition, do not belong to a multicast group host may submit the multicast group sends a packet.

2. IP multicast technology hardware support

To realize the IP multicast communication, requirement between multicast source and receiver router, hubs, switches and host all needs to support IP multicast. At present, IP multicast technology has been hardware, software vendors widespread support.

(1) host

Supports IP multicast communication platform including Windows CE 2.1, Windows 95, Windows 98, Windows NT 4 and Windows 2000, running the operating system host can undertake IP multicast communication. In addition, a new production network card also provides for almost all IP multicast support.

(2) hub and switches

Most current hubs, switches are simply the multicast data as broadcast to send receives, but some medium and high-grade switch provides for IP multicast support. For example, in 3COM SuperStack 3 Swith 3300 on a switch can enable 802.1 p or IGMP multicast filter functions, only has detected IGMP packets to port forwarding multicast data packets.

(3) router

Multicast communication requirements multicast source node and destination node between all routers must provide for Internet group management protocol (IGMP), multicast routing protocol (such as PIM, etc) DVMRP support.

When a host to join a multicast group, will send out "host members report IGMP notifications multicast router. When multicast router to receive send the multicast groups of data, will the transmitted to all the multicast host. Multicast router also periodically will send out "host" members inquires to subnet inquires IGMP news, a multicast host, if discover a multicast group has no any member, then stop the forwarding the multicast group of data. In addition, when the host (IGMP v2 support such as Windows 98/2000 computer) quit a multicast group, also to router sends a "left" IGMP news group to inform the router forwards the multicast group to stop the data. But only when the child online all hosts are exit a multicast group, the router will stop to the subnet forwarding the multicast group of data.

Using multicast routing protocols, routers can build from multicast source node to all destination node multicast routing table, so as to realize the subnetwork interconnection forwarding multicast data packets. For example, PIM (protocol independent multicast) is a kind of multicast routing protocols, it has two types: sparse mode (sparse - mode) and dense mode (dense - mode). With Cisco routers 2621 as an example, enable IP multicast forwarding function of basic Settings are:

C2621 (config) # IP multicast - ccna startup IP multicast, make the router becomes a multicast router

C2621 (config) # int f0/4.0 configure fast Ethernet port 0

C2621 (config - if) # IP pim dense - mode (or sparse - mode) started pim, activate IGMP protocol

C2621 (config - if) # int f0/1 fast Ethernet port configuration to 1

C2621 (config - if) # IP pim dense - mode (or sparse - mode)

Second, IP multicast application programming method

In practical applications, programming staff usually need oneself to prepare underlying network applications to the bottom of the realization of online communication, such as a concrete realization IP multicast communication function. Prepare underlying network applications often to resort to online data communication programming interface, and in different operating systems is provided in the network programming interface is different, as in Microsoft Windows environment of network programming interface is Windows Socket (hereinafter Winsock Socket, Windows).

Winsock offering including TCP/IP, IPX etc. Various communication protocol of programming interface. Different Windows support different Winsock edition which Windows 95 etc early version itself only support Winsock1.1 (16) under the programming (can by installing related package make its support Winsock2.0), and Windows 98, Windows NT4.0, Windows 2000 is directly support Winsock2.0 (32). Winsock2.0 is Winsock1.1 expansion, except compatible Winsock1.1 API outside, still defines a set of supports IP multicast has nothing to do with the agreement of the API.

Use Winsock 2.0 realize IP multicast general procedure is as follows:

1. Initialization Winsock resources

In Winsock before use, must call WSAStartup () function initializes the Windows Sockets DLL. It allows the application or designated Windows Sockets API DLL requirements version.

2. Create a socket

Call WSASocket () function can be used to create a UDP protocol of sockets, it is to join a multicast group initialization socket, and after the sending and receiving data in the socket. For IP multicast communication, can be set to WSA_FLAG_MULTIPOINT_C_LEAF, dwFlags parameters WSA_FLAG_MULTIPOINT_D_LEAF and WSA_FLAG_OVERLAPPED, indicates the bit and IP multicast communication in the control level and data layer are "rootless", only exists leaf nodes, and they can be arbitrary join a multicast group, and from a leaf nodes transmitted data will be transferred to every leaf nodes (including its own); Create a socket with overlapping attributes.

3. Sets a socket option

Call setsockopt () function for socket set SO_REUSEADDR options to allow a socket binding to an already in use of address.

4. Bind socket

Call bind () function bind socket, which will create good socket with local address and local port connection. For multicast communication speaking, sending and receiving data usually adopts the same port.

5. Set multicast socket mode

WSAIoctl () function is used to SIO_MULTICAST_LOOP command yards allow or prohibit the multicast communication when sending out communication flow is also able to in the same socket is receiving (namely multicast return). Note that in Windows 95/98 / NT 4, default is to allow multicast came back, but we cannot set prohibited, otherwise will go wrong, Only in Windows 2000 above version, can Settings allowed/prohibited multicast returns.

WSAIoctl () function is used to set SIO_MULTICAST_SCOPE command yards multicast spread of limits, namely survival time TTL. Whenever multicast router forwards multicast data packets, packet of TTL value will be minus 1, if a packet of TTL reduced to 0, the router will abandon the packets. TTL value is how much, multicast data and most ability after many a multicast router. For example, TTL value is 0, the multicast only in local host multiple socket spread, and cannot spread to "lines", TTL (the default value is 1), then a multicast data hit the first router, will it be cruel to discard, "" don't allow efferent local networks, namely, only one outside the multicast group inside network can receive multicast data.

No comments:

Post a Comment