DHCP Snooping Commands

Use these M4500 CLI commands to enable DHCP snooping, configure trusted ports, VLANs, binding database, and Option 82, and display snooping bindings and statistics.

DHCP snooping is a security feature that monitors DHCP messages between a DHCP client and DHCP servers to filter harmful DHCP messages and to build a bindings database of {MAC address, IP address, VLAN ID, port} tuples that are considered authorized. You can enable DHCP snooping globally and on specific VLANs, and configure ports within the VLAN to be trusted or untrusted. DHCP servers must be reached through trusted ports.

The DHCP snooping binding table contains the MAC address, IP address, lease time, binding type, VLAN number, and interface information that corresponds to the local untrusted interfaces of a switch; it does not contain information regarding hosts interconnected with a trusted interface. An untrusted interface is an interface that is configured to receive messages from outside the network or firewall. A trusted interface is an interface that is configured to receive only messages from within the network.

DHCP snooping acts like a firewall between untrusted hosts and DHCP servers. It also gives you a way to differentiate between untrusted interfaces connected to the end-user and trusted interfaces connected to the DHCP server or another switch.

DHCP snooping enforces the following security rules:

DHCP packets from a DHCP server (DHCPOFFER, DHCPACK, DHCPNAK, DHCPRELEASEQUERY) are dropped if received on an untrusted port.

DHCPRELEASE and DHCPDECLINE messages are dropped if for a MAC address in the snooping database, but the binding's interface is other than the interface where the message was received.

On untrusted interfaces, the switch drops DHCP packets whose source MAC address does not match the client hardware address. This feature is a configurable option.

The hardware identifies all incoming DHCP packets on ports where DHCP snooping is enabled. DHCP snooping is enabled on a port if (a) DHCP snooping is enabled globally, and (b) the port is a member of a VLAN where DHCP snooping is enabled. On untrusted ports, the hardware traps all incoming DHCP packets to the CPU. On trusted ports, the hardware forwards client messages and copies server messages to the CPU so that DHCP snooping can learn the binding.

You can enable the switch to operate as a DHCP Layer 2 relay agent to relay DHCP requests from clients to a Layer 3 relay agent or server. The Circuit ID and Remote ID can be added to DHCP requests relayed from clients to a DHCP server. This information is included in DHCP Option 82, as specified in sections 3.1 and 3.2 of RFC3046.

show ip dhcp snooping

This command displays the DHCP snooping global configurations and summaries of port configurations.

Default None
Format show ip dhcp snooping
Mode Privileged Exec

Example:

CODE
(M4500-32C) #show ip dhcp snooping

DHCP snooping is Enabled
DHCP snooping source MAC verification is enabled
DHCP snooping is enabled on the following VLANs:
1

 Interface    Trusted     Log Invalid Pkts
-----------  ----------   ----------------
0/1          Yes          No
0/2          No           No
0/3          No           No
0/4          No           No
0/5          No           No
0/6          No           No
0/7          No           No
0/8          No           No
0/9          No           No
0/10         No           No
0/11         No           No
0/12         No           No
0/13         No           No
0/14         No           No
0/15         No           No

(M4500-32C) #

show ip dhcp snooping per interface

This command displays the DHCP snooping detail configurations for all interfaces or for a specific interface.

Default None
Format show ip dhcp snooping interfaces [<slot/port> | port-channel <portchannel-id>]
Mode Privileged Exec

Example:

CODE
(M4500-32C) #show ip dhcp snooping interfaces

Interface     Trust State     Rate Limit      Burst Interval
                                 (pps)           (seconds)
----------   -------------   -------------   ---------------
0/1          Yes             None            N/A
0/2          No              None            N/A
0/3          No              None            N/A
0/4          No              None            N/A
0/5          No              None            N/A
0/6          No              None            N/A
0/7          No              None            N/A
0/8          No              None            N/A
0/9          No              None            N/A
0/10         No              None            N/A
0/11         No              None            N/A
0/12         No              None            N/A
0/13         No              None            N/A
0/14         No              None            N/A
0/15         No              None            N/A
0/16         No              None            N/A
0/17         No              None            N/A
0/18         No              None            N/A
0/19         No              None            N/A

(M4500-32C) #

show ip dhcp snooping binding

This command displays the DHCP Snooping binding entries.

The parameter “static” means to restrict the output based on static entries which are added by user manually.

The parameter “dynamic” means to restrict the output based on dynamic entries which are added by DHCP Snooping automatically.

Default None
Format show ip dhcp snooping binding [{static | dynamic}] [interface {<slot/port> | port-channel <portchannel-id>}] [vlan <vlan-id>]
Mode Privileged Exec

Example:

CODE
(M4500-32C) #show ip dhcp snooping binding

Total number of bindings:  363
Total number of Tentative bindings:  61

   MAC Address       IP Address     VLAN   Interface    Type    Lease (Secs)
-----------------  ---------------  ----  -----------  -------  -----------
44:0A:A7:8A:00:00        10.10.1.6     1         0/10  DYNAMIC        86383
44:0A:A7:8A:00:01        10.10.1.8     1         0/10  DYNAMIC        86383
44:0A:A7:8A:00:02       10.10.1.10     1         0/10  DYNAMIC        86383
44:0A:A7:8A:00:03       10.10.1.11     1         0/10  DYNAMIC        86383
44:0A:A7:8A:00:04       10.10.1.12     1         0/10  DYNAMIC        86383
44:0A:A7:8A:00:05       10.10.1.13     1         0/10  DYNAMIC        86383
44:0A:A7:8A:01:00        10.10.1.2     1         0/10  DYNAMIC        86383
44:0A:A7:8A:01:01        10.10.1.3     1         0/10  DYNAMIC        86383
44:0A:A7:8A:01:02        10.10.1.4     1         0/10  DYNAMIC        86383
44:0A:A7:8A:01:03        10.10.1.5     1         0/10  DYNAMIC        86383
44:0A:A7:8A:01:04        10.10.1.7     1         0/10  DYNAMIC        86383
44:0A:A7:8A:01:05        10.10.1.9     1         0/10  DYNAMIC        86383
44:0A:A7:8A:02:00       10.10.1.20     1         0/10  DYNAMIC        86383
44:0A:A7:8A:02:01       10.10.1.21     1         0/10  DYNAMIC        86383
44:0A:A7:8A:02:02       10.10.1.22     1         0/10  DYNAMIC        86383
44:0A:A7:8A:02:03       10.10.1.23     1         0/10  DYNAMIC        86383
 (M4500-32C) #

show ip dhcp snooping database

This command displays the DHCP Snooping configuration related to the database persistency.

Default None
Format show ip dhcp snooping database
Mode Privileged Exec

Example:

CODE
(M4500-32C) #show ip dhcp snooping database
agent url:  local
write-delay:  300
(M4500-32C) #

show ip dhcp snooping information all

This command displays the summaries of DHCP Option-82 configurations.

Default None
Format show ip dhcp snooping information all
Mode Privileged Exec

Example:

CODE
(M4500-32C) #show ip dhcp snooping information all

DHCP Information Option82 is  Enabled.

Interface   OPT82 Mode   TrustMode
---------  ------------  --------------
0/1        Enabled       trusted
0/2        Disabled      untrusted
0/3        Disabled      untrusted
0/4        Disabled      untrusted
0/5        Disabled      untrusted
0/6        Disabled      untrusted
0/7        Disabled      untrusted
0/8        Disabled      untrusted
0/9        Disabled      untrusted
0/10       Disabled      untrusted
0/11       Disabled      untrusted
0/12       Disabled      untrusted
0/13       Disabled      untrusted
0/14       Disabled      untrusted
0/15       Disabled      untrusted
0/16       Disabled      untrusted
0/17       Disabled      untrusted
0/18       Disabled      untrusted

(M4500-32C) #

show ip dhcp snooping information statistics

This command displays DHCP Option-82 statistics per interface.

Default None
Format show ip dhcp snooping information stats interface {<slot/port> | all}
Mode Privileged Exec

Example:

CODE
(M4500-32C) #show ip dhcp snooping information stats interface all

Interface    UntrustedServer  UntrustedClient  TrustedServer     TrustedClient
             MsgsWithOpt82    MsgsWithOpt82    MsgsWithoutOpt82  MsgsWithoutOpt82
-----------  ---------------  ---------------  ----------------  ----------------
0/1          0                0                0                 0
0/2          0                0                0                 0
0/3          0                0                0                 0
0/4          0                0                0                 0
0/5          0                0                0                 0
0/6          0                0                0                 0
0/7          0                0                0                 0
0/8          0                0                0                 0
0/9          0                0                0                 0
0/10         0                0                0                 0
0/11         0                0                0                 0
0/12         0                0                0                 0
0/13         0                0                0                 0
0/14         0                0                0                 0
0/15         0                0                0                 0
0/16         0                0                0                 0
0/17         0                0                0                 0
0/18         0                0                0                 0
0/19         0                0                0                 0

(M4500-32C) #

show ip dhcp snooping information agent-option

This command displays the Option-82 configurations of DHCP Relay agent on specific VLAN.

Default None
Format show ip dhcp snooping information agent-option vlan <vlan-list>
Mode Privileged Exec

:

CODE
Example
(M4500-32C) # show ip dhcp snooping information agent-option vlan 1
DHCP Information Option82 is  Enabled.
VLAN Id    DHCP OPT82   CircuitId    RemoteId
---------  ---------    ----------   --------------------------------
1          Enabled      Enabled      testRemoteIdString
(M4500-32C) #

show ip dhcp snooping information per vlan

This command displays the DHCP Option-82 configurations per specific VLAN.

Default None
Format show ip dhcp snooping information vlan <vlan-list>
Mode Privileged Exec

Example:

CODE
(M4500-32C) #show ip dhcp snooping information vlan 1
DHCP Information Option82 is  Enabled.
DHCP L2 Relay is enabled on the following VLANs:
1
(M4500-32C) #

show ip dhcp snooping information circuit-id

This command displays the circuit-id configuration of DHCP Option-82 per specific VLAN.

Default None
Format show ip dhcp snooping information circuit-id vlan <vlan-list>
Mode Privileged Exec

Example:

CODE
(M4500-32C) # show ip dhcp snooping information circuit-id vlan 1
DHCP Information Option82 is Enabled.
DHCP Circuit-Id option is enabled on the following VLANs:
1
(M4500-32C) #

show ip dhcp snooping information remote-id

This command displays the remote-id configuration of DHCP Option-82 per specific VLAN.

Default None
Format show ip dhcp snooping information remote-id vlan <vlan-list>
Mode Privileged Exec

Example:

CODE
(M4500-32C) # show ip dhcp snooping information remote-id vlan 1
DHCP Information Option82 is Enabled.
VLAN ID    Remote Id
---------  --------------------------------
1          testRemoteIdString
(M4500-32C) #

show ip dhcp snooping information interface

This command displays the remote-id configuration of DHCP Option-82 per interface.

Default None
Format show ip dhcp snooping information interface {<slot/port> | all}
Mode Privileged Exec

Example:

CODE
(M4500-32C) #show ip dhcp snooping information interface 0/1
DHCP Information Option82 is  Enabled.
Interface  OPT82 Mode    TrustMode
---------  ------------  --------------
0/1        Enabled       trusted
(M4500-32C) #

ip dhcp snooping

This command enables or disables the DHCP Snooping globally.

Default Disable
Format [no] ip dhcp snooping
Mode Global Config

ip dhcp snooping vlan

This command enables or disables the DHCP Snooping to the specific VLAN.

Default Disable
Format [no] ip dhcp snooping vlan <vlan-list>
Mode Global Config

ip dhcp snooping verify mac-address

This command enables or disables the verification of the source MAC address with the client hardware address in the received DHCP message.

Default Enable
Format [no] ip dhcp snooping verify mac-address
Mode Global Config

ip dhcp snooping database

This command configures the persistent location of the DHCP Snooping database. This can be local or a remote file on a given IP machine.

The parameter “local” means to set database access inside device.

The parameter “tftp://hostIP/filename” means to set database access on remote TFTP Server.

Default Local
Format ip dhcp snooping database {local | <url>}
Mode Global Config

ip dhcp snooping database write-delay

This command configures the interval in seconds at which the DHCP Snooping database will be persisted, and this database stores the results of DHCP snooping bindings. Use keyword “no” to restore the default value of this command.

The parameter “<interval>” value ranges is from 15 to 86400 seconds.

Default 300
Format

ip dhcp snooping database write-delay <interval>

no ip dhcp snooping database write-delay

Mode Global Config

ip dhcp snooping binding

This command configures the static DHCP Snooping binding which binds a MAC address to assigned IP address on a specific VLAN ID and interface. Use keyword “no” to remove an existing entry of DHCP Snooping binding.

Default None
Format

ip dhcp snooping binding <mac-address> vlan <vlan id> <ip address> interface {<slot/port> | port-channel < portchannel-id>}

no ip dhcp snooping binding <mac-address>

Mode Global Config

Example: To add a static entry of DHCP snooping binding which binds MAC address 00:11:22:33:44:55 to IP address 10.0.0.1 on vlan 1 and port interface 0/1.

CODE
(M4500-32C) #configure
(M4500-32C) (Config)#ip dhcp snooping binding 00:11:22:33:44:55 vlan 1 10.0.0.1 interface 0/1
(M4500-32C) (Config)#

ip dhcp snooping information option

This command enables or disables the DHCP Snooping application to support information Option 82 in global configuration or a specific interface.

Default Disable
Format [no] ip dhcp snooping information option
Mode

Global Config

Interface Config

ip dhcp snooping information option circuit-id

This command enables or disables the DHCP Snooping Option 82 with sub-option circuit-id in a range of VLANs.

The format of circuit-id is LLLLVVVVXXYYZZ, and LLLL is the length from V to Z, VVVV is VLAN ID, XX is the Unit ID, YY is the function/module ID and ZZ is the Port number.

Default Disable
Format [no] ip dhcp snooping information option circuit-id vlan <vlan-list>
Mode Global Config

ip dhcp snooping information option remote-id

This command enables or disables the DHCP Snooping Option 82 with sub-option remote-id in a range of VLANs. When it’s enabled, all DHCP client’s requests received to this device will be added remote-id sud-option with remote-id string.

The format of remote-id is LLLLXXXXX, and LLLL is the total length of all X, XXXXX is remote-id string which is set by user.

The parameter “<remoteId string>“ defines remote-id string which of maximum length is 32 characters

Default Disable
Format

ip dhcp snooping information option remote-id <remoteId string> vlan <vlan-list>

no ip dhcp snooping information option remote-id vlan <vlan-list>

Mode Global Config

ip dhcp snooping information option vlan

This command enables or disables the DHCP Snooping option 82 in a range of VLANs.

Default Disable
Format [no] ip dhcp snooping information option vlan <vlan-list>
Mode Global Config

ip dhcp snooping information option trust

This command configures an interface to be trusted for Option-82 reception.

Default Disable
Format [no] ip dhcp snooping information option trust
Mode Interface Config

ip dhcp snooping limit

This command controls the rate at which the DHCP Snooping messages come. If packet rate exceeds limitation over burst interval, the assigned port will shut down automatically. User could use interface command “shutdown” and then “no shutdown” to recover it. Use keyword “no” to restore the default value of this command.

The parameter “rate” means to the limitation of packet rate. Its range is from 0 to 300 packets per second.

The parameter “burst interval” means the time interval of packet burst could be over rate limitation. Its range is from 1 to 15 seconds.

Default

“rate” is None

“burst interval” is 1 second.

Format

ip dhcp snooping limit {rate <pps> [burst interval <seconds>] | none}

no ip dhcp snooping limit

Mode Interface Config

Example: While the packet rate of DHCP message received from port 0/1 exceeds 100 pps and consecutive time interval is over 10 seconds, the port 0/1 will be shutdown automatically.

CODE
(M4500-32C) #configure
(M4500-32C) (Config)#interface 0/1
(M4500-32C) (Interface 0/1)# ip dhcp snooping limit rate 100 burst interval 10
(M4500-32C) (Interface 0/1)#

ip dhcp snooping log-invalid

This command controls logging the illegal DHCP messages to logging buffer.

Default Disabled
Format [no] ip dhcp snooping log-invalid
Mode Interface Config

ip dhcp snooping trust

This command enables or disables a port as DHCP Snooping trust port.

Default Disabled
Format [no] ip dhcp snooping trust
Mode Interface Config

ip dhcp snooping trust

This command enables or disables a port as DHCP Snooping trust port.

Default Disabled
Format [no] ip dhcp snooping trust
Mode Interface Config

clear ip dhcp snooping binding

This command is used to clear all DHCP Snooping bindings on all interfaces or on a specific interface.

Default None
Format clear ip dhcp snooping binding [interface <slot/port>]
Mode Privileged EXEC

clear ip dhcp snooping statistics

This command is used to clear all DHCP Snooping statistics.

Default None
Format clear ip dhcp snooping statistics
Mode Privileged EXEC

clear ip dhcp snooping information statistics

This command is used to clear statistics of DHCP Snooping Option 82.

Default None
Format clear ip dhcp snooping information statistics interface {<slot/port> | all}
Mode Privileged EXEC