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.
vrouter 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. - vrouter 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 listen: - vrouter running dhcp-server A.B.C.D# interface IFNAME- IFNAME
- Name of an interface to which a DHCP server is connected. 
 
- The - dhcp-serverconfiguration can be disabled:- vrouter 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: - vrouter 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: - vrouter running dhcp-server A.B.C.D# drop-unmatched true
Maximum hop¶
- Specify the maximum hop count before discard a packet: - vrouter 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: - vrouter running dhcp-server A.B.C.D# max-size <64-1400>
Configuration example¶
vrouter> edit running
vrouter running config# vrf main
vrouter running vrf main# dhcp
vrouter running dhcp# relay
vrouter running relay# hop-count 5
vrouter running relay# dhcp-server 1.0.0.1
vrouter running dhcp-server 1.0.0.1# interface eth0
vrouter running dhcp-server 1.0.0.1# interface eth1
vrouter running dhcp-server 1.0.0.1# drop-unmatched true
vrouter running dhcp-server 1.0.0.1# ..
vrouter running relay# ..
vrouter running dhcp#
The same configuration can be made using this NETCONF XML configuration:
vrouter> 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>