If the
-a flag is set the relay agent will append an agent option field to each request before forwarding it to the server. Agent option fields in responses sent from servers to clients will be stripped before forwarding such responses back to the client.
The agent option field will contain two agent options: the Circuit ID suboption and the Remote ID suboption. Currently, the Circuit ID will be the printable name of the interface on which the client request was received. The client supports inclusion of a Remote ID suboption as well, but this is not used by default.
When forwarding packets, dhcrelay discards packets which have reached a hop count of 10. If a lower or higher threshold (up to 255) is desired, depending on your environment, you can specify the max hop count threshold as a number following the -c option.
Relay Agent options are added to a DHCP packet without the knowledge of the DHCP client. The client may have filled the DHCP packet option buffer completely, in which case there theoretically isn't any space to add Agent options. However, the DHCP server may be able to handle a much larger packet than most DHCP clients would send. The current Agent Options draft requires that the relay agent use a maximum packet size of 576 bytes.
It is recommended that with the Internet Systems Consortium DHCP server, the maximum packet size be set to about 1400, allowing plenty of extra space in which the relay agent can put the agent option field, while still fitting into the Ethernet MTU size. This can be done by specifying the -A flag, followed by the desired maximum packet size (e.g., 1400).
Note that this is reasonably safe to do even if the MTU between the server and the client is less than 1500, as long as the hosts on which the server and client are running support IP fragmentation (and they should). With some knowledge as to how large the agent options might get in a particular configuration, this parameter can be tuned as finely as necessary.
It is possible for a relay agent to receive a packet which already contains an agent option field. If this packet does not have a giaddr set, the standard requires that the packet be discarded.
If giaddr is set, the server may handle the situation in one of four ways: it may append its own set of relay options to the packet, leaving the supplied option field intact. It may replace the existing agent option field. It may forward the packet unchanged. Or, it may discard it.
Which of these behaviours is followed by the Internet Systems Consortium DHCP Relay Agent may be configured with the -m flag, followed by one of the four keywords specified in italics above.
When the relay agent receives a reply from a server that it's supposed to forward to a client, and Relay Agent Information option processing is enabled, the relay agent scans the packet for Relay Agent Information options and removes them. As it's scanning, if it finds a Relay Agent Information option field containing an Agent ID suboption that matches one of its IP addresses, that option is recognized as its own. If no such option is found, the relay agent can either drop the packet, or relay it anyway. If the -D option is specified, all packets that don't contain a match will be dropped.