DHCP Relay Agent Behavior for IPv4 and IPv6
IPv4
When using a relay agent for DHCP for IPv4, when a DHCP server responds using the DORA process, it uses the address in the GIADDR field as the destination IP for the response.
This IP address corresponds to the client-facing interface of the DHCP relay agent.
For example, with this topology:
When R1 requests an IP address through DHCP, R2 will relay this to R3 (DHCP server).
Here's the DHCP offer from R3:
Frame 51: 345 bytes on wire (2760 bits), 345 bytes captured (2760 bits) on interface eth2, id 0 Ethernet II, Src: aa:bb:cc:00:03:10 (aa:bb:cc:00:03:10), Dst: aa:bb:cc:00:02:20 (aa:bb:cc:00:02:20) Internet Protocol Version 4, Src: 192.168.23.3, Dst: 192.168.12.2 User Datagram Protocol, Src Port: 67, Dst Port: 67 Dynamic Host Configuration Protocol (Offer) Message type: Boot Reply (2) Hardware type: Ethernet (0x01) Hardware address length: 6 Hops: 0 Transaction ID: 0xaac7ebda Seconds elapsed: 0 Bootp flags: 0x8000, Broadcast flag (Broadcast) Client IP address: 0.0.0.0 Your (client) IP address: 192.168.12.1 Next server IP address: 0.0.0.0 Relay agent IP address: 192.168.12.2 Client MAC address: aa:bb:cc:00:01:10 (aa:bb:cc:00:01:10) Client hardware address padding: 00000000000000000000 Server host name not given Boot file name not given Magic cookie: DHCP Option: (53) DHCP Message Type (Offer) Option: (61) Client identifier Option: (54) DHCP Server Identifier (192.168.23.3) Option: (51) IP Address Lease Time Option: (58) Renewal Time Value Option: (59) Rebinding Time Value Option: (1) Subnet Mask (255.255.255.0) Option: (255) End
IPv6
In DHCPv6, the relay agent operates differently. It does not alter the source address of relayed packets but instead uses the IPv6 address of the server-facing interface on the relay agent.
DHCPv6 does not have a direct equivalent to the GIADDR field used in DHCPv4.
Instead, DHCPv6 relay agents encapsulate client messages in a Relay-Forward message, which includes additional information in the form of DHCP options like the Relay Message Option (Option Code 9).
The Relay-Forward message can contain an optional Interface-Id Option (Option Code 18) indicating the client's interface or link. The Link-Address field within this message fulfills a similar role to the GIADDR field, containing the relay agent’s client-link interface address.
These processes allow the DHCPv6 server to determine the appropriate configuration for the client by identifying the subnet or scope through these fields. This functionality shows how IPv4 and IPv6 handle DHCP relay differently.
Links
https://networklessons.com/ip-services/cisco-ios-dhcp-relay-agent
https://networklessons.com/ipv6/cisco-dhcpv6-server-configuration/
https://networklessons.com/ip-services/dhcp-client-on-cisco-ios