Which of the following command is the correct command to assign a relay agent for DHCP?

After a DHCP relay agent is configured, it can forward DHCP Request messages from DHCP clients to the DHCP server on a different network segment.

Context

If DHCP clients and a DHCP server are located on different subnets, configure DHCP relay on the DHCP relay agent's interface. After the configuration is complete, the DHCP relay agent forwards DHCP request packets from the DHCP clients to the DHCP server. When the DHCP server receives these packets, it assigns IP addresses to the DHCP clients.

When forwarding a request packet from a DHCP client, a DHCP relay-enabled gateway uses the IP address of the outbound interface as the source IP address of the request packet. If the response packet from the DHCP server cannot be received on the DHCP relay-enabled gateway that initiates the request or a different source IP address needs to be specified for the packet to be forwarded, you can configure an interface whose IP address will be used as the source IP address of DHCP request packets.

In Layer 3 distributed VXLAN gateway scenarios, DHCP users obtain IP addresses from DHCP servers in different subnets through DHCP relay-enabled gateways. Users in a subnet use the same gateway address. If the gateway address is carried as the destination IP address in a response packet from the DHCP server, the packet may not be received on the gateway of the user. As a result, the user fails to go online. To resolve this problem, enable a DHCP relay-enabled gateway to insert the Vendor-Specific suboption (suboption 9) of Option 82 into a DHCP request packet and configure a format for the suboption 9, so that the IP address that uniquely identifies the gateway location will be encapsulated into a DHCP request packet to be sent to the DHCP server. The DHCP server that supports the Option 82 attribute reserves this suboption in the response packet. If the response packet is sent to a wrong gateway, the DHCP relay-enabled gateway forwards the packet to the correct gateway based on the IP address carried in the Option 82 suboption 9.

Procedure

  • Configure DHCP relay in the intra-VPN scenario.
    1. Run system-view

      The system view is displayed.

    2. Run dhcp enable

      DHCP is enabled globally.

      By default, DHCP is disabled.

    3. Run interface interface-type interface-number

      The interface view is displayed.

    4. Run ip address ip-address { mask | mask-length }

      The interface's IP address is configured.

      By default, no IP address is configured for interfaces.

    5. (Optional) Run ip address ip-address { mask | mask-length } sub

      A secondary IP address is configured for the interface.

      By default, no IP address is configured for interfaces.

      If the DHCP relay agent fails to use the primary IP address to apply for IP addresses for DHCP clients, run this command to configure a secondary IP address as a gateway address to apply for IP addresses for the DHCP clients.

    6. Run dhcp select relay

      DHCP relay is enabled.

      By default, DHCP relay is disabled.

    7. Run dhcp relay binding server ip ip-address

      A DHCP server address is configured on the VLANIF interface.

      By default, no DHCP server address is configured on an interface.

    8. For the DHCP server that replies packets based on the source IP address, the DHCP relay agent uses the IP address of the relay interface as the source IP address when forwarding a DHCP request packet from a DHCP client. If the source IP address needs to be specified, perform either of the following operations:
      • (Optional) Run the dhcp relay source-ip-address ip-address command to configure the source IP address of the DHCP relay agent on the relay interface.

        By default, the primary IP address of the relay interface on the DHCP relay agent is used as the source IP address.

      • (Optional) Run the dhcp relay source-interface interface-type interface-number command to configure the interface where the source IP address of the DHCP request packet resides.

        By default, the interface where the source IP address of the DHCP request packet resides is not configured.

      dhcp relay source-ip-address and dhcp relay source-interface commands are mutually exclusive.

    9. Run quit

      Exit from the interface view.

    10. (Optional) Run dhcp rate-limit { disable | rateLimitValue }

      Global rate limiting is disabled for DHCP messages or a rate limit is configured for DHCP messages.

      By default, global rate limiting is enabled for DHCP messages, and the default rate limit for DHCP messages is 600 pps.

    11. (Optional) Run interface vbdif bd-id

      A VBDIF interface is created, and the VBDIF interface view is displayed.

      You must run the preceding commands in VXLAN distributed gateway scenarios.

    12. (Optional) Run the following commands:

      To enable a DHCP relay-enabled gateway to insert the Vendor-Specific suboption (suboption 9) of Option 82 into a DHCP packet, run the dhcp option82 vendor-specific insert enable command.

      By default, the Vendor-Specific suboption (suboption 9) of Option 82 is not inserted into a DHCP packet.

      To configure a format for the Option 82 suboption 9, run the dhcp option82 vendor-specific format vendor-sub-option sub-option-num source-ip-address ip-address command.

      By default, no format is configured for the Option 82 suboption 9.

      When this command is run to deploy gateways functioning as a DHCP relay, set the sub-option-num parameter to the same value for different gateways and set the ip-address parameter to the VTEP address of a specified gateway.

      You must run the preceding commands in VXLAN distributed gateway scenarios.

    13. Run commit

      The configuration is committed.

  • Configure DHCP relay in the inter-VPN scenario.
    1. Run system-view

      The system view is displayed.

    2. Run dhcp enable

      DHCP is enabled globally.

      By default, DHCP is disabled.

    3. Run interface interface-type interface-number

      The interface view is displayed.

    4. Run ip address ip-address { mask | mask-length }

      The interface's IP address is configured.

      By default, no IP address is configured for interfaces.

    5. (Optional) Run ip address ip-address { mask | mask-length } sub

      A secondary IP address is configured for the interface.

      By default, no IP address is configured for interfaces.

      If the DHCP relay agent fails to use the primary IP address to apply for IP addresses for DHCP clients, run this command to configure a secondary IP address as a gateway address to apply for IP addresses for the DHCP clients.

    6. Run dhcp select relay

      DHCP relay is enabled.

      By default, DHCP relay is disabled.

    7. Run dhcp relay binding server ip ip-address { vpn-instance vpn-instance-name | public-net }

      An IP address is configured for the DHCP server.

      By default, no DHCP server address is configured on an interface.

    8. For the DHCP server that replies packets based on the source IP address, the DHCP relay agent uses the IP address of the relay interface as the source IP address when forwarding a DHCP request packet from a DHCP client. If the source IP address needs to be specified, perform either of the following operations:
      • (Optional) Run the dhcp relay source-ip-address ip-address command to configure the source IP address of the DHCP relay agent on the relay interface.

        By default, the primary IP address of the relay interface on the DHCP relay agent is used as the source IP address.

      • (Optional) Run the dhcp relay source-interface interface-type interface-number command to configure the interface where the source IP address of the DHCP request packet resides.

        By default, the interface where the source IP address of the DHCP request packet resides is not configured.

      dhcp relay source-ip-address and dhcp relay source-interface commands are mutually exclusive.

    9. Run dhcp option82 { vss-control | link-selection | server-id-override } insert enable

      The function of inserting the Option 82 field into packets is enabled on the DHCP relay interface.

      By default, the function to insert the Option 82 field is not enabled on a DHCP relay-enabled.

      You must run this command in inter-VPN address assignment scenarios where a DHCP client and server belong to different VPNs to enable the DHCP relay agent to insert suboptions (VSS-Control, Link-Selection, or Server-ID-Override) of the Option 82 into a DHCP request message. This ensures that the client can obtain an IP address.

    10. (Optional) Run dhcp option82 link-selection subnet-ip-address ip-address,

      An IP address corresponding to the Sub5 field in Option 82 on the DHCP relay interface is configured.

    11. Run quit

      Exit from the interface view.

    12. (Optional) Run dhcp rate-limit { disable | rateLimitValue }

      Global rate limiting is disabled for DHCP messages or a rate limit is configured for DHCP messages.

      By default, global rate limiting is enabled for DHCP messages, and the default rate limit for DHCP messages is 600 pps..

    13. (Optional) Run interface vbdif bd-id

      A VBDIF interface is created, and the VBDIF interface view is displayed.

      You must run the preceding commands in VXLAN distributed gateway scenarios.

    14. (Optional) Run the following commands:

      To enable a DHCP relay-enabled gateway to insert the Vendor-Specific suboption (suboption 9) of Option 82 into a DHCP packet, run the dhcp option82 vendor-specific insert enable command.

      By default, the Vendor-Specific suboption (suboption 9) of Option 82 is not inserted into a DHCP packet.

      To configure a format for the Option 82 suboption 9, run the dhcp option82 vendor-specific format vendor-sub-option sub-option-num source-ip-address ip-address command.

      By default, no format is configured for the Option 82 suboption 9.

      When this command is run to deploy gateways functioning as a DHCP relay, set the sub-option-num parameter to the same value for different gateways and set the ip-address parameter to the VTEP address of a specified gateway.

      You must run the preceding commands in VXLAN distributed gateway scenarios.

    15. (Optional) Run dhcp relay giaddr outgoing-interface-address

      The relay agent address is configured as the IP address of the outbound interface.

      By default, a DHCP relay interface uses its primary IP address as the relay agent address.

      • In inter-VPN scenarios, if the DHCP server supports the Link-Selection suboption of Option 82, you can run this command to allow return routes of response packets to be found based on the GiAddr address.
      • In inter-VPN scenarios, if the DHCP server does not support the Link-Selection suboption, the problem of unreachable return routes can be solved using a loopback interface. Specifically, you can configure a loopback interface on the DHCP relay agent, configure the loopback interface's IP address as the GiAddr address, and bind it to the VPN where the DHCP server resides.
    16. Run commit

      The configuration is committed.

Follow-up Procedure

  • (Optional) Run dhcp relay gateway ip-address

    The relay agent address is configured.

    By default, no gateway address is configured on a DHCP relay interface.

  • (Optional) Run dhcp relay gateway-switch enable

    The function of switching the relay agent address is enabled.

    By default, DHCP relay gateway switching is disabled.

    If the DHCP relay agent fails to use the primary IP address to apply for IP addresses for DHCP clients, this function allows the DHCP relay agent to use the secondary IP address as a gateway address to apply for IP addresses for the DHCP clients.

What is DHCP relay agent command?

A DHCP relay agent uses "ip helper-address" command to indicate the DHCP server's IP address. It will insert the IP address of the interface which has that command configured into the gateway IP address field of DHCP packet to let DHCP server know which IP address range should be used to allocate.

Which command relays DHCP requests to a DHCP server?

To rectify this, we can configure R1 to act as a DHCP relay agent and forward the request to the configured DHCP server. This is done by issuing the ip helper-address DHCP_SERVER_IP_ADDRESS command on its Gi0/0 interface. This command instructs the router to do the following: watch for DHCP messages on the interface.

What is the command to enable the DHCP relay on a Cisco router?

DETAILED STEPS.

What is a DHCP relay agent Cisco?

DHCP is often used for hosts to automatically assign IP addresses and uses 4 different packets to do so. Since a host doesn't have an IP address to start with, we use broadcast messages on the network that hopefully end up at a DHCP server.