How does a PXE client know what network its on?

In PXE Boot one of the first steps is to acquire a IP address via DHCP.

To use DHCP requires you know the broadcast address of your network.

How does this network get initially configured for a PXE client?


Solution 1:

How would it even communicate on the IP layer when it doesn’t have an address? It doesn’t, not really anyway. Instead, it communicates using layer 2.

The broadcast address of any Ethernet network is FF:FF:FF:FF:FF:FF. On the IP layer, there’s 255.255.255.255. That’s what’s present on the DHCPDISCOVER packet. This way, you can have a regular UDP listen socket instead of a raw Ethernet socket.

Solution 2:

To use DHCP requires you know the broadcast address of your network.

No. You only need the local broadcast address 255.255.255.255 (for IPv4), or the multicast group ff02::1:2 (for IPv6). The whole point of DHCP is that it doesn't require any prior configuration on the client.

Solution 3:

  1. The booting firmware discovers the installed NICs
  2. The booting firmware discovers each NIC Broadcast MAC address asking the PXE UNDI driver (UNDI GET INFORMATION returning HwType and HwAddrLen) i.e. HwType=ETHER_TYPE HwAddrLen=6 => Broadcast MAC address=FF:FF:FF:FF:FF:FF.
  3. The booting firmware initiates the DHCP DORA sequence (DHCPDISCOVERY) announcing itself as a PXE client (DHCP option 60) on the BIOS/UEFI enabled NICs using:
    1. The corresponding previously discovered MAC broadcast address at OSI level 2 (Data Link layer)
    2. The BIOS/UEFI enabled IPv4/IPv6 broadcast address (255.255.255.255/ff02::1:2) at OSI level 3 (Network Layer)
  4. The booting firmware finishes the DHCP DORA sequence if a complete DHCP-PXE offer is received defining:

    1. Client IP/Mask address
    2. TFTP server IP address
    3. NBP (Network boot Program)

    Note: If more than one complete offer is received the current standards do not specifically define how the client must select one.

  5. The booting firmware sets the NIC IP, TFTP transfers, loads in memory, and executes the NBP.

The layer 2 MAC Broadcast address allows the delivery of the DHCP Ethernet frame to all the listeners within the client's NIC Ethernet collision domain. The layer 3 IP broadcast address is the one that opens the door of the DHCP server IP stack. Both L2/L3 broadcast addresses are needed.

When the PXE client and DHCP server are located in different subnetworks the broadcast DHCP traffic is stopped at the router/s then they must enable their DHCP relay agent (IP Helper on Cisco world) taking i.e. the broadcast DHCPDISCOVERY packet, convert it to a unicast DHCPDISCOVERY and route it to the IP address of the defined target DHCP server.