Übungen zu Kommunikationssysteme Multicast Peter Bazan, Gerhard Fuchs, David Eckhoff
Multicast Classification Example Applications Principles Multicast via Unicast Application-layer Multicast Network Multicast Application-Layer vs. Network Multicast IP Multicast Addressing Layer 2 Aspects Protocols (overview & theory: local/wide area protocols, multicast trees) Protocols (implementation examples: ICMP, DVMRP, PIM DM/SM) Java example Übungen zu Kommunikationssysteme: Multicast 2
Classification Multicast is a type of group communication where one sender communicates with many receivers (1:m) Group communication: Multiple partners communicate in a closed group. One differentiating factor is the number of participating sender and receiver. Types of group communication: Unicast: 1:1 Concast: m:1 Multicast: 1:m Multipeer: m:n (typically emulated using multicast) Übungen zu Kommunikationssysteme: Multicast 3
Multicast Classification Example Applications Principles Multicast via Unicast Application-layer Multicast Network Multicast Application-Layer vs. Network Multicast IP Multicast Addressing Layer 2 Aspects Protocols (overview & theory: local/wide area protocols, multicast trees) Protocols (implementation examples: ICMP, DVMRP, PIM DM/SM) Java example Übungen zu Kommunikationssysteme: Multicast 4
Example Applications TV broadcast time synchronization (NTP) distribution of data (e.g. stock exchange rates) Receiver Receiver Sender Receiver Receiver Übungen zu Kommunikationssysteme: Multicast 5
Example Applications Multipeer Applications video conferences multiplayer games Sender Receiver Sender Receiver Sender Receiver Übungen zu Kommunikationssysteme: Multicast 6
Multicast Classification Example Applications Principles Multicast via Unicast Application-layer Multicast Network Multicast Application-Layer vs. Network Multicast IP Multicast Addressing Layer 2 Aspects Protocols (overview & theory: local/wide area protocols, multicast trees) Protocols (implementation examples: ICMP, DVMRP, PIM DM/SM) Java example Übungen zu Kommunikationssysteme: Multicast 7
Principles Multicast via Unicast source sends N unicast datagrams, one addressed to each of N receivers multicast sender routers forward unicast datagrams multicast receiver (red) not a multicast receiver (grey) Übungen zu Kommunikationssysteme: Multicast 8
Principles Application-layer Multicast end systems involved in multicast copy and forward unicast datagrams among themselves Übungen zu Kommunikationssysteme: Multicast 9
Principles Network Multicast Router actively participate in multicast, making copies of packets as needed and forwarding towards multicast receivers Multicast routers (red) duplicate and forward multicast datagrams Übungen zu Kommunikationssysteme: Multicast 10
Principles Application-Layer vs. Network Multicast Source Source n point-to-point connections single multicast connection Unicast receivers Multicast receivers Übungen zu Kommunikationssysteme: Multicast 11
Multicast Classification Example Applications Principles Multicast via Unicast Application-layer Multicast Network Multicast Application-Layer vs. Network Multicast IP Multicast Addressing Layer 2 Aspects Protocols (overview & theory: local/wide area protocols, multicast trees) Protocols (implementation examples: ICMP, DVMRP, PIM DM/SM) Java example Übungen zu Kommunikationssysteme: Multicast 12
IP Multicast Addressing multicast group concept: use of indirection hosts addresses IP datagram to multicast group routers forward multicast datagrams to hosts that have joined that multicast group 128.59.16.12 128.119.40.186 multicast group 226.17.30.197 128.34.108.63 128.34.108.60 Übungen zu Kommunikationssysteme: Multicast 13
IP Multicast Addressing class D Internet addresses reserved for multicast: host group semantics: o anyone can join (receive) multicast group o anyone can send to multicast group o no network-layer identification to hosts of members needed: infrastructure to deliver mcast-addressed datagrams to all hosts that have joined that multicast group Übungen zu Kommunikationssysteme: Multicast 14
IP Multicast Addressing Multicast addresses = Class D addresses address range: 224.0.0.0/4 only for destination address source address is still the unicast source address Link-Local multicast addresses only available in the subnet (will not be forwarded) address range: 224.0.0.0/24 reserved addresses (examples): 224.0.0.1 - all systems 224.0.0.2 - all routers 224.0.0.5 - OSPF routers 224.0.0.6 - OSPF designated routers Übungen zu Kommunikationssysteme: Multicast 15
IP Multicast Addressing Globally scoped addresses 224.0.1.0-238.255.255.255 are to be used globally in the internet Source-specific multicast 232.0.0.0/8 GLOP addresses (RFC2770) 233.0.0.0/8 reserved for statically defined addresses by organizations that already have an AS number reserved address: 233.<AS>.0/24 Administratively scoped addresses 239.0.0.0/8 like RFC1918 addresses for local use only not routed in the internet Übungen zu Kommunikationssysteme: Multicast 16
IP Multicast Addressing thresholds are used to limit multicast traffic to a particular region same principle as in IP unicast TTL scope Initial TTL value TTL threshold Local net 1 - Site 15 16 Region 63 64 World 127 128 Übungen zu Kommunikationssysteme: Multicast 17
IP Multicast Layer 2 Aspects Multicast IP addresses are mapped to special Ethernet MAC addresses The last 23 Bit of the IP Address are mapped to the MAC Address (x) Octet 0 Octet 1 Octet 2 Octet 3 Octet 4 Octet 5 xxxxxxx1 xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx broadcast / multicast bit Übungen zu Kommunikationssysteme: Multicast 18
IP Multicast Layer 2 Aspects Why 23 Bit? In the early 90s Steve Deering tried to get 16 Organizationally Unique Identifiers (OUI s) from the IEEE but could not pay for it. Any problems? 32 IP multicast addresses can be mapped to a single ethernet address. This may lead to performance problems! 32 Bit 28 Bit IP multicast address Header: 1110 239.255.0.1 Ethernet multicast address Header: 01-00-5e 01-00-5e-7f-00-01 23 Bit 48 Bit Übungen zu Kommunikationssysteme: Multicast 19
IP Multicast Layer 2 Aspects Normal case: multicast = broadcast, i.e. flooding trough the LAN IGMP snooping Intelligent switches process all multicast packets, look for IGMP messages and analyze them Prerequisite for a broad use: layer-3-aware switches Cisco Group Management Protocol (CGMP) Intelligence only at the router, which informs its local switches No processing power at the switch is required Übungen zu Kommunikationssysteme: Multicast 20
IP Multicast Protocols Overview local protocol (IGMP) host interacts with local mcast router to mediate the membership to a multicast group mcast router administrates tables about the membership IGMP IGMP IGMP Übungen zu Kommunikationssysteme: Multicast 21
IP Multicast Protocols Overview wide-area protocol (e.g., PIM, DVMRP, MOSPF) local router interacts with other routers to mediate the receive of the mcast datagram flow organize and build multicast trees between each other datagrams are send from the root of the tree to the leaves wide-area multicast routing Übungen zu Kommunikationssysteme: Multicast 22
IP Multicast Protocols Theory Goal: find a tree (or trees) connecting routers having local mcast group members tree: not all paths between routers used, loop free shared-tree: same tree used by all group members source-based: different tree from each sender to rcvrs Shared tree Source-based trees Übungen zu Kommunikationssysteme: Multicast 23
IP Multicast Protocols Theory Approaches for building mcast trees: source-based tree: one tree per source shortest path trees reverse path forwarding group-shared tree: group uses one tree minimal spanning (Steiner) center-based trees Übungen zu Kommunikationssysteme: Multicast 24
IP Multicat Protocols Theory (Shortest Path Tree) mcast forwarding tree: tree of shortest path routes from source to all receivers Dijkstra s algorithm S: source R1 1 R2 3 4 2 R4 5 R5 LEGEND router with attached group member router with no attached group member R3 R6 6 R7 i link used for forwarding, i indicates order link added by algorithm Übungen zu Kommunikationssysteme: Multicast 25
IP Multicast Protocols Theory (Reverse Path Forwarding) relies on router s knowledge of unicast shortest path from it to sender each router has simple forwarding behavior: if (mcast datagram received on incoming link on shortest path back to center) then flood datagram onto all outgoing links else ignore datagram Übungen zu Kommunikationssysteme: Multicast 26
IP Multicast Protocols Theory (Reverse Path Forwarding) S: source R2 R1 R4 R5 LEGEND router with attached group member router with no attached group member R3 R6 R7 datagram will be forwarded datagram will not be forwarded result is a source-specific reverse SPT may be a bad choice with asymmetric links Übungen zu Kommunikationssysteme: Multicast 27
IP Multicast Protocols Theory (Reverse Path Forwarding) Pruning: forwarding tree contains subtrees with no mcast group members no need to forward datagrams down subtree prune msgs sent upstream by router with no downstream group members S: source LEGEND R1 R4 router with attached group member R3 R2 R6 P P R7 R5 P router with no attached group member prune message links with multicast forwarding Übungen zu Kommunikationssysteme: Multicast 28
IP Multicast Protocols Theory (Steiner Tree) Shared-Tree Steiner Tree: minimum cost tree connecting all routers with attached group members problem is NP-complete excellent heuristics exists not used in practice: computational complexity information about entire network needed monolithic: rerun whenever a router needs to join/leave Übungen zu Kommunikationssysteme: Multicast 29
IP Multicast Protocols Theory (Center-based trees) single delivery tree shared by all one router identified as center of tree to join: edge router sends unicast join-msg addressed to center router join-msg processed by intermediate routers and forwarded towards center join-msg either hits existing tree branch for this center, or arrives at center path taken by join-msg becomes new branch of tree for this router Übungen zu Kommunikationssysteme: Multicast 30
IP Multicast Protocols Theory (Center-based trees) Suppose R6 chosen as center: LEGEND R1 3 R4 router with attached group member R3 R2 1 R6 2 R7 R5 1 router with no attached group member path order in which join messages generated Übungen zu Kommunikationssysteme: Multicast 31
IP Multicast Protocols Theory (Tunneling) Q: How to connect islands of multicast routers in a sea of unicast routers? physical topology logical topology mcast datagram encapsulated inside normal (non-multicastaddressed) datagram normal IP datagram sent thru tunnel via regular IP unicast to receiving mcast router receiving mcast router unencapsulates to get mcast datagram Übungen zu Kommunikationssysteme: Multicast 32
IP Multicast Protocols (IGMP) IGMP: Internet Group Management Protocol host: sends IGMP report when application joins mcast group IP_ADD_MEMBERSHIP socket option in the C socket library host need not explicitly unjoin group when leaving router: sends IGMP query at regular intervals host belonging to a mcast group must reply to query query report Übungen zu Kommunikationssysteme: Multicast 33
IP Multicast Protocols (IGMP) IGMP version 1 router: Host Membership Query msg broadcast on LAN to all hosts host: Host Membership Report msg to indicate group membership randomized delay before responding implicit leave via no reply to Query RFC 1112 IGMP v2: additions include last host replying to Query can send explicit Leave Group MSG router performs group-specific query to see if any hosts left in group RFC 2236 IGMP v3: The desired source (multicast sender) can be specified RFC 2933 Übungen zu Kommunikationssysteme: Multicast 34
IP Multicast Protocols (DVMRP) DVMRP: distance vector multicast routing protocol RFC1075 flood and prune: reverse path forwarding, source-based tree RPF tree based on DVMRP s own routing tables constructed by communicating DVMRP routers no assumptions about underlying unicast initial datagram to mcast group flooded everywhere via RPF routers not wanting group: send upstream prune msgs Übungen zu Kommunikationssysteme: Multicast 35
IP Multicast Protocols (DVMRP) soft state: DVMRP router periodically (1 min.) forgets branches are pruned: mcast data again flows down unpruned branch downstream router: reprune or else continue to receive data routers can quickly regraft to tree following IGMP join at leaf odds and ends commonly implemented in commercial routers Mbone routing done using DVMRP Übungen zu Kommunikationssysteme: Multicast 36
IP Multicast Protocols (PIM) Protocol Independent Multicast not dependent on any specific underlying unicast routing algorithm (works with all) two different multicast distribution scenarios: Dense: group members densely packed, in close proximity. bandwidth more plentiful Sparse: # networks with group members small wrt # interconnected networks group members widely dispersed bandwidth not plentiful Übungen zu Kommunikationssysteme: Multicast 37
IP Multicast Protocols (PIM) Consequences: Dense group membership by routers assumed until routers explicitly prune data-driven construction on mcast tree (e.g., RPF) bandwidth and nongroup-router processing profligate Sparse: no membership until routers explicitly join receiver- driven construction of mcast tree (e.g., center-based) bandwidth and non-grouprouter processing conservative Übungen zu Kommunikationssysteme: Multicast 38
IP Multicast Protocols (PIM-DM) flood-and-prune RPF, similar to DVMRP but underlying unicast protocol provides RPF info for incoming datagram less complicated (less efficient) downstream flood than DVMRP reduces reliance on underlying routing algorithm no list of PIM neighbors (receivers from the same router) request for pruning sent to all PIM local routers ( neighbors ) response to request to prune from any receiver delayed 3 seconds, so other PIM routers can override (if they want to receive packets) has protocol mechanism for router to detect it is a leafnode router Übungen zu Kommunikationssysteme: Multicast 39
IP Multicast Protocols (PIM-SM) center-based approach router sends join msg to rendezvous point (RP) intermediate routers update state and forward join after joining via RP, router can switch to source-specific tree increased performance: less concentration, shorter paths R3 R2 R1 join all data multicast from rendezvous point join R6 join R4 R5 R7 rendezvous point Übungen zu Kommunikationssysteme: Multicast 40
IP Multicast Protocols (PIM-SM) sender(s): unicast data to RP, which distributes down RProoted tree RP can extend mcast tree upstream to source the source need not to be a receiver! RP can send stop msg if no attached receivers no one is listening! R3 R2 R1 join all data multicast from rendezvous point join R6 join R4 R5 R7 rendezvous point Übungen zu Kommunikationssysteme: Multicast 41
Sample multicast sender import sun.net.*; // Import some needed classes import java.net.*; int port = 5555; // Port to send to String mcastgroup = "225.4.5.6"; // Multicast address // Create a socket MulticastSocket socket = new MulticastSocket(); // We are only sending data and not receiving, // so we don't have to join the multicast group String hi = Hello! // Create a DatagramPacket DatagramPacket packet = new DatagramPacket(hi.getBytes(), hi.length(), InetAddress.getByName(mcastGroup), port); socket.send(packet, timetolive); // Send the packet socket.close(); // Close the socket when finished Übungen zu Kommunikationssysteme: Multicast 42
Sample multicast receiver // Import some needed classes import sun.net.*; import java.net.*; int port = 5555; // Port to listen to String mcastgroup = "225.4.5.6"; // Multicast address // Create a socket and bind it to the port MulticastSocket socket = new MulticastSocket(port); // join the multicast group socket.joingroup(inetaddress.getbyname(mcastgroup)); // Create a DatagramPacket and a receive data byte buffer[] = new byte[1024]; DatagramPacket packet = new DatagramPacket(buffer, buffer.length); socket.receive(packet); // Print the received data System.out.println("Received data from: + packet.getaddress().tostring() + ":" + packet.getport() + " with length: " + packet.getlength()); System.out.println(new String(packet.getData())); System.out.println(); // Leave the multicast group and close the socket socket.leavegroup(inetaddress.getbyname(mcastgroup)); socket.close(); Übungen zu Kommunikationssysteme: Multicast 43