DHCP - How a host is identified by a remote DHCP server
When a DHCP client attempts to obtain an IP address from a DHCP server that is not on the same subnet, it uses a DHCP relay agent. This relay agent will act as an intermediary between the requesting host and the DHCP server in the DORA process.
The DHCP relay agent uses the GIADDR (Gateway IP Address) field in the DHCP packet to determine where to send the DHCP offer. When a DHCP relay agent receives a DHCP discover message from a client, it inserts its own IP address (the IP address of the interface that received the DHCP discover message) into the GIADDR field and forwards the message to the DHCP server.
Upon receiving this message, the DHCP server uses the GIADDR to identify the subnet from which the request originated and the appropriate IP address to offer. The server then sends a DHCP offer back to the relay agent, using the GIADDR field to determine the destination.
The relay agent broadcasts the offer on the local network, and the client that originally sent the discover message receives it. The client's MAC address is included in the Client Identifier field of the DHCP packet, ensuring that the offer is correctly identified by the client and ignored by other hosts.
Thus, the GIADDR field and the client ID are needed for the DHCP server to know the subnet of the original request and to ensure the correct host receives the DHCP offer.
Links
https://forum.networklessons.com/t/cisco-ios-dhcp-relay-agent/1121/73?u=lagapidis
https://networklessons.com/cisco/ccie-enterprise-infrastructure/cisco-ios-dhcp-relay-agent/