5.7 Configure and verify DHCP snooping, DAI and port security

CCNA 200-301 v1.1 · 5.0 Security Fundamentals

Access ports are where attackers plug in. Port security limits which and how many MAC addresses a port accepts. DHCP snooping stops rogue DHCP servers and records who leased which address. Dynamic ARP inspection (DAI) uses that record to drop forged ARP replies. Together they block the classic man-in-the-middle attacks of the CCNA.

What you must know

Port security

Port security only works on a static access (or trunk) port. It learns MAC addresses up to a maximum and reacts when a new one exceeds it.

interface GigabitEthernet0/1
 switchport mode access
 switchport access vlan 10
 switchport port-security
 switchport port-security maximum 2
 switchport port-security mac-address sticky
 switchport port-security violation restrict
Violation modeDrops the frameLogs and countsShuts the port
protectYesNoNo
restrictYesYesNo
shutdown (default)YesYesYes: err-disabled

An err-disabled port stays down until you shutdown and no shutdown it, or errdisable recovery cause psecure-violation brings it back after a timer.

DHCP snooping

Every port is untrusted by default once snooping is on. An untrusted port may send DHCP client messages, but server messages (Offer, Ack) arriving on it are dropped. Trust only the ports toward the real server: its Offer reaches PC1 (1), while a rogue server on an access port is dropped at SW1 (2).

ip dhcp snooping
ip dhcp snooping vlan 10
no ip dhcp snooping information option
!
interface GigabitEthernet0/24
 ip dhcp snooping trust
!
interface range GigabitEthernet0/1 - 23
 ip dhcp snooping limit rate 15

Snooping builds a binding table: MAC address, IP address, VLAN, port and lease time of every client that got a lease. By default the switch also inserts option 82 into requests. An IOS DHCP server that receives option 82 with an empty giaddr rejects the request, which is why the lab turns insertion off with no ip dhcp snooping information option (or the server uses ip dhcp relay information trusted).

Dynamic ARP inspection

ARP has no authentication: an attacker can claim to be the default gateway and pull traffic through itself. DAI checks every ARP packet on untrusted ports against the snooping binding table and drops those whose IP and MAC do not match a lease.

ip arp inspection vlan 10
!
interface GigabitEthernet0/24
 ip arp inspection trust

Commands

show port-security interface Gi0/1Status, violation mode, maximum, current and sticky MAC count, and the violation counter.
show port-security addressThe secure MAC addresses on every port.
show ip dhcp snoopingSnooping VLANs, option 82 setting and the trusted ports.
show ip dhcp snooping bindingThe binding table: MAC, IP, lease, VLAN and port.
show ip arp inspectionDAI VLANs and the forwarded and dropped counters.
show interfaces status err-disabledPorts shut by a security violation and why.

Exam traps

Check yourself

A port with port security in restrict mode sees a third MAC address; the maximum is 2. What happens?
Frames from the new MAC are dropped, a log message is sent and the violation counter increases. The port stays up.
Clients stop getting addresses right after you enable DHCP snooping. Name two likely causes.
The uplink toward the server is not trusted, or option 82 insertion makes an IOS DHCP server reject the requests.
What does DAI compare an ARP reply against?
The DHCP snooping binding table (or an ARP ACL for static hosts).
How do you bring back an err-disabled port after fixing the cause?
shutdown then no shutdown on the interface, or configure errdisable recovery cause psecure-violation.

Labs

Try it live: Port security, DHCP snooping and DAI

More topics in 5.0 Security Fundamentals