Learn / Stage 3: Networking and CCNA / Lesson 3.12

$ lesson 3.12 --track ccna --domain security

Layer 2 Security and AAA: Port Security, DHCP Snooping, DAI, TACACS+ and RADIUS

Most attacks on a LAN start at a wall port: a rogue DHCP server, a flood of fake MAC addresses, a laptop pretending to be the gateway. Learn the switch features that stop each one, and how AAA servers replace a password on every box.

  • Stage 3 Networking and CCNA
  • Level Advanced
  • 75 min
  • 5 sections, quiz, lab

Start the lesson Jump to the lab

By the end of this lesson you can

  • Use threat, vulnerability, exploit and mitigation correctly
  • Configure port security with limits, sticky learning and violation modes
  • Configure DHCP snooping and explain how DAI uses it
  • Compare TACACS+ and RADIUS and configure AAA with a local fallback
  • Describe site to site and remote access VPNs and password alternatives
3.12.01

Security language and the human layer

Security terms
TermMeaningExample
ThreatWho or what could cause harmA scammer, malware, a careless insider
VulnerabilityThe weaknessAn open switch port in a meeting room
ExploitThe method that uses the weaknessPlugging in a rogue DHCP server
MitigationThe control that reduces the riskDHCP snooping, port security

A security programme is more than device configuration: user awareness (recognising phishing and scams, the topic of much of this site), training for the people who run systems, and physical access control (badges, locked wiring closets, no spare live ports in public areas). Most breaches still start with a stolen password or a convincing message, which is why MFA belongs in network security too.

Passwords alone are weak. Alternatives and additions: multi factor authentication (something you know plus something you have or are), certificates (a device or user proves itself with a private key), and biometrics. In password policy, length beats forced complexity, and checking new passwords against known breached lists helps more than frequent forced changes.

3.12.02

Port security

A switch learns MAC addresses into a table of limited size. A CAM (MAC) flooding attack sends frames from thousands of fake source MACs until the table is full, after which some switches flood unknown unicast traffic out of every port, where the attacker can capture it. Port security limits how many MACs a port may use.

Port security options
SettingDefaultNotes
switchport port-security maximum N1MAC addresses allowed on the port
switchport port-security violationshutdownprotect: drop silently. restrict: drop, log and count. shutdown: err-disable the port.
switchport port-security mac-address stickyoffLearned MACs are written into the running config (save to keep them).
SW1(config)#interface range Fa0/1 - 2
SW1(config-if-range)#switchport mode access
SW1(config-if-range)#switchport access vlan 10
SW1(config-if-range)#switchport port-security
SW1(config-if-range)#switchport port-security maximum 2
SW1(config-if-range)#switchport port-security mac-address sticky
SW1(config-if-range)#switchport port-security violation restrict

Port security only works on a port that is statically access (or trunk); a dynamic (DTP) port rejects it. An err-disabled port comes back with shutdown then no shutdown once the cause is removed. Port security does not stop someone copying an allowed MAC address. 802.1X, which authenticates the device or user before the port opens, is the stronger control.

3.12.03

DHCP snooping and Dynamic ARP Inspection

DHCP snooping splits switch ports into trusted (toward the real DHCP server, and uplinks) and untrusted (everything else). Server messages such as Offer and Ack arriving on an untrusted port are dropped, so a rogue server on a user port cannot hand out a fake gateway or DNS. Snooping also builds a binding table of MAC, IP, VLAN, port and lease for every client, and can rate limit DHCP on untrusted ports to slow starvation attacks.

SW1(config)#ip dhcp snooping
SW1(config)#ip dhcp snooping vlan 10
SW1(config)#no ip dhcp snooping information option
SW1(config)#interface Fa0/24
SW1(config-if)#ip dhcp snooping trust
SW1(config)#interface range Fa0/1 - 10
SW1(config-if-range)#ip dhcp snooping limit rate 10

You need both the global command and the per VLAN command. When snooping is on, the switch inserts DHCP option 82 by default; a server that is not expecting it may ignore those requests, which is why labs often turn it off.

ARP spoofing: the attacker claims the gateway's IP so PC1's traffic flows through it. DAI drops ARP replies that do not match the DHCP snooping tablePC1192.168.10.100Attackerfake ARP repliesGateway192.168.10.1intended path"192.168.10.1 is at my MAC": PC1 now sends its traffic through the attacker
ARP has no authentication, so any host can claim any IP. Dynamic ARP Inspection checks ARP on untrusted ports against the snooping bindings.

Dynamic ARP Inspection (ip arp inspection vlan 10) inspects ARP packets on untrusted ports and drops any whose IP to MAC pairing is not in the binding table. Trust the uplinks and the server port with ip arp inspection trust. Devices with static addresses have no binding, so on real gear they need trust or an ARP ACL, or their ARP is dropped. Snooping alone does not stop ARP spoofing; it only builds the table DAI uses.

3.12.04

AAA, TACACS+ and RADIUS

Local usernames on every device do not scale: when an engineer leaves, someone has to remove them from 400 switches. AAA moves the decision to a server: authentication (who are you), authorization (what may you do), accounting (what did you do).

TACACS+ compared with RADIUS
TACACS+RADIUS
TransportTCP 49UDP 1812 and 1813 (older 1645 and 1646)
EncryptionWhole payloadOnly the password
The three A'sSeparate, so per command authorization is possibleAuthentication and authorization combined
Typical useDevice administrationNetwork access: 802.1X, VPN, Wi-Fi
OriginCisco originated, now documented in RFC 8907Open standard
R1(config)#username backup secret <a long local password>
R1(config)#tacacs-server host 10.0.0.20 key <shared key>
R1(config)#aaa new-model
R1(config)#aaa authentication login default group tacacs+ local
R1(config)#line vty 0 4
R1(config-line)#login authentication default
R1(config-line)#transport input ssh

The method list is tried in order: the TACACS+ server first, and the local database only if the server cannot be reached (not if it says no). Keep one local account for that emergency, with a long secret that is rarely used and closely watched. Run aaa new-model only once you have that account and an open console session, because it changes login behaviour immediately.

VPNs (concept): an IPsec site to site VPN joins two networks across the internet through their gateways; a remote access VPN connects one user's device, using client software or a browser based TLS portal. IPsec provides confidentiality, integrity, authentication and anti-replay. A VPN protects traffic in transit; it does nothing about malware already on the laptop.

3.12.05

Practise on SW1

SW1 is a 2960. VLAN 10 exists, Fa0/24 (real DHCP server) and Fa0/10 (Admin-PC) are already access ports in VLAN 10, Gi0/1 is the trunk to R1. Fa0/1 to Fa0/3 have not been touched. Fa0/3 has a small hub with two devices behind it, one of them the rogue server. The DHCP clients are modelled by the console.

console: SW1 (SW1 access layer console)

Missions 0/12

    Simplified IOS simulator in your browser. It teaches the commands; Packet Tracer and real gear have many more.

    Flashcards: do you remember?

    Tap a card to flip it. Try to answer in your head first; recalling is what makes it stick.

    Quick quiz

    Instant feedback on every answer. Score 70% or more to pass this lesson's quiz.

    Q1A rogue DHCP server is on Fa0/3. Which feature stops its offers?

    Q2Which violation mode drops, logs and counts but keeps the port up?

    Q3DHCP snooping is on. Does it stop ARP spoofing by itself?

    Q4Which protocol encrypts the whole AAA payload?

    Q5With aaa authentication login default group tacacs+ local, the server rejects a password. What happens?

    Q6An attacker sends frames from thousands of random MACs. What is this and what limits it?

    0 / 6

    Hands-on lab

    Cisco Packet Tracer lab60 minutessimulated network

    Packet Tracer lab 3.12: lock down the access layer and centralise logins

    You need: Cisco Packet Tracer (free with a Cisco Networking Academy account; version 9.0.1 was the current download on the NetAcad Resource Hub when this lesson was written). Devices: 1 x 2960, 1 x ISR4331, 3 x Server-PT (Server-DHCP, Rogue-Server, Server-AAA), 3 x PC-PT. All SW1 user ports in VLAN 10.

    Topology and addressing

    Lab 3.12 topology: SW1 with a real DHCP server on Fa0/24, two DHCP clients, a rogue DHCP server on Fa0/3 and an admin PC; R1 reaches an AAA serverFa0/24Gi0/1Gi0/0/0Gi0/0/1Fa0/1Fa0/2Fa0/3Fa0/10SW12960, VLAN 10 .2R1ISR4331Server-AAA10.0.0.20Server-DHCP192.168.10.5PC1DHCPPC2DHCPRogue-Server192.168.10.6Admin-PC192.168.10.50
    Server-DHCP on SW1 Fa0/24, PC1 Fa0/1, PC2 Fa0/2, Rogue-Server Fa0/3, Admin-PC Fa0/10, SW1 Gi0/1 to R1 Gi0/0/0, R1 Gi0/0/1 to Server-AAA.
    Addressing table
    DeviceInterfaceIPv4 address / prefixDefault gateway or note
    R1Gi0/0/0 / Gi0/0/1192.168.10.1/24 / 10.0.0.1/24
    SW1VLAN 10192.168.10.2/24gateway 192.168.10.1
    Server-DHCPFa0192.168.10.5/24pool from .100, gateway .1
    Rogue-ServerFa0192.168.10.6/24pool from .200, gateway .6 (the bad gateway)
    Server-AAAFa010.0.0.20/24gateway 10.0.0.1, TACACS+ and RADIUS
    Admin-PCFa0192.168.10.50/24static
    1. See the problem

      With no protection, release and renew DHCP on PC1 and PC2 a few times (IP Configuration, switch to Static and back to DHCP). Some leases may come from the rogue server: a .200 address with gateway .6.

    2. DHCP snooping

      SW1(config)#ip dhcp snooping
      SW1(config)#ip dhcp snooping vlan 10
      SW1(config)#no ip dhcp snooping information option
      SW1(config)#interface Fa0/24
      SW1(config-if)#ip dhcp snooping trust
      SW1(config)#interface range Fa0/1 - 10
      SW1(config-if-range)#ip dhcp snooping limit rate 10

      Renew on the PCs: only the real server's addresses should appear now.

    3. Dynamic ARP Inspection

      SW1(config)#ip arp inspection vlan 10
      SW1(config)#interface Fa0/24
      SW1(config-if)#ip arp inspection trust
      SW1(config)#interface Gi0/1
      SW1(config-if)#ip arp inspection trust

      On real gear, Admin-PC with its static address would also need trust or an ARP ACL.

    4. Port security

      SW1(config)#interface range Fa0/1 - 2
      SW1(config-if-range)#switchport mode access
      SW1(config-if-range)#switchport access vlan 10
      SW1(config-if-range)#switchport port-security
      SW1(config-if-range)#switchport port-security maximum 2
      SW1(config-if-range)#switchport port-security mac-address sticky
      SW1(config-if-range)#switchport port-security violation restrict
      SW1(config)#interface Fa0/3
      SW1(config-if)#switchport mode access
      SW1(config-if)#switchport port-security
      SW1(config-if)#switchport port-security violation shutdown

      Put a hub on Fa0/3 with two devices behind it, or swap the device on the port, and send traffic to trigger the violation.

    5. AAA on R1

      On Server-AAA, Services, AAA: add client R1 (10.0.0.1, key of your choice, type TACACS) and a user.

      R1(config)#username backup secret <a long local password>
      R1(config)#tacacs-server host 10.0.0.20 key <the key>
      R1(config)#aaa new-model
      R1(config)#aaa authentication login default group tacacs+ local
      R1(config)#line vty 0 4
      R1(config-line)#login authentication default
      R1(config-line)#transport input ssh

      SSH from Admin-PC with the server account. Then turn off the AAA service on the server and confirm the backup account still works. Optional: repeat with radius-server host and group radius local.

    6. Verify

      SW1#show ip dhcp snooping
      SW1#show ip dhcp snooping binding
      SW1#show ip arp inspection vlan 10
      SW1#show port-security
      SW1#show port-security interface Fa0/1
      SW1#show interfaces status err-disabled
      SW1#show running-config | include sticky
      R1#show users

    You are done when: PCs only get .100 and up after snooping; the binding table lists PC1 and PC2; show port-security shows Fa0/1 and Fa0/2 with maximum 2 and Fa0/3 err-disabled after the violation; SSH to R1 works with the server account and, with the server off, with the backup account.

    Packet Tracer limits and notes

    • DHCP snooping works on the 2960 in Packet Tracer, but the binding table output can be sporadic, per Wendell Odom's CCNA lab notes for PT 8.0 (certskills.com). The same notes say it could be configured on the 3650 but only worked on 2960s in their testing.
    • Dynamic ARP Inspection: per the same source, Packet Tracer 8.0 accepts the DAI commands but does not actually filter bad ARP, and may show the VLAN as inactive. Treat DAI as configuration practice, not a working defence demo. Whether newer builds behave better is UNVERIFIED.
    • Port security works on the 2960 in Packet Tracer in the outline author's experience. AAA with TACACS+ and RADIUS against Server-PT is supported in that experience too; the newer named syntax (tacacs server NAME) is UNVERIFIED, so this lab uses tacacs-server host. show aaa servers is also UNVERIFIED.
    • IPsec VPN configuration is outside CCNA scope and Packet Tracer's depth of support is UNVERIFIED, so VPNs stay conceptual.
    • Packet Tracer simulates a subset of IOS. If a command here is rejected in your version, note it, skip that step and carry on; the concept still applies to real Cisco gear.

    Download the lab checklist (.txt) Print it or keep it open beside Packet Tracer.

    Key takeaways

    • Name the threat, the vulnerability, the exploit and the mitigation.
    • Port security caps MACs per port; default is 1 MAC and shutdown.
    • DHCP snooping trusts only server-facing ports and builds the binding table.
    • DAI uses that table to drop spoofed ARP.
    • AAA centralises logins; keep a rarely used local fallback.
    • MFA and awareness are part of network security.

    Finished the sections, quiz and lab? Mark the lesson complete. Progress is saved only in this browser.