Product SiteDocumentation Site

9.3. DHCP Relay Agent

The DHCP Relay Agent (dhcrelay) enables the relay of DHCP and BOOTP requests from a subnet with no DHCP server on it to one or more DHCP servers on other subnets.
When a DHCP client requests information, the DHCP Relay Agent forwards the request to the list of DHCP servers specified when the DHCP Relay Agent is started. When a DHCP server returns a reply, the reply is broadcast or unicast on the network that sent the original request.
The DHCP Relay Agent for IPv4, dhcrelay, listens for DHCPv4 and BOOTP requests on all interfaces unless the interfaces are specified in /etc/sysconfig/dhcrelay with the INTERFACES directive. See Section 9.3.1, “Configure dhcrelay as a DHCPv4 and BOOTP relay agent”. The DHCP Relay Agent for IPv6, dhcrelay6, does not have this default behavior and interfaces to listen for DHCPv6 requests must be specified. See Section 9.3.2, “Configure dhcrelay as a DHCPv6 relay agent”.
dhcrelay can either be run as a DHCPv4 and BOOTP relay agent (by default) or as a DHCPv6 relay agent (with -6 argument). To see the usage message, issue the command dhcrelay -h.

9.3.1. Configure dhcrelay as a DHCPv4 and BOOTP relay agent

To run dhcrelay in DHCPv4 and BOOTP mode specify the servers to which the requests should be forwarded to. Copy and then edit the dhcrelay.service file as the root user:
~]# cp /lib/systemd/system/dhcrelay.service /etc/systemd/system/
~]# vi /etc/systemd/system/dhcrelay.service
Edit the ExecStart option under section [Service] and add one or more server IPv4 addresses to the end of the line, for example:
ExecStart=/usr/sbin/dhcrelay -d --no-pid
If you also want to specify interfaces where the DHCP Relay Agent listens for DHCP requests, add them to the ExecStart option with -i argument (otherwise it will listen on all interfaces), for example:
ExecStart=/usr/sbin/dhcrelay -d --no-pid -i em1
For other options see the dhcrelay(8) man page.
To activate the changes made, as the root user, restart the service:
~]# systemctl --system daemon-reload
~]# systemctl restart dhcrelay