Questo contenuto non è disponibile nella lingua selezionata.

14.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 14.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 14.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.

14.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 192.168.1.1
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 192.168.1.1 -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

14.3.2. Configure dhcrelay as a DHCPv6 relay agent

To run dhcrelay in DHCPv6 mode add the -6 argument and specify the lower interface (on which queries will be received from clients or from other relay agents) and the upper interface (to which queries from clients and other relay agents should be forwarded). Copy dhcrelay.service to dhcrelay6.service and edit it as the root user:
~]# cp /lib/systemd/system/dhcrelay.service /etc/systemd/system/dhcrelay6.service
~]# vi /etc/systemd/system/dhcrelay6.service
Edit the ExecStart option under section [Service] add -6 argument and add the lower interface and upper interface interface, for example:
ExecStart=/usr/sbin/dhcrelay -d --no-pid -6 -l em1 -u em2
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 dhcrelay6
Red Hat logoGithubRedditYoutubeTwitter

Formazione

Prova, acquista e vendi

Community

Informazioni sulla documentazione di Red Hat

Aiutiamo gli utenti Red Hat a innovarsi e raggiungere i propri obiettivi con i nostri prodotti e servizi grazie a contenuti di cui possono fidarsi.

Rendiamo l’open source più inclusivo

Red Hat si impegna a sostituire il linguaggio problematico nel codice, nella documentazione e nelle proprietà web. Per maggiori dettagli, visita ilBlog di Red Hat.

Informazioni su Red Hat

Forniamo soluzioni consolidate che rendono più semplice per le aziende lavorare su piattaforme e ambienti diversi, dal datacenter centrale all'edge della rete.

© 2024 Red Hat, Inc.