00 Windows Command
Windows Client Commands
End hosts maintain a local DNS cache and a static hosts file to reduce unnecessary DNS queries. The hosts file is checked before querying a DNS server.
# Display all IP parameters, including the configured DNS server
:: View full IP configuration including DHCP status, lease obtained/expiration, DNS, Gateway
C:\> ipconfig /all
# Query a specific DNS server for a hostname's IP address
C:\> nslookup youtube.com
# Display the local DNS resolver cache
C:\> ipconfig /displaydns
# Clear the local DNS resolver cache
C:\> ipconfig /flushdns
:: Release the current DHCP-leased IP address (sends DHCP Release message)
C:\> ipconfig /release
:: Request a new IP address (sends DHCP Discover message)
C:\> ipconfig /renew
:: Check arp table
C:\> arp -a
01 Network Device
02 Interface Cable
PINOUT RULES (10/100 Mbps):
- PC / Router / Firewall : Tx on Pins 1 & 2 | Rx on Pins 3 & 6
- Switch : Tx on Pins 3 & 6 | Rx on Pins 1 & 2
CABLE SELECTION RULES:
- Different devices (PC to Switch) = Straight-through
- Same devices (Router to Router) = Crossover
- Modern devices = Auto MDI-X (Any cable works)
WIRE USAGE RULES:
- 10/100 Mbps (10BASE-T / 100BASE-T) = 4 wires (Pins 1, 2, 3, 6)
- 1/10 Gbps (1000BASE-T / 10GBASE-T) = 8 wires (All pins, bidirectional)
DISTANCE LIMITS:
- UTP = 100 meters max
- Multimode Fiber = Hundreds of meters (e.g., 400m - 550m)
- Single-mode Fiber = Kilometers (e.g., 5km - 30km+)
03 TCP IP
Protocol Data Units (PDUs)
Layer 5 (App): [ Application Data ]
Layer 4 (Trans): [ L4 Header | Application Data ] = Segment (TCP) or Datagram (UDP)
Layer 3 (Net): [ L3 Header | L4 Header | App Data ] = Packet
Layer 2 (Link): [ L2 Header | Packet | L2 Trailer ] = Frame
Layer 1 (Phys): [ Bits transmitted over wire ]
04 IOS CLI
Save configuration
Ctrl + Shift + 6
# to terminate IOS command
Router# write
Router# write memory
Router# copy running-config startup-config
| Command |
Mode to Execute |
Full Syntax / Purpose |
enable |
User EXEC |
Enters Privileged EXEC mode. |
configure terminal |
Privileged EXEC |
Enters Global Configuration mode (Shortcut: conf t). |
enable password <pass> |
Global Config |
Sets a plain-text password for Privileged EXEC mode. |
enable secret <pass> |
Global Config |
Sets a secure MD5-hashed password for Privileged EXEC mode. |
service password-encryption |
Global Config |
Encrypts current and future plain-text passwords (Type 7). |
no service password-encryption |
Global Config |
Stops encrypting future passwords (does not decrypt existing ones). |
show running-config |
Privileged EXEC |
Displays the active configuration in RAM (Shortcut: sh run). |
show startup-config |
Privileged EXEC |
Displays the saved configuration in NVRAM (Shortcut: sh start). |
write / write memory |
Privileged EXEC |
Saves the running-config to the startup-config. |
copy running-config startup-config |
Privileged EXEC |
Saves the running-config to the startup-config. |
do <command> |
Any Config Mode |
Executes a Privileged EXEC command from a lower mode. |
no <command> |
Global Config |
Removes or negates a previously entered configuration command. |
exit |
Any Mode |
Moves down one level in the CLI hierarchy (or logs out from User EXEC). |
05 06 LAN
| Field |
Size |
Purpose |
| Preamble |
7 bytes (56 bits) |
Alternating 1s and 0s for receiver clock synchronization. |
| Start Frame Delimiter (SFD) |
1 byte (8 bits) |
Indicates the end of the preamble and start of the actual frame. |
| Destination MAC |
6 bytes (48 bits) |
The physical address of the intended recipient. |
| Source MAC |
6 bytes (48 bits) |
The physical address of the sending device. |
| Type / Length |
2 bytes (16 bits) |
$\le$ 1500: Indicates payload Length in bytes. $\ge$ 1536: Indicates Type (e.g., 0x0800 = IPv4, 0x86DD = IPv6, 0x0806 = ARP). |
| Payload & Padding |
46 - 1500 bytes |
The encapsulated Layer 3 Packet. If payload is < 46 bytes, padding (hex 00) is added. |
| Frame Check Sequence (FCS) |
4 bytes (32 bits) |
Used for error detection via Cyclic Redundancy Check (CRC). |
Layer 2 commands
| Command |
Description |
show mac address-table |
Displays the switch’s MAC address table (VLAN, MAC, Type, Port). |
clear mac address-table dynamic |
Flushes all dynamically learned MAC addresses (forces re-learning). |
clear mac address-table dynamic address <mac> |
Removes a specific MAC address entry. |
clear mac address-table dynamic interface <id> |
Removes all MAC entries associated with a specific interface. |
show arp |
Displays the device’s ARP table (IPv4 to MAC mappings). |
ping <ip> |
Tests reachability using ICMP Echo Requests (Default: 5x 100-byte packets). |
07 08 IPv4 address
| Class |
First Octet Range |
Leading Bits |
Default Prefix |
Default Subnet Mask |
Networks |
Hosts per Network |
| A |
1 - 126 |
0 |
/8 |
255.0.0.0 |
126 |
16,777,214 |
| B |
128 - 191 |
10 |
/16 |
255.255.0.0 |
16,384 |
65,534 |
| C |
192 - 223 |
110 |
/24 |
255.255.255.0 |
2,097,152 |
254 |
| D |
224 - 239 |
1110 |
N/A |
N/A |
N/A (Multicast) |
N/A |
| E |
240 - 255 |
1111 |
N/A |
N/A |
N/A (Experimental) |
N/A |
Router> enable
Router# configure terminal
Router(config)# interface gigabitethernet 0/0
Router(config-if)# description #Connected_to_SW1#
Router(config-if)# ip address 192.168.1.254 255.255.255.0
Router(config-if)# no shutdown
Router(config-if)# exit
Interface
| Command |
Purpose |
show ip interface brief |
Displays a summary of all interfaces, including IP address, Layer 1 status, and Layer 2 protocol state. |
show interfaces [interface] |
Displays detailed Layer 1, Layer 2, and some Layer 3 information (including MAC/BIA address) for a specific interface. |
show interfaces description |
Displays interface status alongside configured descriptions. |
! Enter privileged EXEC mode
Router> enable
! Enter global configuration mode
Router# configure terminal
! Enter interface configuration mode
Router(config)# interface gigabitethernet 0/0
Router(config)# int g0/0
! Configure IP address and subnet mask
Router(config-if)# ip address <ip_address> <subnet_mask>
! Enable the interface
Router(config-if)# no shutdown
Router(config-if)# no shut
! Add a text description to the interface
Router(config-if)# description <text>
! Verify interface IP and status summary
Router# show ip interface brief
Router# sh ip int br
! Verify detailed interface information (includes MAC/BIA)
Router# show interfaces [interface_id]
! Verify interface descriptions
Router# show interfaces description
09 Switch Interface
L1 L2 status
! Check Layer 1 and Layer 2 status
SW1# show ip interface brief
SW1# show interfaces status
! Scroll to the bottom of the output to view error counters
SW1# show interfaces fastEthernet 0/1
Interface speed, duplex, description
SW1(config)# interface fastEthernet 0/1
SW1(config-if)# speed 100
SW1(config-if)# duplex full
SW1(config-if)# description Connected to R1
Multiple Interfaces
! Shut down a consecutive range of unused interfaces
SW1(config)# interface range fastEthernet 0/5 - 12
SW1(config-if-range)# description UNUSED
SW1(config-if-range)# shutdown
! Enable non-consecutive interfaces
SW1(config)# interface range fastEthernet 0/5 - 6, fastEthernet 0/9 - 12
SW1(config-if-range)# no shutdown
| Command |
Description |
show ip interface brief |
Displays Layer 1/2 status and IP addresses. |
show interfaces status |
Displays description, VLAN, duplex, speed, and connection status. |
show interfaces [id] |
Displays detailed interface statistics and error counters. |
speed [10 | 100 | 1000 | auto] |
Configures interface speed. |
duplex [full | half | auto] |
Configures interface duplex. |
description [text] |
Adds a text description to the interface. |
interface range [range] |
Enters configuration mode for multiple interfaces at once. |
shutdown / no shutdown |
Administratively disables or enables an interface. |
! Complete Interface Configuration Example
SW1(config)# interface range fastEthernet 0/1 - 4
SW1(config-if-range)# description CONNECTED_TO_HOSTS
SW1(config-if-range)# speed auto
SW1(config-if-range)# duplex auto
SW1(config-if-range)# no shutdown
SW1(config)# interface range fastEthernet 0/5 - 48
SW1(config-if-range)# description UNUSED_PORTS
SW1(config-if-range)# shutdown
| Field |
Length |
Purpose & Details |
| Version |
4 bits |
Identifies the IP version. IPv4 = 4 (0100 in binary). IPv6 = 6 (0110 in binary). Note: IPv5 was an experimental protocol (Internet Stream Protocol) never publicly used. |
| Internet Header Length (IHL) |
4 bits |
Indicates the length of the header in 4-byte increments. - Min value: 5 (5 x 4 = 20 bytes, no options). - Max value: 15 (15 x 4 = 60 bytes, meaning 40 bytes of options). |
| DSCP |
6 bits |
Differentiated Services Code Point. Used for QoS (Quality of Service) to prioritize delay-sensitive traffic like voice and video. |
| ECN |
2 bits |
Explicit Congestion Notification. Signals network congestion without dropping packets. Optional; requires support from both endpoints and network infrastructure. |
| Total Length |
16 bits |
Total length of the entire packet (Header + Data) in bytes (not 4-byte increments). - Min: 20 bytes (header only). - Max: 65,535 bytes. |
| Identification |
16 bits |
Uniquely identifies the original IP packet. All fragments of the same packet share this value so the receiver can reassemble them. |
| Flags |
3 bits |
Controls and identifies fragmentation. - Bit 0: Reserved (always 0). - Bit 1 (DF): Don’t Fragment. If 1, packet cannot be fragmented. - Bit 2 (MF): More Fragments. Set to 1 if more fragments are coming; 0 for the last fragment or unfragmented packets. |
| Fragment Offset |
13 bits |
Indicates the position of the fragment within the original unfragmented packet. Allows reassembly even if fragments arrive out of order. |
| Time to Live (TTL) |
8 bits |
Prevents infinite routing loops. Decremented by 1 at each router (hop count). Packet is dropped if TTL reaches 0. Originally designed for seconds, but practically acts as a hop count. Recommended default is 64. |
| Protocol |
8 bits |
Identifies the encapsulated Layer 4 PDU type. - TCP = 6 - UDP = 17 - ICMP = 1 (used by ping) - OSPF = 89 |
| Header Checksum |
16 bits |
Checks for errors ONLY in the IPv4 header. It does not check the encapsulated data (Layer 4 protocols like TCP/UDP handle data error checking). |
| Source IP |
32 bits |
IPv4 address of the sender. |
| Destination IP |
32 bits |
IPv4 address of the intended receiver. |
| Options |
Variable (0-40 bytes) |
Rarely used. If present, the IHL field will be greater than 5. Max length is 320 bits (40 bytes). |
Ping commands
! Standard ping (Default size is 100 bytes on Cisco IOS)
Router# ping 192.168.1.2
! Large ping (10,000 bytes). Exceeds the 1500-byte Ethernet MTU, causing fragmentation.
! Wireshark will show multiple fragments with the same Identification value and MF (More Fragments) bit set to 1, except for the last fragment.
Router# ping 192.168.1.2 size 10000
! Ping with the Don't Fragment (DF) bit set.
! If the packet size exceeds the MTU and the DF bit is set, the router will drop the packet and the ping will fail.
Router# ping 192.168.1.2 df-bit
11 Static Route
Connected and Local Routes
Router(config)# interface gigabitethernet0/2
Router(config-if)# ip address 192.168.1.1 255.255.255.0
Router(config-if)# no shutdown
Router(config-if)# exit
Router# show ip interface brief
Router# show ip route
Things to note: In the show ip route output, you may see lines like 192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks. These are not routes; they are informational headers indicating that the routing table contains multiple subnets and masks within that major network.
- To configure static routes,
- on a router, add the destination network it needs to go, and which next-hop is directly connected to it
Static Route Configuration
Router(config)# ip route <destination_network> <subnet_mask> <next_hop_ip | exit_interface | both>
- Next-Hop IP: The IP address of the adjacent router’s interface (Recommended).
- Exit Interface: The local interface the packet should be sent out of.
- Both: Specifies both the exit interface and next-hop IP.
Default Route Configuration
! Configure default route pointing to an ISP router
Router(config)# ip route 0.0.0.0 0.0.0.0 203.0.113.2
! Restore interface back to default
Router(config)# default interface g1/0/2
12 Packet Life
Relevant commands
! View the ARP table (IP to MAC mappings)
Router# show arp
Router# show ip arp
! View the MAC address table on a switch (Learned MACs per port)
Switch# show mac address-table
! View the routing table (Used to determine the next-hop IP)
Router# show ip route
! View interface details including IP and burned-in MAC address
Router# show ip interface brief
Router# show interfaces gigabitEthernet 0/0
! Clear the ARP cache to force a new ARP request
Router# clear arp-cache
13 15 Subnet
Subnet Mask Cheat Sheet (Class C Example)
| CIDR |
Subnet Mask |
Host Bits |
Usable Hosts |
Block Size |
| /24 |
255.255.255.0 |
8 |
254 |
256 |
| /25 |
255.255.255.128 |
7 |
126 |
128 |
| /26 |
255.255.255.192 |
6 |
62 |
64 |
| /27 |
255.255.255.224 |
5 |
30 |
32 |
| /28 |
255.255.255.240 |
4 |
14 |
16 |
| /29 |
255.255.255.248 |
3 |
6 |
8 |
| /30 |
255.255.255.252 |
2 |
2 |
4 |
# Calculate Usable Hosts
Usable_Hosts = (2 ^ host_bits) - 2
# Calculate Number of Subnets
Total_Subnets = 2 ^ borrowed_bits
# Calculate Block Size (Magic Number)
Block_Size = 256 - (Value of the last octet in the subnet mask)
Applying Subnets in Cisco IOS
! Entering interface configuration mode
Router(config)# interface GigabitEthernet0/0
! Assigning an IP address and subnet mask (Dotted Decimal format required in IOS)
! Example: 192.168.1.1 with a /26 mask (255.255.255.192)
Router(config-if)# ip address 192.168.1.1 255.255.255.192
! Activating the interface
Router(config-if)# no shutdown
! Verifying the IP and subnet configuration
Router# show ip interface brief
Router# show ip route
16 VLAN
| Field |
Size |
Description |
| TPID (Tag Protocol Identifier) |
16 bits (2 bytes) |
Always set to hexadecimal 0x8100. Identifies the frame as 802.1Q tagged. |
| TCI (Tag Control Information) |
16 bits (2 bytes) |
Contains three sub-fields: PCP, DEI, and VID. |
| ↳ PCP (Priority Code Point) |
3 bits |
Used for Class of Service (CoS) to prioritize traffic. |
| ↳ DEI (Drop Eligible Indicator) |
1 bit |
Indicates if the frame can be dropped during congestion. |
| ↳ VID (VLAN ID) |
12 bits |
Identifies the specific VLAN (1-4094). |
Basic VLAN & Access Port Configuration
! Check existing VLANs
Switch# show vlan brief
! Create and name a VLAN manually
Switch(config)# vlan 10
Switch(config-vlan)# name ENGINEERING
Switch(config-vlan)# exit
! for different ranges
Switch(config)# interface range g1/0,g2/0,g3/0
! Configure an interface as an Access Port
Switch(config)# interface range g1/0 - 3
Switch(config-if)# switchport mode access
Switch(config-if)# switchport access vlan 10
! Note: If VLAN 10 didn't exist, it is auto-created here.
! For an acess switch, config vlan access mode on both ingress and egress port
Trunk Port Configuration
! Set encapsulation (Only required on older switches supporting both ISL and Dot1q)
Switch(config-if)# switchport trunk encapsulation dot1q
! Manually force the port into Trunk mode
Switch(config-if)# switchport mode trunk
! Restrict allowed VLANs on the trunk
Switch(config-if)# switchport trunk allowed vlan 10,30
Switch(config-if)# switchport trunk allowed vlan add 20
Switch(config-if)# switchport trunk allowed vlan remove 20
Switch(config-if)# switchport trunk allowed vlan all
Switch(config-if)# switchport trunk allowed vlan except 1-5,10
Switch(config-if)# switchport trunk allowed vlan none
! Change the Native VLAN (Best Practice: use an unused VLAN)
Switch(config-if)# switchport trunk native vlan 1001
! Verify trunk configuration
Switch# show interfaces trunk
Router on a Stick (ROAS) Configuration
! Enable the physical interface (No IP address on physical interface)
Router(config)# interface g0/0
Router(config-if)# no shutdown
Router(config-if)# exit
! Configure Subinterface for VLAN 10
Router(config)# interface g0/0.10
Router(config-subif)# encapsulation dot1q 10
Router(config-subif)# ip address 192.168.1.254 255.255.255.192
! To delete subinterface
Router(config)# no interfaces g0/0.10
! Configure Subinterface for VLAN 20
Router(config)# interface g0/0.20
Router(config-subif)# encapsulation dot1q 20
Router(config-subif)# ip address 192.168.1.126 255.255.255.192
! Configure Native VLAN on a subinterface (Option 1)
Router(config)# interface g0/0.1
Router(config-subif)# encapsulation dot1q 1 native
Router(config-subif)# ip address 192.168.1.62 255.255.255.192
! Use same subinterface number as VLAN numbers
Layer 3 Switch Configuration
! if in L2, check by running ip ?, if there are ip add command available it is in L3
! Enable Layer 3 routing globally on the switch (CRITICAL STEP)
Switch(config)# ip routing
! else show ip route will be empty
! Configure an SVI (Switch Virtual Interface) for VLAN 10
Switch(config)# interface vlan 10
Switch(config-if)# ip address 192.168.1.254 255.255.255.192
Switch(config-if)# no shutdown
! Note: SVIs are shutdown by default!
Switch(config-if)# do show ip int br
! check for vlan to be up
! Convert a physical switchport into a Layer 3 Routed Port
Switch(config)# interface g0/1
Switch(config-if)# no switchport
Switch(config-if)# ip address 192.168.1.193 255.255.255.252
Switch(config-if)# no shutdown
! Configure a default route on the Layer 3 Switch pointing to an upstream router
Switch(config)# ip route 0.0.0.0 0.0.0.0 192.168.1.194
! Verify SVI and Routing status
Switch# show ip interface brief
Switch# show ip route
Switch# show interfaces status
Verification Commands
Switch# show vlan
Switch# show vlan brief
Switch# show interfaces trunk
Switch# show ip interface brief
Switch# show ip route
Switch# show interfaces status
Access Port & VLAN Commands
Switch(config)# vlan [1-4094]
Switch(config-vlan)# name [NAME]
Switch(config-if)# switchport mode access
Switch(config-if)# switchport access vlan [1-4094]
Trunk Port Commands
Switch(config-if)# switchport trunk encapsulation dot1q
Switch(config-if)# switchport mode trunk
Switch(config-if)# switchport trunk allowed vlan [vlan-list]
Switch(config-if)# switchport trunk allowed vlan add [vlan-list]
Switch(config-if)# switchport trunk allowed vlan remove [vlan-list]
Switch(config-if)# switchport trunk allowed vlan all
Switch(config-if)# switchport trunk allowed vlan except [vlan-list]
Switch(config-if)# switchport trunk allowed vlan none
Switch(config-if)# switchport trunk native vlan [1-4094]
Router on a Stick (ROAS) Commands
Router(config)# interface [interface-id].[subinterface-id]
Router(config-subif)# encapsulation dot1q [vlan-id]
Router(config-subif)# encapsulation dot1q [vlan-id] native
Router(config-subif)# ip address [ip] [mask]
Layer 3 Switch Commands
Switch(config)# ip routing
Switch(config)# interface vlan [vlan-id]
Switch(config-if)# ip address [ip] [mask]
Switch(config-if)# no shutdown
Switch(config-if)# no switchport
Switch(config)# ip route 0.0.0.0 0.0.0.0 [next-hop-ip]
19 Dynamic Trunking Protocol
DTP Configuration
! Check interface switchport details (Administrative vs Operational mode)
Switch# show interfaces [interface_id] switchport
! Configure DTP modes
Switch(config-if)# switchport mode dynamic desirable
Switch(config-if)# switchport mode dynamic auto
! Disable DTP negotiation (Stops sending DTP frames)
Switch(config-if)# switchport nonegotiate
! Configure trunk encapsulation manually (Required on switches supporting both ISL and dot1q)
Switch(config-if)# switchport trunk encapsulation dot1q
Switch(config-if)# switchport trunk encapsulation isl
Switch(config-if)# switchport trunk encapsulation negotiate
VLAN Trunking Protocol (VTP)
! Show VTP status, domain, version, and revision number
Switch# show vtp status
! Configure VTP Domain name
Switch(config)# vtp domain [name]
! Configure VTP Mode
Switch(config)# vtp mode server
Switch(config)# vtp mode client
Switch(config)# vtp mode transparent
! Configure VTP Version (Changing version increases the revision number!)
Switch(config)# vtp version [1 | 2 | 3]
DTP & VTP summary
! --- DTP COMMANDS ---
! View interface switchport details (Admin vs Operational mode)
Switch# show interfaces [interface_id] switchport
! Set DTP negotiation modes
Switch(config-if)# switchport mode dynamic desirable
Switch(config-if)# switchport mode dynamic auto
! Disable DTP frames (Stops negotiation)
Switch(config-if)# switchport nonegotiate
! Can only stop once the operational mode is trunk (run sw mode trunk)
! Manually set trunk encapsulation (If switch supports both ISL and dot1q)
Switch(config-if)# switchport trunk encapsulation dot1q
Switch(config-if)# switchport trunk encapsulation isl
Switch(config-if)# switchport trunk encapsulation negotiate
! --- VTP COMMANDS ---
! View VTP status (Version, Domain, Mode, Revision Number)
Switch# show vtp status
! Set VTP Domain Name
Switch(config)# vtp domain [name]
! Set VTP Operating Mode
Switch(config)# vtp mode server
Switch(config)# vtp mode client
Switch(config)# vtp mode transparent
! vtp server sync vlan number and domain even if no ip is assigned
! vtp transparent can add vlan indep and allow other vtp to sync
! vtp client cannot add vlan indep
! Set VTP Version (1, 2, or 3)
Switch(config)# vtp version [1 | 2 | 3]
20 Spanning Tree Protocol (STP)
STP Port Role
| Port Role |
Quantity |
Description |
State |
| Root Port (RP) |
1 per non-root switch |
The port with the lowest cost path to the Root Bridge. |
Forwarding |
| Designated Port (DP) |
1 per collision domain |
The port on a segment closest to the Root Bridge. Forwards BPDUs down the tree. |
Forwarding |
| Non-Designated Port |
0 or more per switch |
Redundant ports that do not meet RP or DP criteria. Prevents loops. |
Blocking |
STP Port States
| State |
Duration |
Forwards Traffic? |
Learns MACs? |
Processes BPDUs? |
| Disabled |
N/A |
No |
No |
No (Administratively down) |
| Blocking |
Indefinite |
No |
No |
Receives only (Does not forward) |
| Listening |
15 seconds |
No |
No |
Sends/Receives |
| Learning |
15 seconds |
No |
Yes |
Sends/Receives |
| Forwarding |
Indefinite |
Yes |
Yes |
Sends/Receives |
STP Timers
- Hello Timer (2 seconds): How often the Root Bridge sends Configuration BPDUs.
- Forward Delay Timer (15 seconds): Time spent in Listening and Learning states. (Total 30 seconds).
- Max Age Timer (20 seconds): How long a switch waits without receiving BPDUs before assuming the topology has changed and recalculating.
- Total Convergence Time: A blocked port takes 50 seconds to transition to forwarding (20s Max Age + 15s Listening + 15s Learning).
STP Configuration
Configuring the Root Bridge
Instead of manually calculating priorities in increments of 4096, use the macro commands:
Switch(config)# spanning-tree vlan 1 root primary
Sets priority to 24576, or 4096 less than the current lowest priority in the network.
Switch(config)# spanning-tree vlan 1 root secondary
Sets priority to 28672 (acts as the backup root).
Load Balancing with PVST+
! On SW1: Primary for VLAN 10, Secondary for VLAN 20
Switch(config)# spanning-tree vlan 10 root primary
Switch(config)# spanning-tree vlan 20 root secondary
! On SW2: Primary for VLAN 20, Secondary for VLAN 10
Switch(config)# spanning-tree vlan 20 root primary
Switch(config)# spanning-tree vlan 10 root secondary
Modifying Interface Parameters
Switch(config-if)# spanning-tree vlan 1 cost 19
Switch(config-if)# spanning-tree vlan 1 port-priority 64
Note: Port priority must be configured in increments of 32 (0, 32, 64… 224).
Enabling Edge Port Protections
! Interface level
Switch(config-if)# spanning-tree portfast
Switch(config-if)# spanning-tree bpduguard enable
! Global level (Applies to all access ports)
Switch(config)# spanning-tree portfast default
Switch(config)# spanning-tree portfast bpduguard default
Things to note: If a port is shut down by BPDU Guard, you must manually recover it by issuing shutdown followed by no shutdown on the interface, after removing the offending device.
STP Command Summary
! --- STP Mode Configuration ---
Switch(config)# spanning-tree mode pvst
Switch(config)# spanning-tree mode rapid-pvst
! --- Root Bridge Election ---
Switch(config)# spanning-tree vlan [vlan_id] root primary
Switch(config)# spanning-tree vlan [vlan_id] root secondary
Switch(config)# spanning-tree vlan [vlan_id] priority [priority_value]
! --- Interface STP Parameters ---
Switch(config-if)# spanning-tree vlan [vlan_id] cost [1-200000000]
Switch(config-if)# spanning-tree vlan [vlan_id] port-priority [0-224 in increments of 32]
! --- PortFast Configuration ---
Switch(config-if)# spanning-tree portfast
Switch(config)# spanning-tree portfast default
! --- BPDU Guard Configuration ---
Switch(config-if)# spanning-tree bpduguard enable
Switch(config)# spanning-tree portfast bpduguard default
! --- Interface Recovery ---
Switch(config-if)# shutdown
Switch(config-if)# no shutdown
Verification Commands
Switch# show spanning-tree interface <interface> detail
Switch# show running-config interface <interface>
Switch# show running-config vlan <vlan-id>
Switch# show spanning-tree
Switch# show spanning-tree summary
Switch# show errdisable recovery
Switch# show interfaces <interface>
PortFast Configuration
! Enable on a specific access interface
Switch(config-if)# spanning-tree portfast
! Modern IOS automatically appends 'edge' -> spanning-tree portfast edge
! Enable on a specific trunk interface (Use case: Router-on-a-stick, Virtualization server)
Switch(config-if)# spanning-tree portfast trunk
! Enable by default on ALL access ports globally
Switch(config)# spanning-tree portfast default
! Disable PortFast on a specific interface (if enabled globally)
Switch(config-if)# spanning-tree portfast disable
PortFast Verification
Switch# show spanning-tree interface gigabitethernet 0/1 detail
! Look for: "The port is in the portfast edge mode"
Switch# show running-config interface gigabitethernet 0/1
! Note: Modern IOS adds the 'edge' keyword automatically. Packet Tracer may not support the 'edge' keyword.
BPDU Guard
- Concept: Protects the STP topology from unauthorized switches. If a BPDU Guard-enabled port receives a BPDU, it immediately enters the err-disabled state (shuts down the port).
! Enable per-port
Switch(config-if)# spanning-tree bpduguard enable
! Enable globally on ALL PortFast-enabled ports (Not necessarily all access ports)
Switch(config)# spanning-tree portfast bpduguard default
! Disable per-port
Switch(config-if)# spanning-tree bpduguard disable
- Err-Disable Recovery:
- When a port is err-disabled, it must be fixed.
- Manual Recovery:
shutdown followed by no shutdown on the interface.
- Automatic Recovery: Disabled by default. Default timer is 300 seconds (5 minutes).
! View err-disable recovery status and timers
Switch# show errdisable recovery
! Enable automatic recovery for BPDU Guard violations
Switch(config)# errdisable recovery cause bpduguard
! Modify the recovery timer (e.g., to 60 seconds)
Switch(config)# errdisable recovery interval 60
BPDU Filter
- Concept: Prevents a port from sending BPDUs.
! 1. Enable per-port (HIGH RISK)
Switch(config-if)# spanning-tree bpdufilter enable
! Behavior: Port stops sending BPDUs AND ignores any received BPDUs. Effectively disables STP on the port. Can cause permanent Layer 2 loops if connected to a switch.
! 2. Enable globally (RECOMMENDED)
Switch(config)# spanning-tree portfast bpdufilter default
! Behavior: Port stops sending BPDUs. BUT if it receives a BPDU, PortFast and BPDU Filter are disabled, and it reverts to a normal STP port.
! Disable per-port
Switch(config-if)# spanning-tree bpdufilter disable
Root Guard
- Concept: Guards the root bridge of the LAN. Prevents a port from becoming a Root Port by blocking it if superior BPDUs (BPDUs claiming a better Root Bridge ID) are received.
- Can ONLY be configured per-port. There is no global default command.
Switch(config-if)# spanning-tree guard root
Loop Guard
- Concept: Protects against Layer 2 loops caused by unidirectional links or software bugs where a port unexpectedly stops receiving BPDUs.
! Enable per-port (Typically on Root and Non-Designated ports)
Switch(config-if)# spanning-tree guard loop
! Enable globally on all ports
Switch(config)# spanning-tree loopguard default
! Disable per-port
Switch(config-if)# spanning-tree guard none
22 Rapid Spanning Tree Protocol (RSTP)
| Protocol |
IEEE Standard / Cisco Proprietary |
STP Instances |
Load Balancing Capability |
Notes |
| Classic STP |
IEEE 802.1D |
1 (Shared by all VLANs) |
No |
Original standard; slow convergence (up to 50s). |
| PVST+ |
Cisco Proprietary |
1 per VLAN |
Yes |
Cisco’s upgrade to 802.1D. Requires dot1q trunking. |
| RSTP |
IEEE 802.1w |
1 (Shared by all VLANs) |
No |
Fast convergence via handshake, but no per-VLAN load balancing. |
| Rapid PVST+ |
Cisco Proprietary |
1 per VLAN |
Yes |
Default on modern Cisco switches. Combines RSTP speed with per-VLAN instances. |
| MSTP |
IEEE 802.1s |
Multiple VLANs per instance |
Yes |
Groups VLANs into instances (e.g., VLANs 1-100 in Instance 1). Cisco runs the standard 802.1s. Best for large networks. |
RSTP Port States
| RSTP State |
Description |
Traffic Forwarding? |
MAC Learning? |
| Discarding |
Combines Classic STP’s Blocking, Listening, and Disabled states. No user data is forwarded or learned. |
No |
No |
| Learning |
Port prepares to forward traffic; learns MAC addresses but does not forward user data. |
No |
Yes |
| Forwarding |
Port actively forwards user traffic and learns MAC addresses. |
Yes |
Yes |
RSTP Port Roles
| Port Role |
Description |
Fails Over To |
| Root Port (RP) |
Unchanged. The port with the lowest root cost to the Root Bridge. |
N/A |
| Designated Port (DP) |
Unchanged. The port on a segment sending the best BPDU. |
N/A |
| Alternate Port |
A discarding port that receives a superior BPDU from another switch. Acts as a backup to the Root Port. |
Root Port |
| Backup Port |
A discarding port that receives a superior BPDU from another interface on the same switch (only occurs when connected via a hub). Acts as a backup to a Designated Port. |
Designated Port |
RSTP Link Types
| Link Type |
Connected Device |
Duplex Mode |
Configuration Command |
| Edge |
End Host (PC, Server, Printer) |
N/A |
spanning-tree portfast |
| Point-to-Point |
Another Switch |
Full-Duplex |
spanning-tree link-type point-to-point (Auto-detected) |
| Shared |
Hub |
Half-Duplex |
spanning-tree link-type shared (Auto-detected) |
RSTP Configuration
! Set the spanning tree mode to Rapid PVST+ (Default on modern switches)
Switch(config)# spanning-tree mode rapid-pvst
! Verify STP mode, port roles, and states
Switch# show spanning-tree
! Configure an interface as an Edge port (PortFast)
Switch(config)# interface GigabitEthernet0/1
Switch(config-if)# spanning-tree portfast
! Edge port even if connected to hub, hub does not exist in STP
! Explicitly configure link type (usually auto-detected, but good to know)
Switch(config-if)# spanning-tree link-type point-to-point
Switch(config-if)# spanning-tree link-type shared
spanning-tree mode rapid-pvst ! Enable Rapid PVST+ (Default)
show spanning-tree ! View STP status, roles, and states
spanning-tree portfast ! Enable PortFast (configures Edge port)
spanning-tree link-type point-to-point ! Manually set link type to P2P
spanning-tree link-type shared ! Manually set link type to Shared
23 EtherChannel
L2 Load Balancing Configuration
- Concept: Traffic is load-balanced across the physical member interfaces based on flows (a communication session between two nodes), not per-packet. This prevents frames from arriving out of order, which can disrupt applications.
Switch# show etherchannel load-balance
Switch(config)# port-channel load-balance src-dst-mac
L2 Load Balancing Mode Configuration
! PAgP Configuration Example
Switch(config)# interface range gigabitethernet 0/1 - 4
Switch(config-if-range)# channel-group 1 mode desirable
! LACP Configuration Example (Preferred for CCNA)
Switch(config)# interface range gigabitethernet 0/1 - 4
Switch(config-if-range)# channel-group 1 mode active
! Static Configuration Example
Switch(config)# interface range gigabitethernet 0/1 - 4
Switch(config-if-range)# channel-group 1 mode on
on ↔ on (Static)
desirable ↔ desirable or auto (PAgP)
active ↔ active or passive (LACP)
- Invalid:
auto ↔ auto, passive ↔ passive, or mixing protocols (e.g., desirable ↔ active).
L2 Load Balancing Verifications
Switch# show etherchannel summary
Switch# show etherchannel port-channel
Switch# show interfaces trunk
show etherchannel summary Flags
| Flag |
Meaning |
Context |
| S |
Layer 2 EtherChannel (Switchport) |
Next to Port-Channel interface |
| R |
Layer 3 EtherChannel (Routed port) |
Next to Port-Channel interface |
| U |
In Use (Active and operational) |
Next to Port-Channel interface |
| P |
Bundled in Port-Channel |
Next to physical member interfaces (Desired state) |
| D |
Down |
Interface or Port-Channel is administratively down |
| s |
Suspended |
Interface excluded due to configuration mismatch |
L3 EtherChannel Configuration
- Concept: Used in modern network designs (e.g., between distribution and core switches) to eliminate STP entirely by using routed ports instead of switchports.
Switch(config)# interface range gigabitethernet 0/1 - 4
Switch(config-if-range)# no switchport
Switch(config-if-range)# channel-group 1 mode active
Switch(config-if-range)# exit
Switch(config)# interface port-channel 1
Switch(config-if)# no switchport
Switch(config-if)# ip address 10.0.0.1 255.255.255.252
Switch(config)# ip routing
Etherchannel Summary
! View current load-balancing method
Switch# show etherchannel load-balance
! Configure load-balancing method (e.g., src-dst-mac, src-dst-ip)
Switch(config)# port-channel load-balance src-dst-mac
! Configure physical interfaces for EtherChannel (PAgP, LACP, or Static)
Switch(config)# interface range gigabitethernet 0/1 - 4
Switch(config-if-range)# channel-group 1 mode {desirable | auto | active | passive | on}
! (Optional) Manually set the negotiation protocol
Switch(config-if-range)# channel-protocol {lacp | pagp}
! Configure Layer 3 EtherChannel
Switch(config-if-range)# no switchport
Switch(config)# interface port-channel 1
Switch(config-if)# no switchport
Switch(config-if)# ip address <ip> <mask>
! Verify EtherChannel status and flags
Switch# show etherchannel summary
! Verify detailed Port-Channel info (including mode)
Switch# show etherchannel port-channel
24 Dynamic Routes
Protocol Comparison
- IGP (Interior Gateway Protocol): Used to share routes within a single Autonomous System (AS) or organization (e.g., a company network).
- EGP (Exterior Gateway Protocol): Used to share routes between different Autonomous Systems (e.g., across the Internet).
| Protocol |
Category |
Algorithm Type |
Primary Use Case |
| RIP (Routing Information Protocol) |
IGP |
Distance Vector |
Legacy/Small networks |
| EIGRP (Enhanced Interior Gateway Routing Protocol) |
IGP |
Distance Vector |
Cisco-centric enterprise networks |
| OSPF (Open Shortest Path First) |
IGP |
Link State |
Modern enterprise networks (CCNA Focus) |
| IS-IS (Intermediate System to Intermediate System) |
IGP |
Link State |
Service Provider networks |
| BGP (Border Gateway Protocol) |
EGP |
Path Vector |
Internet routing (Between ASes) |
| Protocol |
Metric Type |
Calculation Details |
| RIP |
Hop Count |
Number of routers to the destination. Ignores link speed (10 Mbps = 10 Gbps). |
| EIGRP |
Composite |
Based primarily on Bandwidth (slowest link in path) and Delay (sum of all links). |
| OSPF |
Cost |
Calculated based on interface Bandwidth. Higher bandwidth = lower cost. |
| IS-IS |
Cost |
Default cost is 10 for all links (functions like hop count unless manually tuned). |
Administrative Distance (AD)
- Concept: A measure of the trustworthiness of a routing information source. Used to choose the best route when a router learns about the same destination from different routing protocols.
| Route Source |
Default Administrative Distance (AD) |
| Connected Interface |
0 (Most trusted) |
| Static Route |
1 |
| eBGP (External BGP) |
20 |
| EIGRP (Internal) |
90 |
| IGRP (Legacy) |
100 |
| OSPF |
110 |
| IS-IS |
115 |
| RIP |
120 |
| iBGP (Internal BGP) |
200 |
| Unusable / Unknown |
255 (Router will not install this route) |
Floating Static Routes
- Concept: A static route configured with a manually assigned AD higher than the dynamic routing protocol’s AD.
Router(config)# ip route 192.168.4.0 255.255.255.0 10.0.12.2 150
! Configure a standard static route (AD defaults to 1)
Router(config)# ip route [destination_network] [subnet_mask] [next_hop_ip | exit_interface]
! Configure a host route (specific /32 destination)
Router(config)# ip route 10.0.12.1 255.255.255.255 [next_hop_ip]
! Configure a floating static route (Backup route with higher AD)
Router(config)# ip route [destination_network] [subnet_mask] [next_hop_ip] [administrative_distance]
! Example:
Router(config)# ip route 192.168.4.0 255.255.255.0 10.0.12.2 150
! Verify routing table to check AD (left number in brackets) and Metric (right number)
Router# show ip route
! Configure loopback address
Router# interface Loopback 0
! interface ? to see other possible interfaces, the number that can be assigned is quite big
! normal to set /32 mask for loopback, always up
Router# show interface l0
! show route info and subnet information
Things to note: In show ip route output, routes are displayed with codes (e.g., C for Connected, S for Static, O for OSPF, D for EIGRP, R for RIP). The values in brackets [AD/Metric] are critical for troubleshooting route selection (e.g., [110/3] means AD is 110, Metric is 3). Static routes will show a metric of 0. Connected routes have an AD of 0, but it is not explicitly displayed in the brackets.
RIP Configuration
Router(config)# router rip
Router(config-router)# version 2
Router(config-router)# no auto-summary
Router(config-router)# network 10.0.0.0
Router(config-router)# passive-interface GigabitEthernet2/0
Router(config-router)# default-information originate
Router(config-router)# maximum-paths 8
Router(config-router)# distance 85
EIGRP Configuration
Router(config)# router eigrp 1
! 1 as AS number, must match for routers to be neighbours
Router(config-router)# no auto-summary
Router(config-router)# passive-interface GigabitEthernet2/0
Router(config-router)# network 10.0.0.0
Router(config-router)# network 172.16.1.0 0.0.0.15
! first param as one of the IP int configured on the device
Router(config-router)# eigrp router-id 1.1.1.1
Router(config-router)# distance 85
Router(config-router)# variance 2
! allow feasible successor routes with feasible distance up to 2 times the sucessor's route's feasible distance can be used to load balance
Router(config-router)# network 0.0.0.0 255.255.255.255
! Enable EIGRP on all interfaces (not reccomended in real)
Router# show ip protocols
! Check if EIGRP is auto-summarizing, and the passive interfaces
Router(config-router)# do show ip eigrp neighbors
Router(config-router)# do show ip eigrp topology
RIP EIGRP Commands Comparison
| Task |
RIP Command |
EIGRP Command |
| Enter Config Mode |
router rip |
router eigrp <AS> |
| Set Version |
version 2 |
N/A |
| Disable Auto-Summary |
no auto-summary |
no auto-summary |
| Activate on Interface |
network <classful-ip> |
network <ip> <wildcard-mask> |
| Stop Sending Updates |
passive-interface <int> |
passive-interface <int> |
| Advertise Default Route |
default-information originate |
network 0.0.0.0 (or redistribute) |
| Set Max ECMP Paths |
maximum-paths <1-32> |
maximum-paths <1-32> |
| Change Admin Distance |
distance <1-255> |
distance <1-255> |
| Set Router ID |
N/A |
eigrp router-id <ip> |
| Verify |
show ip protocols |
show ip protocols |
26 Open Shortest Path First (OSPF)
OSPF Configuration
! Enable OSPF process (Process ID is locally significant, does NOT need to match)
Router(config)# router ospf 1
! Activate OSPF on interfaces matching the network/wildcard in a specific area
Router(config-router)# network 10.0.12.0 0.0.0.255 area 0
! Alternative: Enable OSPF directly on the interface (No router ospf + network command needed)
Router(config-if)# ip ospf 1 area 0
! Configure Passive Interface (Stops Hello packets, still advertises the subnet)
Router(config-router)# passive-interface GigabitEthernet0/0
! OR make all passive by default, then enable specific ones
Router(config-router)# passive-interface default
Router(config-router)# no passive-interface GigabitEthernet0/0
! passive interface on access port and loopback interfaces
! Advertise a default route into OSPF (Makes router an ASBR)
Router(config)# ip route 0.0.0.0 0.0.0.0 203.0.113.2
Router(config-router)# default-information originate
! Manually configure Router ID (Requires process reset to take effect)
Router(config-router)# router-id 1.1.1.1
Router# clear ip ospf process
! Change OSPF Administrative Distance
Router(config-router)# distance 85
! View the LSDB
Router# show ip ospf database
! View the neighbours
Router# show ip ospf neighbors
OSPF Metric (Cost) Changes
! Change Reference Bandwidth (Value in Mbps, must match on ALL routers)
Router(config-router)# auto-cost reference-bandwidth 100000
! Manually set interface cost (Overrides auto-calculation = interface bw / reference bw, reference bw = 100)
Router(config-if)# ip ospf cost 50
! Change interface bandwidth (Value in kbps, NOT recommended for OSPF cost tuning)
Router(config-if)# bandwidth 100000
OSPF Neighbour Configuration
! Configure Hello/Dead Timers
Router(config-if)# ip ospf hello-interval 5
Router(config-if)# ip ospf dead-interval 20
! Configure Authentication
Router(config-if)# ip ospf authentication-key jeremy
Router(config-if)# ip ospf authentication
! Configure IP MTU
Router(config-if)# ip mtu 1400
OSPF Configuration & Verification
Router(config)# router ospf 1
Router(config-router)# network 10.0.0.0 0.0.255.255 area 0
Router(config-router)# passive-interface default
Router(config-router)# no passive-interface Gi0/0
Router(config-router)# default-information originate
Router(config-router)# router-id 1.1.1.1
Router(config-router)# auto-cost reference-bandwidth 100000
Router(config-router)# distance 90
Router(config-router)# shutdown / no shutdown
Router# clear ip ospf process
Router# show ip protocols
Router# show ip ospf neighbor
Router# show ip ospf interface [brief]
Router# show ip ospf database
Router# show ip route ospf
OSPF Interface Specific Configuration
Router(config-if)# ip ospf 1 area 0
Router(config-if)# ip ospf cost 50
Router(config-if)# bandwidth 100000
Router(config-if)# ip ospf hello-interval 10
Router(config-if)# ip ospf dead-interval 40
! need to make sure neighbour hello and dead interval the same
Router(config-if)# ip ospf priority 255
Router(config-if)# ip ospf network point-to-point
Router(config-if)# ip ospf authentication-key PASSWORD
Router(config-if)# ip ospf authentication
Router(config-if)# ip mtu 1500
Router(config-if)# encapsulation ppp
Router(config-if)# clock rate 64000
Router# show controllers serial 0/0
Serial Interface
Router(config-if)# ip address <IP> <MASK>
Router(config-if)# clock rate 64000
! only set rate on DCE interfaces (not DTE end), check from below
Router# show controllers serial 0/0
29 First Hop Redundancy Protocols (FHRP)
FHRP Comparison
| Feature |
HSRP (Hot Standby Router Protocol) |
VRRP (Virtual Router Redundancy Protocol) |
GLBP (Gateway Load Balancing Protocol) |
| Vendor |
Cisco Proprietary |
Open Standard |
Cisco Proprietary |
| Roles |
Active, Standby |
Master, Backup |
AVG (Active Virtual Gateway), AVF (Active Virtual Forwarder) |
| IPv4 Multicast |
v1: 224.0.0.2 v2: 224.0.0.102 |
224.0.0.18 |
224.0.0.102 |
| Virtual MAC Format |
v1: 0000.0c07.acXX v2: 0000.0c9f.fXXX |
0000.5e00.01XX |
0007.b400.XXYY (XX=Group, YY=AVF) |
| Load Balancing |
Across multiple subnets/VLANs only |
Across multiple subnets/VLANs only |
Within a single subnet (up to 4 routers) |
Hot Standby Router Protocol
! Enable HSRP Version 2 (Optional, but recommended for IPv6 and more groups)
Router(config-if)# standby version 2
! Configure the Virtual IP (VIP) for Group 1
Router(config-if)# standby 1 ip 172.16.0.254
! Set Priority (Range 0-255, Default is 100)
! Higher priority wins the Active election
Router(config-if)# standby 1 priority 200
! Enable Preemption so this router reclaims Active role if it recovers
Router(config-if)# standby 1 preempt
! Sets router priority for Active election (Default: 100)
standby [group] preempt ! Allows router to reclaim Active role if it has highest priority
! Verification Commands
show standby ! Displays HSRP state, VIP, VMAC, priorities, and timers
show standby brief ! Displays a summarized table of all HSRP groups on the router
30 TCP UDP
TCP Protocols
| Protocol |
Description |
Port(s) |
| FTP |
File Transfer Protocol |
20 (Data), 21 (Control) |
| SSH |
Secure Shell (Secure CLI access) |
22 |
| Telnet |
Unsecure CLI access |
23 |
| SMTP |
Simple Mail Transfer Protocol (Sending email) |
25 |
| HTTP |
Hypertext Transfer Protocol (Web pages) |
80 |
| POP3 |
Post Office Protocol v3 (Retrieving email) |
110 |
| HTTPS |
HTTP Secure (Encrypted web traffic) |
443 |
UDP Protocols
| Protocol |
Description |
Port(s) |
| DHCP |
Dynamic Host Configuration Protocol |
67 (Server), 68 (Client) |
| TFTP |
Trivial File Transfer Protocol |
69 |
| SNMP |
Simple Network Management Protocol |
161 (Traffic), 162 (Traps) |
| Syslog |
Log message standard |
514 |
Both TCP & UDP
| Protocol |
Description |
Port(s) |
| DNS |
Domain Name System |
53 (Usually UDP, TCP for large transfers) |
31 IPv6
IPv6 Address Types
| Address Type |
Prefix / Range |
Scope / Routing |
Description |
| Global Unicast (GUA) |
2000::/3 (Originally), now all unassigned |
Routable over Internet |
Public addresses. Requires registration. |
| Unique Local (ULA) |
FC00::/7 (Usually FD) |
Routable internally, dropped by ISP |
Private addresses. No registration needed. |
| Link-Local |
FE80::/10 (Usually FE80) |
Non-routable (Local subnet only) |
Auto-generated. Used for routing protocols/NDP. |
| Multicast |
FF00::/8 |
Varies by scope |
One-to-many. Replaces IPv4 Broadcast. |
| Anycast |
Any Unicast range |
Routable |
One-to-one-of-many. Nearest router responds. |
| Unspecified |
::/0 |
N/A |
All zeros. Used when device doesn’t know its IP. |
| Loopback |
::1/128 |
Local device only |
Tests protocol stack. Equivalent to 127.0.0.1. |
Multicast Scopes
| Scope |
Prefix |
Description |
| Interface-Local |
FF01:: |
Stays within the local device (node-local). |
| Link-Local |
FF02:: |
Stays within the local subnet. Not routed. |
| Site-Local |
FF05:: |
Limited to a single physical site/WAN boundary. |
| Organization-Local |
FF08:: |
Wider scope, across multiple sites in an org. |
| Global |
FF0E:: |
Routable across the public Internet. |
Important Multicast Addresses:
FF02::1: All Nodes (All Hosts) - Functions like a broadcast.
FF02::2: All Routers.
FF02::5: All OSPF Routers (IPv4: 224.0.0.5).
FF02::A: All EIGRP Routers (IPv4: 224.0.0.10).
| ICMPv6 Type |
Message Name |
Function |
Destination |
| 133 |
Router Solicitation (RS) |
Host asks for routers on the link. |
FF02::2 (All Routers) |
| 134 |
Router Advertisement (RA) |
Router announces presence, prefix, etc. |
FF02::1 (All Nodes) |
| 135 |
Neighbor Solicitation (NS) |
Asks for a neighbor’s MAC address (Replaces ARP Request). |
Target’s Solicited-Node Multicast |
| 136 |
Neighbor Advertisement (NA) |
Replies with MAC address (Replaces ARP Reply). |
Requester’s Unicast IP |
IPv6 Global Configuration
Router(config)# ipv6 unicast-routing
! Enables IPv6 routing globally (DISABLED BY DEFAULT)
IPv6 Interface Configuration
Router(config-if)# ipv6 address <ipv6-address>/<prefix-length>
! Configures a static IPv6 address (e.g., 2001:db8:0:1::1/64)
Router(config-if)# ipv6 address <ipv6-prefix>/<prefix-length> eui-64
! Generates Interface ID automatically from the interface's MAC address, EUI address
Router(config-if)# ipv6 address autoconfig
! Enables SLAAC (learns prefix from Router Advertisements)
Router(config-if)# ipv6 enable
! Enables IPv6 on the interface and auto-generates a Link-Local address only
Router(config-if)# ipv6 address <ipv6-address>/<prefix-length> anycast
! Configures an Anycast address (usually with /128)
Router(config-if)# no shutdown
! Activates the interface
IPv6 Static Routing
Router(config)# ipv6 route <prefix>/<prefix-length> <next-hop-ip>
! Recursive static route
Router(config)# ipv6 route <prefix>/<prefix-length> <exit-interface> <next-hop-ip>
! Fully specified static route (REQUIRED for link-local next-hops)
! This format for Ethernet interface
! Configure on both end of a serial interface
Router(config)# ipv6 route <prefix>/<prefix-length> <next-hop-ip> <AD>
! Floating static route (e.g., AD 120 for OSPF backup)
! Default static AD = 1
IPv6 Verification & Troubleshooting
Router# show ipv6 interface brief
! Displays IPv6 addresses (including auto-generated Link-Local) and status
Router# show ipv6 interface <interface>
! Shows detailed IPv6 info, including joined multicast groups
Router# show ipv6 route
! Displays the IPv6 routing table
Router# show ipv6 neighbor
! Displays the NDP neighbor table (equivalent to show ip arp)
Router# ping ipv6 <destination-ip>
! Tests IPv6 connectivity
34 Access Control List
Standard Numbered ACL
! Configure Standard Numbered ACL 1, implement as close to destination
R1(config)# access-list 1 permit 192.168.1.1 0.0.0.0
R1(config)# access-list 1 deny 192.168.1.0 0.0.0.255
R1(config)# access-list 1 permit any
R1(config)# access-list 1 remark Permit PC1, block rest of LAN 1
! Single host examples (all do the exact same thing)
R1(config)# access-list 1 deny 1.1.1.1 0.0.0.0
R1(config)# access-list 1 deny 1.1.1.1
R1(config)# access-list 1 deny host 1.1.1.1
Standard Named ACL
! Configure Standard Named ACL
R2(config)# ip access-list standard BLOCK_BOB
R2(config-std-nacl)# 5 deny 1.1.1.1
R2(config-std-nacl)# 10 permit any
R2(config-std-nacl)# remark Block Bob's PC only
! good practice instead of relying on implicit deny
R2(config-std-nacl)# deny any
Interface ACL configuration
! Apply ACL 1 outbound on GigabitEthernet 0/2
R1(config)# interface GigabitEthernet0/2
R1(config-if)# ip access-group 1 out
! Apply Named ACL outbound on GigabitEthernet 0/1
R2(config)# interface GigabitEthernet0/1
R2(config-if)# ip access-group BLOCK_BOB out
ACL Verification
! Display all ACLs and their match counters
R1# show access-lists
! Display only IPv4 ACLs
R1# show ip access-lists
! Filter running config for ACL application on interfaces
R1# show running-config | include access-list
! Display the entire ACL configuration block (Best for Named ACLs)
R1# show running-config | section access-list
ACL Command Summary
! --- Standard Numbered ACL Configuration ---
access-list [1-99, 1300-1999] [permit|deny] [source] [wildcard]
access-list [number] remark [text]
! --- Standard Named ACL Configuration ---
ip access-list standard [name]
[seq] [permit|deny] [source] [wildcard]
remark [text]
! --- Applying to Interface ---
interface [type/number]
ip access-group [number|name] [in|out]
! --- Verification ---
show access-lists
show ip access-lists
show running-config | include access-list
show running-config | section access-list
Extended Access Control List (E-ACL)
Numbered and Named E-ACL Configuration Methods
! Traditional Global Config Method (Harder to edit)
Router(config)# access-list 100 permit ip any any
! Named Config Mode Method (Recommended for editing)
Router(config)# ip access-list extended 100
Router(config-ext-nacl)# permit ip any any
Edit and Resequence E-ACLs
! Deleting a specific entry (Must be in named ACL config mode)
Router(config)# ip access-list extended 100
Router(config-ext-nacl)# no 30
! Inserting a new entry at a specific sequence number
Router(config-ext-nacl)# 30 deny tcp 192.168.2.0 0.0.0.255 any
! Resequencing an ACL (Global config mode)
! Syntax: ip access-list resequence [ACL Name/Number] [Starting Seq] [Increment]
Router(config)# ip access-list resequence 100 10 10
E-ACL Parameter & Protocol Matching
! Deny OSPF traffic (Protocol 89)
Router(config-ext-nacl)# deny 89 any any
! Deny ICMP (Ping) from a specific host to a specific subnet
Router(config-ext-nacl)# deny icmp host 172.16.1.1 192.168.0.0 0.0.0.255
E-ACLs Port Matching
! Deny TCP traffic from any source to host 1.1.1.1 on destination port 80 (HTTP)
Router(config-ext-nacl)# deny tcp any host 1.1.1.1 eq 80
! Permit TCP traffic from 10.0.0.0/16 to host 2.2.2.2 on destination port 443 (HTTPS)
Router(config-ext-nacl)# permit tcp 10.0.0.0 0.0.255.255 host 2.2.2.2 eq 443
! Deny UDP traffic from any source using source ports 20000-30000 to host 3.3.3.3
Router(config-ext-nacl)# deny udp any range 20000 30000 host 3.3.3.3
E-ACL Verification
! View all configured ACLs and their hit counts
Router# show access-lists
! View detailed IP information for a specific interface, including applied ACLs
Router# show ip interface GigabitEthernet0/1
E-ACLs Summary
! Enter extended named/numbered ACL configuration mode
Router(config)# ip access-list extended [name | 100-199 | 2000-2699]
! Configure an ACL entry with a specific sequence number
Router(config-ext-nacl)# [seq_num] [permit | deny] [protocol] [source_ip] [source_wildcard] [dest_ip] [dest_wildcard] [eq|gt|lt|neq|range port]
! Delete a specific ACL entry (Must be in ACL config mode)
Router(config-ext-nacl)# no [seq_num]
! Resequence an ACL (Global config mode)
Router(config)# ip access-list resequence [ACL_name_or_number] [starting_seq] [increment]
! Apply ACL to an interface
Router(config)# interface [type number]
Router(config-if)# ip access-group [ACL_name_or_number] [in | out]
! Verify ACL configuration and hit counts
Router# show access-lists
! Verify which ACLs are applied to an interface (inbound/outbound)
Router# show ip interface [type number]
36 Cisco Discovery Protocol (CDP) & Link Layer Discovery Protocol (LLDP)
CDP Verification Commands
R1# show cdp
! Shows global status: timers (60s/180s) and CDP version (v2).
R1# show cdp traffic
! Shows packet counters: number of CDP advertisements sent and received.
R1# show cdp interface [interface]
! Shows interface-specific info: encapsulation (ARPA/Ethernet 2), timers, and interface status.
R1# show cdp neighbors
R1# show cdp neighbors detail
! Shows extended info: IP address, IOS version, VTP management domain, Native VLAN, Duplex settings.
! Note: VTP info is only available via CDP because VTP is Cisco proprietary.
R1# show cdp entry <hostname>
! Shows the exact same detailed output as 'show cdp neighbors detail', but for a single specific neighbor.
Output columns for show cdp neighbors:
- Device ID: Hostname of the neighbor.
- Local Interface: Interface on the local device connected to the neighbor.
- Holdtime: Counts down from 180s. Resets when a new message is received.
- Capability: Device type codes: R (Router), S (Switch), I (IGMP), B (Source Route Bridge). Focus on R and S for the CCNA.
- Platform: Hardware model (e.g., C2900, C2960).
- Port ID: Interface on the neighboring device.
CDP Configuration Commands
R1(config)# cdp run
! Enables CDP globally (Default state). Use 'no cdp run' to disable.
R1(config-if)# cdp enable
! Enables CDP on a specific interface for both Tx and Rx (Default state). Use 'no cdp enable' to disable.
R1(config)# cdp timer <seconds>
! Changes the CDP update timer (Default: 60).
R1(config)# cdp holdtime <seconds>
! Changes the CDP holdtime (Default: 180).
R1(config)# cdp advertise-v1
! Disables CDPv2 and enables CDPv1. (CDPv2 is default).
LLDP Verification Commands
R1# show lldp
! Shows global status: LLDP enabled, timers (30s update, 120s holdtime, 2s reinit).
R1# show lldp traffic
! Shows frame counters: number of LLDP frames sent and received.
R1# show lldp interface [interface]
! Shows Tx/Rx enabled status and current states (e.g., Tx IDLE, Rx WAIT FOR FRAME).
R1# show lldp neighbors
R1# show lldp neighbors detail
! Shows extended info: OS version, Time remaining (counts down).
! Capability fields:
! - System Capabilities: What the device supports (e.g., B, R).
! - Enabled Capabilities: What is currently active (e.g., if 'ip routing' is on, 'R' appears here).
! Note: Does NOT show VTP information.
R1# show lldp entry <hostname>
! Shows detailed output for a single specific neighbor.
Output columns for show lldp neighbors:
- Device ID: Hostname of the neighbor.
- Local Interface: Interface on the local device.
- Holdtime: Displays the static configured value (120s). It does NOT count down in this view.
- Capability: Device type codes: B (Bridge/Switch), R (Router). Note: ‘S’ is not used for switches in LLDP.
- Port ID: Interface on the neighboring device.
LLDP Configuration Commands
R1(config)# lldp run
! Enables LLDP globally. (Must be done first).
R1(config-if)# lldp transmit
! Enables the interface to SEND LLDP messages.
R1(config-if)# lldp receive
! Enables the interface to RECEIVE LLDP messages.
R1(config)# lldp timer <seconds>
! Changes the LLDP update timer (Default: 30).
R1(config)# lldp holdtime <seconds>
! Changes the LLDP holdtime (Default: 120).
R1(config)# lldp reinit <seconds>
! Changes the LLDP reinitialization delay timer (Default: 2).
CDP vs LLDP Comparison
| Feature |
CDP (Cisco Discovery Protocol) |
LLDP (Link Layer Discovery Protocol) |
| Standard |
Cisco Proprietary |
IEEE 802.1AB (Industry Standard) |
| Default State |
Enabled (Global & Interfaces) |
Disabled (Global & Interfaces) |
| Multicast MAC |
0100.0CCC.CCCC |
0180.C200.000E |
| Update Timer |
60 seconds |
30 seconds |
| Holdtime |
180 seconds |
120 seconds |
| Interface Config |
cdp enable (Tx & Rx together) |
lldp transmit & lldp receive (Separate) |
| Switch Capability Code |
S (Switch) |
B (Bridge) |
| VTP Info Shared |
Yes |
No |
| Holdtime Display |
Counts down in show ... neighbors |
Static in show ... neighbors, counts down in detail |
CDP Commands
! Verification
show cdp
show cdp traffic
show cdp interface
show cdp neighbors
show cdp neighbors detail
show cdp entry <hostname>
! Configuration
cdp run
no cdp run
cdp enable
no cdp enable
cdp timer <seconds>
cdp holdtime <seconds>
cdp advertise-v1
LLDP Commands
! Verification
show lldp
show lldp traffic
show lldp interface
show lldp neighbors
show lldp neighbors detail
show lldp entry <hostname>
! Configuration
lldp run
no lldp run
lldp transmit
no lldp transmit
lldp receive
no lldp receive
lldp timer <seconds>
lldp holdtime <seconds>
lldp reinit <seconds>
37 Network Time Protocol (NTP)
Manual Time Configuration
! View software clock and its time source
Router# show clock
Router# show clock detail
! View hardware clock
Router# show calendar
! Manually set software clock (Privileged EXEC mode)
Router# clock set 14:30:00 26 December 2020
! Manually set hardware clock (Privileged EXEC mode)
Router# calendar set 14:30:00 26 December 2020
! Sync hardware clock TO software clock
Router# clock update-calendar
! Sync software clock FROM hardware clock
Router# clock read-calendar
Time Zone and Daylight Saving Time (DST)
! Configure Time Zone (Global Configuration Mode)
! Syntax: clock timezone <name> <hours-offset> [minutes-offset]
Router(config)# clock timezone JST 9
! Configure Daylight Saving Time (Global Configuration Mode)
! Syntax: clock summer-time <zone> recurring <start-week> <start-day> <start-month> <start-time> <end-week> <end-day> <end-month> <end-time> [offset]
Router(config)# clock summer-time EDT recurring 2 Sunday March 02:00 1 Sunday November 02:00
NTP Operating Modes
| Mode |
Description |
Command |
| Client (Static Client) |
Syncs time from an NTP server. |
ntp server <ip> |
| Server |
Provides time to clients. (Automatically enabled if a client successfully syncs to an upstream server). |
N/A (Automatic) |
| Symmetric Active (Peer) |
Peers with devices at the same stratum to share time and provide redundancy. |
ntp peer <ip> |
| Master |
Acts as an NTP server when no external source is available. |
ntp master [stratum] |
Configuring NTP Client
! Configure NTP servers (specify multiple for redundancy)
Router(config)# ntp server 216.239.35.0
Router(config)# ntp server 216.239.35.4
Router(config)# ntp server 216.239.35.8
Router(config)# ntp server 216.239.35.12
! Force the router to prefer a specific server
Router(config)# ntp server 216.239.35.0 prefer
Best Practice: NTP Source Interface
! Set the source interface for NTP packets
Router(config)# interface Loopback0
Router(config-if)# ip address 10.1.1.1 255.255.255.255
Router(config)# ntp source Loopback0
NTP Master (No External Source)
! Configure device as an NTP Master (Stratum 8 by default)
Router(config)# ntp master
! Or specify a custom stratum (1-14)
Router(config)# ntp master 9
Updating the Hardware Calendar
By default, NTP only updates the software clock. To sync the hardware clock:
! Tell the router to update the hardware calendar with NTP time
Router(config)# ntp update-calendar
Verification Commands
! Check NTP associations (servers/peers)
Router# show ntp associations
! Check overall NTP status (sync status, stratum)
Router# show ntp status
show ntp associations Symbols:
| Symbol |
Meaning |
Description |
* |
sys.peer |
The device is currently synchronizing to this server. |
+ |
Candidate |
Server is reachable and a candidate, but not currently selected. |
~ |
Configured |
Server is configured but not yet reachable/processed. |
| (None) |
Outlier/Falseticker |
Server is deemed inaccurate; device will not sync to it. |
NTP Peering (Symmetric Active Mode)
! Configure R2 and R3 as peers
R2(config)# ntp peer 10.0.23.3
R3(config)# ntp peer 10.0.23.2
NTP Authentication
! 1. Enable NTP authentication globally
Router(config)# ntp authenticate
! 2. Create the authentication key (Key number 1, MD5, password 'jeremysitlab')
Router(config)# ntp authentication-key 1 md5 jeremysitlab
! 3. Mark the key as trusted
Router(config)# ntp trusted-key 1
! 4. Apply the key to the NTP server or peer relationship (Client/Peer side only)
Router(config)# ntp server 10.0.12.1 key 1
Router(config)# ntp peer 10.0.23.3 key 1
Things to note: The server itself does not need the ntp server ... key command. Both sides must have the same ntp authentication-key and ntp trusted-key configured.
Software Clock vs. Hardware Calendar
| Feature |
Software Clock |
Hardware Calendar |
| Command to View |
show clock |
show calendar |
| Command to Set |
clock set (Privileged EXEC) |
calendar set (Privileged EXEC) |
| Persistence |
Lost on reboot (initialized by hardware) |
Survives reboots and power loss |
| NTP Sync |
Synced by default via NTP |
Requires ntp update-calendar |
Manual Time Commands
! View Time
Router# show clock
Router# show clock detail
Router# show calendar
Router# show logging
! Set Time (Privileged EXEC)
Router# clock set 14:30:00 26 December 2020
Router# calendar set 14:30:00 26 December 2020
! Sync Clocks (Privileged EXEC)
Router# clock update-calendar
Router# clock read-calendar
! Time Zone & DST (Global Config)
Router(config)# clock timezone JST 9
Router(config)# clock summer-time EDT recurring 2 Sunday March 02:00 1 Sunday November 02:00
NTP Configuration Commands (Global Config)
! Client Mode
Router(config)# ntp server <ip>
Router(config)# ntp server <ip> prefer
! Master Mode (No external source)
Router(config)# ntp master [stratum 1-14] ! Default is 8
! Peering (Symmetric Active)
Router(config)# ntp peer <ip>
! Source Interface (Best Practice)
Router(config)# ntp source Loopback0
! Hardware Calendar Sync
Router(config)# ntp update-calendar
! Authentication
Router(config)# ntp authenticate
Router(config)# ntp authentication-key <1-65535> md5 <password>
Router(config)# ntp trusted-key <1-65535>
Router(config)# ntp server <ip> key <1-65535>
Router(config)# ntp peer <ip> key <1-65535>
NTP Verification Commands (Privileged EXEC)
Router# show ntp associations
Router# show ntp status
38 Domain Name System (DNS)
DNS Records
| Record Type |
Name |
Purpose |
Example Output |
| A |
Address |
Maps a hostname to an IPv4 address. |
A youtube.com 172.217.25.110 |
| AAAA |
Quadruple-A |
Maps a hostname to an IPv6 address. |
AAAA youtube.com 2607:f8b0:: |
| CNAME |
Canonical Name |
Maps an alias name to another true domain name. |
CNAME www youtube.com |
Configuring a Router as a DNS Server
Router(config)# ip dns server
! Enables the router to respond to DNS queries from clients
Router(config)# ip host PC1 192.168.1.10
! Creates a static local host table entry (Name to IP mapping)
Router(config)# ip name-server 8.8.8.8
! Configures an external DNS server for the router to query if it lacks a local record
Configuring a Router as a DNS Client
Router(config)# ip domain-lookup
! Enables DNS queries on the router (Enabled by default).
! Note: Older IOS versions use 'ip domain-lookup' (with hyphen), modern uses 'ip domain lookup'. Both work.
Router(config)# ip name-server 8.8.8.8
! Tells the router which external DNS server to use for its own lookups (e.g., when you type 'ping youtube.com')
Router(config)# ip domain-name jeremysitlab.com
! Appends this default domain to unqualified hostnames.
! Example: 'ping PC1' becomes 'ping PC1.jeremysitlab.com'. Required for generating RSA keys for SSH.
DNS Verification
Router# show hosts
Cisco IOS Global Configuration
ip dns server # Enable router to act as a DNS server
ip host <name> <ip> # Create static local hostname-to-IP mapping
ip name-server <ip> # Define external DNS server for router to query
ip domain-lookup # Enable DNS queries on router (default: enabled)
ip domain lookup # Modern alternative to 'ip domain-lookup'
ip domain-name <name> # Set default domain appended to unqualified hostnames
Cisco IOS Privileged EXEC
show hosts # View static host table and dynamic DNS cache entries
39 Dynamic Host Configuration Protocol (DHCP)
DHCP Ports and Protocol Details
- Transport Protocol: UDP (User Datagram Protocol)
- Ports:
- DHCP Server: UDP Port 67
- DHCP Client: UDP Port 68
- Magic Cookie: A specific field in DHCP packets used to identify the protocol and differentiate it from BOOTP (Bootstrap Protocol, DHCP’s predecessor).
DHCP Options
| Option |
Purpose |
| 53 |
DHCP Message Type (e.g., Discover, Offer) |
| 51 |
Lease Time duration |
| 6 |
Domain Name Server (DNS) IP address |
| 3 |
Router (Default Gateway) IP address |
| 54 |
Server Identifier (used in Request to select a specific server) |
The DHCP Message Exchange (DORA)
| Message |
Direction |
Source IP |
Dest IP |
Broadcast/Unicast |
Purpose |
| Discover |
Client ➔ Server |
0.0.0.0 |
255.255.255.255 |
Broadcast |
Client looks for available DHCP servers. |
| Offer |
Server ➔ Client |
Server IP |
Offered IP / 255.255.255.255 |
Unicast or Broadcast |
Server offers an IP and configuration parameters. |
| Request |
Client ➔ Server |
0.0.0.0 |
255.255.255.255 |
Broadcast |
Client accepts the offer (specifies chosen server via Option 54). |
| Ack |
Server ➔ Client |
Server IP |
Client IP / 255.255.255.255 |
Unicast or Broadcast |
Server confirms the lease; client configures the interface. |
| Release |
Client ➔ Server |
Client IP |
Server IP |
Unicast |
Client voluntarily gives up the IP address. |
Configuring DHCP Server
! Exclude addresses from being handed out (e.g., for static devices)
Router(config)# ip dhcp excluded-address 192.168.1.1 192.168.1.10
! Create the DHCP pool
Router(config)# ip dhcp pool MY_POOL
Router(dhcp-config)# network 192.168.1.0 255.255.255.0
Router(dhcp-config)# default-router 192.168.1.1
Router(dhcp-config)# dns-server 8.8.8.8
Router(dhcp-config)# domain-name jeremysitlab.com
Router(dhcp-config)# lease 0 5 30
! Format: lease [days] [hours] [minutes]. 0 days, 5 hours, 30 mins.
! Can also use 'lease infinite' (not recommended).
Configuring DHCP Relay Agent
! Enter the interface connected to the DHCP clients
Router(config)# interface GigabitEthernet0/1
Router(config-if)# ip helper-address 192.168.10.10
! 192.168.10.10 is the IP of the centralized DHCP server
Configuring DHCP Client
! On the interface facing the dhcp server
Router(config)# interface GigabitEthernet0/1
Router(config-if)# ip address dhcp
DHCP Verification
! View currently assigned IP addresses and lease expirations
Router# show ip dhcp binding
! View interface configuration and verify if IP is determined by DHCP
Router# show ip interface GigabitEthernet0/1
! View DHCP pool statistics and conflicts
Router# show ip dhcp pool
Router# show ip dhcp server statistics
DHCP Commands
| Command |
Mode |
Purpose |
ip dhcp excluded-address [start] [end] |
Global Config |
Reserves IPs from the DHCP pool. |
ip dhcp pool [name] |
Global Config |
Creates a DHCP pool. |
network [ip] [mask] |
DHCP Config |
Defines the subnet for the pool. |
default-router [ip] |
DHCP Config |
Assigns the default gateway to clients. |
dns-server [ip] |
DHCP Config |
Assigns the DNS server to clients. |
domain-name [name] |
DHCP Config |
Assigns the domain name to clients. |
lease [days] [hours] [minutes] |
DHCP Config |
Sets the IP lease duration. |
ip helper-address [server-ip] |
Interface Config |
Configures the interface as a DHCP Relay Agent. |
ip address dhcp |
Interface Config |
Configures the interface as a DHCP Client. |
show ip dhcp binding |
Privileged EXEC |
Displays active DHCP leases. |
DHCP Command List
ip dhcp excluded-address 192.168.1.1 192.168.1.10
ip dhcp pool MY_POOL
network 192.168.1.0 255.255.255.0
default-router 192.168.1.1
dns-server 8.8.8.8
domain-name jeremysitlab.com
lease 0 5 30
interface GigabitEthernet0/1
ip helper-address 192.168.10.10
interface GigabitEthernet0/1
ip address dhcp
show ip dhcp binding
show ip interface GigabitEthernet0/1
show ip dhcp pool
show ip dhcp server statistics
clear ip dhcp binding *
40 Simple Network Management Protocol (SNMP)
SNMP Versions Comparison
| Feature |
SNMPv1 |
SNMPv2c |
SNMPv3 |
| Status |
Original version |
Most widely used |
Current best practice |
| Security |
Plain-text community strings |
Plain-text community strings |
Strong encryption and authentication |
| Key Addition |
Basic Get/Set/Trap |
Added GetBulk for mass-retrieval |
Security (prevents interception) |
| Passwords |
Community strings |
Community strings (‘c’ stands for community) |
Usernames, Auth passwords, Encryption keys |
SNMP Message Types and Ports
| Message Class |
Message Type |
Direction |
Port Target |
Reliable? |
Description |
| Read |
Get |
NMS $\rightarrow$ Agent |
UDP 161 |
Yes |
Retrieves the value of a specific variable/OID. |
| Read |
GetNext |
NMS $\rightarrow$ Agent |
UDP 161 |
Yes |
Discovers the next available OID in the MIB. |
| Read |
GetBulk |
NMS $\rightarrow$ Agent |
UDP 161 |
Yes |
Mass-retrieval of multiple variables (Introduced in v2). |
| Write |
Set |
NMS $\rightarrow$ Agent |
UDP 161 |
Yes |
Changes the value of a variable (e.g., changing an IP address). |
| Notification |
Trap |
Agent $\rightarrow$ NMS |
UDP 162 |
No |
Alerts the NMS of an event. No response is expected. |
| Notification |
Inform |
Agent $\rightarrow$ NMS |
UDP 162 |
Yes |
Alerts the NMS of an event. Expects a Response (ACK). |
| Response |
Response |
Agent $\rightarrow$ NMS |
UDP 162 |
Yes |
Acknowledges Get, Set, and Inform messages. |
SNMPv2c Configuration
! 1. Optional: Define device contact and location information
Router(config)# snmp-server contact "Admin Team - admin@example.com"
Router(config)# snmp-server location "Building A, Server Room 1"
! 2. Define Community Strings (Passwords)
! RO = Read Only (Can use Get, GetNext, GetBulk)
Router(config)# snmp-server community Jeremy1 RO
! RW = Read/Write (Can use Get AND Set)
Router(config)# snmp-server community Jeremy2 RW
! 3. Specify the NMS (SNMP Server) IP and assign a community string to it
! This restricts the NMS to only use the 'Jeremy1' (RO) string
Router(config)# snmp-server host 192.168.1.1 version 2c Jeremy1
! 4. Enable specific Traps to be sent to the NMS
Router(config)# snmp-server enable traps snmp linkdown linkup
Router(config)# snmp-server enable traps config
## Summary ##
! Optional Device Information
snmp-server contact <text>
snmp-server location <text>
! Community Strings (Passwords)
snmp-server community <string> ro
snmp-server community <string> rw
! Define SNMP Host (NMS) and Version
snmp-server host <ip-address> version <1 | 2c> <community-string>
! Enable Traps
snmp-server enable traps [feature] [specific-trap]
snmp-server enable traps snmp linkdown linkup
snmp-server enable traps config
41 Syslog
Example Syslog Message Breakdown:
*Mar 1 12:00:00.123: %LINK-3-UPDOWN: Interface GigabitEthernet0/0 changed state to up
- Timestamp:
*Mar 1 12:00:00.123
- Facility:
LINK
- Severity:
3 (Error)
- Mnemonic:
UPDOWN
- Description:
Interface GigabitEthernet0/0 changed state to up
Syslog Severity Levels
| Level |
Keyword (RFC / Cisco IOS) |
Description |
| 0 |
Emergency |
System is unusable. |
| 1 |
Alert |
Action must be taken immediately. |
| 2 |
Critical |
Critical conditions. |
| 3 |
Error |
Error conditions. |
| 4 |
Warning |
Warning conditions. |
| 5 |
Notice / Notification |
Normal but significant condition. (Note: RFC uses “Notice”, Cisco IOS uses “Notification”) |
| 6 |
Informational |
Informational messages. |
| 7 |
Debugging |
Debugging messages (least severe). |
Mnemonic to remember levels 0-7: Every Awesome Cisco Engineer Will Need Ice cream Daily.
Syslog Destinations & Defaults
| Destination |
Default Behavior |
Configuration / Notes |
| Console Line |
Enabled (Levels 0-7) |
Displays messages in real-time when physically connected to the console port. |
| Buffer (RAM) |
Enabled (Levels 0-7) |
Stores messages in device memory. View using show logging. |
| VTY Lines (Telnet/SSH) |
Disabled |
Must be enabled per session using terminal monitor in Privileged EXEC mode. |
| External Server |
Disabled |
Centralized logging. Listens on UDP port 514. |
Syslog Configuring Destinations and Levels
! Configure Console logging (Levels 0 to specified level)
Router(config)# logging console 6
! Or use keyword: logging console informational
! Configure VTY/Telnet/SSH logging (Levels 0 to specified level)
Router(config)# logging monitor 6
! Or use keyword: logging monitor informational
! Configure Buffer logging (Optional size in bytes, then level)
Router(config)# logging buffered 16384 6
! Or use keyword: logging buffered informational
! Configure External Syslog Server IP
Router(config)# logging host 192.168.1.100
! Or simply: logging 192.168.1.100
! Set the severity level for the External Server (Levels 0 to specified level)
Router(config)# logging trap 7
! Or use keyword: logging trap debugging
Enabling VTY Logging for Active Sessions
Router# terminal monitor
Things to note: terminal monitor is not persistent. It must be executed every single time you connect via Telnet or SSH.
Improving CLI Readability
By default, incoming Syslog messages can interrupt and break up commands you are currently typing.
! Apply to console or VTY lines to force log messages to a new line
Router(config)# line console 0
Router(config-line)# logging synchronous
Configuring Timestamps and Sequence Numbers
! Enable Timestamps (Datetime is preferred over Uptime)
Router(config)# service timestamps log datetime
! Alternative: service timestamps log uptime
! Enable Sequence Numbers
Router(config)# service sequence-numbers
Syslog Summary
! --- Destination & Level Configuration ---
Router(config)# logging console [level]
Router(config)# logging monitor [level]
Router(config)# logging buffered [size] [level]
Router(config)# logging host [ip_address]
Router(config)# logging trap [level]
! --- Session & Readability Configuration ---
Router# terminal monitor
Router(config-line)# logging synchronous
! --- Formatting Configuration ---
Router(config)# service timestamps log datetime
Router(config)# service sequence-numbers
! --- Verification Commands ---
Router# show logging
42 Remote
Console Port Security
- Concept: Securing physical access to a Cisco IOS device via the console port. By default, no password is required, posing a security risk if physical access is gained.
Router(config)# line console 0
Router(config-line)# password ccna
Router(config-line)# login
! OR, to require a local username/password instead of a line password:
Router(config)# username jeremy secret ccnp
Router(config)# line console 0
Router(config-line)# login local
! Set inactivity timeout to 3 minutes and 30 seconds
Router(config-line)# exec-timeout 3 30
Things to note: If both a line password and login local are configured, login local takes precedence, and the line password is ignored.
Layer 2 Switch Management IP
- Concept: Layer 2 switches do not route packets or build routing tables. However, they require an IP address to be managed remotely (via SSH/Telnet) from a different subnet.
Switch(config)# interface vlan 10
Switch(config-if)# ip address 192.168.10.50 255.255.255.0
Switch(config-if)# no shutdown
Switch(config)# ip default-gateway 192.168.10.1
Things to note: The ip default-gateway command is the Layer 2 equivalent of a default route (ip route 0.0.0.0 0.0.0.0). Without it, the switch can only communicate with devices in its local VLAN.
Telnet (Legacy Protocol)
- Concept: Telnet (Teletype Network, developed in 1969) allows remote CLI access but transmits all data (including usernames and passwords) in plain text. It is largely replaced by SSH due to severe security vulnerabilities.
- Details:
- Uses TCP Port 23.
- Configured on VTY (Virtual Teletype) lines. Cisco devices typically have 16 VTY lines (
0 through 15), allowing up to 16 concurrent remote sessions.
- Requires an
enable secret to be configured, otherwise privileged EXEC mode access will be denied upon connection.
Router(config)# enable secret ccnp
Router(config)# username admin secret ccnp
! Optional: Restrict access via ACL (e.g., only allow 192.168.1.10)
Router(config)# access-list 10 permit host 192.168.1.10
Router(config)# line vty 0 15
Router(config-line)# login local
Router(config-line)# exec-timeout 5 0
Router(config-line)# transport input telnet
Router(config-line)# access-class 10 in
Things to note: Do not confuse access-class (applies ACL to VTY lines) with ip access-group (applies ACL to a physical/logical interface).
SSH (Secure Shell)
- Concept: SSH (Secure Shell) provides encrypted remote CLI access, protecting data integrity and confidentiality. SSHv2 (released in 2006) is the secure standard and should always be used.
- Details:
- Uses TCP Port 22.
- Requires a K9 IOS image (supports cryptographic features). NPE (No Payload Encryption) images do not support SSH.
- Prerequisites for RSA Key Generation: The device must have a non-default
hostname and an ip domain-name configured. The combination forms the FQDN (Fully Qualified Domain Name), which names the RSA key pair.
- RSA modulus size must be at least 768 bits to support SSHv2 (2048 bits is recommended for modern security).
login local is mandatory for SSH; the basic login command will not work.
! Step 1 & 2: Prerequisites for RSA Keys
Switch(config)# hostname SW1
SW1(config)# ip domain-name jeremysitlab.com
! Step 3: Generate RSA Keys (FQDN becomes SW1.jeremysitlab.com)
SW1(config)# crypto key generate rsa modulus 2048
! Note: Can also use 'crypto key generate rsa' and specify modulus interactively
! Step 4: Local Authentication
SW1(config)# enable secret ccnp
SW1(config)# username admin secret ccnp
! Step 5: Enforce SSHv2 and Configure VTY
SW1(config)# ip ssh version 2
SW1(config)# line vty 0 15
SW1(config-line)# login local
SW1(config-line)# exec-timeout 5 0
SW1(config-line)# transport input ssh
! Step 6: Optional ACL restriction
SW1(config-line)# access-class 10 in
Remote access configurations
! Console Security
line console 0
password <password>
login
login local
exec-timeout <minutes> <seconds>
! Layer 2 Management
interface vlan <vlan-id>
ip address <ip> <subnet-mask>
no shutdown
ip default-gateway <ip-address>
! Telnet / SSH VTY Configuration
line vty 0 15
login local
exec-timeout <minutes> <seconds>
transport input telnet ! Allows only Telnet
transport input ssh ! Allows only SSH (Best Practice)
transport input telnet ssh ! Allows both
transport input all ! Allows all supported protocols
access-class <acl-number> in ! Applies ACL to VTY lines
! SSH Specific Configuration
hostname <name> ! Must not be 'Router'
ip domain-name <domain.com> ! Required for FQDN
crypto key generate rsa modulus 2048 ! Min 768 for SSHv2, 2048 recommended
ip ssh version 2 ! Forces SSHv2 only
43 File Transfer
IOS Upgrade Process
- Concept: The standard workflow for upgrading a Cisco device’s IOS using a TFTP or FTP server.
- Step 1: Verify Current State
Router# show version
Router# show flash
- Step 2: Configure FTP Credentials (If using FTP)
Router(config)# ip ftp username cisco
Router(config)# ip ftp password cisco
- Step 3: Copy IOS Image to Flash
Router# copy tftp: flash:
! Prompts for: Server IP, Source Filename, Destination Filename
Router# copy ftp: flash:
! Prompts for: Server IP, Source Filename, Destination Filename
- Step 4: Configure Boot Variable
Router(config)# boot system flash:<new_ios_filename.bin>
Things to note: If the boot system command is not configured, the router will automatically boot the first IOS file it finds in flash memory.
Router(config)# end
Router# copy running-config startup-config
Router# reload
- Step 6: Clean Up (Delete Old IOS)
Router# delete flash:<old_ios_filename.bin>
FTP TFTP configurations
! View file systems
Router# show file systems
! Verify current IOS and flash contents
Router# show version
Router# show flash
! Configure FTP credentials (Global Config)
Router(config)# ip ftp username <username>
Router(config)# ip ftp password <password>
! Copy file from TFTP/FTP server to Flash
Router# copy tftp flash
Router# copy ftp flash
! Set the boot variable (Global Config)
Router(config)# boot system flash <filename>
! Save configuration
Router# copy running-config startup-config
! Reboot the device
Router# reload
! Delete a file from flash
Router# delete flash <filename>
45 Network Address Transation (NAT)
NAT address types
| Term |
Definition |
Typical Address Type |
| Inside Local |
The actual IP address configured on the internal host. |
Private IP |
| Inside Global |
The IP address of the internal host after NAT translation, as seen by the outside world. |
Public IP |
| Outside Local |
The IP address of the external host as seen from the inside network. |
Usually same as Outside Global |
| Outside Global |
The actual IP address configured on the external host. |
Public IP |
Static NAT
- Concept: Manually configures a permanent one-to-one mapping between an Inside Local address and an Inside Global address.
! 1. Define Inside and Outside interfaces
R1(config)# interface GigabitEthernet0/1
R1(config-if)# ip nat inside
R1(config-if)# exit
R1(config)# interface GigabitEthernet0/0
R1(config-if)# ip nat outside
R1(config-if)# exit
! 2. Configure 1-to-1 Static Mapping
! Syntax: ip nat inside source static <local> <global>
R1(config)# ip nat inside source static 192.168.1.10 203.0.113.10
Dynamic NAT
- Concept: Dynamically maps Inside Local addresses to Inside Global addresses from a predefined NAT Pool.
! 1. Define interfaces (ip nat inside / outside)
R1(config)# interface GigabitEthernet0/1
R1(config-if)# ip nat inside
R1(config-if)# exit
R1(config)# interface GigabitEthernet0/0
R1(config-if)# ip nat outside
R1(config-if)# exit
! 2. Create ACL to identify traffic to be translated (Uses Wildcard Mask!)
R1(config)# access-list 1 permit 192.168.1.0 0.0.0.255
! 3. Define the NAT Pool (Uses Prefix-Length or Netmask!)
R1(config)# ip nat pool POOL1 203.0.113.10 203.0.113.20 prefix-length 24
! 4. Bind ACL to Pool
! Syntax: ip nat inside source list <acl> pool <pool>
R1(config)# ip nat inside source list 1 pool POOL1
Port Address Translation (PAT) / NAT Overload
- Concept: Maps many Inside Local addresses to a single (or few) Inside Global addresses by translating both the IP address and the Layer 4 Port number.
Configuration Method 1: Using a NAT Pool
! 1. Define interfaces
! 2. Create ACL
R1(config)# access-list 1 permit 192.168.1.0 0.0.0.255
! 3. Define Pool
R1(config)# ip nat pool POOL1 203.0.113.10 203.0.113.10 prefix-length 24
! 4. Bind with OVERLOAD keyword
R1(config)# ip nat inside source list 1 pool POOL1 overload
Configuration Method 2: Using the Router’s Interface IP (Most Common)
! 1. Define interfaces
! 2. Create ACL
R1(config)# access-list 1 permit 192.168.1.0 0.0.0.255
! 3. Bind to Interface with OVERLOAD keyword
! Syntax: ip nat inside source list <acl> interface <int> overload
R1(config)# ip nat inside source list 1 interface GigabitEthernet0/0 overload
NAT Verification and Troubleshooting
! View the NAT translation table
! Note: Output displays Inside Global BEFORE Inside Local
R1# show ip nat translations
Pro Inside global Inside local Outside local Outside global
icmp 203.0.113.1:512 192.168.1.10:512 8.8.8.8:512 8.8.8.8:512
! View NAT statistics, pool usage, and active translation counts
R1# show ip nat statistics
! Clear DYNAMIC translations only (Static translations remain intact)
R1# clear ip nat translation *
! Clear a specific dynamic translation
R1# clear ip nat translation protocol inside global-ip local-ip outside global-ip outside local-ip
Comparison of NAT Types
| Feature |
Static NAT |
Dynamic NAT |
Dynamic PAT (NAT Overload) |
| Mapping Type |
One-to-One (Permanent) |
One-to-One (Temporary) |
Many-to-One (Temporary) |
| Configuration |
Manual IP mapping |
ACL + NAT Pool |
ACL + Pool OR Interface + overload |
| Port Translation |
No |
No |
Yes (Translates IP & Port) |
| Inbound Traffic? |
Yes (Outside can initiate) |
No (Only if mapping exists) |
No (Only if port mapping exists) |
| Pool Exhaustion |
N/A |
Drops packet |
N/A (Uses ports to scale) |
| IP Conservation |
Poor |
Moderate |
Excellent |
NAT Commands
! --- Interface Configuration ---
Router(config-if)# ip nat inside
Router(config-if)# ip nat outside
! --- Static NAT ---
Router(config)# ip nat inside source static <local-ip> <global-ip>
! --- Dynamic NAT & PAT ---
Router(config)# access-list <1-99> permit <subnet> <wildcard>
Router(config)# ip nat pool <name> <start-ip> <end-ip> prefix-length <len>
Router(config)# ip nat inside source list <acl> pool <pool>
Router(config)# ip nat inside source list <acl> pool <pool> overload
Router(config)# ip nat inside source list <acl> interface <type/num> overload
! --- Verification & Maintenance ---
Router# show ip nat translations
Router# show ip nat statistics
Router# clear ip nat translation *
46 Quality of Service (QoS), VoIP
IP Phones and Voice VLANs
! Configure Voice VLAN on a switch port
Switch(config)# interface g0/0
Switch(config-if)# switchport mode access
Switch(config-if)# switchport access vlan 10
Switch(config-if)# switchport voice vlan 11
Switch(config)# interface g0/1
Switch(config-if)# switchport mode trunk
Switch(config-if)# switchport trunk allowed vlan 10,20
! ROAS config
Router(config)# interface g0/0.10
Router(config-subif)# encapsulation dot1q 10
Router(config-subif)# ip address 172.168.20.1 255.255.255.0
! Verify Voice VLAN configuration
Switch# show interfaces g0/0 switchport
Switch# show interfaces trunk
Switch# show interfaces trunk
Common Misconception: show interfaces trunk will NOT display the port because it is administratively and operationally an access port, despite carrying tagged voice traffic.
Power over Ethernet (PoE)
! Configure Power Policing (Default action is err-disable)
Switch(config-if)# power inline police
Switch(config-if)# power inline police action err-disable
! Configure Power Policing to only log and restart the interface
Switch(config-if)# power inline police action log
! Verify PoE status
Switch# show power inline police g0/0
PoE Standards Comparison
| Standard |
Name |
Max Power |
Wires Used (Historical context) |
| Cisco ILP |
Inline Power |
7W |
4, 5, 7, 8 (Spare pairs) |
| 802.3af |
PoE (Type 1) |
15.4W |
All 4 pairs |
| 802.3at |
PoE+ (Type 2) |
30W |
All 4 pairs |
| 802.3bt |
UPoE (Type 3) |
60W |
All 4 pairs |
| 802.3bt |
UPoE (Type 4) |
100W |
All 4 pairs |
Layer 2 Marking: PCP / CoS
- Concept: Found in the 3-bit PCP (Priority Code Point) field of the 802.1Q VLAN tag. Also known as CoS (Class of Service).
- Details: Values range from 0 to 7.
- 0: Best Effort (Default)
- 3: Critical Applications / Voice Signaling
- 4: Video
- 5: Voice (Audio)
- Limitation: PCP/CoS can ONLY be used on tagged links (Trunk links or Access ports with a Voice VLAN). It cannot be used over standard routed links where the 802.1Q tag is removed.
Layer 3 Marking: ToS Byte & DSCP
- Concept: The IPv4 ToS (Type of Service) byte is used for Layer 3 QoS. It is divided into:
- DSCP (Differentiated Services Code Point): 6 bits (Values 0-63).
- ECN (Explicit Congestion Notification): 2 bits.
- Historical Context: Previously, the first 3 bits were used for IPP (IP Precedence), which only allowed 8 values (0-7). DSCP was created for more flexibility and backward compatibility.
Standard DSCP Markings
| Marking |
Name |
DSCP Value |
Binary (6-bit) |
Usage |
| DF |
Default Forwarding |
0 |
000000 |
Best Effort (Standard data) |
| EF |
Expedited Forwarding |
46 |
101110 |
Voice (Low loss, delay, jitter) |
| AF |
Assured Forwarding |
Varies |
Varies |
Data with guaranteed delivery |
| CS |
Class Selector |
Varies |
Varies |
Backward compatibility with IPP |
48 Security
Reconnaissance Commands
# Reconnaissance Commands
nslookup <domain_name>
whois <domain_name>
# AAA Protocols & Ports (Memorize for Exam)
# RADIUS (Open Standard)
UDP port 1812 # Authentication
UDP port 1813 # Accounting
# TACACS+ (Cisco Proprietary)
TCP port 49 # Authentication, Authorization, and Accounting
49 Port Security
Port Security Configuration
! Check administrative mode (must not be dynamic auto/desirable)
SW1# show interfaces gigabitethernet0/1 switchport
! Statically configure the port as an access port
SW1(config)# interface gigabitethernet0/1
SW1(config-if)# switchport mode access
! Cannot be dynamic auto
! Enable port security with default settings
SW1(config-if)# switchport port-security
SW1# show port-security interface f0/1
! See security configuration
Violation Modes Configuration
- Concept: Determines the action the switch takes when an unauthorized frame (a frame with a source MAC not in the allowed list) enters the interface.
- Details: There are three violation modes.
shutdown is the default.
| Feature |
Shutdown (Default) |
Restrict |
Protect |
| Port Status |
Err-disabled (secure-shutdown) |
Secure-up |
Secure-up |
| Unauthorized Traffic |
Dropped (Port goes down) |
Dropped |
Dropped |
| Authorized Traffic |
Stops (Port is down) |
Continues normally |
Continues normally |
| Syslog / SNMP |
Generates 1 message upon shutdown |
Generates message for every violation |
No messages generated |
| Violation Counter |
Set to 1 (resets on recovery) |
Incremented for every violation |
Not incremented |
! Configure violation mode
SW1(config-if)# switchport port-security violation shutdown
SW1(config-if)# switchport port-security violation restrict
SW1(config-if)# switchport port-security violation protect
MAC Address Learning & Sticky MACs
- Concept: Defines how the switch populates its list of allowed (secure) MAC addresses.
- Details:
- Default Maximum: 1 MAC address allowed per port.
- Sticky MACs: Dynamically learned MAC addresses that are automatically converted to static entries in the running configuration.
! Set maximum allowed MAC addresses
SW1(config-if)# switchport port-security maximum 2
! Manually configure a static secure MAC address
SW1(config-if)# switchport port-security mac-address A.A.A.
! Enable sticky learning (converts dynamic MACs to sticky)
SW1(config-if)# switchport port-security mac-address sticky
SW1# show mac-address table
Secure MAC Address Aging
- Concept: Timers that automatically remove secure MAC addresses from the allowed list. By default, aging is disabled (0 minutes).
- Details:
- By default, only dynamically learned MAC addresses age out. Static MACs do not.
| Aging Type |
Behavior |
| Absolute (Default) |
Timer starts when MAC is learned. MAC is removed when timer expires, even if traffic is continuously received from that MAC. |
| Inactivity |
Timer resets every time a frame is received from the MAC. MAC is only removed if no traffic is seen for the duration of the timer. |
! Set aging timer to 30 minutes
SW1(config-if)# switchport port-security aging time 30
! Set aging type to inactivity
SW1(config-if)# switchport port-security aging type inactivity
! Enable aging for statically configured MAC addresses
SW1(config-if)# switchport port-security aging static
Recovering from Err-Disabled State
- Concept: When a port enters the
err-disabled state (due to a shutdown violation or other reasons), it must be recovered before it can pass traffic again.
! MANUAL RECOVERY: Must be done in interface configuration mode
SW1(config)# interface gigabitethernet0/1
SW1(config-if)# shutdown
SW1(config-if)# no shutdown
! AUTOMATIC RECOVERY: Enable recovery for port-security violations
SW1(config)# errdisable recovery cause psecure-violation
! OPTIONAL: Change the default recovery timer (Default is 300 seconds / 5 mins)
SW1(config)# errdisable recovery interval 180
! Verify errdisable recovery status
SW1# show errdisable recovery
Port Security Verification Commands
- Concept: Commands used to verify Port Security status, violations, and MAC address tables.
! Detailed view of a specific interface's port security status
! Shows: Port Status, Violation Mode, MAC counts, Aging timers, Violation count
SW1# show port-security interface gigabitethernet0/1
! Summary view of all interfaces with port security enabled
! Shows: Max/Current MACs, Violation count, Security Action
SW1# show port-security
! View all secure MAC addresses in the switch's MAC address table
SW1# show mac address-table secure
Port Security Command
! --- Prerequisites & Enabling ---
SW1(config-if)# switchport mode access
SW1(config-if)# switchport port-security
! --- MAC Address Limits & Learning ---
SW1(config-if)# switchport port-security maximum <1-8192>
SW1(config-if)# switchport port-security mac-address <mac_address>
SW1(config-if)# switchport port-security mac-address sticky
! --- Violation Modes ---
SW1(config-if)# switchport port-security violation {shutdown | restrict | protect}
! --- Aging Timers ---
SW1(config-if)# switchport port-security aging time <minutes>
SW1(config-if)# switchport port-security aging type {absolute | inactivity}
SW1(config-if)# switchport port-security aging static
! --- Err-Disable Recovery (Global Config) ---
SW1(config)# errdisable recovery cause psecure-violation
SW1(config)# errdisable recovery interval <seconds>
! --- Manual Recovery (Interface Config) ---
SW1(config-if)# shutdown
SW1(config-if)# no shutdown
! --- Verification ---
SW1# show interfaces <interface> switchport
SW1# show port-security
SW1# show port-security interface <interface>
SW1# show mac address-table secure
SW1# show errdisable recovery
50 DHCP Snoop
DHCP Snooping Configuration
- Enable DHCP Snooping globally.
- Enable DHCP Snooping per VLAN.
- Disable Option 82 (if not using relay agents).
- Configure uplink interfaces as trusted.
- (Optional) Configure rate limiting on downlink interfaces.
! Enable globally
SW1(config)# ip dhcp snooping
! Enable for specific VLANs
SW1(config)# ip dhcp snooping vlan 1
! Disable Option 82 insertion
SW1(config)# no ip dhcp snooping information option
! Configure trusted uplink interface
SW1(config)# interface GigabitEthernet0/0
SW1(config-if)# ip dhcp snooping trust
! Configure rate limiting on untrusted downlink interface
SW1(config)# interface GigabitEthernet0/1
SW1(config-if)# ip dhcp snooping limit rate 15
! Enable errdisable recovery for rate limiting
SW1(config)# errdisable recovery cause dhcp-rate-limit
DHCP Snooping Verification
! View the DHCP snooping binding table
SW1# show ip dhcp snooping binding
! View DHCP snooping configuration and statistics per interface
SW1# show ip dhcp snooping
! View errdisable recovery status and timers
SW1# show errdisable recovery
DHCP Snooping Summary
! Global Configuration
ip dhcp snooping
ip dhcp snooping vlan [vlan-list]
no ip dhcp snooping information option
errdisable recovery cause dhcp-rate-limit
! Interface Configuration
ip dhcp snooping trust
ip dhcp snooping limit rate [packets-per-second]
! Verification
show ip dhcp snooping binding
show ip dhcp snooping
show errdisable recovery
51 Dynamic ARP Inspection (DAI)
DAI Configuration Basics
- Enable DAI: Must be enabled per VLAN.
! Enable DAI for specific VLANs (e.g., VLAN 1)
Switch(config)# ip arp inspection vlan 1
! Configure an interface as trusted
Switch(config-if)# ip arp inspection trust
DAI Rate Limiting
- Purpose: Prevents attackers from overwhelming the switch CPU with a flood of ARP messages.
- Action: If the rate is exceeded, the interface is placed in an err-disabled state.
- Defaults:
- Untrusted ports: Enabled by default at 15 packets per second (pps).
- Trusted ports: Disabled by default.
! Configure rate limit with burst interval (e.g., 25 packets per 2 seconds)
Switch(config-if)# ip arp inspection limit rate 25 burst interval 2
! Configure rate limit without burst interval (defaults to 1 second)
Switch(config-if)# ip arp inspection limit rate 10
! Enable err-disable recovery for ARP inspection
Switch(config)# errdisable recovery cause arp-inspection
DAI Validation Checks
| Check |
Description |
dst-mac |
Validates ARP replies by checking if the Ethernet header destination MAC matches the ARP target MAC. |
ip |
Checks for invalid/unexpected IPs (e.g., 0.0.0.0, 255.255.255.255, multicast). Checks Sender IP in req/reply, Target IP only in replies. |
src-mac |
Checks if the Ethernet header source MAC matches the ARP sender MAC. |
! CRITICAL: All desired checks MUST be configured in a single command!
! Subsequent commands will overwrite previous ones.
Switch(config)# ip arp inspection validate dst-mac ip src-mac
Things to note: If you configure validate dst-mac, then later enter validate ip, the dst-mac check is overwritten and disabled. The order of the arguments in the single command does not matter.
ARP ACLs for Static Hosts
- Concept: Hosts with static IPs do not appear in the DHCP Snooping binding table, so DAI will drop their ARP messages by default.
- Solution: Create an ARP ACL to manually map their IP and MAC addresses.
! Create the ARP ACL
Switch(config)# arp access-list ARP-ACL-1
Switch(config-arp-nacl)# permit ip host 192.168.1.100 mac host 0011.2233.4455
! Apply the ARP ACL to a specific VLAN
Switch(config)# ip arp inspection filter ARP-ACL-1 vlan 1
DAI vs. DHCP Snooping
| Feature |
DHCP Snooping |
Dynamic ARP Inspection (DAI) |
| Inspects |
DHCP Messages |
ARP Messages |
| Prevents |
Rogue DHCP Servers / DHCP Starvation |
ARP Poisoning / MitM Attacks |
| Default Port State |
Untrusted |
Untrusted |
| Rate Limiting Default |
Disabled on all ports |
Enabled on untrusted ports (15 pps) |
| Rate Limiting Syntax |
limit rate [pps] |
limit rate [pps] [burst interval [sec]] |
| Enable Command |
Global + VLAN commands |
VLAN command only |
DAI Show Commands & Statistics
! Show DAI interface trust state and rate limits
Switch# show ip arp inspection interfaces
! Show overall DAI configuration, validation checks, and drop statistics
Switch# show ip arp inspection
! Show err-disable recovery settings
Switch# show errdisable recovery
Things to note: In show ip arp inspection, look at the statistics to see how many packets were dropped due to DHCP snooping mismatches (DHCP drops) versus ACL permits/denies.
DAI Summary
! --- Basic Configuration ---
Switch(config)# ip arp inspection vlan [vlan_ids]
Switch(config-if)# ip arp inspection trust
! --- Rate Limiting ---
Switch(config-if)# ip arp inspection limit rate [packets] burst interval [seconds]
Switch(config-if)# ip arp inspection limit rate [packets]
Switch(config)# errdisable recovery cause arp-inspection
! --- Optional Validation ---
Switch(config)# ip arp inspection validate dst-mac ip src-mac
! --- ARP ACLs ---
Switch(config)# arp access-list [name]
Switch(config-arp-nacl)# permit ip host [IP] mac host [MAC]
Switch(config)# ip arp inspection filter [name] vlan [vlan_id]
! --- Verification ---
Switch# show ip arp inspection interfaces
Switch# show ip arp inspection
Switch# show errdisable recovery
54 Virtualization
VRF Configuration & Verification
! 1. Create the VRFs in global configuration mode
SPR1(config)# ip vrf CUSTOMER1
SPR1(config)# ip vrf CUSTOMER2
! 2. Verify VRF creation
SPR1# show ip vrf
! 3. Assign interfaces to VRFs and configure IP addresses
! CRITICAL: Assigning a VRF removes any existing IP address on the interface!
SPR1(config)# interface GigabitEthernet0/0
SPR1(config-if)# ip vrf forwarding CUSTOMER1
SPR1(config-if)# ip address 192.168.1.1 255.255.255.252
SPR1(config)# interface GigabitEthernet0/2
SPR1(config-if)# ip vrf forwarding CUSTOMER2
! Overlapping IP address is now permitted because it is in a different VRF!
SPR1(config-if)# ip address 192.168.1.1 255.255.255.252
! 4. View routing tables
! Shows the default global routing table (will be empty if all interfaces are in VRFs)
SPR1# show ip route
! Shows the routing table for a specific VRF
SPR1# show ip route vrf CUSTOMER1
SPR1# show ip route vrf CUSTOMER2
! 5. Test reachability
! Standard ping uses the global routing table (will fail if interfaces are in VRFs)
SPR1# ping 192.168.1.2
! Specify the VRF to ping within that virtual routing table
SPR1# ping vrf CUSTOMER1 192.168.1.2
SPR1# ping vrf CUSTOMER2 192.168.1.2
VRF (Virtual Routing and Forwarding)
! Create a VRF
ip vrf [name]
! View configured VRFs
show ip vrf
! Assign interface to a VRF (Clears existing IP)
interface [type/number]
ip vrf forwarding [name]
ip address [ip] [mask]
! View global routing table
show ip route
! View specific VRF routing table
show ip route vrf [name]
! Ping using a specific VRF
ping vrf [name] [destination_ip]
56 Wireless Architecture
802.11 wireless frames are more complex than 802.3 Ethernet frames. Depending on the 802.11 version and message type, some fields may be omitted.
- Frame Control: 2 bytes (16 bits). Indicates message type and subtype.
- Duration/ID: 2 bytes. Indicates the time in microseconds the channel is dedicated for transmission, OR acts as an identifier for the client-AP association.
- Addresses: Up to 4 addresses can be present depending on the message type:
- DA (Destination Address): Final recipient of the frame.
- SA (Source Address): Original sender of the frame.
- RA (Receiver Address): Immediate recipient (not necessarily final destination).
- TA (Transmitter Address): Immediate sender (not necessarily original source).
- Sequence Control: Used to reassemble fragments and eliminate duplicate frames.
- QoS Control: Used to prioritize certain traffic.
- HT (High Throughput) Control: Added in 802.11n (Wi-Fi 4) to enable high-throughput operations. (Note: 802.11ac / Wi-Fi 5 is known as Very High Throughput or VHT).
- Frame Body: The encapsulated packet (payload).
- FCS (Frame Check Sequence): Located in the trailer; used for error checking.
58 Wireless Configuration
Switch Configuration Commands
! Create VLANs
Switch(config)# vlan 10
Switch(config-vlan)# name Management
Switch(config)# vlan 100
Switch(config-vlan)# name Internal
Switch(config)# vlan 200
Switch(config-vlan)# name Guest
! Configure Access Ports for APs and Management PC
Switch(config)# interface range fastethernet 0/6 - 8
Switch(config-if)# switchport mode access
Switch(config-if)# switchport access vlan 10
Switch(config-if)# spanning-tree portfast
! Configure Static LAG (EtherChannel) to WLC
Switch(config)# interface range fastethernet 0/1 - 2
Switch(config-if)# switchport mode trunk
Switch(config-if)# channel-group 1 mode on
Switch(config-if)# no shutdown
! Configure Port-Channel Interface
Switch(config)# interface port-channel 1
Switch(config-if)# switchport trunk allowed vlan 10,100,200
! Configure SVIs for Default Gateways
Switch(config)# interface vlan 10
Switch(config-if)# ip address 192.168.1.1 255.255.255.0
Switch(config)# interface vlan 100
Switch(config-if)# ip address 10.0.0.1 255.255.255.0
Switch(config)# interface vlan 200
Switch(config-if)# ip address 10.1.0.1 255.255.255.0
! Configure DHCP Pools
Switch(config)# ip dhcp pool VLAN10_POOL
Switch(dhcp-config)# network 192.168.1.0 255.255.255.0
Switch(dhcp-config)# default-router 192.168.1.1
Switch(dhcp-config)# option 43 ip 192.168.1.100
! Note: Option 43 tells APs the WLC's IP if they are in a different subnet.
Switch(config)# ip dhcp pool VLAN100_POOL
Switch(dhcp-config)# network 10.0.0.0 255.255.255.0
Switch(dhcp-config)# default-router 10.0.0.1
Switch(config)# ip dhcp pool VLAN200_POOL
Switch(dhcp-config)# network 10.1.0.0 255.255.255.0
Switch(dhcp-config)# default-router 10.1.0.1
! Enable NTP Server on Switch
Switch(config)# ntp master
Things to note:
- DHCP Option 43 is critical when APs and WLCs are in different subnets. If they are in the same subnet, APs use Layer 2 broadcasts for CAPWAP discovery.
- APs connect to Access ports, not Trunk ports. The CAPWAP tunnel handles the VLAN tagging internally.
Wireless summary
! --- SWITCH CONFIGURATION ---
! VLAN Creation
Switch(config)# vlan [10-200]
Switch(config-vlan)# name [Name]
! AP Access Ports
Switch(config)# interface range fa0/7 - 8
Switch(config-if)# switchport mode access
Switch(config-if)# switchport access vlan 10
! Static LAG to WLC (No PAgP/LACP!)
Switch(config)# interface range fa0/1 - 2
Switch(config-if)# switchport mode trunk
Switch(config-if)# channel-group 1 mode on
Switch(config)# interface port-channel 1
Switch(config-if)# switchport trunk allowed vlan 10,100,200
! DHCP Option 43 for AP Discovery
Switch(config)# ip dhcp pool VLAN10_POOL
Switch(dhcp-config)# option 43 ip [WLC_Management_IP]
! --- WLC GUI CONFIGURATION PATHS ---
! Create Dynamic Interface: Controller > Interfaces > New
! Create WLAN: WLANs > Create New
! Change Security: WLANs > [WLAN_ID] > Security > Layer 2 > WPA2 + PSK
! Change QoS: WLANs > [WLAN_ID] > QoS > [Platinum/Gold/Silver/Bronze]
! Apply CPU ACL: Security > Access Control Lists > CPU Access Control Lists
60 Serialization
Comparison: JSON vs. XML vs. YAML
| Feature |
JSON |
XML |
YAML |
| Primary Use |
REST APIs, Web Data |
Legacy APIs, Cisco IOS formatting |
Ansible, Configuration files |
| Whitespace |
Insignificant |
Insignificant |
Significant (Indentation matters) |
| Syntax Style |
Curly {} and Square [] brackets, colons :, quotes "" |
Angle brackets <tag>value</tag> |
Hyphens -, colons :, indentation |
| Human Readability |
High |
Moderate (verbose) |
Very High (clean) |
| Key Requirement |
Keys must be double-quoted strings |
Keys are tag names |
Keys are plain text followed by : |
63 Infrastructure as Code (IaC)
Mutable vs. Immutable Infrastructure
| Approach |
Description |
Typical Tool |
| Mutable |
Infrastructure can be modified in place after deployment (e.g., applying patches or config changes to an existing VM). |
Configuration Management (Ansible) |
| Immutable |
Infrastructure cannot be changed after deployment. Updates require replacing the old resource with a new, updated instance, then destroying the old one. Eliminates configuration drift. |
Provisioning (Terraform) |
Procedural vs. Declarative Approaches
| Approach |
Description |
Focus |
Example Tools |
| Procedural (Imperative) |
Follows explicit, ordered steps defined by the engineer to achieve the desired outcome. Requires knowing exact commands and order. |
How to make changes |
Ansible, Chef |
| Declarative |
Defines the desired end state. The tool automatically figures out the necessary steps and order to achieve that state. |
What the final state should be |
Terraform, Puppet |
IaC Comparison
| Feature |
Ansible |
Puppet |
Chef |
Terraform |
| Primary Use |
Configuration Management |
Configuration Management |
Configuration Management |
Infrastructure Provisioning |
| Language (Core) |
Python |
Ruby |
Ruby |
Go |
| Config Language |
YAML / Jinja2 |
Proprietary |
Ruby-based DSL |
HCL (DSL) |
| Agent Status |
Agentless |
Agent-based (or proxy) |
Agent-based |
Agentless |
| Model |
Push (via SSH) |
Pull |
Pull |
Push (via APIs) |
| Key Port |
TCP 22 (SSH) |
TCP 8140 |
TCP 10002 |
API Ports (varies) |
| Infrastructure |
Mutable |
Mutable |
Mutable |
Immutable |
| Approach |
Procedural (mostly) |
Declarative |
Procedural |
Declarative |
| Key Terminology |
Playbook, Inventory |
Manifest, Puppet Master |
Cookbook, Recipe, Run-list |
Provider, State File, Plan/Apply |
# Conceptual Terraform Workflow Commands
terraform init # Initialize working directory and download providers
terraform plan # Preview the execution plan (Write -> Plan)
terraform apply # Execute the plan to reach the desired state (Apply)
terraform destroy # Tear down the provisioned infrastructure
! Conceptual Ansible/Jinja2 Template Snippet
hostname {{ hostname_var }}
interface GigabitEthernet0/1
ip address {{ ip_address_var }} {{ subnet_mask_var }}
no shutdown