DHCP relay agent
|You must be root to run this utility.|
dhcprelay [-a] [-A value] [-d] [-D] [-q] [-i en0] [... -i enX] [-p port] [-pf pid-file] [-m] dhcp-server1 [... serverX]
The dhcprelay DHCP relay agent relays DHCP and BOOTP requests from a subnet that doesn't have a DHCP server to one that does.
The agent normally runs in the foreground until it has configured an interface, and then runs as a daemon in the background.
The dhcprelay daemon listens for DHCP requests on all interfaces attached to a host (or those specified by the -i option).
When a query is received, dhcprelay forwards it to the list of DHCP servers specified on the command line. When a reply is received, it is broadcast or unicast on the network where the original request came.
When you set the -a flag, the relay agent appends an agent option field to each request before forwarding it to the server. In responses back to the client from the server, the agent option fields are stripped.
The agent option field contains two agent options: the circuit ID suboption and the agent ID suboption. Currently, the circuit ID is the printable name of the interface on which the client request is received. The agent ID is the value that the relay agent stores in the DHCP packet's giaddr field. The client supports inclusion of a remote ID suboption as well, but this is not used by default.
|The agent ID suboption is not defined in the current relay agent information option draft (draft-ietf-dhc-agent-options-03.txt), but has been proposed for inclusion in the next draft.|
Relay agent options are added to a DHCP packet without the knowledge of the DHCP client. If the client has filled the DHCP packet option buffer completely, then there's no space to add agent options. The DHCP server, however, can handle a much larger packet than most DHCP clients send. The current agent options draft requires that the relay agent use a maximum packet size of 576 bytes.
With the Internet software consortium DHCP server, we recommend that you set the maximum packet size 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. You can do this by specifying the -A flag, followed by the desired maximum packet size (e.g. 1400).
It's 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's possible for a relay agent to receive a packet that contains an agent option field. If this packet doesn't have a giaddr set, the packet is discarded.
If giaddr is set, the server may handle the situation in one of four ways. It may:
To do the above, use the -m flag with one of the arguments: append, replace, forward, or discard.
The relay agent usually scans a response from a server and removes the relay agent information option if the relay agent information option processing is enabled. However, if it finds a relay agent information option field containing an agent ID suboption that matches one of its IP addresses, that 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 are dropped.
You must specify on the command line the name or IP address of at least one DHCP server to which DHCP and BOOTP requests should be relayed.
Start dhcprelay using defaults:
Start dhcprelay in quiet mode, servicing only en0:
dhcprelay -q -i en0 10.0.0.1
When an error occurs, dhcprelay sends a description of the error to syslogd and stderr only if dhcprelay is running on the foreground.
Ted Lemon in cooperation with Vixie Enterprises.
This utility is based on copyright software of The Internet Software Consortium; for licensing information, see the Third Party License Terms List at http://licensing.qnx.com/third-party-terms/.
dhcp.client, dhcpd, syslogd.
Based on RFC2131, RFC2132