Home > Articles > DHCP Snooping: Basic Concepts and Configuration

DHCP Snooping: Basic Concepts and Configuration

  • Date: Feb 9, 2016.

Article Description

Mason Harris, CCIE #5916 and co-author of CCNA Security 210-260 Complete Video Course, provides a streamlined introduction to DHCP snooping, a barrier to denial-of-service and man-in-the-middle attacks on organizational networks.

Like this article? We recommend

CCNA Security 210-260 Complete Video Course

CCNA Security 210-260 Complete Video Course

$239.99 (Save 20%)

What Is DHCP?

It is a fundamental law of networking that hosts require addressing in order to communicate. In the early days of networking, devices were often assigned static addresses, since these resources rarely moved. But static addressing of hosts doesn't scale. (Can you imagine having to manage your smartphone IP address every time you leave home?) Therefore, dynamic address configuration has become the de facto standard for the majority of networks around the world. Coffee shops, hotels, and your corporate network all utilize the Dynamic Host Configuration Protocol (DHCP) to make life a little easier for the myriad iPads, smartphones, and other computing devices that require access to your organization's network and to the Internet.

DHCP snooping is a Layer 2 switch feature that mitigates the security risks posed by denial-of-service from rogue DHCP servers, which disrupt networks as they compete with legitimate DHCP servers that configure hosts on the network for communication.

In my experience, rogue DHCP servers are enabled most often by accident. For example: Wanting to extend wireless services into his workspace, a user plugs in an off-the-shelf wireless router that has DHCP enabled by default. Unbeknownst to the user, his new toy provides rogue addresses to unsuspecting hosts, creating reachability issues on the network.

Meanwhile, attackers take advantage of the open nature of DHCP to insert themselves between the host and the resource it's trying to access, typically the Internet. This breach leads to man-in-the-middle exploits, in which unsuspecting users' privacy and passwords could be compromised.

To help explain the challenges of dealing with rogue DHCP servers, let's take a look at how DHCP works.

How DHCP Works

DHCP works on the simple premise that a client broadcasts a message (DHCPDISCOVER) to all hosts on the network, asking whether any DHCP servers are present. The originating client uses a unique identifier in the message—its Media Access Control (MAC) address—as a sort of return address.

If a DHCP server is listening and available, it responds in kind to the client, with a message (DHCPOFFER) stating the terms of the address lease. (If the network has multiple DHCP servers, the client typically responds to the first offer it receives.)

When the client accepts a lease offer, it responds with a request (DHCPREQUEST), which is followed by the DHCP server's acknowledgment (DHCPACK). At this point, the client is configured and able to communicate on the IP network.

Pretty straightforward, right? This simplicity has helped to make DHCP the underlying protocol in the vast majority of networks around the world today. (For additional technical details on DHCP, see Wikipedia's DHCP page.)

DHCP Snooping Concepts

Cisco was the first vendor to release DHCP snooping as a feature in its network switches, designed to mitigate issues with rogue DHCP servers. Other vendors have since created similar features in their operating systems.

DHCP snooping is built on the concept of using one or more trusted ports that have been identified as having legitimate DHCP servers attached. As clients communicate on the network, the switch builds a "bindings table"—a database that lists the client MAC address, DHCP-assigned address, switchport, VLAN, and remaining DHCP lease time. The network switch then filters any DHCP server messages from untrusted ports in order to protect the integrity of legitimate DHCP servers and their operation.

DHCP Snooping Configuration

To begin enabling DHCP snooping, use the global command ip dhcp snooping as shown in Figure 1.

Figure 1 Global enablement of DHCP snooping on a Cisco switch.

Next, configure the VLANs you want to protect, using the command ip dhcp snooping vlan 99. In Figure 2, we're monitoring only VLAN 99, but we could easily include a range or sequence of VLANs, as shown in Figure 3.

Figure 2 Single VLAN example.

Figure 3 Multiple VLAN example.

Finally, we need to tell the switch the port to which our trusted DHCP server is directly connected, as shown in Figure 4.

Figure 4 Trusted port configuration for a legitimate DHCP server.

That's it for a basic configuration on a Cisco switch. To verify proper operation, use the IOS command show ip dhcp snooping as shown in Figure 5. Notice that DHCP snooping is configured for both VLAN 99 and 999, but only operational on VLAN 99, as shown in the output.

Figure 5 Verification of proper DHCP snooping configuration.

More advanced configurations allow for exporting the DHCP bindings database and rate-limiting DHCP server responses, as well as manipulating which hardware addresses are used for verification.

Understanding DHCP Option 82

In the early days of networking, networks tended to be "flat," meaning that they had very few broadcast domains. In those days, DHCP servers could serve a large number of clients, because more hosts existed in larger broadcast domains. The downside to this scenario is that larger broadcast domains become very inefficient as they scale to larger sizes, due to the broadcast nature of Ethernet.

Network switches solved this issue by segmenting the networks into smaller chunks called virtual local area networks (VLANs). However, DHCP servers were still required in each VLAN to address hosts dynamically. This model clearly doesn't scale (the number of DHCP servers would equal the number of VLANs), until the concept of relaying DHCP responses through Layer 3 devices was first implemented in RFC 3046. This design allowed hosts on remote VLANs to receive addresses from a DHCP server that was outside their subnet.

DHCP Option 82 allows DHCP relay-agent information to be inserted so that policies can be applied to remote hosts in accordance with the network addressing schema. Some vendors use these fields to implement their own extensions, and problems could arise if DHCP snooping is checking for specific values. Accordingly, Cisco devices can cause problems if these Option 82 fields don't match. To makes matters even more complicated, the behavior of whatever is inserted in these fields may change from one software release to another!

Understanding how Option 82 extensions are used will aid in troubleshooting scenarios where hosts are not being addressed properly. For more information, see the Cisco article "Understanding and Troubleshooting DHCP in Catalyst Switch or Enterprise Networks."

DHCP Snooping Operational Practices

When DHCP snooping detects a violation, the offending packet is dropped and an event is generated that contains the text DHCP_SNOOPING in the log message. Violations could occur from MAC address mismatches or attempts to provide DHCP services on untrusted ports.

Typically DHCP snooping is enabled on switches that contain access ports. A best practice is to also enable rate-limiting of DHCP requests on the untrusted ports. This IOS command is enabled at a port level and protects the DHCP server from excessive amounts of addressing requests. It's enabled using this command:

ip dhcp snooping limit rate <1-4294967294>

where the variable number is expressed in packets per second.

Final Thoughts

I'd encourage anyone interested in deploying DHCP snooping in a production environment to test it in the lab first, to ensure a complete understanding of how the feature is intended to work. In my experience, most network engineers are familiar with the general concepts of DHCP, but a far smaller number understand the details, especially when it comes to proprietary vendor extensions and how they're used.

For more information on the DHCP protocol and its proper behavior, see the Internet Engineering Task Force(IETF) Request for Comments (RFC) 2131. RFCs detail the workings of a specific protocol or technology, and they're a great place to start when you need to understand how something is intended to work in practice.

I also provide a detailed overview of DHCP snooping in CCNA Security 210-260 Complete Video Course.

Cisco Press Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from Cisco Press and its family of brands. I can unsubscribe at any time.

Overview

Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about Cisco Press products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites; develop new products and services; conduct educational research; and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@ciscopress.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security

Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children

This site is not directed to children under the age of 13.

Marketing

Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out

Users can always make an informed choice as to whether they should proceed with certain services offered by Cisco Press. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.ciscopress.com/u.aspx.

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links

This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020