What is limited broadcast in IPv4 and how limited broadcast works
Broadcast is "one to all" type of network communication. The limited broadcast can be used to send broadcast messages to all devices in Local Area Networks (LAN). Since one of the main function of a router is to segment broadcast domains, Routers do not forward limited broadcast packets to another connected network segment. Therefore limited broadcast messages never cross a router to reach another broadcast domain. The scope of limited broadcast is within the Local Area Network (LAN).
Limited broadcasts are required for many protocols included in the IPv4 based TCP/IP protocol suite to function. Therefore, the limited broadcast messages should reach all the connected interfaces of all the devices in the broadcast domain. The router of the network also should receive the broadcast copy and should process the information in the broadcast, because the limited broadcast message may contain information relevant for the router also. But limited broadcast messages should not cross the router to reach another broadcast domain.
Two important addresses you need to remember related with IPv4 broadcast is listed below
- Limited broadcast IPv4 Address - 255.255.255.255
- Layer 2 Broadcast MAC address - ff:ff:ff:ff:ff:ff
Before continuing further, I strongly suggest you to visit and learn following lessons.
- Unicast, Multicast and Broadcast
- Broadcast domain
- Benefits of segmenting a network using a Router
- Datalink layer of TCP/IP model
- Ethernet Frame Format
- MAC addresses
- Broadcast MAC Address - ff:ff:ff:ff:ff:ff
- Network layer of TCP/IP model
- IPv4 Protocol, IPv4 header and fields of IPv4 header
- IPv4 addresses
- IPv4 Limited broadcast address
- IPv4 Directed broadcast address
- What is directed broadcast in IPv4 and how directed broadcast works
Limited broadcast IPv4 address - 255.255.255.255
Limited broadcasts are sent to a special destination IPv4 address of 255.255.255.255. A limited broadcast address (255.255.255.255) can never appear as a source IPv4 address; it can appear only as a destination IPv4 address.
Layer 2 Broadcast MAC address - ff:ff:ff:ff:ff:ff
Special MAC address ff:ff:ff:ff:ff:ff is used as the layer 2 broadcast address for Ethernet frames. Switches broadcast (forward a copy to all active interfaces of the switch) Ethernet frames with destination MAC address ff:ff:ff:ff:ff:ff to all devices in the Local Area Network (LAN). IPv4 broadcast packages with destination limited broadcast IPv4 Address 255.255.255.255 are encapsulated with Ethernet frame having layer 2 broadcast MAC address ff:ff:ff:ff:ff:ff as the destination MAC address.
Following images explain how limited broadcast works. Consider the situation where a computer with IPv4 address 192.168.1.100 wants to send a limited broadcast packet in its Local Area Network (LAN).
The computer prepares encapsulated Ethernet frame with limited broadcast IPv4 address "255.255.255.255" as the destination layer 3 address. When the destination IPv4 address (in IPv4 datagram header, layer 3) is limited broadcast IPv4 address "255.255.255.255", destination MAC address (in Ethernet frame, layer 2) will be the broadcast MAC address "ff:ff:ff:ff:ff:ff". Computer then places the Ethernet frame for broadcast on network media at Physical layer. Please refer below image.
Layer 2 switches operate at datalink layer of TCP/IP model and switches deliver Ethernet frames in Local Area Network (LAN) based on MAC addresses (layer 2 addresses). The Ethernet frame with destination MAC address as broadcast MAC address "ff:ff:ff:ff:ff:ff" is then reached at the network switch. When the switch finds the destination MAC address as broadcast MAC address ("ff:ff:ff:ff:ff:ff"), switch will flood (broadcast) the packet to all its connected ports.
Thus all the devices in the Local Area Network (LAN) receive a copy of the broadcasted packet, including the interface of the router connected to the LAN.
When the limited broadcast Ethernet frame is received and processed at the datalink layer of the computers inside the LAN, the datalink layer identifies the destination MAC address as broadcast MAC address ff:ff:ff:ff:ff:ff. Since the destination MAC address is broadcast MAC ff:ff:ff:ff:ff:ff, all the computers in the Local Area Network (LAN) (including the Router) need to accept and process the broadcasted Ethernet frame. Why? because the broadcasted Ethernet frame may contain information relevant for every device in that Local Area Network (LAN). The datalink layer will strip-off the Ethernet frame header and trailer and pass the IPv4 datagram to its upper layer (layer 3 - Network layer) for further processing at Network layer.
When the router receives a copy of the broadcasted packet, the router can detect that the Ethernet frame is a limited broadcast packet from the layer 2 destination broadcast MAC address ff:ff:ff:ff:ff:ff. Routers also need to accept and process the broadcasted Ethernet frame, because the broadcasted Ethernet frame may contain information relevant for the router also. But, routers do not forward the limited broadcast packets to its other network segments. Thus the limited broadcast is limited within the Local Area Network (LAN).
If you are curious how a captured limited broadcast packet looks like, please refer below image. Since this is a DHCPDiscover message, there is no IPv4 address still assigned and configured for the network interface. That is the reason why the source IPv4 address appears as 0.0.0.0.