Configuring DHCP Snooping on Multiple VLANs

DHCP snooping can be enabled on multiple VLANs using one command. The following task configures multiple VLANs and enables DHCP snooping on most of the configured VLANs using a single command.
Note: DHCP snooping can be configured on a maximum number of 511 VLANs at one time.
Note: DHCP Snooping can be configured for a VLAN or VLANS even before the VLAN or VLANS are created. VLANs and DHCP Snooping configurations on the VLANS are not automatically deleted when the VLAN is deleted.
Note: When configuring DHCP snooping on a range of VLANs or multi-VLAN, there cannot not be any VLAN in the range that is a member of a VLAN group or any reserved VLAN. Otherwise, configurations fail on the entire range.
  1. Enter global configuration mode.
    device# configure terminal
  2. Configure the port-based VLANs.
    device(config)# vlan 100 to 150
  3. Add port Ethernet 1/1/12 as a tagged port.
    device(config-mvlan-100-150)# tagged ethernet 1/1/12
  4. Use the exit command to return to global configuration mode.
    device(config-mvlan-100-150)# exit
  5. Configure more port-based VLANs.
    device(config)# vlan 151 to 200
  6. Add port Ethernet 1/1/12 as a tagged port.
    device(config-mvlan-151-200)# tagged ethernet 1/1/12
  7. Use the exit command to return to global configuration mode.
    device(config-mvlan-151-200)# exit
  8. Use the ip dhcp snooping command with the to keyword, specifying a VLAN range, to enable DHCP snooping on multiple VLANs.
    device(config)# ip dhcp snooping vlan 100 to 150 160 170 to 200
  9. Change the trust setting of the ports that are connected to the DHCP server to trusted at the interface configuration level.
    1. To enable trust on a port, enter interface configuration mode.
      device(config)# interface ethernet 1/1/12
    2. Enable trust on the port.
      device(config-if-e10000-1/1/12)# dhcp snooping trust
The following example configures VLANs 100 through 200, and enables DHCP snooping on VLANs 100 through 150, VLAN 160, and VLANs 170 through 200.
device# configure terminal
device(config)# vlan 100 to 150
device(config-mvlan-100-150)# tagged ethernet 1/1/12
device(config-mvlan-100-150)# exit
device(config)# vlan 151 to 200
device(config-mvlan-151-200)# tagged ethernet 1/1/12
device(config-mvlan-100-150)# exit
device(config)# ip dhcp snooping vlan 100 to 150 160 170 to 200
device(config)# interface ethernet 1/1/12
device(config-if-e10000-1/1/12)# dhcp snooping trust