dhcrelay

Dynamic Host Configuration Protocol relay agent

Syntax:

dhcrelay [-4] [-dqaD] [-p port] [-c count]
         [-A length] [-pf pid-file ] [--no-pid]
         [-m append | replace | forward | discard]
         -i interface0 [... -i interfaceN]
         server0 [ ...serverN ]

dhcrelay -6 [-dqI] [-p port] [-c count]
         [-pf pid-file ] [--no-pid]
         -l lower0 [... -l lowerN]
         -u upper0 [... -u upperN]

Runs on:

QNX Neutrino

Options:

Protocol-selection options:

-4
Run dhcrelay as a DHCPv4/BOOTP relay agent. This is the default mode of operation, so the option isn't necessary, but you can specify it for clarity. It's incompatible with -6.
-6
Run dhcrelay as a DHCPv6 relay agent. Incompatible with the -4 option. If you specify this option, the names of the default files include a “6”:
IPv4 name IPv6 name
/var/run/dhcrelay.pid /var/run/dhcrelay6.pid

Specifying DHCPv4/BOOTP servers:

In DHCPv4 mode, you must specify a list of one or more server addresses to which DHCP/BOOTP queries should be relayed.

Options available for both DHCPv4 and DHCPv6:

-c count
The maximum hop count. When forwarding packets, dhcrelay discards packets that have reached a hop count of count. The default is 10, and the maximum is 255.
-d
Force dhcrelay to run as a foreground process. Useful when running dhcrelay under a debugger.
-p port
Listen and transmit on the specified port. This is mostly useful for debugging purposes. The default is port 67 for DHCPv4/BOOTP, or port 547 for DHCPv6.
-q
Quiet mode; prevents dhcrelay from printing its network configuration on startup.
-pf pid-file
The path to the alternate pid file.
--no-pid
Disable the writing of pid files. By default the program writes a pid file.

Options available in DHCPv4 mode only:

-a
Append an agent option field to each request before forwarding it to the server. Agent option fields in responses sent from servers to clients are stripped before forwarding such responses back to the client. The agent option field contains two agent options: the Circuit ID suboption and the Remote ID suboption. Currently, the Circuit ID is 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 isn't used by default.
-A length
Specify the maximum packet size to send to a DHCPv4/BOOTP server. This might be done to allow sufficient space for the addition of relay agent options while still fitting into the Ethernet MTU size.
-D
Drop packets from upstream servers if they contain Relay Agent Information options that indicate that they were generated in response to a query that came via a different relay agent. If you don't specify this option, such packets are relayed anyway.
-i ifname
Listen for DHCPv4/BOOTP queries on interface ifname. You can specify multiple interfaces by using more than one -i option. If you don't specify any interfaces, dhcrelay identifies all network interfaces, eliminating non-broadcast interfaces if possible, and attempts to listen on all of them.
-m append | replace | forward | discard
Control the handling of incoming DHCPv4 packets that already contain relay agent options. If such a packet doesn't have giaddr set in its header, the DHCP standard requires that the packet be discarded. However, if giaddr is set, the relay agent may handle the situation in 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.
  • It may discard it.

To use this option, you must also enable the -a option.

Options available in DHCPv6 mode only:

-I
Force the use of the DHCPv6 Interface-ID option. This option is automatically sent when there are two or more downstream interfaces in use, to disambiguate between them. The -i option causes dhcrelay to send the option even if there is only one downstream interface.
-l [address%]ifname[#index]
(“el”) Specifies the “lower” network interface for DHCPv6 relay mode: the interface on which queries will be received from clients or from other relay agents. You must include at least one -l option in the command line when you're running in DHCPv6 mode. The interface name ifname is a mandatory parameter. You can specify the link address by address%; if you don't, dhcrelay uses the first non-link-local address configured on the interface. The optional #index parameter specifies the interface index.
-u [address%]ifname
Specifies the “upper” network interface for DHCPv6 relay mode: the interface to which queries from clients and other relay agents should be forwarded. You must include at least one -u option in the command line when you're running in DHCPv6 mode. The interface name ifname is a mandatory parameter. You can specify the destination unicast or multicast address by address%; if you don't, the relay agent forwards to the DHCPv6 All DHCP Relay Agents and Servers multicast address.

It's possible to specify the same interface with different addresses more than once, and even, when the system supports it, to use the same interface as both upper and lower interfaces.

Description:

The Internet Systems Consortium DHCP Relay Agent, dhcrelay, provides a means for relaying DHCP and BOOTP requests from a subnet to which no DHCP server is directly connected to one or more DHCP servers on other subnets. It supports both DHCPv4/BOOTP and DHCPv6 protocols.

The DHCP Relay Agent listens for DHCPv4 or DHCPv6 queries from clients or other relay agents on one or more interfaces, passing them along to “upstream” servers or relay agents as specified on the command line. When a reply is received from upstream, it's multicast or unicast back downstream to the source of the original request.

See also:

RFC3315, RFC2132, RFC2131

Files:

The dhcrelay agent depends on the following libraries:

Caveats:

Using the same interface on both upper and lower sides may cause loops, so when you're running dhcrelay this way, you should set the maximum hop count to a low value.

The loopback interface isn't (yet) recognized as a valid interface.