Command:
ip dhcp snooping
This command enables DHCP Snooping globally on the device, helping monitor and block unauthorized DHCP servers.
Disable DHCP snooping
sonic-cli# configure terminal
sonic-cli(config)# no ip dhcp snooping
Enabling DHCP Snooping on VLANs
After globally enabling DHCP Snooping on a network switch, the next step is to configure which VLANs will have DHCP Snooping active.
Command:
ip dhcp snooping vlan <vlan-id>
Example:
sonic(config)# ip dhcp snooping vlan 110
This command enables DHCP Snooping on VLAN 110, helping filter DHCP messages on this VLAN.
Configuring Trusted DHCP Interfaces
In DHCP Snooping, all interfaces on a switch are untrusted by default to prevent unauthorized DHCP servers from issuing IP addresses. To allow legitimate DHCP messages to pass through, you need to configure specific interfaces as trusted.
Command:
ip dhcp snooping trust
Example:
sonic(config)# interface Ethernet5
sonic(config-if)# ip dhcp snooping trust
This command marks Ethernet5 as a trusted interface, allowing DHCP messages from legitimate DHCP servers to pass.
Disable:
# no ip dhcp snooping trust
Enabling DHCP Snooping MAC Verification
To enhance security within DHCP Snooping, you can enable MAC address verification. This feature helps ensure that the MAC addresses in DHCP messages are consistent with the bindings stored in the DHCP Snooping database.
This command enables DHCPv4 Snooping MAC verification, which checks that the MAC addresses in DHCP packets match the entries in the binding database. If a mismatch occurs, the switch can take action, such as dropping the packet.
sonic-cli# configure terminal
sonic-cli(config)# ip dhcp snooping verify mac-address
sonic-cli# configure terminal
sonic-cli(config)# no ip dhcp snooping verify mac-address
Importance of MAC Verification
Enabling MAC address verification adds an additional layer of security to your DHCP Snooping configuration. It helps prevent unauthorized devices from responding to DHCP requests and ensures that clients receive the correct IP addresses based on their MAC addresses, enhancing the overall integrity and security of the network.
Verifying DHCP Snooping Status
To verify that DHCP Snooping is functioning correctly, you can use the following command to check its status.
Command:
show ip dhcp snooping
Using the command to check DHCP Snooping configuration displays the VLANs where DHCP Snooping is enabled and the status of interfaces. It identifies which interfaces are trusted (connected to legitimate DHCP servers) and which are untrusted (connected to end devices).
Viewing DHCP Bindings
Once DHCP is configured, you can view the current DHCP bindings, which show which IP addresses have been assigned to which clients.
Command:
show ip dhcp snooping binding