32
Multicasting © Dr. Ayman Abdel-H ! CS4254 C"mputer #et$"r% Arc&itecture a 'r"gramming Dr. Ayman A. Abdel-Hamid C"mputer Science Department (irginia )ec& Multicasting

Multi Cast

Embed Size (px)

DESCRIPTION

Multicasting overview

Citation preview

  • CS4254Computer Network Architecture and ProgrammingDr. Ayman A. Abdel-HamidComputer Science DepartmentVirginia TechMulticasting

    Dr. Ayman Abdel-Hamid, CS4254 Spring 2006

  • OutlineMulticasting (Chapter 21)Multipoint CommunicationsIP MulticastIPv4 Multicast addressesSending and Receiving MessagesMulticasting on a LANMulticasting on a WANMulticast Issues

    Dr. Ayman Abdel-Hamid, CS4254 Spring 2006

  • Multipoint Communications Multipoint communications support communications between more than two hostsOne-to-manyMany-to-manyUnlike broadcast, allows a proper subset of hosts to participateExample standardsIP Multicast (RFC 1112, standard)

    Dr. Ayman Abdel-Hamid, CS4254 Spring 2006

  • Logical Multipoint CommunicationsTwo basic logical organizationsRooted: hierarchy (perhaps just two levels) that structures communicationsNon-rooted: peer-to-peer (no distinguished nodes)Different structure could apply to control and data planesControl plane determines how multipoint session is createdData plane determines how data is transferred between hosts in the multipoint session

    Dr. Ayman Abdel-Hamid, CS4254 Spring 2006

  • Logical Multipoint CommunicationsControl PlaneThe control plane manages creation of a multipoint sessionRooted control planeOne member of the session is the root, c_rootOther members are the leafs, c_leafsNormally c_root establishes a sessionRoot connects to one or more c_leafsc_leafs join c_root after session establishedNon-rooted control planeAll members are the same (c_leafs)Each leaf adds itself to the session

    Dr. Ayman Abdel-Hamid, CS4254 Spring 2006

  • Logical Multipoint CommunicationsData PlaneThe data plane is concerned with data transferRooted data planeSpecial root member, d_rootOther members are leafs, d_leafsData transferred between d_leafs and d_rootsd_leaf to d_rootd_root to d_leafThere is no direct communication between d_leafsNon-rooted data planeNo special members, all are d_leafsEvery d_leafs communicate with all d_leafs

    Dr. Ayman Abdel-Hamid, CS4254 Spring 2006

  • Forms of Multipoint CommunicationsServer-based -- rooted multipoint communications with server as d_rootPassive or inactiveRelayReflectorActiveBridge or multipoint control unit (MCU)Strictly peer-to-peer multipoint Non-rootedMulticast

    Dr. Ayman Abdel-Hamid, CS4254 Spring 2006

  • Multipoint ServersPassive Multipoint Servera relay or reflector serviceProvides no processing of the dataMinimum requirement is for transport-level semantics, so can operate at the transport or application levelActive Multipoint ServerDoes application-level processingtranscodinguses application-level semantics

    Dr. Ayman Abdel-Hamid, CS4254 Spring 2006

  • Multicast CommunicationMulticast abstraction is peer-to-peerApplication-level multicastNetwork-level multicastRequires router support (multicast-enabled routers)Multicast provided at network protocol level IP multicast

    Dr. Ayman Abdel-Hamid, CS4254 Spring 2006

  • Multicast CommunicationTransport mechanism and network layer must support multicastInternet multicast limited to UDP (not TCP)Unreliable: No acknowledgements or other error recovery schemes (perhaps at application level)Connectionless: No connection setup (although there is routing information provided to multicast-enabled routers)Datagram: Message-based multicast

    Dr. Ayman Abdel-Hamid, CS4254 Spring 2006

  • IP MulticastIP supports multicastingUses only UDP, not TCPSpecial IP addresses (Class D) identify multicast groupsInternet Group Management Protocol (IGMP) to provide group routing informationMulticast-enabled routers selectively forward multicast datagramsIP TTL field limits extent of multicastRequires underlying network and adapter to support broadcast or, preferably, multicastEthernet (IEEE 802.3) supports multicast

    Dr. Ayman Abdel-Hamid, CS4254 Spring 2006

  • IP Multicast: Group AddressHow to identify the receivers of a multicast datagram?How to address a datagram sent to these receivers?Each multicast datagram to carry the IP addresses of all recipients? Not scalable for large number of recipients Use address indirectionA single identifier used for a group of receivers

    Dr. Ayman Abdel-Hamid, CS4254 Spring 2006

  • IP Multicast: IGMP ProtocolRFC 3376 (IGMP v3): operates between a host and its directly attached routerhost informs its attached router that an application running on the host wants to join or leave a specific multicast groupanother protocol is required to coordinate multicast routers throughout the Internet network layer multicast routing algorithmsNetwork layer multicast IGMP and multicast routing protocols IGMP enables routers to populate multicast routing tablesCarried within an IP datagram

    Dr. Ayman Abdel-Hamid, CS4254 Spring 2006

  • IP Multicast: IGMP ProtocolIGMP v2 Message typesmembership query: generalSent by routers router query multicast groups joined by attached hostsmembership query: specificSent by routers query if specific multicast group joined by attached hostsmembership reportSent by host report host wants to join or is joined to given multicast groupleave group (optional)Sent by host report leaving given multicast group

    Dr. Ayman Abdel-Hamid, CS4254 Spring 2006

  • IP Multicast: IGMP ProtocolJoining a groupHost sends group report when the first process joins a given groupApplication requests join, service provider (end-host) sends reportMaintaining table at the routerMulticast router periodically queries for group informationHost (service provider) replies with an IGMP report for each groupHost does not notify router when the last process leaves a group this is discovered through the lack of a report for a query

    Dr. Ayman Abdel-Hamid, CS4254 Spring 2006

  • IP Multicast: Multicast RoutingMulticast routers do not maintain a list of individual members of each host groupMulticast routers do associate zero or more host group addresses with each interface

    Dr. Ayman Abdel-Hamid, CS4254 Spring 2006

  • IP Multicast: Multicast RoutingMulticast router maintains table of multicast groups that are active on its networksDatagrams forwarded only to those networks with group members

    Dr. Ayman Abdel-Hamid, CS4254 Spring 2006

  • IP Multicast: Multicast RoutingHow multicast routers route traffic amongst themselves to ensure delivery of group traffic?Find a tree of links that connects all of the routers that have attached hosts belonging to the multicast group Group-shared treesSource-based treesShared TreeSource Trees

    Dr. Ayman Abdel-Hamid, CS4254 Spring 2006

  • MBONE: Internet Multicast BackboneThe MBone is a virtual network on top of the Internet (section B.2)Routers that support IP multicastIP tunnels between such routers and/or subnets

    Dr. Ayman Abdel-Hamid, CS4254 Spring 2006

  • Unicast versus Broadcast versus MulticastA unicast address identifies a single IP interfaceA broadcast address identifies all IP interfaces on the subnetA multicast address identifies a set of IP interfacesA multicast datagram is received only by those interfaces interested in the datagram (applications wishing to participate in the multicast group)

    Dr. Ayman Abdel-Hamid, CS4254 Spring 2006

  • IPv4 Multicast Addresses 1/3Class D addresses in the range 224.0.0.0 through 239.255.255.255Low order 28 bits of class D Naddress (see appendix A) form the multicast group ID (32-bit address is the group address)Mapping of IPv4 multicast address to Ethernet addressHigh-order 24 bits of Ethernet address are always 01:00:5ENext bit always 0Low-order 23 bits are copied from low-order 23 bits of multicast group addressHigh-order 5 bits of group address are ignored in the mappingMapping not one-to-one

    Dr. Ayman Abdel-Hamid, CS4254 Spring 2006

  • IPv4 Multicast Addresses 2/3224.0.1.88 mapped into an Ethernet address?Remember an Ethernet address is 48 bitsThe address 224 is E0 in hex, 0 is 00 in hex, 1 is 01 in hex, and 88 is 58 in hex. However, only the low-order 23 bits are usedTherefore, the IP address of 224.0.1.88 converted to a MAC address is 01-00-5E-00-01-58.

    Dr. Ayman Abdel-Hamid, CS4254 Spring 2006

  • IPv4 Multicast Addresses 3/3Some special IPv4 multicast addresses224.0.0.0 reserved224.0.0.1 all-host group224.0.0.2 all-routers group224.0.0.1 through 224.0.0.255 reserved for routing-protocolsDatagrams destined to any of theses addresses are never forwarded by a multicast router

    Dr. Ayman Abdel-Hamid, CS4254 Spring 2006

  • Sending & Receiving Multicast MessagesReceiving Multicast MessagesCreate a UDP socketBind it to a UDP port, e.g., 1234 All processes must bind to the same port in order to receive the multicast messagesJoin a multicast group addressUse recv or recvfrom to read the messages

    Sending Multicast MessagesYou may use the same socket (you used for receiving) for sending multicast messages or you can use any other UDP socket (it does not have to join any multicast group)

    Dr. Ayman Abdel-Hamid, CS4254 Spring 2006

  • Multicast on a LAN 1/3Receiving application creates a UDP socket, binds to port 123 and joins multicast group 224.0.1.1IPv4 layers saves the information internally and tells appropriate datalink to receive Ethernet frames destined to 01:00:5E:00:01:01Sending applications creates a UDP socket and sends a datagram to 224.0.1.1, port 123Ethernet frame contains destination Ethernet address, destination IP address, and destination portA host on the LAN that did not express interest in receiving multicast from that group will ignore such datagramDestination Ethernet address does not match the interface addressDestination Ethernet address is not the ethernet broadcast addressThe interface has not been told to receive any group addresses

    Dr. Ayman Abdel-Hamid, CS4254 Spring 2006

  • Multicast on a LAN 2/3Ethernet frame received by datalink of receiver based on imperfect filtering (When interface told to receive frames destined to one specific Ethernet multicast address, it can receive frames destined to other Ethernet multicast addresses)Ethernet interface cards apply a hash function to group address, calculating a value between 0 and 511. This information turns on a bit in a 512-bit arraySmall size bit-array implies receiving unwanted framesSome network cards provide perfect filteringSome network cards have no multicast filtering at all (multicast promiscuous mode) Packet passed to IP layer (IP layer compares group address against all multicast addresses that applications on this host have joined perfect filtering)Packet passed to UDP layer, which passes it to socket bound to port 123

    Dr. Ayman Abdel-Hamid, CS4254 Spring 2006

  • Multicast on a LAN 3/3Some Other scenariosA host running an application that has joined 225.0.1.1 Ethernet address 01:00:5E:00:01:01. Packet will be discarded by perfect filtering in IP layerA host running an application that has joined some multicast group which the Ethernet address produces the same hash value as 01:00:5E:00:01:01. Packet will be discarded by datalink layer or by IP layerA packet destined to the same group, but a different port. Accepted by IP layer, but discarded by UDP layer (no socket has bound the different port)

    Dr. Ayman Abdel-Hamid, CS4254 Spring 2006

  • Multicast on a WANA program started on five hosts belonging to different LANsMulticast routers communicate with neighbor routers using a multicast routing protocol (MRP)When a process on a host joins a multicast group, that host sends an IGMP message to any attached multicast routers, which in turn exchange this information using MRP with neighbor routersWhen a sender sends a multicast message, mutlicast routing information is used to direct the message

    Dr. Ayman Abdel-Hamid, CS4254 Spring 2006

  • Some Multicast IssuesTime To LiveSet TTL for outgoing multicast datagrams (default is 1 local subnet)Loopback modeEnable or disable local loopback of multicast datagramsBy default loopback is enabledA copy of each multicast datagram sent by a process on the host will also be looped back and processed as a received datagram by that hostPort ReuseAllow the same multicast application to have several instances running on the same hostIn Java, Port reuse is enabled by default

    Dr. Ayman Abdel-Hamid, CS4254 Spring 2006

  • Socket OptionsVarious attributes that are used to determine the behavior of sockets (see chapter 7)#include int getsockopt (int sockfd, int level, int optname, void * optval, socklen_t *optlen);int setsockopt (int sockfd, int level, int optname, const void * optval, socklen_t optlen);Both return 0 if OK, -1 on errorsockfd: an open socket descriptorlevel: code in the system that interprets the option (general socket code, or protocol-specific code) (SOL_SOCKET, IPPROTO_IP, IPPROTO_IPv6, IPPROTO_TCP are examples)optname: see page 193

    Dr. Ayman Abdel-Hamid, CS4254 Spring 2006

  • Socket OptionsSome socket options examples (see table on page 193 and 194)For multicast socket options see section 21.6 on page 559Socket LevelSO_SNDBUF, SO_RCVBUF, SO_KEEPALIVE, SO_BROADCAST, SO_REUSEADDR, SO_RESUEPORTIP LevelIP_TTL, IPMULTICAST_IF, IPMUTLICAST_TTL, IP_MULTICAST_LOOP, IP_ADD_MEMBERSHIP, IP_DROP_MEMBERSHIPTCP LevelTCP_KEEPALIVE, TCP_MAXSEG, TCP_NODELAY

    Dr. Ayman Abdel-Hamid, CS4254 Spring 2006

  • Sending and ReceivingSection 21.10 page 575A program to send and receive multicast datagramsSend datagram to a specific group every five seconds (datagram contains senders hostname and process ID)An infinite loop that joins the multicast group to which the sending part is sending and prints every received datagramCreate a UDP socket then set multicast socket options for address reuse, joining the group, and setting loopbackSee mcast/main.c, mcast/send.c, and mcast/recv.c

    Dr. Ayman Abdel-Hamid, CS4254 Spring 2006