DHCP Relay Commands

This chapter contains the following sections:

ip dhcp relay enable (Global)

Use the ip dhcp relay enable Global Configuration mode command to enable the DHCP relay feature on the device. Use the no form of this command to disable the DHCP relay feature.

Syntax

ip dhcp relay enable

no ip dhcp relay enable

Default Configuration

DHCP relay feature is disabled.

Command Mode

Global Configuration mode

Example

The following example enables the DHCP relay feature on the device.

switchxxxxxx(config)# ip dhcp relay enable

ip dhcp relay enable (Interface)

Use the ip dhcp relay enable Interface Configuration mode command to enable the DHCP relay feature on an interface. Use the no form of this command to disable the DHCP relay agent feature on an interface.

Syntax

ip dhcp relay enable

no ip dhcp relay enable

Default Configuration

Disabled

Command Mode

Interface Configuration mode

User Guidelines

The operational status of DHCP Relay on an interface is active if one of the following conditions exist:

  • DHCP Relay is globally enabled, and there is an IP address defined on the interface.

Or

  • DHCP Relay is globally enabled, there is no IP address defined on the interface, the interface is a VLAN, and option 82 is enabled.

Example

The following example enables DHCP Relay on VLAN 21.

switchxxxxxx(config)# interface vlan 21
switchxxxxxx(config-if)# ip dhcp relay enable

ip dhcp relay address (Global)

Use the ip dhcp relay address Global Configuration mode command to define the DHCP servers available for the DHCP relay. Use the no form of this command to remove the server from the list.

Syntax

ip dhcp relay address ip-address

no ip dhcp relay address [ip-address]

Parameters

  • ip-address—Specifies the DHCP server IP address. Up to 8 servers can be defined.

Default Configuration

No server is defined.

Command Mode

Global Configuration mode

User Guidelines

Use the ip dhcp relay address command to define a global DHCP Server IP address. To define a few DHCP Servers, use the command a few times.

To remove a DHCP Server, use the no form of the command with the ip-address argument.

The no form of the command without the ip-address argument deletes all global defined DHCP servers.

Example

The following example defines the DHCP server on the device.

switchxxxxxx(config)# ip dhcp relay address 176.16.1.1

show ip dhcp relay

Use the show ip dhcp relay EXEC mode command to display the DHCP relay information.

Syntax

show ip dhcp relay

Command Mode

User EXEC mode

Examples

Option 82 is disabled:

switchxxxxxx# show ip dhcp relay
DHCP relay is globally disabled
Option 82 is disabled
Maximum number of supported VLANs without IP Address: 0
Number of DHCP Relays enabled on VLANs without IP Address: 4
DHCP relay is enabled on Ports: gi1/0/1,po1-2
 Active:
 Inactive: gi1/0/1, po1-4
DHCP relay is enabled on VLANs: 1, 2, 4, 5
 Active:
 Inactive: 1, 2, 4, 5
Global Servers: 1.1.1.1 , 2.2.2.2

Option 82 is enabled:

switchxxxxxx# show ip dhcp relay
DHCP relay is globally enabled
Option 82 is enabled
Maximum number of supported VLANs without IP Address is 4
Number of DHCP Relays enabled on VLANs without IP Address: 2
DHCP relay is enabled on Ports: gi1/0/1,po1-2
 Active: gi1/0/1
 Inactive: po1-2
DHCP relay is enabled on VLANs: 1, 2, 4, 5
 Active: 1, 2, 4, 5
 Inactive:
Global Servers: 1.1.1.1 , 2.2.2.2