Presentation is loading. Please wait.

Presentation is loading. Please wait.

Multicasting Jari Kellokoski 13.5.2005 Introduction When a unicast address identifies a sigle IP interface Then a broadcast address identifies all IP.

Similar presentations


Presentation on theme: "Multicasting Jari Kellokoski 13.5.2005 Introduction When a unicast address identifies a sigle IP interface Then a broadcast address identifies all IP."— Presentation transcript:

1

2 Multicasting Jari Kellokoski 13.5.2005

3 Introduction When a unicast address identifies a sigle IP interface Then a broadcast address identifies all IP interfaces This leaves multicast a set of IP interfaces Multicast datagrams are received only by those interfaces interested in the datagram And in theory all this is simple – just about nine socket options: three affecting sending and six for host’s reception of multicast datagrams

4 Content Multicast addressing Multicast vs. Broadcasting on a LAN/WAN Multicast socket options mcast_join and related functions Examples Summary

5 Multicast Addresses Always note difference between IPv4 and IPv6 Multicast addresses are class D addresses – range 224.0.0.0 to 239.255.255.255 (in IPv4) The low-order 28 bits of a class D address form the multicast group ID and 32-bit address is the group address 01005e 28 bit group ID low-order 23 bits IPv4 multicast address Ethernet multicast address IPv4 mapping to Ethernet: high order 24 bits of the Ethernet address are always: 01:00:5e. The next bit is always 0, and low- order 23 bits are compied from the low-order 23 of the multicast group address. The high-order 5 bits of the gourp address are ignoreed in the mapping. So 32 multicast addresses map to a single Ethernet address – not one to one mapping

6 Multicast Addresses cont. Special IPv4 multicast addresses: 224.0.0.1 all hosts group – all multicast-capable nodes on a subnet must join this group 224.0.02 all-routers group – all multicast- capable routers on a subnet must join this group 224.0.0.0/24 is link local addresses are reserved for low-level topology discovery or maintenance protocol

7 Multicast Addresses cont. On IPv6… –Mapping for Ethernet is defined on RFC2464 Idea is the same: 32-bit group ID, high-order bytes are fixed etc. Something different: flags for well-know multicast groups and transient multicast group (unicast based multicast addresses RFC 3306) Scope for how ”far” the multicast packet will travel 1 – interface local 2 – link local 4 – admin local 5 – site local 8 – organization local 14 - global

8 Multicasting vs. Broadcasting on a LAN Sending application Receiving application Just a host… 1 23 4

9 Multicasting vs. Broadcasting on a LAN cont. Receiving application starts and creates socket (e.g UDP) and binds it a port and then joins a multicast group Joining is done with setsockopt After joining: IPv4 layer is telling to datalink to receive Ethernet address corresponding to the multicast address that the application has just joined Sending application is creating a socket and sends a datagram(s) to multicast address (and port) where the receiving application has joined sending to a multicast address does not require anything special (no need for joining to multicast group) Sent frame includes the destination Ethernet address and destination IP address Host in the middle ignores the frame completely because: 1.destination Ethernet address does not match 2.destination Ethernet address is not broadcast address 3.interface has not been told to receive any groups addresses The frame is received by the datalink on receiving host based on imperfect filtering (it can receive frames destined to other Ethernet multicast address) Ethernet frame type IPv4 so it is passed to IP layer IP layer compares this address against all the multicast addresses host has joined 1 2 3 4

10 Multicasting on a WAN Multicasting is also beneficial on WANs Sender Member R1 R2 R3 R5 R4 LAN 1 LAN 2 LAN 3 LAN 4 LAN 5

11 Multicasting on a WAN cont. The packets are multicast on top left LAN by the sender. Member in LAN 1 can receive these easily (joined a multicast group) as the multicast router R1 (multicast router must receive all multicast packets) R1 forwards the multicast packet to R2 since the MRP (Multicast Routing Protocol) has informed R1 that R2 needs to receive packets destined to this group R2 multicasts the packet on its own LAN 2 since it has members of this multicast group too. It also makes a copy fo the packet and sends it to R3 R3 sends the multicast packet to R4 but R3 is not multicast a copy to its own LAN 3 since it does not have any multicast members R4 multicasts the packet onto its attached LAN 4 since it has multicast members belong to that group. It does not make a copy and send it to R5 because none of the host on LAN 5 belong to multicast group and R4 knows this based on routing information it has exchanged with R5

12 Multicasting on a WAN cont. Difficulties – Multicast Routing Protocol MRP need to get the data from all the senders which may be located anywhere in the network to all the receivers which may similarly be located anywhere Difficulties – Address allocation There are not enogh IPv4 multicast addresses to statically assign them to everyone who wants it. Send wide-area multicast and not confilict with other multicast address. Solution? Source-specific multicast (SSM) Receivers supply the sender’s source address to the routers as a part of joining the group Redefinition of the identifier to combination fo unicast source and multicast destination address

13 Multicast Socket Options API support for traditional multicasting requires five new socket options Source-filtering support (SSM) adds four more Shortly about the options: IP_ADD_MEMBERSHIP, IPV6_JOIN_GROUP, MCAST_JOIN_GROUP join an any-source multicast group on specific local interface IP_DROP_MEMBERSHIP, IPV&_LEAVE_GROUP, MCAST_LEAVE_GROUP leave an any-source multicast group on a specified local interfeace If local interface is not specified the first matching multicast group membership is dropped IP_BLOCK_SOURCE, MCAST_BLOCK_SOURCE block receip of traffic on this socket from a source given an existing any-source groups memebership on specified local interface

14 Multicast Socket Options cont. IP_UNBLOCK_SOURCE, MCAST_SOURCE unblock a previously blocked source IP_ADD_SOURCE_MEMBERSHIP, MCAST_JOIN_SOURCE_GROUP join a source-specific group on a specific local interface. The group must not have already bee joined using anysource interface IP_DROP_SOURCE_MEMBERSHIP, MCAST_LEAVE_SOURCE_GROUP leave a source-specific group on a specific local interface IP_MULTICAST_IF, IPV6_MULTICAST_IF specify the interface for outgoing multicast datagrams sen on this socket IP_MULTICAST_TTL, IPV6_MULTICAST_HOPS set the IPv4 TTL or IPv6 hop limit for outgoing multicast datagrams IP_MULTICAST_LOOP, IPV6_MULTICAST_LOOP enable or disable local loopback of multicast datagrams (default enabled)

15 mcast_join and related functions Although all these socket options are quite simple it might be easier to write protocol independent code and hide protocol differences with wrapper functions e.g. joining int mcast_join(int sokfd, const struct sockadd *grp, socklen_t gprlen, const char *ifname, u_int ifindex); mcast_join joins the any-source multicast group whose IP address is contained within the socket address structure pointed to by grp, and whose lenght is specified by grplen. Interface on which to join the group by either interface name (a non-null ifname) or a nonzero inteface index (ifindex)

16 dg_cli Function Using Multicasting If you have a broadcast program (Figure 20.5 on page 537) then making it multicast version is simple – just remove call to setsockopt (where broadcast option is enabled) This works if the default multicast socket options are ok (outgoing interface, TTL and loopback) The books example works because the each reply is unicast and that is because the source address of the request, which is used by each server as the destination address of the reply, is a unicast address

17 Multicast usage examples IP Multicast Infrastructure Session Announcements Simple Network Time Protocol (SNTP)

18 Summary Multicast addresses are class D addresses – range 224.0.0.0 to 239.255.255.255 (in IPv4) Multicast application starts by joining the multicast group assigned to the application. It is telling to IP layer to join the group, which tells the datalink layer to receive multicast frames that are send to corresponding hardware layer multicast address Multicasting on a WAN requires multicast-capable routers and multicast routing protocol Nine socket options provide the API for multicasting: Join an any-source multicast group on an interface Leave a multicast group Block a source on from a joined group Unblock a blocked source Join a source-specific multicast group Set the default interface for outgoing multicasts Set the TTL on hop limit for outgoing multicasts Enable or disable loopback of multicasts Receiving Sending


Download ppt "Multicasting Jari Kellokoski 13.5.2005 Introduction When a unicast address identifies a sigle IP interface Then a broadcast address identifies all IP."

Similar presentations


Ads by Google