Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Example: Configure DHCP Relay in Forward Only Mode

 

The example shows how to configure a “stateless” (“forward-only”) DHCP Relay on Enhanced Layer 2 Software (ELS) EX Series and QFX Series switches. If your switch runs software that does not support ELS, see Configuring Interface Ranges. For ELS details, see Using the Enhanced Layer 2 Software CLI.

Requirements

This example uses the following hardware and software components:

  • QFX or EX Series Switches (ELS mode).

  • Junos OS Release 18.4R3.

Before you configure forward-only DHCP relay on EX Series and QFX Series switches, lets understand about Option 82 support on DHCP.

To verify whether your device supports DHCP Option-82, see Check if Your Device Support DHCP Option-82.

The following messages from the DHCP server include a copy of the Option 82 information on sent by the DHCP Relay in the Discover and Request messages:

  • Offer

  • Acknowledgement (ACK)

  • Negative acknowledgment (NACK)

The DHCP relay discards any OFFER, ACK, and NACK messages that do not include a valid Option 82 information.

On how to avoid dropping of DHCP offer message when PXE or BOOTP servers do not support Option-82, see Managing Your DHCP PXE/BOOTP Servers That Do Not Support Option-82.

Overview

In this example, we are configuring a switching device to act as DHCP relay agent by completing the following steps:

  1. Add a set of DHCP server IP addresses configured as active server groups.

  2. Configure the option 82 support for a named group of interfaces.

After you configure the example, the DHCP relay agent includes option 82 information in the DHCP packets that it receives from the clients and forwards to the DHCP server.

Configuration

To configure a forward-only DHCP relay agent on a ELS supported EX or QFX switches, perform these tasks:

CLI Quick Configuration

To quickly configure this example, copy the following commands, paste them in a text file, remove any line breaks, change any details necessary to match your network configuration, and then copy and paste the command into the CLI at the [edit] hierarchy level.

Configure forward-only' DHCP Relay Agent

Step-by-Step Procedure

To configure forward-only DHCP relay:

  1. Specify the name of the server group, SV1 and SV2.
  2. Add the IP addresses of the DHCP servers belonging to the group.
  3. (Optional) In enterprise scenario, you can use the Preboot Execution Environment (PXE) or BOOTP for a PC (or other devices) to get its Junos OS from a server.
    • If you want to enable BOOTP support when the switch is configured to be a DHCP relay agent, enter the following statement:

    • Add a DHCP or PXE Servers to the DHCP Servers group

  4. Apply the server group as an active server group.
  5. Define DHCP-FO as interface group on your switching device acting as DHCP relay. Configure:
  6. Add a list of interfaces to the interface group.
  7. Set relay option 82 to interfaces and specify Agent circuit ID. Agent Circuit ID identifies the interface on which the client DHCP packet is received. When you configure circuit ID, the include the textual interface description in the message.

Results

From configuration mode, confirm the results of your configuration by issuing the show statement at the [edit forwarding-options] hierarchy level. If the output does not display the intended configuration, repeat the configuration instructions in this example to correct it.

[edit forwarding-options]
user@host> show

If you are done configuring the device, enter commit from configuration mode.

Verification

Verify if the messages from the DHCP server includes a copy of the Option 82 information sent by the DHCP relay.

Verifying the Offer message with Option-82

Purpose

Verify the “forward-only” DHCP Relay by enabling the dhcp traceoptions on the DHCP Relay.

Action

  • Receive the output of the tracing operation in the specified file.

    user@host# set system processes dhcp-service traceoptions file dhcp_logfile size 10m
    user@host# set system processes dhcp-service traceoptions level all
    user@host# set system processes dhcp-service traceoptions flag all
  • You can use the following commands to search for problems in the DHCP traceoptions log file (in this example, ‘dhcp_logfile’).

    • To get an overview of most common problems, use:

      user@host> show log dhcp_logfile | match "dropp|fail|unconf" | except "packet_dropped No"
    • To investigate a specific problem, use:

      user@host> show log dhcp_logfile | find " arrived on unconfigured interface"

      The find command is similar to Linux less command. It will reach the first entry in the log and allow you to scroll up/down the message.

  • (Optional) To query the traceoptions logs on a Linux sever (or from the Junos shell), you can use both the following commands:

    user@host> egrep -i "dropp|fail|unconf" dhcp_logfile | egrep -v "packet_dropped No" | more
    user@host> egrep -i -b 5 " arrived on unconfigured interface" dhcp_logfile | more

Meaning

The above sample confirms that the messages from the DHCP server includes a copy of the Option 82 information sent by the DHCP relay and the sample also displays the textual description of the interface.