12 broadcast and multicast
12.1 Introduction
In Chapter 1, we mention that there are three IP addresses: unicast addresses, broadcast addresses, and multicast addresses. This chapter will introduce broadcast and multicast in more detail. Broadcasting and multicast is only used in UDP, they are important to use applications that need to pass the packets to multiple recipients. TCP is a connection-oriented protocol, which means that there is a connection between two processes (by port number determination) within the two hosts (determined by the IP address). Consider shared channel networks that contain multiple hosts such as Ethernet. Each Ethernet frame contains an Ethernet address (48 bit) of the source host and destination host. Usually each Ethernet frame is only sent to a single destination host, the destination address specifies a single receiving interface, which is thus referred to as unicast. In this manner, communication of any two hosts does not interfere with other hosts (except for the case of the competition for sharing channels). However, sometimes a host sends a frame to other hosts on the Internet, which is broadcast. This process can be seen by ARP and RARP. Multicast is in unicast and broadcast: the frame is transmitted to multiple hosts belonging to the multicast group. To make it easy to get broadcasting and multicast, you need to understand the filtering process of the host to transfer the frame by the channel. Figure 12.1 illustrates this process. First, the NIC will view the frame transferred by the channel, determine if the frame is received, and if it is received, it will pass it to the device driver. Usually the NIC only receives those destination addresses for the network card physical address or broadcast address. In addition, the majority interfaces are set to a hybrid mode, which can receive a copy of each frame. As an example, TCPDUMP uses this mode.
Figure 12.1 Protocol Stack of Filtering Processes for Receiving Frames
Currently, most network cards can receive a frame of destination addresses or some subnet multicast addresses. For Ethernet, the minimum bit of the highest byte in the address is set to 1 indicates that the address is a multicast address, which can be expressed as 01: 00: 00: 00: 00: (Ethernet broadcast address ff: ff: ff: ff: ff: ff can be seen as a special case of Ethernet multicast addresses.) If the network card receives a frame, this frame will be transmitted to the device driver. (If the frame inspection and error, the NIC will discard the frame.) The device driver will perform additional frame filtering. First, the protocol (IP, ARP, etc.) to use must be specified in the frame type. Next, multicast filtration is performed to detect the multicast group that the host belongs to the multicast address description. The device driver then passes the data frame to the next layer, for example, when the frame type is specified as an IP datagram, the IP layer is passed. IP performs more extraction detection according to the source address and destination address in the IP address, and if it is normally, it is transmitted to the next layer (such as TCP or UDP). Each UDP receives a datagram that is transmitted by IP, according to the destination port number, sometimes the source port number performs data report filtering. If the current no process uses this destination port number, discard the datagram and generate an ICMP unreachable message. (TCP is similar to its port number.) If the UDP datagram has a check and error, it will be discarded. The problem with broadcasting is that it adds processing loads that are not interested in the broadcast data. Take a use of UDP broadcast applications as an example. If there are 50 hosts in the network, there is only 20 participating applications, and the remaining 30 hosts have to deal with these broadcasts when a UDP broadcast data is sent each time 20 hosts. Data report, until the UDP layer, the UDP broadcast data reporter received will be discarded. These 30 hosts discard the UDP broadcast datagram because these hosts do not use this destination port. The emergence of multicast reduces processing load on the host. With multicast, the host can join one or more multicast groups. In this way, the NIC will learn which multicast group belongs to the host, and then receives the multicast frames of the multicast group where the host is located.
12.2 Broadcast
In Figure 3.9, we know four IP broadcast addresses, which are described in more detail below. The restricted broadcast restricted broadcast address is 255.255.255.255. This address is used for the destination address in the IP datagram during the host configuration. At this point, the host may not know the network mask of its network, and even its IP address does not know. In any case, the router does not forward the datagram of the destination address as the restricted broadcast address, such a datagree report only in the local network. An unfolbened problem is: If a host is a multi-interface, when a process sends a data report to this network broadcast address, whether the broadcast should send the datagram to each connected interface? If this is not the case, the application that broadcasts all interfaces of the host must determine all interfaces that support broadcasts in the host and send a datagram to each interface. Most BSD systems regard 255.255.255.255 as the broadcast address of the first interface after configuration, and does not provide the functionality of transmitting the datagram to the belonging to the broadcast capability interface. However, ROUTED (see 10.3) and RWHOD (Server of BSD RWHO customers) are two applications that send UDP datagrams to each interface. Both applications have similar startup processes to determine all interfaces in the host and understand which interfaces have broadcast capabilities. At the same time, the broadcast address of the pointing network of the interface will be the destination address of the datagram to which the interface is transmitted.
The Host Requirements RFC does not further involve the multi-interface host to send a restricted broadcast to all of its interfaces.
Pointing to the broadcast of the network pointing to the network's broadcast address is the address of the host number field is 1. The Class A network broadcast address is NetID.255.255.255, where NetID is the network number of the Class A network. A router must forward the broadcast of the network, but it must have a choice that is not forwarded.
The broadcast address of the broadcast pointing to the subnet is 1 and has an address of the host number field and has a specific subnet number. The IP address of the direct broadcast address as a subnet requires a mask of the subnet. For example, if the router receives a data report to 128.1.255, when the subnet mask of Class B 128.1 is 255.255.255.0, the address is the broadcast address of the subnet; but if the mask of the subnet is 255.255.254.0, this address is not a broadcast address of the subnet.
Pointing to all subnets to point to all subnets, also requires a subnet mask of the network to distinguish from the broadcast address of the network. The subnet number field and host number field pointing to all subnets are 1. For example, if the destination subnet mask is 255.255.255.0, the IP address 128.1.255.255 is a broadcast address pointing to all subnets. However, if the network is not divided into subnet, this is a broadcast to network. Current view [almquist 1993] is that this broadcast is old, better way to use multicast instead of broadcasting all the subnets.
---- [Almquist 1993] explains that RFC 922 requires a broadcast to all subnets to all subnets, but the current router does not do this. This is fortunate, because a host that has already configured does not have its host mask to transfer its local broadcast to all subnets. For example, if the host of the IP address is 128.1.2.3 does not set a subnet mask, its broadcast address is 128.1.255.255. However, if the subnet mask is set to 255.255.255.0, the broadcast from the error configured host will point to all subnets. ---- 1983 4.2bsd is the first implementation of a wide range of TCP / IP, which uses host number 0 as a broadcast address. One earliest broadcast IP address reference is Ien 212 [GURWITZ AND HINDEN 1982], which proposes 1 bit to the host number to represent IP broadcast addresses. (IENS is an internet test note, basically the predecessor of RFC.) RFC 894 [Hornig 1984] Think 4.2bsd uses an unbatrigated broadcast address, but RFC 906 [Finlayson 1984] noticed that there is no Internet standard for broadcast addresses. He also added a footnote to the lack of standard broadcast addresses in RFC 906, and strongly recommended that the host number 1 as a broadcast address. Although the 1986 4.3BSD adopts the host number 1 to represent the broadcast address, the operating system (highlighting SunOS 4.x) continues to use non-standard broadcast addresses until the early 1990s. 12.3 Examples of broadcasting
How is broadcasting? How do routers and hosts handle broadcast? Unfortunately, this is a problem that is difficult to answer, as it relies on the type of broadcast, the type of application, TCP / IP implementation method, and the configuration of the router. First, the application must support broadcast. If executed
Sun% ping 255.255.255.255/usr/etc/ping: unknown Host 255.255.255.255
It is intended to carry out broadcast on the local cable, but it cannot be performed because there is a problem in the application (ping). Most applications receive a decimal IP address or host name, the function inet_addr (3) is called to convert them to the binary IP address of the 32 bit. Assuming to translate a host name, if the transformation fails, the library function will return -1 to indicate that there is a certain error (for example, a character rather than the number or string has a decimal point), but the broadcast address (255.255.255.255) Also treated as a mistake, Returns -1. Most programs are assumed that the received strings are hostnames, then find domain name system DNS (Chapter 14), and output error information, such as "unknown host" after failure. If we fix this lack in the PING program, the result is not always satisfactory. In the test of 6 different systems, only one of the Broadcasting Datashers is produced as expected. Most of them look for IP addresses 255.255.255.255 in the routing table, and the address is used as the default router address, thus unicasting a datagram to the default router. The final datagram was discarded. Broadcasting to the subnet is what we should use. In Section 6.3, we send datagrams to the IP address of 140.252.13.63 to the test network (see Seal 2), and receive an answer from all hosts in the Ethernet. Each interface associated with subnet broadcast addresses is the value used to command ifconfig (see Section 3.8). If we ping that address, the expected result is:
(See the original book P.1731)
The IP is determined by the destination address (140.252.13.63), which is the broadcast address of the subnet and then transmits the datagram to the broadcast address of the link layer. Our receiving objects mentioned in 6.3 are all hosts including the local area network, including sending hosts, so it can be seen that in addition to receiving other hosts within the net, it also received from the Send Host (Sun) Reply. In this example, we also show the contents of the ARP cache before and after the PING broadcast address. This can display the interactions between broadcasts and ARPs. The ARP cache before executing the ping command is empty, and it is full. (That is, the host in the network has an entry in the ARP cache.) How we mentioned the broadcast address (0xfffffffff) of the Link layer is transmitted to the link layer ? The data frame sent by the Sun host does not require ARP. If you use TCPDUMP to observe the execution process, you can see that the recipient of the broadcast data frame first creates an ARP request to the Sun host before sending its response, because its answer is sent back in the form of unicast. In Section 4.5 we introduce a recipient of an ARP request (which is Sun) is usually sent to the ARP cache in the ARP cache in the ARP request. This is based on such assumptions: If the requester sends us a datagram, we will also want to send back to it. Our PING programs are somewhat special because the programming interface it uses ("Raw Socket" is usually allowed to send datagrams to a broadcast address in most UNIX implementations). What if we use unsupported applications such as TFTP? (TFTP will be described in detail in Chapter 15.) BSDI% TFTP -------- Start customer program TFTP> Connect 140.252.13.63 ---- Describe the server's IP address TFTP> Get Temp.foo ---- - Try to get a file from the server or get a file TFTP: Sendto: Permission DeniedTftp> Quit -------- Termination of the client
In this example, the program immediately creates an error, but does not send any information to the network. The reason for this is that the application interface API provided by the socket only allows it to send UDP datagrams to the broadcast address when the process is clearly intended to broadcast. This is mainly to prevent the user from incorrectly adopting a broadcast address (as such an example), but the application is not planning to broadcast.
Before broadcasting the UDP datagram, the application in the interface in the jack must set the SO_BROADCAST jack option. This limit is not all systems to use this limit. This note can broadcast UDP datagram in some systems. Some systems have more restrictions, and there is a process that requires superuser privileges to broadcast.
The next question is whether broadcast data is forwarded. Some system kernels and routers have an option to control allow or disable this feature. (See Appendix E) If we let the router BSDI be forwarded broadcast data, then run the PING program on the host SLIP, we can observe the subnet broadcast datagram that is forwarded by the router BSDI. The forwarding broadcast datagram means that the router receives broadcast data, determines which interface is broadcast, and then broadcasts the corresponding network forwarding datagram with the link layer broadcast.
(See the original book P.1741)
We observed it correctly, and also saw the PING program in the BSD system checkup duplicate datagram. If the duplicate serial number is displayed, it will display DUP!, It means a datagram has been in a certain It is repeated, however it is what we expect, because we are sending data to a broadcast address. We can also perform this test from the mainframe of the network pointing from the broadcast. If the PING program is run on the host AngoGOGH.cx.berkeley.edu (and our network distance 14), if the router Sun is set to be able to forward the pointed broadcast, it also works. In this case, this IP datagram (transmitting ICMP echo request) is forwarded by each router on the path, and they do not know that they are actually broadcast data. The last router Netb then revealed to the router Sun. The router Sun is aware that the IP address of this purpose is actually a broadcast address on a connected subnet interface, which is broadcast to the corresponding network with the link layer broadcast. Broadcast is a kind of ability to use caution. In many cases, IP multicast proves to be a better solution. 12.4 multicast
IP multicast provides two types of services. 1. Transfer data to multiple destination address. There are many applications that send information to multiple recipients: such as interactive conferencing systems, and distribute mail or news to multiple recipients. If you do not use multicast, these applications are currently used in TCP to complete (send a separate data replication to each destination address). However, both use multicast, some applications may continue to use TCP to ensure its reliability. 2. Customer requests for the server. For example, a diskless workstation needs to determine the boot boot server. Currently, this service is provided by broadcast (as Bootp, Chapter 16), but use multicast reduces the burden of this service host. Multicast Group Address Diagram 12.2 shows the format of the D IP address.
Figure 12.2 D IP address format
Unlike the other three types of IP addresses (A, B and C) shown in Figure 1.5, allocated 28 bits are used as multicast group numbers and no longer represent others. The multicast group address includes a category bit and multicast group number with a maximum 4 bit of 1110. They can generally be expressed as the number of dot divisions, range from 224.0.0.0 to 239.255.255.255. Host Groups that can receive a host group (Host Group) can be received to receive a host set of a particular multicast group address data. A host group can span multiple networks. Members in the host group can join or leave the host group at any time. There is no limit to the number of hosts in the host group, and the host that does not belong to a host group can send information to the group. Some multicast group addresses are determined by IANA as familiar address. They are also treated as a permanent host group, which is similar to those in TCP and UDP. Similarly, these familiar multicast addresses are listed in the RFC's latest allocation. Note that the group represented by these multicast addresses is a permanent group, and their group members are not permanent. For example, 224.0.0.1 represents "All System Groups in the subnet", 224.0.0.2 represents "All router groups in the subnet". Multicast Address 224.0.1.1 Used as Network Time Protocol NTP, 224.0.0.9 is used as RIP-2 (see Section 10.5), 224.0.1.2 is used as Dogfight Applications for SGI.
The conversion of the multicast group address to the Ethernet address has an Ethernet address block, that is, the Ethernet address of the high position 24 bit is 00: 00: 5E (hexadecimal), which means the address of the address block. Scope from 00:00: 5E: 00: 00: 00 to 00: 00: 5E: ff: ff: ff. IANA assigns half of them into multicast addresses. In order to indicate a multicast address, the first one of the Ethernet addresses must be 01, which means the Ethernet address corresponding to the IP multicast, from 01:00: 5E: 00: 00: 00 to 01:00 : 5E: 7F: ff: ff.
---- Here is the order of the Internet standard bit, which is the same as the Bit sequence that appears in memory. This is also the order in which most programmakers and system managers are adopted. The IEEE document uses this bit of transmission order. The Assigned NumBers RFC gives these representations. This address assignment will enable 23 bits in the Ethernet multicast address to correspond to the IP multicast group number, which is implemented by mapping the low 23 bit in the multicast group number to the low 23 bit implementation in the Ethernet address, this process Figure 12.3. Since the maximum 5 bit in the multicast group number is ignored during the mapping process, the multicast group corresponding to each Ethernet multicast address is not unique. 32 different multicast group numbers are mapped to an Ethernet address. For example, multicast addresses 224.128.64.32 (Sixteen Improve E0.80.40.20) and 224.0.64.32 (Sixteen Imprint E0.00.40.20) are mapped to the same Ethernet address 01: 00: 5e: 00: 40 : 20. Since the address mapping is unique, this means that the device driver or IP layer (see Figure 12.1) must perform datagram, because the NIC may receive the multicast data frame that the host does not want to receive. In addition, if the NIC does not provide enough multicast data frame filtering, the device driver must receive all multicast data frames and then filter them.
Figure 12.3 Map of class D IP address to Ethernet multicast addresses
The local area network card tends to two processing types, one is the network card to implement multicast filtering according to the hash value of the multicast address, which means that the multicast data that does not want to receive is still received. Another network card is only receiving some fixed number of multicast addresses, which means that when the host wants to receive a multicast address other than the NIC pre-supported addresses, Multicast Promiscuous mode. Therefore, these two types of network cards still require the device driver check whether the received frame is really required. Emphas only a perfect multicast filtering (based on 48 bit hardware addresses), the filtering process is still necessary because the mapping of the hardware address from the D class IP address to 48 bit is not one-on-one. Although there is an address mapping that is not perfect and requires insufficient hardware filtering, the multicast is still better than broadcasting.
Multicast multicast of a single physical network is simple. The multicast process specifies the destination IP address as a multicast address, and the device driver converts it to the corresponding Ethernet address and then send the data out. These receiving processes must be notified to their IP layers they want to receive a datagram to give a given multicast address, and the device driver must be able to receive these multi-broadcast frames. This process is "joining a multicast group". (The reason for using the "Receive Process" plural is to exist multiple recipients on the same host or multiple hosts, which is why you want to use more than one. When you multicast data report, it must transmit a copy to each process belonging to that multicast group. This and a single process receives different UDPs of unicast UDP datagrams, using multicast, there may be multiple processes that belong to the same multicast group on one host. When the multicast is extended to a single physical network, the complexity is increased when the router is forwarded. There is a protocol to make the multicast router understand any host that is determined to determine the multicast group in the network. This protocol is the Internet Group Management Agreement (IGMP), which is also the content introduced in the next chapter.
The multicast FDDI network in the FDDI and token ring network uses the same D class IP address to the 48 Bit FDDI address mapping process [Katz 1990]. Token ring networks typically use different address mapping methods because of the limitations in most token controls.
12.5 small knot
Broadcasting is transmitted to all hosts in the network (usually a local network), and multicast is a host group that sends the datagram to the network. The basic point of these two concepts is to use different types of filtration when receiving data frames sent to the previous protocol stack. Each protocol layer can be discarded due to different reasons. There are currently four types of broadcast addresses: restricted broadcasts, pointing to the broadcast, pointing to the broadcast of the subnet, and the broadcast of all subnets. The most commonly used is to point to the broadcast of the subnet. Limited broadcasts are usually only used when the system is initially started. The problem that tries to broadcast through the router, often because the router does not understand the subnet mask of the network. The results are related to a variety of factors: broadcast address type, configuration parameters, etc. The D IP address is called a multicast group address. The multicast group address to the Ethernet address can be implemented by mapping its low 23 bit to the corresponding Ethernet address. Since address mapping is unique, other protocols require additional datagrams filtering. exercise
12.1 Whether broadcasting increases network traffic? 12.2 Consider an Ethernet with 50 hosts: 20 sets of TCP / IP and other three other protocols running. How does the host send broadcast from the other protocol host host? 12.3 You log in to a UNIX system that has never been used in the past, and intends to find all the broadcast addresses of all supported interfaces. How do you do this? 12.4 If we use the PING program to send a long grouping to a broadcast address, such as
(See the original book P.1781)
It works normally, but the length of the group will increase by one byte after a byte: sun% ping 140.252.13.63 1473ping 140.252.13.63: 1473 Data Bytessendto: Message Too Long
What is the problem? 12.5 Heavy exercises 10.6, assuming that 8 RIP packets are multicast instead of broadcasting (using RIP version 2). What changes? 12-1