Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Navigation

Example: Configuring DHCP Relay Agent Selective Traffic Processing Based on DHCP Option Strings

This example shows how to configure DHCP relay agent to use DHCP option strings to selectively identify, filter, and process client traffic.

Requirements

This example uses the following hardware and software components:

  • MX Series 3D Universal Edge Routers
  • Junos OS Release 12.3 or later.

Before you configure DHCP relay agent selective processing support, be sure you:

Overview

In this example, you configure DHCP relay agent to use DHCP option strings in client packets to selectively identify, filter, and process client traffic. To configure selective processing, you perform the following procedures:

  1. Identify the client traffic—Specify the DHCP option that DHCP relay agent uses to identify the client traffic you want to process. The option you specify matches the option in the client traffic.
  2. Configure a default action—Specify the default processing action, which DHCP relay uses for identified client traffic that does not satisfy any configured match criteria.
  3. Create match filters and associate an action with each filter—Specify match criteria that filter the client traffic. The criteria can be an exact match or a partial match with the option string in the client traffic. Associate a processing action with each match criterion.

Configuration

To configure DHCP relay agent selective processing based on DHCP option information, 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.

set forwarding-options dhcp-relay relay-option option-number 60set forwarding-options dhcp-relay relay-option equals ascii video-gold forward-onlyset forwarding-options dhcp-relay relay-option equals ascii video-bronze local-server-group servergroup-15set forwarding-options dhcp-relay relay-option starts-with hexadecimal fffff local-server-group servergroup-eastset forwarding-options dhcp-relay relay-option default-action drop

Configuring DHCP Relay Agent To Selectively Process Client Traffic Based on DHCP Option Strings

Step-by-Step Procedure

To configure DHCP relay selective processing:

  1. Specify that you want to configure DHCP relay agent support.
    [edit forwarding-options]user@host# edit dhcp-relay
  2. Specify the DHCP option that DHCP relay agent uses to identify incoming client traffic.
    [edit forwarding-options dhcp-relay]user@host# set relay-option option-number 60
  3. Configure a default action, which DHCP relay agent uses when the incoming client traffic does not satisfy any configured match criteria.
    [edit forwarding-options dhcp-relay]user@host# set relay-option default-action drop
  4. Configure an exact match condition and associated action that DHCP relay uses to process the identified client traffic.
    [edit forwarding-options dhcp-relay]user@host# set relay-option equals ascii video-gold forward-only
  5. Configure a second exact match condition and associated action that DHCP relay uses to process client traffic.
    [edit forwarding-options dhcp-relay]user@host# set relay-option equals ascii video-bronze local-server-group servergroup-15
  6. Configure a partial match criteria and associated action that DHCP relay uses to process client traffic.
    [edit forwarding-options dhcp-relay]user@host# set relay-option starts-with hexadecimal fffff local-server-group servergroup-east

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
dhcp-relay {relay-option {option-number 60;equals {ascii video-gold {forward-only;}}equals {ascii video-bronze {local-server-group servergroup-15;}}default-action {drop;}starts-with {hexadecimal fffff {local-server-group servergroup-east;}}}}

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

Verification

To verify the status of DHCP relay agent selective traffic processing, perform this task:

Verifying the Status of DHCP Relay Agent Selective Traffic Processing

Purpose

Verify the DHCP relay agent selective traffic processing status.

Action

Display statistics for DHCP relay agent.

user@host> show dhcp relay statistics
Packets dropped:
    Total                      30
    Bad hardware address       1
    Bad opcode                 1
    Bad options                3
    Invalid server address     5
    No available addresses     1
    No interface match         2
    No routing instance match  9
    No valid local address     4
    Packet too short           2
    Read error                 1
    Send error                 1
    Option 60                  1
    Option 82                  2

Messages received:
    BOOTREQUEST                116
    DHCPDECLINE                0
    DHCPDISCOVER               11
    DHCPINFORM                 0
    DHCPRELEASE                0
    DHCPREQUEST                105

Messages sent:
    BOOTREPLY                  0
    DHCPOFFER                  2
    DHCPACK                    1
    DHCPNAK                    0
    DHCPFORCERENEW             0

Packets forwarded:
    Total                      4
    BOOTREQUEST                2
    BOOTREPLY                  2

Meaning

The Packets forwarded field in the show dhcp relay statistics command output displays the number of client packets that have been forwarded as a result of the selective traffic processing configuration. In this example, the output indicates the total number of packets that DHCP relay agent has forwarded, as well as a breakdown for the number of BOOTREQUEST and BOOTREPLY packets forwarded.

Published: 2013-02-11