Configuration Examples for DHCP
Configuration Examples for DHCP
This example shows how to enable DHCP snooping on two VLANs, with Option 82 support enabled and
Ethernet interface 2/5 trusted because the DHCP server is connected to that interface:
feature dhcp
ip dhcp snooping
ip dhcp snooping information option
interface ethernet 2/5
ip dhcp snooping trust
ip dhcp snooping vlan 1
ip dhcp snooping vlan 50
This example shows how to enable the DHCP relay agent and configure the DHCP server IP address for
Ethernet interface 2/3, where the DHCP server IP address is 10.132.7.120 and the DHCP server is in the VRF
instance named red:
feature dhcp
ip dhcp relay
ip dhcp relay information option
ip dhcp relay information option vpn
interface ethernet 2/3
ip dhcp relay address 10.132.7.120 use-vrf red
This example shows how to enable and use the DHCP smart relay agent. In this example, the device forwards
the DHCP broadcast packets received on Ethernet interface 2/2 to the DHCP server (10.55.11.3), inserting
192.168.100.1 in the giaddr field. If the DHCP server has a pool configured for the 192.168.100.0/24 network,
it responds. If the server does not respond, the device sends two more requests using 192.168.100.1 in the
giaddr field. If the device still does not receive a response, it starts using 172.16.31.254 in the giaddr field
instead.
feature dhcp
ip dhcp relay
ip dhcp smart-relay global
interface ethernet 2/2
ip address 192.168.100.1/24
ip address 172.16.31.254/24 secondary
ip dhcp relay address 10.55.11.3
Configuration Examples for DHCP Client
The following example shows how the DHCP client feature can be used to assign an IPv4 address to a VLAN
interface:
switch# configure terminal
switch(config)# interface vlan 7
switch(config-if)# no shutdown
switch(config-if)# ip address dhcp
switch(config-if)# show running-config interface vlan 7
interface Vlan7
no shutdown
ip address dhcp
Cisco Nexus 9000 Series NX-OS Security Configuration Guide, Release 9.x
366
Configuring DHCP