DHCP relay

Overview

The DHCP relay listens for DHCP queries and responses. When a query is received from a client, it is forwarded to the specified DHCP server(s). When a reply is received from a server, it is forwarded to the client that made the initial request.

The DHCP relay needs at least the IP address of a reachable DHCP server.

You can configure the DHCP relay parameters in the dhcp relay context.

vsr running config# vrf VRFNAME dhcp relay
VRFNAME

VRF name on which the DHCP relay must run.

See also

The DHCP relay command reference for details.

DHCP relay configuration

  • To relay the DHCP clients’ requests to DHCP servers, the DHCP relay must know the IPv4 address of a DHCP server.

    vsr running relay# dhcp-server A.B.C.D
    
    A.B.C.D

    IPv4 address of a DHCP server connected to the DHCP relay.

  • By default the DHCP relay will listen on all broadcast interfaces. But it’s also possible to specify one or more interfaces on which to listen:

    vsr running dhcp-server A.B.C.D# interface IFNAME
    
    IFNAME

    Name of an interface to which DHCP clients are connected.

    It is also possible to specify the network interface used to communicate with a particular DHCP server:

    vsr running dhcp-server A.B.C.D# server-interface SERVIFNAME
    
    SERVIFNAME

    Name of the network interface used to reach a DHCP server.

    The server-interface must be set if the server and relay are not on the same IPv4 network.

  • The dhcp-server configuration can be disabled:

    vsr running dhcp-server A.B.C.D# enabled false
    

DHCP configuration options

DHCP relay options can be specified in the root DHCP relay context or overwritten per dhcp-server.

Handle option

  • Specify the handling policy of DHCPv4 packets that already contain relay agent options:

    vsr running dhcp-server A.B.C.D# handle-option append|replace|forward|discard
    
    append

    Append its own set of relay options to the packet.

    replace

    Replace the existing agent option field.

    forward

    Forward the packet unchanged.

    discard

    Discard the packet.

Drop unmatched packets

  • Packets coming from upstream servers who contains relay agent information options that indicate they were generated in response to a query that came via a different relay agent can be dropped:

    vsr running dhcp-server A.B.C.D# drop-unmatched true
    

Maximum hop

  • Specify the maximum hop count before discard a packet:

    vsr running dhcp-server A.B.C.D# hop-count <0-255>
    

Maximum packet size

  • Specify the maximum packet size to send to a DHCPv4 server. If a DHCP packet size surpasses this value it will be forwarded without appending relay agent information:

    vsr running dhcp-server A.B.C.D# max-size <64-1400>
    

Configuration example

vsr> edit running
vsr running config# vrf main
vsr running vrf main# dhcp
vsr running dhcp# relay
vsr running relay# hop-count 5
vsr running relay# dhcp-server 1.0.0.1
vsr running dhcp-server 1.0.0.1# interface eth0
vsr running dhcp-server 1.0.0.1# interface eth1
vsr running dhcp-server 1.0.0.1# drop-unmatched true
vsr running dhcp-server 1.0.0.1# ..
vsr running relay# ..
vsr running dhcp#

The same configuration can be made using this NETCONF XML configuration:

vsr> show config xml absolute vrf main dhcp relay
<config xmlns="urn:6wind:vrouter">
  <vrf>
    <name>main</name>
    <dhcp xmlns="urn:6wind:vrouter/dhcp">
      <relay>
        <enabled>true</enabled>
        <handle-option>append</handle-option>
        <drop-unmatched>false</drop-unmatched>
        <hop-count>5</hop-count>
        <max-size>576</max-size>
        <dhcp-server>
          <address>1.0.0.1</address>
          <enabled>true</enabled>
          <interface>eth0</interface>
          <interface>eth1</interface>
          <drop-unmatched>true</drop-unmatched>
        </dhcp-server>
      </relay>
    </dhcp>
  </vrf>
</config>