1 / 21

Broadcast and Multicast

Broadcast and Multicast. Unicast. Host 1. Host 2. Broadcast. Packet received by every host on network (including the sender!). Multicast. Packet received by a selected subset of hosts in the network. Root. Leaf. Leaf. Broadcast. Advantages Reducing Network Traffic

Download Presentation

Broadcast and Multicast

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Broadcast and Multicast

  2. Unicast Host 1 Host 2

  3. Broadcast Packet received by every host on network (including the sender!)

  4. Multicast Packet received by a selected subset of hosts in the network Root Leaf Leaf

  5. Broadcast • Advantages • Reducing Network Traffic • Network Time Protocol (NTP), Route Broadcasts • Resource Discovery • ARP, BOOTP

  6. Broadcast… • Disadvantage • Everybody receives a packet, whether they want it or not. • Receving a packet Interrupting your work and processing the packet.

  7. Types of broadcast addresses • IP Address can be broken down as {netid, subnetid, hostid} E.g. 130.245.224.19 130.245  Netid 224  subnet id 19  host id

  8. Types of broadcast addresses… • Subnet-directed broadcast {netid, subnetid, *} E.g. 130.245.224.255 • Broadcasts to local subnet. • Routers do not forward these types of broadcast.

  9. Types of broadcast addresses… • All-Subnet broadcast {netid, *, *} E.g. 130.245.255.255 • Broadcasts to all subnets under netid • Almost never used. May not be allowed for administrative reasons.

  10. Types of broadcast addresses… • Network directed broadcast {netid, *} • For networks without sub-netting • Doesn’t exist anymore

  11. Types of broadcast addresses… • Limited broadcast address {*, *, *} E.g. 255.255.255.255 • Older form of Subnet-directed broadcast • Broadcasts to local subnet • Never forwarded across routers.

  12. How broadcast works Dest IP = 130.245.224.255 Receiver Sender Dest Port = 9999 Port 9999 UDP UDP UDP X IPv4 IPv4 IPv4 Data Link Data Link Data Link Dest Ethernet addr ff:ff:ff:ff:ff:ff

  13. Example Echo from Multiple Servers

  14. int sockfd, on=1, len; char recvline[MAXLILNE]; struct sockaddr_in reply_addr, bcastaddr; sockfd = Socket(…); /* Enable broadcast on socket */ Setsockopt(sockfd, SOL_SOCKET,SO_BROADCAST, &on, sizeof(on)); /* Set a receive timeout on socket */ tv.tv_sec = 5; tv.tv_usec = 0; Setsockopt( sockfd, SOL_SOCKET, SO_RCVTIMEO, (void *)&tv, sizeof(tv)); Initialize bcastaddr with IP = 130.245.224.255 and Port = 9999

  15. /* Broadcast a Hello */ Sendto(sockfd, “Hello”, strlen(“Hello”), 0, (struct sockaddr *)&bcastaddr, sizeof(bcastaddr)); /* Receive Echos from servers*/ for(;;) { len = sizeof(reply_addr); n = recvfrom (sockfd, recvline, MAXLINE, 0, &reply_addr, &len); if( n < 0) { if (errno == EAGAIN) { printf(“Waited for 5 seconds - exiting\n”); } else { perror(“ERROR”); } exit(0); } recvline[n] = 0; printf(“%s\n”, recvline); }

  16. Multicast

  17. Multicast addresses • Class D address : • 224.0.0.0 to 239.255.255.255 • Low order 28 bits identify a multicast group id. • Link Local addresses : • 224.0.0.0 to 224.0.0.255 • Reserved for network maintenance messages • Never forwarded by routers • All-hosts group - 224.0.0.1 • All-routers group - 224.0.0.2

  18. Multicast to Ethernet mapping 28-bit group ID e 01 00 5e Low order 23 bits 32 IP multicast groups map to one Ethernet level multicast group

  19. How multicast works Join 224.0.1.1 Dest IP = 224.0.1.1 Receiver Sender Dest Port = 9999 Port 9999 UDP UDP UDP IPv4 IPv4 IPv4 Data Link Data Link Data Link Receive 01:00:5e:00:01:01 Dest Ethernet addr 01:00:5e:00:01:01

  20. Managing multicast membership • Five Socket options • IP_ADD_MEMBERSHIP • Join a multicast group • IP_DROP_MEMBERSHIP • Leave a multicast group • IP_MULTICAST_IF • Specify a default interface for outgoing multicast • IP_MULTICAST_TTL • Specify TTL for outgoing multicast • IP_MULTICAST_LOOP • Enable or disable loopback of outgoing multicast

  21. WAN Multicast Sender R3 S1 S4 R1 S2 R2 S – subnet R - Router S3 - Receiver

More Related