This is a summary of IP addressing types. We look at unicast, broadcast, multicast and anycast addressing of IP packets, and also describe the destination MAC addresses for each case. Some of the text and all of the images are courtesy of Wikipedia, I just added my comments.
There are four forms of IP addressing, each with its own unique properties:
The most common addressing scheme of an IP address is unicast addressing – available in both IPv4 and IPv6. It normally refers to a single sender or a single receiver, and can be used for both sending and receiving. Usually, a unicast address is associated with a single device or host, but it is not a one-to-one correspondence. Some individual PCs have several distinct unicast addresses, each for its own distinct purpose. Sending the same data to multiple unicast addresses requires the sender to send all the data many times over, once for each recipient.
- Most browsing traffic from your Internet router to your computer will be unicast TCP or UDP traffic; if you do a search at google.com the search results are sent only to your computer.
- Any application that uses TCP must use unicast IP addressing, since TCP and multicast/broadcast do not mix by design.
- Link layer destination: The link layer destination address depends on the sender’s routing table:
In IPv4 it is possible to send data to all possible destinations (“all-hosts broadcast”), which permits the sender to send the data only once, and all receivers receive a copy of it. In the IPv4 protocol, the address 255.255.255.255 is used for local broadcast. In addition, a directed (limited) broadcast can be made by combining the network prefix with a host suffix composed entirely of binary 1s. For example, the destination address used for a directed broadcast to devices on the 192.0.2.0/24 network is 192.0.2.255. IPv6 does not implement broadcast addressing and replaces it with multicast to the specially-defined all-nodes multicast address.
- The Dropbox client uses a broadcasting LAN sync discovery protocol to find other dropbox computers on the local network to synchronize with. It sends IP packets with destination address 255.255.255.255.
- An client using the DHCP protocol transmits to the 255.255.255.255 broadcast address for the initial discovery of the DHCP server.
- Link layer destination: The link layer’s defined MAC broadcast address is ff:ff:ff:ff:ff:ff. A link layer switch will forward an Ethernet frame with this address to all interfaces (except the sender’s), so every computer on the LAN will receive a copy of the frame. Ethernet frames that contains IP broadcast packets are usually sent to this address.
- The ARP protocol usually runs directly on Ethernet, and all ARP requests are sent to destination ff:ff:ff:ff:ff:ff.
A multicast address is associated with a group of interested receivers. In IPv4, addresses 188.8.131.52 through 184.108.40.206 (the former Class D addresses) are designated as multicast addresses. The sender sends a single datagram from its unicast address to the multicast group address and the intermediary routers take care of making copies and sending them to all receivers that have joined the corresponding multicast group. IPv6 uses the address block with the prefix ff00::/8 for multicast applications. Note that the sender does not have to be a member of the destination group.
- The range of IPv4 addresses has several reserved blocks, which includes a block reserved for multicast addresses. Some examples are:
Address Block Present Use --------------------------------------------------- 0.0.0.0/8 "This" Network 127.0.0.0/8 Loopback 220.127.116.11/24 6to4 Relay Anycast 192.168.0.0/16 Private-Use Networks 18.104.22.168/4 Multicast 240.0.0.0/4 Reserved for Future Use 255.255.255.255/32 Limited Broadcast
- The range of IPv4 addresses between 22.214.171.124 and 126.96.36.199, inclusive, is reserved for the use of routing protocols and other low-level topology discovery or maintenance protocols, such as gateway discovery and group membership reporting. Multicast routers should not forward any multicast datagram with destination addresses in this range, regardless of its TTL.
- The Internet Assigned Number Authority (IANA) maintains a list of reserved unicast IPv4 addresses at this location. Some examples are:
188.8.131.52 Base address (reserved). 184.108.40.206 The All Hosts multicast group that contains all systems on the same network segment. 220.127.116.11 The All Routers multicast group that contains all routers on the same network segment.
- In the case of IPv4, the Internet Group Management Protocol (IGMP) is used to establish multicast group memberships. The protocol deserves a post of its own, but it basically has a join and leave command, and a system receives all data destined for a group after joining it.
- Link layer destination
- Any Ethernet, or other 802.x, address with a high-order bit set to 1 (that is, if its first octet is odd) is multicast, except for the Broadcast address (which is all ones). Specific addresses have been reserved by IANA for different multicast applications.
- Ethernet frames have a 48 bit destination address field. The IANA reserved a range of Ethernet addresses for IPv4 multicast: every Ethernet frame with its destination in the range 01:00:5e:00:00:00 to 01:00:5e:ff:ff:ff contains data for an IPv4 multicast group. The prefix 01:00:5e identifies the frame as multicast, the next bit is always 0 and so 23 bits are left to the multicast address. As IPv4 multicast groups are 28 bits long, the mapping can not be one-to-one. Only the 23 least significant bits of the IP multicast group are placed in the frame. The remaining 5 high-order bits are ignored, resulting in 32 different multicast groups being mapped to the same Ethernet address. This means that the Ethernet layer acts as an imperfect filter, and the IP layer will have to decide whether to accept the datagrams the data-link layer passed to it. The IPv4 layer acts as a definitive perfect filter.
- For IPv6 multicast, the prefix 33:33 is used on the link-layer, leaving 32 bits for the group identifier. These 32 bits are simply filled with the last four bytes of the IPv6 address.
- Remember that the broadcast MAC ff:ff:ff:ff:ff:ff will ensure every host on the network receives a frame. How are frames with multicast MAC addresses handled? This depends on the network equipment. Switches that do not understand multicast addresses will usually treat it as broadcast traffic. When this is the case the system’s network card (or operating system) has to filter the packets sent to multicast groups they are not subscribed to. On my local network this seems to be the case: broadcast and multicast MAC addresses are always replicated to the entire LAN.
Like broadcast and multicast, anycast is a one-to-many routing topology. However, the data stream is not transmitted to all receivers, just the one which the router decides is the “closest” in the network. Anycast is useful for global load balancing and is commonly used in DNS communications. Since most applications of anycast are at the higher routing levels we won’t discuss it further.