skip to content

How does a DHCP snooping switch build and remove its binding-table entries, and why does losing the table in a reboot cut hosts off?

level: seniorimportance: should knowfreq 18%

answer

  1. learnt from what the switch forwards
  2. MAC, IP, lease, VLAN, port
  3. release only from the same port
  4. renewals cannot come from nowhere
  5. RFC 7513 section 9.2

basics

~20 s

A snooping switch records MAC, IP, lease, VLAN and port from each DHCPACK it forwards to an untrusted port, and deletes the entry on a same-port release or decline, or at expiry. Without the table, hosts are dropped until they redo DHCP.

solid answer

~50 s

The switch learns from the exchange it already polices. When a `DHCPACK` from a trusted port reaches a client on an untrusted port, it records the client's `chaddr`, the assigned `yiaddr`, the lease time from option 51, the VLAN and the port. A renewal's ACK refreshes the lifetime; a `DHCPRELEASE` or `DHCPDECLINE` from that same port, or expiry, removes it. Statically addressed hosts never appear. ARP inspection and IP source guard drop traffic that has no binding, so after a reboot that wipes the table every host is a stranger until its binding returns: at its next renewal if DHCP still passes, or only at lease expiry under RFC 7513, which discards a DHCPv4 client message whose source is neither `0.0.0.0` nor bound — unless the host happens to redo DHCP from `0.0.0.0` after its link bounces. RFC 7513 section 9.2 therefore recommends restoring bindings from non-volatile storage.

go deeper

for a junior

Recall that the binding table lists which MAC holds which IP on which port and VLAN, and that it is learnt from DHCP acknowledgements.

for a middle

Explain each step of an entry's life — provisional on the request, bound on the ACK, refreshed by renewals, removed by same-port release, decline or expiry.

for a senior

Show what a reload does to hosts behind ARP inspection or IP source guard, how long they stay cut off, and why persisted bindings matter.

for a principal

Weigh persistence, static bindings and data snooping against the processor and operations cost of each, for a site where switch reloads are routine.

## What an entry holds **DHCP snooping**, a vendor feature with no RFC, learns a **binding** each time it forwards a `DHCPACK` from a trusted port toward a client on an untrusted port. Typical fields: | Field | Where the switch reads it | |---|---| | Client MAC | `chaddr` in the exchange, already checked against the client's frame | | IP address | `yiaddr`, the address the server assigned | | Lease time | Option 51 in the `DHCPACK` | | VLAN | The VLAN the exchange ran on | | Port | The untrusted port where the client's request arrived | **SAVI-DHCP** (RFC 7513, Standards Track), the IETF's specification of the same idea for DHCPv4 and DHCPv6, calls this the **Binding State Table** and gives each entry six fields: binding anchor, address, state (such as `INIT_BIND` or `BOUND`), lifetime, transaction ID and a timeout count. Its **binding anchor** is the attachment — usually a switch port, plus a MAC address where an unmanaged device shares the port — and RFC 7513 says a SAVI device "MUST use a non-spoofable and exclusive binding anchor". A plain MAC address does not qualify, because any host can forge one. ## Building, refreshing and removing entries 1. A client on an untrusted port sends its `DHCPREQUEST`. RFC 7513 creates a provisional `INIT_BIND` entry at this point, keyed by the transaction ID, with a short lifetime. 2. The server's `DHCPACK` arrives on a trusted port; the switch matches it to the pending entry and the entry becomes `BOUND`, its lifetime set to the lease time plus a short response allowance. 3. Each renewal the switch sees refreshes the lifetime from the new `DHCPACK`. 4. A `DHCPRELEASE` or `DHCPDECLINE` removes the entry — but only from the port that holds the binding. RFC 7513 calls this the binding anchor check. 5. Expiry removes the entry when the lifetime runs out with no renewal. ## Who reads the table - **ARP inspection** (vendor feature, no RFC) drops ARP packets on untrusted ports whose sender MAC and IP do not match a binding. - **IP source guard** (vendor feature, no RFC) drops IP packets whose source address, and optionally source MAC, is not bound to the arrival port. - **Per-port binding limits** count entries to cap how many addresses one attachment may hold. RFC 7513 section 8 folds these into one rule set: a data packet from a validating attachment whose source has no `BOUND` entry "MUST be discarded", and ARP and Neighbor Discovery packets are checked against the same table. ## What never lands in it 1. **Statically addressed hosts** — no DHCP exchange, no entry. Implementations let operators add static bindings. 2. **Hosts whose exchange the switch did not see.** RFC 7513 names multiple paths (the DHCP exchange went around this switch) and dynamic paths (a topology change, or a host moving ports without reconfirming). 3. **Addresses DHCP never assigned** — link-local addresses and SLAAC addresses. RFC 7513 points to FCFS SAVI (RFC 6620) for those. ## When the switch reboots The table normally lives in memory. A switch reload does not touch the hosts' leases, but the switch has forgotten all of them, and every feature that reads the table now drops their traffic. A host that senses its link go down and up and re-verifies its lease — an INIT-REBOOT `DHCPREQUEST` sent from `0.0.0.0` — gets its binding back at once; RFC 7513 lets that message through and binds on the server's reply. A host that does not re-verify — one behind an unmanaged switch, whose own link never dropped — stays unknown, and how long depends on what still passes: - If DHCP itself is let through, an entry returns when the switch sees that host's next renewal, at T1 — by default half the lease, so hours with day-long leases. - Under RFC 7513's control-packet rule, a DHCPv4 client message whose source is "neither all zeros nor bound" MUST be discarded. The unicast renewal and the broadcast rebind both carry the host's own address, so both are dropped, and the host waits for its lease to expire and starts again from `0.0.0.0`. RFC 7513 section 9.2 therefore recommends saving entries to non-volatile storage when they reach `BOUND`, restoring them immediately after reboot, and removing those that would have expired meanwhile. Its optional **Data Snooping Process** (section 7) is the fallback: an unbound data packet can trigger a duplicate check by ARP or DAD and then a leasequery — `DHCPLEASEQUERY` from RFC 4388 for DHCPv4 — asking the server whether the address is really leased. RFC 7513 warns that data snooping puts "a considerable burden" on the switch's processor, which is why it is optional and triggered only probabilistically.

  • Why must a DHCPRELEASE be checked against the port that holds the binding?
    RFC 2131 identifies a lease by client identifier or `chaddr` plus the address, and all of those are fields the sender writes. Without a port check, any host on the VLAN could send a `DHCPRELEASE` naming a victim's lease: the server frees the address, the switch deletes the binding, and the victim's traffic is dropped while its address can go to someone else.
  • Why does RFC 7513 insist on a non-spoofable binding anchor rather than a MAC address?
    The binding is only as strong as its anchor. If the anchor is a plain MAC, a host that forges its neighbour's MAC inherits the neighbour's binding and passes validation; RFC 7513 warns that a spoofable anchor "can lead to worse outcomes than allowing spoofed IP traffic". A switch port, extended with a MAC only where an unmanaged device shares it, cannot be forged from the host side.

saying these in an interview costs you the question

  • The binding table is built from DHCPDISCOVER messages as clients ask for addresses.
  • Statically addressed hosts are added to the binding table automatically.
  • After a switch reboot, hosts rebuild their bindings within seconds by re-ARPing.
  • A plain MAC address is a strong enough anchor for an IP binding.
  • Any DHCPRELEASE naming a lease should delete its binding, whichever port sent it.