DHCP Relay

Since Dynamic Host Configuration Protocol must work correctly even before DHCP clients have been configured, the DHCP server and DHCP client need to be connected to the same network.

In larger networks, this is not always practical because each network link contains one or more DHCP relay (DHCP-R) agents. These agents receive messages from DHCP clients and forward them to DHCP servers thus extending the reach of the DHCP beyond the local network.

DHCP-R is supported for IPv4 and IPv6.

DHCP-R is supported for both primary IP subnet and secondary IP subnets.

In some cases it is desired that DHCP-R functionality is automatically enabled to all IP interfaces in the system. For this purpose a vrf-auto-helper may be configured on a DHCP-R instance which would provide DHCP-R services automatically for each newly created interface on a VRF.

Only one instance in each VRF can have vrf-auto-helper capability. Whenever a new instance is created in a VRF, it automatically becomes a vrf-auto-helper.

It is possible to manually disable auto-helper capability for the instance. See the command “vrf-auto-helper” for more information.

It is possible to define an interface to be downstream, upstream, or bidirectional (both downstream and upstream):

  • Bidirectional interface – capable of performing downstream and upstream functionalities

  • Downstream interface (default configuration) – the interface on which queries are received from clients or from other relay agents

  • Upstream interface – the interface to which queries from clients and other relay agents are forwarded

ip dhcp relay

ip dhcp relay [instance <instance-id>]

no ip dhcp relay [instance <instance-id>]

Enters DHCP relay instance configuration mode, and creates DHCP instance in active VRF context.

The no form of the command deletes the instance and DHCP relay process corresponding to it.

Syntax Description

instance-id

Range: 1-8

Default

N/A

Configuration Mode

config

History

3.6.3004

Example

switch (config)# ip dhcp relay instance 1

switch (config ip dhcp relay instance 1)#

Related Commands

Notes

If an instance is not specified then instance 1 is used (if nonexistent, then it is created).


address

address <ip-address>

no address <ip-address>

Configures the DHCP server IP address on a particular instance.

The no form of the command deletes the DHCP server IP address.

Syntax Description

ip-address

Valid IP unicast address of DHCP server.

Default

N/A

Configuration Mode

config ip dhcp relay

History

3.3.4150

3.6.1002

Added VRF parameter

3.6.3004

Enhanced command for DHCP-R multi-instance

Example

switch (config ip dhcp relay instance 1)# address 1.2.3.4

Related Commands

ip dhcp relay

Notes

  • Up to 16 IP addresses may be configured

  • To enable DHCP relay instance, at least one IP address should be configured, or always-on parameter should be turned on using the command “ip dhcp relay always-on”

  • The following option for running this command is also possible: ip dhcp relay instance 1 address <ip-address>. However, if an instance is not specified then instance 1 is used (if nonexistent, then it is created).


always-on

always-on

no always-on

Enables broadcast mode on a particular instance.

The no form of the command disables the broadcast mode from instance.

Syntax Description

vrf

VRF name

Default

Disabled

Configuration Mode

config ip dhcp relay

History

3.3.4150

3.6.1002

Added VRF parameter

3.6.3004

Enhanced command for DHCP-R multi-instance

Example

switch (config ip dhcp relay instance 1)# always-on

Related Commands

ip dhcp relay

Notes

  • Broadcasts DHCP requests to all interfaces with the DHCP relay agent for given VRF

  • In order to enable DHCP relay, at least one IP address should be configured, or always-on parameter should be turned on using this command

  • When DHCP servers are configured, requests are forwarded only to configured servers

  • The following option for running this command is also possible: ip dhcp relay instance 1 always-on. However, if an instance is not specified then instance 1 is used (if nonexistent, then it is created).


information option

information option

no information option

Enables DHCP relay agents to insert option 82 on the packets of a particular instance.

The no form of the command removes option 82 from the packets.

Syntax Description

N/A

Default

Disabled

Configuration Mode

config ip dhcp relay

History

3.3.4150

3.6.3004

Enhanced command for DHCP-R multi-instance

Example

switch (config ip dhcp relay instance 1)# information option

Related Commands

ip dhcp relay

Notes

The following option for running this command is also possible: ip dhcp relay instance 1 information option. However, if an instance is not specified then instance 1 is used (if nonexistent, then it is created).


vrf

vrf <vrf-name>

no vrf <vrf-name>

Configures mention instance in the given VRF.

The no form of the command moves the instance back to default VRF.

Syntax Description

N/A

Default

N/A

Configuration Mode

config ip dhcp relay

History

3.6.3004

Example

switch (config ip dhcp relay instance 1)# vrf 2

Related Commands

Notes

  • If no VRF is specified, then the DHCP-R instance is created in the active VRF

  • If the VRF is changed, then the configuration of the DHCP-R instance is automatically deleted

  • The following option for running this command is also possible: ip dhcp relay instance 1 vrf <vrf-name>. However, if an instance is not specified then instance 1 is used (if nonexistent, then it is created).


port

port <udp-port>

no port <udp-port>

Changes the UDP port for the given instance.

The no form of the command sets the UDP port to default value.

Syntax Description

udp-port

UDP port

Range: 1-65534

Default

67

Configuration Mode

config ip dhcp relay

History

3.6.3004

Example

switch (config ip dhcp relay instance 1)# port 65534

Related Commands

Notes

  • The system allocated 2 ports: One is the server port (udp-port), and another is client port (udp-port+1)

  • The following option for running this command is also possible: ip dhcp relay instance 1 port <udp-port>. However, if an instance is not specified then instance 1 is used (if nonexistent, then it is created).


use-secondary-ip

use-secondary-ip

no use-secondary-ip

Enables the switch to relay a single request from the client multiple times simultaneously, with each of the IP addresses configured on the corresponding downstream interfaces as the respective gateway address (linkaddr field of IPv4 DHCP request packet).

The no form of the command disables this function.

Syntax Description

N/A

Default

Disabled

Configuration Mode

config ip dhcp relay

History

3.6.8008

Example

switch (config ip dhcp relay instance 1)# use-secondary-ip

Related Commands

Notes


vrf-auto-helper

vrf-auto-helper

no vrf-auto-helper

Makes all L3 interfaces (existing/newly created) to be part of the given instance.

The no form of the command resets this parameter to its default

Syntax Description

N/A

Default

N/A

Configuration Mode

config ip dhcp relay

History

3.6.3004

Example

switch (config ip dhcp relay instance 1)# vrf-auto-helper

Related Commands

Notes

  • Every new DHCP-R instance created in a VRF automatically becomes the VRF auto-helper if no other DHCP-R instance has been configured VRF auto-helper previously in that VRF

  • The following option for running this command is also possible: ip dhcp relay instance 1 vrf-auto-helper. However, if an instance is not specified then instance 1 is used (if nonexistent, then it is created).


ip dhcp relay instance (config interface)

ip dhcp relay instance <instance-id> [downstream] [upstream]

no ip dhcp relay instance <instance-id> [downstream] [upstream]

Enables the given interface to listen for DHCP packets coming from specified instance (i.e. binds interface to that instance).

The no form of the command removes the interface mapping from that instance.

Syntax Description

instance-id

DHCP instance ID

Range: 1-8

downstream

The interface on which queries are received from clients or from other relay agents

upstream

The interface to which queries from clients and other relay agents should be forwarded

Default

Downstream

Configuration Mode

config interface ethernet set as router port interface

config interface port-channel

config interface vlan

History

3.6.3004

3.6.6000

Added downstream and upstream parameters

Example

switch (config interface ethernet 1/13)# ip dhcp relay instance 7 downstream

Related Commands

Notes

  • In order to enable DHCP relay, other than configuring the downstream interface, at least one IP address must be configured, or the always-on parameter must be activated using the command “ip dhcp relay always-on”

  • When DHCP servers are configured, requests are forwarded only to configured servers

  • At most, 64 interfaces can be configured on each instance

  • Only an existent DHCP-R may be specified

  • Each interface is either upstream, downstream, or bidirectional

  • If only downstream interfaces are defined, all interfaces in VRF are assumed to be upstream interfaces


clear ip dhcp relay counters

clear ip dhcp relay counters [vrf {<vrf-name> | all} | instance <instance-id>]

Clears all DHCP relay counters (all interfaces) in a given VRF or instance.

Syntax Description

vrf-name

VRF name or “all” for all VRFs

instance-id

DHCP instance ID

Range: 1-8

Default

N/A

Configuration Mode

config

History

3.3.4150

3.6.1002

Added VRF parameter

3.6.3004

Enhanced command for DHCP-R multi-instance

3.6.5000

Added “all” parameter

Example

switch (config)# clear ip dhcp relay counters

Related Commands

Notes

  • If no DHCP-R instance is specified, then the counters of all DHCP-R instances are cleared

  • If a VRF is specified, then the counters of all instances on that VRF are cleared

  • The command “clear counters all” may also be used to clear all DHCP-R counters


ip dhcp relay information option circuit-id

ip dhcp relay information option circuit-id <label>

no ip dhcp relay information option circuit-id

Specifies the content of the circuit ID sub-option attached to the client DHCP packet when it is forwarded a DHCP server.

The no form of the command removes the label assigned.

Syntax Description

label

Specifies the label attached to packets. The string may be up to 15 characters.

Default

The label is taken from the IP interface name (e.g. “vlan1”)

Configuration Mode

config interface vlan

config interface ethernet set as router port interface

config interface port-channel set as router port interface

History

3.3.4150

3.6.1002

Added VRF parameter

Example

switch (config interface vlan 10)# ip dhcp relay information options circuit-id my-label

Related Commands

Notes

The circuit ID sub-option is an IP interface attribute which is shared across all DHCP-R instances.


ipv6 dhcp relay instance

ipv6 dhcp relay instance <instance-id> [vrf-auto-helper] [downstream] [upstream]

no ipv6 dhcp relay instance <instance-id> [vrf-auto-helper]

Enables DHCP relay instance configuration mode, and creates DHCP instance in active VRF context.

The no form of the command deletes the DHCP relay instance.

Syntax Description

instance-id

DHCP instance ID

Range: 1-8

vrf-auto-helper

Instance becomes VTF auto helper

downstream

The interface on which queries are received from clients or from other relay agents

upstream

The interface to which queries from clients and other relay agents should be forwarded

Default

Disabled

Configuration Mode

config interface ethernet

config interface port-channel

config interface vlan

History

3.6.4070

3.6.6000

Added downstream and upstream parameters

Example

switch (config interface ethernet 1/1) # ipv6 dhcp relay instance 1 downstream

Related Commands

Notes

  • An instance without an assigned addresses is sent to All_DHCP_servers address

  • Each interface is either upstream, downstream, or bidirectional

  • At most, 64 interfaces can be configured on each instance

  • If only downstream interfaces are defined, all interfaces in VRF are assumed to be upstream interfaces

  • An instance must meet two conditions to become active:

    • A server address or an upstream interface

    • A downstream interface


ipv6 dhcp relay instance (global server)

ipv6 dhcp relay instance <instance-id> address <ipv6-address or list of addresses>

no ipv6 dhcp relay instance <instance-id> address <ipv6-address or list of addresses>

Configure the server address on a particular instance.

The no form of the command will delete the server address from instance.

Syntax Description

instance-id

DHCP instance ID

Range: 1-8

ipv6-address

Valid global unicast IPv6 server address

Up to 16 addresses can be assigned per instance

Default

N/A

Configuration Mode

config

History

3.6.4070

Example

switch (config)# ipv6 dhcp relay instance 1 address 2001::1

Related Commands

Notes

An instance without an assigned addresses will send to All_DHCP_servers address


ipv6 dhcp relay instance address (destination address on interface)

ipv6 dhcp relay instance <instance-id> address <link-local-address>

no ipv6 dhcp relay instance <instance-id> address <link-local-address>

Configures the destination address on a particular instance on a specific upstream interface. Only link local address is supported.

The no form of the command deletes the destination address on a specific upstream interface from a particular instance.

Syntax Description

instance-id

DHCP instance ID

Range: 1-8

ipv6-address

Destination unicast or multicast address

Only link local address in supported

Default

N/A

Configuration Mode

config interface ethernet

config interface port-channel

config interface vlan

History

3.6.4070

Example

switch (config interface ethernet 1/13)# ipv6 dhcp relay instance 1 address fe80::1

Related Commands

Notes

Up to 16 addresses can be assigned per instance


ipv6 dhcp relay instance interface-id option

ipv6 dhcp relay instance <instance-id> interface-id option

no ipv6 dhcp relay instance <instance-id> interface-id option

Enables the instance to insert interface ID option.

The no form of the command disables this option.

Syntax Description

instance-id

DHCP instance ID

Range: 1-8

Default

Default interface-id is an interface name (e.g. vlan1, eth1/1)

Configuration Mode

config

History

3.6.4070

Example

switch (config)# ipv6 dhcp relay instance 1 interface-id option

Related Commands

Notes


ipv6 dhcp relay instance vrf

ipv6 dhcp relay instance <instance-id> vrf <vrf-name>

no ipv6 dhcp relay instance <instance-id> vrf <vrf-name>

Configures instance in the given VRF.

The no form of the command will reset the instance back to default VRF.

Syntax Description

instance-id

DHCP instance ID

Range: 1-8

vrf-name

Name of VRF

Default

Default VRF

Configuration Mode

config

History

3.6.4070

Example

switch (config)# ipv6 dhcp relay 1 vrf test

Related Commands

Notes

When an instance is moved from one VRF to another - it loses all its current configuration.


ipv6 dhcp relay instance port

ipv6 dhcp relay instance <instance-id> port <udp-port>

no ipv6 dhcp relay instance <instance-id> port <udp-port>

Modifies the UDP port for the given instance.

The no form of the command will set the UDP port to default value.

Syntax Description

instance-id

DHCP instance ID

Range: 1-8

port

UDP Port ID

Range: 1-65534

Default

UDP port 547

Configuration Mode

config

History

3.6.4070

Example

switch (config)# ipv6 dhcp relay 1 port 555

Related Commands

Notes


ipv6 dhcp relay instance interface-id option

ipv6 dhcp relay instance <instance-id> interface-id option [user-defined-id]

Specifies the content of the interface-id option that will be sent by the relay agent.

Syntax Description

instance-id

DHCP instance ID

Range: 1-8

user-defined-id

Interface ID option content

Length: 1-15 (char)

Default: interface name

Default

N/A

Configuration Mode

config

History

3.6.4070

Example

switch (config)# ipv6 dhcp relay instance <instance-id> interface-id option eth1/1

Related Commands

Notes


ipv6 dhcp relay instance use-secondary-ip

ipv6 dhcp relay instance use-secondary-ip

no ipv6 dhcp relay instance use-secondary-ip

Enables the switch to relay a single request from the client multiple times simultaneously, with each of the IP addresses configured on the corresponding downstream interfaces as the respective gateway address (giaddr field of IPv6 DHCP request packet).

The no form of the command disables this function.

Syntax Description

N/A

Default

Disabled

Configuration Mode

config

History

3.6.8008

Example

switch (config ipv6 dhcp relay instance 1)# use-secondary-ip

Related Commands

Notes


clear ipv6 dhcp relay counters

clear ipv6 dhcp relay counters [vrf {<vrf-name> | all} | instance <instance-id>]

Clears DHCP relay counters for specific instance or all instances in given VRF or all instances in the system.

Syntax Description

vrf-name

VRF name or “all” for all VRFs

instance-id

DHCP instance ID

Range: 1-8

Default

N/A

Configuration Mode

config

History

3.6.4070

3.6.5000

Added “all” parameter

Example

switch (config)# clear ipv6 dhcp relay counters vrf all

Related Commands

Notes


show ip dhcp relay

show ip dhcp relay [instance <instance-id>]

Displays general DHCP configuration.

Syntax Description

instance-id

If instance ID is specified, then a particular instance configuration is displayed

Default

N/A

Configuration Mode

Any command mode

History

3.3.4150

3.6.1002

Added VRF and all parameters

3.6.3004

Updated example and parameters

3.6.6000

Updated example

3.6.8008

Updated example

Example

switch (config)# show ip dhcp relay 

Instance ID 1:

VRF Name: default

DHCP Servers:

1.1.1.1

DHCP relay agent options:

always-on : Disabled

Information Option: Disabled

UDP port : 67

Auto-helper : Disabled

-------------------------------------------

Interface Label Mode

-------------------------------------------

eth1/5 N/A downstream

Related Commands

Notes

  • If no DHCP-R instance is given, then all DHCP-R instances are displayed

  • Only configured interfaces are displayed

  • Once vrf-auto-helper is enabled, no interface is displayed


show ip dhcp relay counters

show ip dhcp relay counters [instance <instance-id> | vrf <vrf-name>]

Displays the DHCP relay counters.

Syntax Description

instance-id

Displays the DHCP relay counters for a given instance

vrf

Displays the DHCP relay counters in a given VRF

Default

N/A

Configuration Mode

Any command mode

History

3.3.4150

3.6.1002

Added VRF and all parameters

3.6.5000

Updated example

3.6.8008

Updated example

Example

switch (config) # show ip dhcp relay counters 

Instance 1:

VRF Name: vrf-default

DHCP Counter flags:

SPR : Server Packets Received

SPE : Server Packets Error

SPRE: Server Packet Relayed

CPR : Client Packets Received

RP : Relay Packets

RE : Relay Errors

-----------------------------------

Req/Resp Received Forwarded

-----------------------------------

All Req 0 0

All Res 0 0

------------------------------------------------------

If SPRE SPE SPR CPR

------------------------------------------------------

eth1/5 0 0 0 0

Packets Relayed to Server:

------------------------------------

Server RP RE

------------------------------------

1.1.1.1 0 0

Related Commands

Notes


show ipv6 dhcp relay

show ipv6 dhcp relay [instance <instance-id>]

Displays general DHCP configuration on all instances.

If instance ID is defined then specific instance configuration is displayed.

Syntax Description

instance-id

DHCP instance ID

Range: 1-8

Default

N/A

Configuration Mode

Any command mode

History

3.6.4070

First release

3.6.5000

Updated example

3.6.6000

Updated example

3.6.8008

Updated example

Example

switch (config)# show ipv6 dhcp relay 

Instance ID 1:

VRF Name: default

DHCP Servers:

2001:db8:701f::8f9

DHCP relay agent options:

All_DHCP_Servers : Disabled

Interface-id Option: Disabled

UDP port : 547

Auto-helper : Disabled

Status : Down

-------------------------------------------

Interface Label Mode

-------------------------------------------

eth1/5 N/A downstream

Related Commands

Notes

  • If no DHCP-R instance is given, then all DHCP-R instances are displayed

  • Only configured interfaces are displayed

  • Once vrf-auto-helper is enabled, no interface is displayed


show ipv6 dhcp relay counters

show ipv6 dhcp relay counters [instance <instance-id> | vrf <vrf-name>]

Displays the DHCPv6 relay counters.

Syntax Description

instance-id

Displays the DHCPv6 relay counters for a given instance

vrf

Displays the DHCPv6 relay counters in a given VRF

Default

N/A

Configuration Mode

Any command mode

History

3.3.4150

3.6.8008

Updated example

Example

switch (config) # show ipv6 dhcp relay counters 

Instance 1:

VRF Name: vrf-default

DHCP Counter flags:

SPR : Server Packets Received

SPE : Server Packets Error

SPRE: Server Packet Relayed

CPR : Client Packets Received

RP : Relay Packets

RE : Relay Errors

-----------------------------------

Req/Resp Received Forwarded

-----------------------------------

All Req 0 0

All Res 0 0

------------------------------------------------------

If SPRE SPE SPR CPR

------------------------------------------------------

eth1/5 0 0 0 0

Packets Relayed to Server:

-------------------------------------------------------------------

Server RP RE

-------------------------------------------------------------------

2001:db8:701f::8f9 0 0

Related Commands

Notes


© Copyright 2023, NVIDIA. Last updated on Nov 15, 2023.