skip to content

In IPv4, how do unicast, limited broadcast, directed broadcast and multicast differ in who receives a datagram and which addresses signal them?

level: juniorimportance: must knowfreq 60%

answer

  1. one, all, or members only
  2. all ones, on two scales
  3. only the last router knows
  4. first four bits 1110

basics

~20 s

Unicast reaches one interface. Limited broadcast, 255.255.255.255, reaches every host on the sender's link and is never routed. A directed broadcast (a network's all-ones host address) reaches every host on that remote network. Multicast, 224.0.0.0-239.255.255.255, reaches joined group members.

solid answer

~30 s

A **unicast** address names one interface and is routed normally. **Limited broadcast**, `255.255.255.255`, reaches every host on the sender's own link, and RFC 1812 forbids routers to forward it. A **directed broadcast** is a network's address with the host part all ones, such as `198.51.100.255` for `198.51.100.0` with mask `255.255.255.0`: it travels like unicast until the last-hop router turns it into a link broadcast, and since RFC 2644 routers block that by default. **Multicast** uses `224.0.0.0` to `239.255.255.255` and reaches only hosts that joined the group. Broadcast and multicast addresses are destinations only: RFC 1122 forbids either as a source address.

go deeper

for a junior

Recall the four types: one receiver, everyone on the link, everyone on a named network, and joined group members, with 255.255.255.255 and 224.0.0.0 to 239.255.255.255 as the landmarks.

for a middle

Explain why limited broadcast never crosses a router, why only the last-hop router recognises a directed broadcast, and how multicast membership limits delivery.

for a senior

Show the safety rules: broadcast and multicast are never valid sources, routers discard such datagrams, and no ICMP errors are sent in reply to broadcasts.

for a principal

Discuss why broadcast-based designs scale poorly and why IPv6 dropped broadcast for multicast, and what that means when choosing discovery mechanisms.

## Four ways to address an IPv4 datagram Every IPv4 destination address falls into one of a few **delivery types**. The type decides who processes the datagram and how far it may travel. RFC 1122 (hosts) and RFC 1812 (routers) define the rules. | Type | Example address | Who processes it | Crosses routers? | |---|---|---|---| | Unicast | `198.51.100.20` | the one interface holding that address | yes, routed normally | | Limited broadcast | `255.255.255.255` | every host on the sender's own link | never | | Directed broadcast | `198.51.100.255` for network `198.51.100.0` with mask `255.255.255.0` | every host on that one network | travels as if unicast to the last router; forwarding now blocked by default | | Multicast | `224.0.0.0`-`239.255.255.255` | hosts that joined that group | only if multicast routing is in place | ## Unicast A **unicast** address identifies a single interface. It is the normal case: the sender picks a destination, routers forward the datagram along the best route, and exactly one interface accepts it. Every address that is not a broadcast, a multicast group or one of the reserved special forms is unicast. ## Limited broadcast: 255.255.255.255 The all-ones address is **limited broadcast**. RFC 1122 says it is received by every host on the connected physical network and is not forwarded outside it; RFC 1812 makes that a hard rule for routers: limited broadcasts **MUST NOT be forwarded** (and must not be discarded either, because the router itself is a recipient). A host uses it when it needs everyone on the link but may not yet know its own network, as when it is still obtaining an address. On Ethernet it is carried in a frame sent to the broadcast hardware address `FF-FF-FF-FF-FF-FF` (RFC 894). ## Directed broadcast A **directed broadcast** is a network's address with the **host part set to all ones**, such as `198.51.100.255` for `198.51.100.0` with mask `255.255.255.0`. It targets every host on that particular network, which may be far away: 1. Routers along the path cannot tell it from a unicast, because they do not know the remote network's mask. 2. The **last-hop router**, attached to that network, recognises the all-ones host part and sends it as a link-layer broadcast. RFC 1812 originally required routers to forward these by default. RFC 2644 (1999) reversed that default to blocking, because directed broadcasts were being abused to amplify attacks. ## Multicast: 224.0.0.0 to 239.255.255.255 **Multicast** addresses are the old class D space: first four bits `1110`, `224.0.0.0` to `239.255.255.255`. RFC 1112 defines one as a group address: a datagram sent to it goes to every host that has **joined the group**, using IGMP to tell local routers, and not to anyone else. A host must silently discard a datagram for a group it has not joined on that interface. Some groups never leave the link: RFC 5771 reserves `224.0.0.0`-`224.0.0.255` for local network control traffic that is not forwarded off link. On Ethernet, RFC 1112 maps a group to a hardware multicast address by copying the low 23 bits of the group into `01-00-5E-00-00-00`. A group address has 28 significant bits, so 32 groups share each hardware address, and the IP layer still checks membership. ## Rules that tie the types together - **Broadcast and multicast are never sources.** RFC 1122 requires a host's source address to be one of its own addresses, but not a broadcast or multicast address (the only special exception is `0.0.0.0` while a host is still learning its address); RFC 1112 says a group address must never appear in the source field. RFC 1812 requires routers to silently discard datagrams with such invalid sources. - **No ICMP errors in reply to broadcast or multicast.** RFC 1122 forbids sending an ICMP error about a datagram addressed to a broadcast or multicast address, or received as a link-layer broadcast; otherwise one datagram to a closed port would make every host answer at once. - **IPv6 has no broadcast at all**; it uses multicast for everything broadcast did in IPv4. ## What interviewers listen for - Limited broadcast stays on the link; directed broadcast targets a named network. - Multicast reaches members only, not everyone. - Broadcast and multicast are destinations, never sources.

  • Why must an IPv4 host never answer a broadcast or multicast datagram with an ICMP error?
    RFC 1122 forbids ICMP errors about datagrams sent to a broadcast or multicast address, or received as a link-layer broadcast. Without that rule, one broadcast UDP datagram to a closed port would make every host on the link return a Destination Unreachable at the same moment, a self-inflicted broadcast storm.
  • How does an IPv4 multicast datagram reach the right hosts on an Ethernet link?
    RFC 1112 maps the group address onto a hardware multicast address by copying its low 23 bits into `01-00-5E-00-00-00`. A group has 28 significant bits, so 32 groups share each hardware address; the interface accepts frames for addresses it was told to listen to, and the IP layer then discards any datagram for a group the host has not joined.

saying these in an interview costs you the question

  • A router floods 255.255.255.255 out of all its interfaces.
  • Every host on a link processes a multicast datagram, member or not.
  • A broadcast address can be used as a source to reply to everyone.
  • A directed broadcast is only ever delivered on the sender's own link.
  • IPv6 still has a broadcast address like IPv4's 255.255.255.255.