Stevens Chap12 Cast

download Stevens Chap12 Cast

of 22

Transcript of Stevens Chap12 Cast

  • 8/3/2019 Stevens Chap12 Cast


    CSCI 5273

    Computer Networks

    Stevens, Chapter 12 & 13Broadcast & Multicast

    with IGMP

    Dirk Grunwald

    Assoc. ProfessorDept. of Computer Science

    University of Colorado, Boulder

  • 8/3/2019 Stevens Chap12 Cast


    Using Broadcast

    u UDP broadcast involves sending to explicit broadcastaddresses

    l Most POSIX implementations require you explic itly enablebroadcast

    ret = setsockopt(sockfd, SOL_SOCKET,SO_BROADCAST, &on, sizeof(on));

    u Only applicable to UDP!

  • 8/3/2019 Stevens Chap12 Cast


    Broadcast Addresses

    u Limited Net Broadcast -

    l Never forwarded by a router!

    u Net-directed Broadcast - e.g., A router must forward a net-directed broadcast, but must have

    an option to disable this.

    u Subnet-directed Broadcast - e.g.,

  • 8/3/2019 Stevens Chap12 Cast



    u Class D addresses are mult icast addresses

    l through

    uA specific multicast address defines a network group

    u Two special network groups

    l is never routedl - all hosts group

    l - all routers group

  • 8/3/2019 Stevens Chap12 Cast


    Well-defined multicast groups

    u is

    l Network time protocol

  • 8/3/2019 Stevens Chap12 Cast



    // Set socket option to to joint// Set socket option to to joint mcastmcast



    struct ipstruct ip__mreq mreqmreq mreq;;



    sizeofsizeof((structstruct in_in_addraddr));));

    mreqmreq..imrimr_interface.s__interface.s_addraddr == htonlhtonl(INADDR_ANY);(INADDR_ANY);

    retret == setsockoptsetsockopt((sockfdsockfd, IPPROTO_IP, IP_ADD_MEMBERSHIP,, IPPROTO_IP, IP_ADD_MEMBERSHIP,

    &&mreqmreq,, sizeofsizeof((mreqmreq));));

    check_and_exit(check_and_exit(retret, ", "setsockoptsetsockopt");");


    Joining a Multicast Group prior to receive

    Desired multicast


  • 8/3/2019 Stevens Chap12 Cast


    Using TTL to define multicast scope

    u TTL field is used to limit propogation of mult icast packets

    u In IPv4

    l 0 - node local - doesnt leave machine

    l 1 - link local - doesnt get routedl

  • 8/3/2019 Stevens Chap12 Cast




    // Set socket option to to joint// Set socket option to to joint mcastmcast



    u_charu_char ttlttl = 16;= 16;

    retret == setsockoptsetsockopt((sockfdsockfd, IPPROTO_IP, IP_MULTICAST_TTL,, IPPROTO_IP, IP_MULTICAST_TTL,

    &&ttlttl,, sizeofsizeof((ttlttl));));

    check_and_exit(check_and_exit(retret, ", "setsockoptsetsockopt");");


    Setting a TTL scope

    Desired TTL


  • 8/3/2019 Stevens Chap12 Cast


    Administrative Scoping

    u is the administratively scope mult icast IPspace

    l Addresses assigned locally to an organization, but not uniqueacross organizations

    l Border routers must not forward

    u link-local -- to

    u site-local -- to

    u organization-local - to global -- to

  • 8/3/2019 Stevens Chap12 Cast


    Converting Multicast to Ethernet

    u Multicast addresses are targeted to a number of clients

    l How does the ethernet card know which messages to receive?

    u Could simple broadcast all packets

    l Takes the same amount of network bandwidth as selectivemulticast, but..

    l Disturbs all machines

    u Can use ARP to advertise single MAC as resolving

    multiple IP addressesl ..But multiple machines want to receive

  • 8/3/2019 Stevens Chap12 Cast


    u Ethernet cards can usually receive on mult iple MACaddresses

    u Multicast router enters a virtual MAC address, clients

    receive on that virtual MAC

    1110 0000

    00101 11100000 00000000 0001

    Mapping a Multicast Address toEthernet Address

  • 8/3/2019 Stevens Chap12 Cast


    Digression - Virtual IP Addresses

    u alias alias_address[/bitmask]

    l Establishes an additional network address for this interface.

    l Eample:ifconfig eth0 alias

    u The following aliaslist command adds network addresses40 through 50, inclusive, to subnets

    18.240.32, 18.240.64, and 18.240.96

    ifconfig aliaslist 18.240.32,64,96.40-50

    u Doesnt require multiple MAC addresses, but oftenimplemented using them.

  • 8/3/2019 Stevens Chap12 Cast


    IGMP - Internet Group ManagementProtocol

    u Part of IP layer

    u Lets hosts & routers know who belongs to what groups

    IP Header

    (20 bytes)


    Message (8 bytes)

  • 8/3/2019 Stevens Chap12 Cast


    IGMP Message Format

    Version(1) Type(1-2) MBZ 16-bit checksum

    32-bit group address (Class D IP address)

    u Typel 1 is a query sent by multicast router

    l 2 is a reponse sent by a host

    u Group address is a class D IP address

    l On query, its zero

    l On response, its the group address being reported

  • 8/3/2019 Stevens Chap12 Cast


    IGMP Host Reports

    Host Router

    u Host sends a report when it joins a group

    u Doesnt report when it leaves the group, but doesnt respond tonext query

    IGMP report, TTL =1IGMP group addr = group address

    dest IP addr = group address

    src IP addr = hosts IP address

  • 8/3/2019 Stevens Chap12 Cast


    IGMP Router Query

    Host Router

    u Router sends query at regular intervals to see if anyone sti llbelongs to anygroups. Queries sent out each interface.

    u Host responds by sending one responsefor each group to which it belongs IGMP query, TTL =1

    IGMP group addr =

    dest IP addr =

    src IP addr = routers IP address

  • 8/3/2019 Stevens Chap12 Cast


    Sample Query on Windows Bootup

    05:52:32.517937 arp who-has tell

    05:52:32.518010 linux > icmp: echo


    05:52:33.378928 > ALL-ROUTERS.MCAST.NET:

    icmp: router solicitation

    05:52:37.511385 arp who-has tell linux

    05:52:37.511664 arp reply is-at


    05:52:38.453193 > ALL-ROUTERS.MCAST.NET:

    icmp: router solicitation05:52:43.477432 > ALL-ROUTERS.MCAST.NET:

    icmp: router solicitation

  • 8/3/2019 Stevens Chap12 Cast


    Multicast Routes

  • 8/3/2019 Stevens Chap12 Cast


    Sender Sends DatagramWith Specified TTL


    because no

    one is


  • 8/3/2019 Stevens Chap12 Cast


    Receiver Starts Joins group

  • 8/3/2019 Stevens Chap12 Cast


    Routers Form Destination Tree

  • 8/3/2019 Stevens Chap12 Cast


    Non-participants prune themselves