Complete CCNA CLI Reference Guide - Comprehensive Edition: Router Boot Process and Initial Configuration
Complete CCNA CLI Reference Guide - Comprehensive Edition: Router Boot Process and Initial Configuration
This expanded guide covers every CCNA topic with in-depth explanations, complete command variations,
detailed troubleshooting, and real-world scenarios.
1. Network Fundamentals
Routers are Layer 3 devices that forward packets between networks based on IP addresses. They maintain
routing tables, make forwarding decisions, and provide interconnection between different network
segments.
bash
# Boot Process Overview:
# 1. Power-On Self Test (POST)
# 2. Bootstrap program loads IOS from Flash
# 3. IOS loads configuration from NVRAM
# 4. If no config, enters Setup mode
# Context-sensitive help
Router> ? # Available commands in user mode
Router# ? # Available commands in privileged
mode
Router(config)# ? # Available global config commands
Router(config-if)# ? # Available interface commands
bash
# Hostname Configuration
Router(config)# hostname R1 # Set device hostname
Router(config)# no hostname # Reset to default (Router)
# Remove banners
Router(config)# no banner motd
Router(config)# no banner login
bash
# Enable Password (less secure - plaintext storage)
Router(config)# enable password cisco123 # Plaintext password
bash
# Interface Selection Methods
Router(config)# interface gigabitethernet 0/0 # Full name
Router(config)# interface gi0/0 # Abbreviated
Router(config)# interface g0/0 # Short form
Router(config)# interface range gi0/0-3 # Range configuration
Router(config)# interface range gi0/0-1,gi0/3 # Multiple interfaces
# IP Address Configuration
Router(config-if)# ip address 192.168.1.1 255.255.255.0 # Primary IP
Router(config-if)# ip address 192.168.1.10 255.255.255.0 secondary # Secondary IP
Router(config-if)# ip address dhcp # DHCP client
Router(config-if)# ip address dhcp hostname R1 # DHCP with hostname
Router(config-if)# ip address negotiated # PPP negotiated address
bash
# Domain Name and Host Resolution
Router(config)# ip domain-name company.com # Domain name
Router(config)# ip domain-lookup # Enable DNS lookups (default)
Router(config)# no ip domain-lookup # Disable DNS lookups
Router(config)# ip name-server 8.8.8.8 # DNS server
Router(config)# ip name-server 8.8.4.4 8.8.8.8 # Multiple DNS servers
# IP Services
Router(config)# ip routing # Enable IP routing (default on
routers)
Router(config)# no ip routing # Disable IP routing
Router(config)# ip classless # Classless routing behavior
Router(config)# ip subnet-zero # Allow subnet zero usage
# Router Information
Router(config)# snmp-server location "Building A Rack 1" # Physical location
Router(config)# snmp-server contact "admin@company.com" # Contact information
bash
# Configuration Display
Router# show running-config # Current active configuration
Router# show startup-config # Saved configuration in NVRAM
Router# show running-config | section interface # Interface configurations only
Router# show running-config | include hostname # Lines containing 'hostname'
Router# show running-config | exclude ! # Exclude comment lines
Router# show running-config | begin line vty # Start from 'line vty'
# System Information
Router# show version # IOS version, uptime, hardware info
Router# show tech-support # Complete technical information
Router# show inventory # Hardware inventory
Router# show environment # Environmental status (temp, power)
Router# show processes # Running processes
Router# show processes cpu # CPU utilization
Router# show memory # Memory usage
Router# show stacks # Stack trace information
# Interface Verification
Router# show interfaces # All interfaces detailed info
Router# show ip interface brief # IP interface summary
Router# show interface gi0/0 # Specific interface details
Router# show interface description # Interface descriptions
Router# show interface status # Interface status summary
Router# show interface counters # Interface packet counters
Router# show interface counters errors # Interface error counters
Router# show controllers serial 0/0/0 # Controller information
bash
# Connectivity Testing
Router# ping 8.8.8.8 # Basic ping
Router# ping 8.8.8.8 source gi0/0 # Ping with source interface
Router# ping 8.8.8.8 size 1500 # Large packet ping
Router# ping 8.8.8.8 repeat 100 # Extended ping
Router# ping 8.8.8.8 timeout 10 # Custom timeout
# Traceroute Testing
Router# traceroute 8.8.8.8 # Basic traceroute
Router# traceroute 8.8.8.8 source gi0/0 # Source interface traceroute
Router# traceroute 8.8.8.8 numeric # Numeric output only
# Telnet Testing
Router# telnet 192.168.1.2 # Telnet to device
Router# telnet 192.168.1.2 23 # Telnet to specific port
# Clear Commands
Router# clear counters # Clear interface counters
Router# clear arp-cache # Clear ARP cache
Router# clear ip route * # Clear all dynamic routes
Router# clear logging # Clear log buffer
Configuration Management:
bash
# Save Configuration
Router# copy running-config startup-config # Save to NVRAM
Router# write memory # Alternative save command
Router# copy run start # Abbreviated save
Router# wr # Shortest save command
# Configuration Archive
Router(config)# archive
Router(config-archive)# path flash:archive-config # Archive path
Router(config-archive)# maximum 14 # Keep 14 versions
Router(config-archive)# time-period 1440 # Archive every 24 hours
# Archive Operations
Router# archive config # Archive current config
Router# show archive # Show archived configs
Router# configure replace flash:archive-config-1 # Replace with archived config
# Reset Configuration
Router# write erase # Erase startup configuration
Router# erase startup-config # Alternative erase command
Router(config)# config-register 0x2142 # Boot without startup-config
Router# reload # Restart router
Router-on-a-Stick Setup
What Is It?
“Router-on-a-Stick” is a network setup where a single physical router interface (usually connecting to a
switch) is used to route traffic between multiple VLANs. This is achieved by configuring subinterfaces on the
router, each corresponding to a different VLAN, and using 802.1Q trunking.
Where to use:
• Campus networks with multiple VLANs and Layer 2 switches only (no multilayer/L3 switches).
• Small to medium deployments with low inter-VLAN traffic demand.
Topology Example
Step-by-Step Configuration
bash
# Create VLANs
Switch(config)# vlan 10
Switch(config-vlan)# name SALES
Switch(config)# vlan 20
Switch(config-vlan)# name IT
bash
Switch(config)# interface fastethernet0/1
Switch(config-if)# switchport trunk encapsulation dot1q # May be required on some
switches
Switch(config-if)# switchport mode trunk
Switch(config-if)# switchport nonegotiate # Optional: disables DTP
Switch(config-if)# description Trunk to Router
3. Router Subinterface Configuration
bash
Router(config)# interface GigabitEthernet0/0
Router(config-if)# no shutdown
• encapsulation dot1Q xx: Enables 802.1Q tagging, tags this subinterface’s traffic with VLAN ID.
• ip address: Acts as the default gateway for all devices in that VLAN.
bash
Router(config)# interface GigabitEthernet0/0.99
Router(config-if)# encapsulation dot1Q 99 native
Router(config-if)# ip address 192.168.99.1 255.255.255.0
Verification
bash
# On Router:
show ip interface brief
show running-config interface GigabitEthernet0/0.10
show running-config interface GigabitEthernet0/0.20
# On Switch:
show interfaces trunk
show vlan brief
show mac address-table vlan 10
show mac address-table vlan 20
# Test:
ping 192.168.10.1 # From VLAN 10 client to gateway
ping 192.168.20.1 # From VLAN 20 client to its gateway
ping 192.168.20.10 # From VLAN 10 client to VLAN 20 client (test inter-VLAN)
Summary Table
Switches forward frames based on MAC addresses (Layer 2) or route packets between VLANs (Layer 3).
Modern switches combine both functions for efficient network operation.
bash
# Switch Boot Process:
# 1. POST (Power-On Self Test)
# 2. Boot Loader initialization
# 3. IOS loading from flash
# 4. Configuration loading from NVRAM
# 5. VLAN database loading
# Switch-specific Information
Switch# show version # Switch IOS and hardware
Switch# show system # System information
Switch# show switch # Stack information (if stackable)
Switch# show module # Module information
bash
# VLAN Creation and Management
Switch(config)# vlan 10 # Create VLAN 10
Switch(config-vlan)# name Users # VLAN name
Switch(config-vlan)# state active # VLAN state (active/suspend)
Switch(config-vlan)# exit
# VLAN Verification
Switch# show vlan # Detailed VLAN information
Switch# show vlan brief # VLAN summary
Switch# show vlan id 10 # Specific VLAN
Switch# show vlan name Users # VLAN by name
Switch# show interfaces vlan 10 # SVI information
Switch# show ip interface brief # All IP interfaces
bash
# Interface Selection Methods
Switch(config)# interface fastethernet 0/1 # Single interface
Switch(config)# interface range fa0/1-24 # Port range
Switch(config)# interface range fa0/1-10,fa0/15-24 # Multiple ranges
Switch(config)# interface range gi0/1-2 # Gigabit range
bash
# Enable IP Routing
Switch(config)# ip routing # Enable routing capability
bash
# Interface and Port Information
Switch# show interfaces status # Port status summary
Switch# show interfaces description # Port descriptions
Switch# show interfaces trunk # Trunk port information
Switch# show interfaces switchport # Switchport information
Switch# show interfaces gi0/1 switchport # Specific port switchport info
NGFWs provide comprehensive security beyond traditional packet filtering, including application awareness,
intrusion prevention, URL filtering, and malware detection.
bash
# Security Zones Creation
Router(config)# zone security INSIDE # Internal trusted zone
Router(config-sec-zone)# description "Internal LAN Zone"
bash
# IPS Global Configuration
Router(config)# ip ips config location flash:/ipsdir/ # IPS signature location
Router(config)# ip ips name IPS_RULE # Create IPS rule
Router(config)# ip ips notify log # IPS logging
Router(config)# ip ips notify syslog # Syslog notifications
# IPS Troubleshooting
Router# debug ip ips # Debug IPS operations
Router# show logging | include IPS # IPS-related logs
Router# clear ip ips statistics # Clear IPS statistics
bash
# URL Filtering (using zone-based firewall with URL filtering)
Router(config)# parameter-map type urlfilter URLF_PARAM
Router(config-profile)# server vendor websense # Websense server
Router(config-profile)# server 192.168.100.50 # URL filtering server
Router(config-profile)# port 8080 # Server port
Router(config-profile)# timeout 5 # Timeout value
Router(config-profile)# cache 1000 # Cache size
Router(config-profile)# exit
Router(config)# class-map type urlfilter match-any URLFILTER_CLASS
Router(config-cmap)# match server-response refuse # Blocked URLs
Router(config-cmap)# exit
bash
# Zone-Based Firewall Verification
Router# show zone security # Security zones
Router# show zone-pair security # Zone pairs
Router# show policy-map type inspect # Inspect policies
Router# show class-map type inspect # Inspect class maps
# Performance Monitoring
Router# show processes cpu | include IP inspect # CPU usage
Router# show memory statistics | include inspect # Memory usage
Router# show ip traffic # IP traffic statistics
# Troubleshooting Commands
Router# debug zone # Debug zone operations
Router# debug policy-firewall # Debug firewall policies
Router# debug ip inspect # Debug inspection
Router# undebug all # Turn off all debugging
Access Points provide wireless connectivity while controllers centrally manage multiple APs, enforce
policies, and optimize RF performance.
bash
# Basic AP Setup and Management
AP> enable
AP# configure terminal
AP(config)# hostname Office-AP-01 # Set AP hostname
AP(config)# enable secret AP123secret # Enable password
AP(config)# username admin privilege 15 secret AdminPass123 # Local user
# SSH Configuration
AP(config)# crypto key generate rsa general-keys modulus 1024
AP(config)# line vty 0 4
AP(config-line)# transport input ssh # SSH only
AP(config-line)# login local # Local authentication
AP(config-line)# exec-timeout 10 0 # 10-minute timeout
AP(config-line)# exit
# SNMP Configuration
AP(config)# snmp-server community public ro # Read-only community
AP(config)# snmp-server location "Building A Floor 2" # Location
AP(config)# snmp-server contact "netadmin@company.com" # Contact
Radio Interface Configuration - Detailed:
bash
# 2.4 GHz Radio Configuration
AP(config)# interface dot11radio 0 # 2.4 GHz radio
AP(config-if)# no shutdown # Enable radio
AP(config-if)# ssid Corporate_24GHz # SSID name
AP(config-if)# channel 6 # Channel (1, 6, or 11 recommended)
AP(config-if)# power local maximum # Maximum power output
AP(config-if)# antenna gain 0 # Antenna gain setting
AP(config-if)# rts threshold 2347 # RTS threshold
AP(config-if)# fragmentation-threshold 2346 # Fragmentation threshold
AP(config-if)# beacon period 100 # Beacon interval (ms)
AP(config-if)# dtim-period 2 # DTIM period
AP(config-if)# exit
# 802.11n/ac Configuration
AP(config-if)# 802.11n # Enable 802.11n
AP(config-if)# mbssid # Multiple BSSID support
AP(config-if)# 802.11n only # 802.11n only mode
AP(config-if)# 802.11n amsdu # A-MSDU aggregation
bash
# Open Security (No encryption - for testing only)
AP(config-if)# encryption mode ciphers none # No encryption
AP(config-if)# authentication open # Open authentication
# WEP Security (Legacy - Not recommended)
AP(config-if)# encryption key 1 size 128bit 1234567890123456789012345678 transmit-key
AP(config-if)# encryption mode wep mandatory # WEP encryption required
AP(config-if)# authentication shared-key # Shared key authentication
# WPA2-Personal Configuration
AP(config-if)# encryption mode ciphers aes-ccmp # AES encryption
AP(config-if)# authentication open # Open authentication
AP(config-if)# authentication key-management wpa version 2 # WPA2
AP(config-if)# wpa-psk ascii 0 SecurePassword123 # Pre-shared key
AP(config-if)# wpa-psk ascii 1 BackupPassword456 # Additional PSK
# WPA3-Enterprise Configuration
AP(config-if)# authentication key-management wpa3 # WPA3 enterprise
AP(config-if)# dot1x authentication-server host 192.168.1.100
AP(config-if)# dot1x authentication-server key WPA3RadiusKey
AP(config-if)# encryption mode ciphers aes-ccmp # AES encryption
bash
# Multiple SSID Configuration with VLANs
AP(config)# interface dot11radio 0.10 # Subinterface for VLAN
AP(config-subif)# encapsulation dot1q 10 # VLAN 10 tagging
AP(config-subif)# ssid Users_VLAN10 # SSID for VLAN 10
AP(config-subif)# bridge-group 10 # Bridge group 10
AP(config-subif)# exit
bash
# Initial WLC Setup
(Cisco Controller) > configure network interface management
IP Address: 192.168.1.100
Netmask: 255.255.255.0
Gateway: 192.168.1.1
DHCP Server: 192.168.1.1
# System Configuration
(Cisco Controller) > config system name WLC-01
(Cisco Controller) > config system location "Data Center"
(Cisco Controller) > config system contact "admin@company.com"
(Cisco Controller) > config time manual 04/15/2024 14:30:00
# NTP Configuration
(Cisco Controller) > config time ntp server 1 pool.ntp.org
(Cisco Controller) > config time ntp server 2 time.google.com
(Cisco Controller) > config time ntp interval 3600
# Management Access Configuration
(Cisco Controller) > config network ssh enable # Enable SSH
(Cisco Controller) > config network telnet disable # Disable Telnet
(Cisco Controller) > config network http disable # Disable HTTP
(Cisco Controller) > config network https enable # Enable HTTPS
(Cisco Controller) > config network https port 443 # HTTPS port
# User Management
(Cisco Controller) > config mgmtuser add admin admin123 read-write # Add admin user
(Cisco Controller) > config mgmtuser add operator oper123 read-only # Read-only user
(Cisco Controller) > config mgmtuser password admin NewPass123 # Change password
bash
# Create and Configure WLAN
(Cisco Controller) > config wlan create 1 Corporate-WiFi # Create WLAN ID 1
(Cisco Controller) > config wlan ssid Corporate-WiFi 1 # Set SSID
(Cisco Controller) > config wlan broadcast-ssid enable 1 # Broadcast SSID
(Cisco Controller) > config wlan interface 1 management # Assign interface
# Security Configuration
(Cisco Controller) > config wlan security wpa2 enable 1 # Enable WPA2
(Cisco Controller) > config wlan security wpa2 ciphers aes enable 1 # AES cipher
(Cisco Controller) > config wlan security wpa2 akm psk enable 1 # PSK
authentication
(Cisco Controller) > config wlan security wpa2 akm psk set-key ascii SecurePass123 1
# WPA3 Configuration
(Cisco Controller) > config wlan security wpa3 enable 1 # Enable WPA3
(Cisco Controller) > config wlan security wpa3 sae enable 1 # SAE authentication
(Cisco Controller) > config wlan security pmf required 1 # PMF required for
WPA3
# Enable WLAN
(Cisco Controller) > config wlan enable 1 # Enable WLAN
bash
# AP Discovery and Naming
(Cisco Controller) > show ap join stats summary # AP join statistics
(Cisco Controller) > config ap name Office-AP-01 00:1a:2b:3c:4d:5e # Name by MAC
(Cisco Controller) > config ap location "Building A Floor 1" Office-AP-01
(Cisco Controller) > config ap country US Office-AP-01 # Country code
# AP Mode Configuration
(Cisco Controller) > config ap mode local Office-AP-01 # Local mode (default)
(Cisco Controller) > config ap mode flexconnect Office-AP-01 # FlexConnect mode
(Cisco Controller) > config ap mode monitor Office-AP-01 # Monitor/sniffer mode
(Cisco Controller) > config ap mode rogue-detector Office-AP-01 # Rogue detection
# FlexConnect Configuration
(Cisco Controller) > config flexconnect group create Branch1 # Create group
(Cisco Controller) > config ap flexconnect group Branch1 Office-AP-01 # Assign AP
(Cisco Controller) > config flexconnect group Branch1 vlan add 10 10 # Add VLAN
mapping
(Cisco Controller) > config flexconnect group Branch1 radius server auth primary
192.168.1.200
# AP Radio Management
(Cisco Controller) > config 802.11b disable network # Disable 2.4GHz
globally
(Cisco Controller) > config 802.11a disable network # Disable 5GHz globally
(Cisco Controller) > config 802.11b enable Office-AP-01 # Enable 2.4GHz on AP
(Cisco Controller) > config 802.11a enable Office-AP-01 # Enable 5GHz on AP
bash
# WLC System Information
(Cisco Controller) > show sysinfo # System information
(Cisco Controller) > show inventory # Hardware inventory
(Cisco Controller) > show boot # Boot information
(Cisco Controller) > show time # Current time
(Cisco Controller) > show network summary # Network configuration
# AP Information
(Cisco Controller) > show ap summary # All APs summary
(Cisco Controller) > show ap config general Office-AP-01 # AP configuration
(Cisco Controller) > show ap status Office-AP-01 # AP status
(Cisco Controller) > show ap stats Office-AP-01 # AP statistics
(Cisco Controller) > show ap inventory Office-AP-01 # AP inventory
# Autonomous AP Verification
AP# show interfaces dot11radio 0 # Radio 0 status
AP# show interfaces dot11radio 1 # Radio 1 status
AP# show dot11 associations # Associated clients
AP# show controllers dot11radio 0 # Radio controller info
AP# show bridge # Bridge information
AP# show version # AP software version
bash
# Basic Network Information
C:\> ipconfig # Basic IP configuration
C:\> ipconfig /all # Detailed configuration
C:\> ipconfig /? | more # Help information
# IP Address Management
C:\> ipconfig /release # Release DHCP lease
C:\> ipconfig /renew # Renew DHCP lease
C:\> ipconfig /release "Local Area Connection" # Release specific adapter
C:\> ipconfig /renew "Local Area Connection" # Renew specific adapter
# DNS Operations
C:\> ipconfig /flushdns # Clear DNS resolver cache
C:\> ipconfig /displaydns # Display DNS resolver cache
C:\> ipconfig /displaydns | findstr "Record Name" # Find specific records
C:\> ipconfig /registerdns # Register DNS names
C:\> nslookup google.com # DNS lookup
C:\> nslookup google.com 8.8.8.8 # Query specific DNS server
# Connectivity Testing
C:\> ping 8.8.8.8 # Basic ping test
C:\> ping -t 8.8.8.8 # Continuous ping
C:\> ping -n 20 8.8.8.8 # Ping 20 times
C:\> ping -l 1472 8.8.8.8 # Large packet ping
C:\> ping -4 google.com # Force IPv4
C:\> ping -6 google.com # Force IPv6
C:\> pathping 8.8.8.8 # Combined ping/tracert
# Network Tracing
C:\> tracert 8.8.8.8 # Trace route
C:\> tracert -h 15 8.8.8.8 # Max 15 hops
C:\> tracert -w 5000 8.8.8.8 # 5-second timeout
# ARP Operations
C:\> arp -a # Display ARP table
C:\> arp -d # Clear ARP cache
C:\> arp -s 192.168.1.1 00-11-22-33-44-55 # Add static ARP entry
# Network Statistics
C:\> netstat -an # All connections and ports
C:\> netstat -rn # Routing table
C:\> netstat -e # Ethernet statistics
C:\> netstat -s # Protocol statistics
C:\> netstat -b # Show binaries using connections
C:\> netstat -o # Show process IDs
# Route Management
C:\> route print # Display routing table
C:\> route add 192.168.2.0 mask 255.255.255.0 192.168.1.1 # Add route
C:\> route delete 192.168.2.0 # Delete route
C:\> route -p add 0.0.0.0 mask 0.0.0.0 192.168.1.1 # Persistent default route
# DHCP Configuration
C:\> netsh interface ip set address "Local Area Connection" dhcp
C:\> netsh interface ip set dns "Local Area Connection" dhcp
# Interface Management
C:\> netsh interface show interface # Show interfaces
C:\> netsh interface ip show config # IP configuration
C:\> netsh wlan show interface # Wireless interfaces
C:\> netsh wlan show profiles # Wireless profiles
Linux Network Configuration - Comprehensive Guide:
bash
# Modern IP Command Suite
$ ip addr show # Show all IP addresses
$ ip a # Abbreviated form
$ ip addr show eth0 # Specific interface
$ ip -4 addr show # IPv4 addresses only
$ ip -6 addr show # IPv6 addresses only
$ ip addr add 192.168.1.100/24 dev eth0 # Add IP address
$ ip addr del 192.168.1.100/24 dev eth0 # Remove IP address
[Network]
DHCP=yes
# OR for static:
Address=192.168.1.100/24
Gateway=192.168.1.1
DNS=8.8.8.8
DNS=8.8.4.4
# DNS Tools
$ dig google.com # DNS lookup
$ dig @8.8.8.8 google.com # Query specific server
$ dig google.com MX # MX records
$ dig -x 8.8.8.8 # Reverse DNS
$ nslookup google.com # Alternative DNS tool
$ host google.com # Simple DNS lookup
# Network Statistics and Connections
$ ss -tuln # Socket statistics (modern)
$ ss -tuln | grep :22 # SSH connections
$ netstat -tuln # Network statistics (legacy)
$ netstat -i # Interface statistics
$ netstat -r # Routing table
bash
# Interface Information
$ ifconfig # Interface configuration
$ ifconfig en0 # Specific interface (usually WiFi)
$ ifconfig en1 # Ethernet interface
$ networksetup -listallhardwareports # List all network ports
# IP Configuration
$ sudo ifconfig en0 inet 192.168.1.100 netmask 255.255.255.0 # Set static IP
$ sudo route add default 192.168.1.1 # Add default route
$ sudo route delete default # Remove default route
# DNS Configuration
$ scutil --dns # Show DNS configuration
$ sudo networksetup -setdnsservers "Wi-Fi" 8.8.8.8 8.8.4.4 # Set DNS servers
$ sudo networksetup -setdnsservers "Wi-Fi" "Empty" # Use DHCP DNS
# Network Testing
$ ping -c 4 8.8.8.8 # Ping test
$ traceroute 8.8.8.8 # Trace route
$ dig google.com # DNS lookup
$ nslookup google.com # Alternative DNS lookup
# WiFi Management
$ /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/a
irport -s # Scan WiFi
$ sudo networksetup -setairportpower en0 off # Turn off WiFi
$ sudo networksetup -setairportpower en0 on # Turn on WiFi
$ networksetup -getairportnetwork en0 # Current WiFi network
2. Network Access
EtherChannel bundles multiple physical links into a single logical link for increased bandwidth and
redundancy. This section covers all protocols and comprehensive troubleshooting.
bash
# Switch 1 Configuration
Switch1(config)# interface range gi0/1-2
Switch1(config-if-range)# channel-group 1 mode on # Manual mode
Switch1(config-if-range)# description "Manual EtherChannel to SW2"
Switch1(config-if-range)# exit
bash
# Switch 1 Configuration
Switch1(config)# interface range gi0/3-4
Switch1(config-if-range)# channel-group 2 mode active # LACP active
Switch1(config-if-range)# lacp port-priority 128 # Port priority
Switch1(config-if-range)# lacp timeout short # LACP timeout
Switch1(config-if-range)# exit
# Switch 2 Configuration
Switch2(config)# interface range gi0/3-4
Switch2(config-if-range)# channel-group 2 mode passive # LACP passive
Switch2(config-if-range)# lacp port-priority 128
Switch2(config-if-range)# exit
bash
# Switch 1 Configuration
Switch1(config)# interface range gi0/5-6
Switch1(config-if-range)# channel-group 3 mode desirable # PAgP desirable
Switch1(config-if-range)# pagp port-priority 128 # Port priority
Switch1(config-if-range)# exit
# Switch 2 Configuration
Switch2(config)# interface range gi0/5-6
Switch2(config-if-range)# channel-group 3 mode auto # PAgP auto
Switch2(config-if-range)# pagp port-priority 128
Switch2(config-if-range)# exit
bash
# Switch 1 Configuration
Switch1(config)# interface range gi0/7-8
Switch1(config-if-range)# no switchport # Layer 3 ports
Switch1(config-if-range)# channel-group 4 mode active # LACP active
Switch1(config-if-range)# exit
# Switch 2 Configuration
Switch2(config)# interface range gi0/7-8
Switch2(config-if-range)# no switchport
Switch2(config-if-range)# channel-group 4 mode passive
Switch2(config-if-range)# exit
bash
# Basic EtherChannel Status
Switch# show etherchannel summary # Quick overview
Switch# show etherchannel detail # Detailed information
Switch# show etherchannel port-channel # Port-channel details
Switch# show etherchannel load-balance # Load balancing method
# Protocol-Specific Verification
Switch# show lacp neighbor # LACP neighbors
Switch# show lacp neighbor detail # Detailed LACP info
Switch# show lacp counters # LACP packet counters
Switch# show lacp sys-id # LACP system ID
# Interface-Specific Information
Switch# show interfaces port-channel 1 # Port-channel interface
Switch# show interfaces gi0/1 etherchannel # Member interface details
Switch# show etherchannel 1 port-channel # Specific channel group
# Troubleshooting Commands
Switch# show etherchannel 1 summary # Channel group 1 summary
Switch# show etherchannel port # All member ports
Switch# show interfaces status | include Po # Port-channel status
Switch# show spanning-tree interface port-channel 1 # STP on port-channel
# Clear Commands
Switch# clear lacp counters # Clear LACP counters
Switch# clear pagp counters # Clear PAgP counters
Switch# clear etherchannel # Clear EtherChannel info
bash
# Port-Channel Status Flags
# D - EtherChannel is down
# U - EtherChannel is up and in use
# P - Port is bundled in the port-channel
# S - Layer 2 EtherChannel (switching)
# R - Layer 3 EtherChannel (routing)
# H - Hot-standby (LACP only)
# I - Individual port (not bundled)
# s - Port is suspended
# M - Not in use, minimum links not met
# f - Failed to allocate aggregator
# w - Waiting to be aggregated
# d - Default port
bash
# Global Load Balancing Methods
Switch(config)# port-channel load-balance src-mac # Source MAC
Switch(config)# port-channel load-balance dst-mac # Destination MAC
Switch(config)# port-channel load-balance src-dst-mac # Source and destination MAC
Switch(config)# port-channel load-balance src-ip # Source IP
Switch(config)# port-channel load-balance dst-ip # Destination IP
Switch(config)# port-channel load-balance src-dst-ip # Source and destination IP
Switch(config)# port-channel load-balance src-port # Source port
Switch(config)# port-channel load-balance dst-port # Destination port
Switch(config)# port-channel load-balance src-dst-port # Source and destination port
bash
# Common Issues and Solutions
# 1. Mismatched Configurations
# Problem: Different modes on each end
# Solution: Ensure compatible modes
Switch# show etherchannel summary
# Look for (I) individual flags instead of (P) bundled
# 2. STP Issues
# Problem: Port-channel blocked by STP
Switch# show spanning-tree interface port-channel 1
# Solution: Check spanning tree configuration
# 3. VLAN Mismatch
# Problem: Different VLAN configurations on member ports
Switch# show interfaces trunk
Switch# show vlan brief
# Solution: Ensure all member ports have same trunk config
# 4. Speed/Duplex Mismatch
# Problem: Member ports with different speeds
Switch# show interfaces status
# Solution: Configure all member ports with same speed/duplex
# 5. Protocol Mismatch
# Problem: LACP on one end, PAgP on other
Switch# show lacp neighbor
Switch# show pagp neighbor
# Solution: Use compatible protocols on both ends
# Recovery Commands
Switch# clear etherchannel 1
Switch(config)# interface port-channel 1
Switch(config-if)# shutdown
Switch(config-if)# no shutdown
Legend:
Key Guidelines:
• Both sides must use the SAME protocol (LACP or PAgP) and compatible modes for
automatic negotiation.
• "on" mode should only be used when both sides are set to "on".
• "auto" and "passive" are both passive and will NOT form a bundle with each
other.
• LACP is generally preferred for multi-vendor compatibility.
2.2 Spanning Tree Protocol (STP) - Deep Dive Explanation
STP prevents loops in Layer 2 networks while providing redundancy. Understanding the complete process is
crucial for network stability.
bash
# Bridge ID Components
# Bridge Priority (2 bytes) + MAC Address (6 bytes) = 8 bytes total
# Default Priority: 32768 (can be modified in increments of 4096)
# Priority Configuration
Switch(config)# spanning-tree vlan 1 priority 4096 # Higher priority (lower
value)
Switch(config)# spanning-tree vlan 1 priority 8192 # Lower priority
Switch(config)# spanning-tree vlan 1 priority 0 # Highest priority (root)
Switch(config)# spanning-tree vlan 1 priority 65536 # Invalid (not multiple of
4096)
# Verify Bridge ID
Switch# show spanning-tree vlan 1 # Show STP for VLAN 1
Switch# show spanning-tree root # Show root bridge info
Switch# show spanning-tree summary # STP summary
bash
# BPDU Fields:
# - Root Bridge ID (which switch is the root)
# - Sender Bridge ID (who sent this BPDU)
# - Root Path Cost (cost to reach root bridge)
# - Timer values (Hello, Max Age, Forward Delay)
# BPDU Transmission
Switch(config)# spanning-tree vlan 1 hello-time 2 # Hello interval (1-10 sec)
Switch(config)# spanning-tree vlan 1 max-age 20 # Max age (6-40 sec)
Switch(config)# spanning-tree vlan 1 forward-delay 15 # Forward delay (4-30 sec)
# View BPDU Information
Switch# show spanning-tree interface gi0/1 detail # Detailed interface info
Switch# debug spanning-tree bpdu # Debug BPDUs (careful!)
bash
# Root Port Election Criteria (in order):
# 1. Lowest path cost to root bridge
# 2. Lowest sender bridge ID
# 3. Lowest sender port ID (priority + port number)
bash
# Designated Port Election on each Segment:
# 1. Lowest path cost to root bridge
# 2. Lowest bridge ID of sender
# 3. Lowest port ID of sender
bash
# Port States:
# 1. Disabled - Administratively down or failed
# 2. Blocking - Receives BPDUs, doesn't forward data, doesn't learn MACs
# 3. Listening - Processes BPDUs, doesn't forward data, doesn't learn MACs
# 4. Learning - Processes BPDUs, doesn't forward data, learns MACs
# 5. Forwarding - Fully functional, forwards data and learns MACs
bash
# RSTP Improvements:
# - Faster convergence (sub-second)
# - Backward compatible with STP
# - Enhanced port roles and states
# Enable RSTP
Switch(config)# spanning-tree mode rapid-pvst # Enable Rapid PVST+
Switch# show spanning-tree summary # Verify mode
bash
# PortFast - Immediate Forwarding for End Devices
Switch(config)# interface gi0/1
Switch(config-if)# spanning-tree portfast # Enable PortFast
Switch(config-if)# spanning-tree portfast trunk # PortFast for trunk (rare)
bash
# PVST+ Features:
# - Separate STP instance per VLAN
# - Load balancing across VLANs
# - Different root bridges per VLAN
bash
# Common STP Issues:
# Recovery Commands
Switch# clear spanning-tree detected-protocols # Clear protocols
Switch(config)# interface gi0/1
Switch(config-if)# shutdown
Switch(config-if)# no shutdown # Reset port
# Advanced Troubleshooting
Switch# debug spanning-tree events # Debug events
Switch# debug spanning-tree root # Debug root election
Switch# debug spanning-tree backbonefast # Debug BackboneFast
Switch# show spanning-tree pathcost method # Path cost method
# STP Optimization
Switch(config)# spanning-tree extend system-id # Include VLAN in Bridge ID
Switch(config)# spanning-tree vlan 1-100 priority 8192 # Bulk priority setting
bash
# MSTP allows grouping VLANs into instances
# Reduces STP overhead compared to PVST+
# Industry standard (not Cisco proprietary)
# MST Verification
Switch# show spanning-tree mst configuration # MST config
Switch# show spanning-tree mst # MST status
Switch# show spanning-tree mst 1 # Specific instance
This section covers all major routing protocols with detailed configuration steps and explanations.
bash
# Basic Static Route Concepts:
# - Manually configured routes
# - No automatic updates
# - Administrative Distance: 1
# - Used for stub networks, default routes, and specific routing requirements
# 1. Next-Hop IP Address
Router(config)# ip route 192.168.10.0 255.255.255.0 10.1.1.2
Router(config)# ip route 172.16.0.0 255.240.0.0 10.1.1.2 # Summary route
# Route Filtering
Router(config-router)# distribute-list 1 out gi0/1 # Filter outbound updates
Router(config)# access-list 1 deny 192.168.10.0 0.0.0.255
Router(config)# access-list 1 permit any
# RIP Verification
Router# show ip rip database # RIP database
Router# show ip protocols # RIP configuration
Router# debug ip rip # RIP debugging
EIGRP (Enhanced Interior Gateway Routing Protocol) - Detailed Configuration:catchpoint
bash
# EIGRP Characteristics:
# - Advanced Distance Vector (Hybrid)
# - DUAL algorithm prevents loops
# - Fast convergence (sub-second)
# - Supports VLSM and CIDR
# - Administrative Distance: Internal 90, External 170
# - Multicast updates (224.0.0.10)
# EIGRP Router ID
Router(config-router)# eigrp router-id 1.1.1.1 # Manual Router ID
Router(config-router)# eigrp log-neighbor-changes # Log neighbor state changes
# Passive Interfaces
Router(config-router)# passive-interface default # All interfaces passive
Router(config-router)# no passive-interface gi0/1 # Enable EIGRP on interface
# Load Balancing
Router(config-router)# maximum-paths 4 # Equal-cost paths (1-32)
Router(config-router)# variance 2 # Unequal-cost load balancing
# Variance allows paths up to 2x the best metric
# EIGRP Authentication
Router(config)# interface gi0/1
Router(config-if)# ip authentication mode eigrp 100 md5
Router(config-if)# ip authentication key-chain eigrp 100 EIGRP_KEYS
# EIGRP Verification
Router# show ip eigrp neighbors # EIGRP neighbors
Router# show ip eigrp neighbors detail # Detailed neighbor info
Router# show ip eigrp topology # Topology table
Router# show ip eigrp topology all-links # All topology entries
Router# show ip eigrp interfaces # EIGRP-enabled interfaces
Router# show ip eigrp interfaces detail gi0/1 # Detailed interface info
Router# show ip eigrp traffic # EIGRP packet statistics
# EIGRP Troubleshooting
Router# debug eigrp packets # EIGRP packet debugging
Router# debug ip eigrp neighbor # Neighbor debugging
Router# show logging | include EIGRP # EIGRP log messages
bash
# OSPF Characteristics:
# - Link State Protocol
# - Shortest Path First (Dijkstra) algorithm
# - Fast convergence
# - Hierarchical design with areas
# - Administrative Distance: 110
# - Multicast updates (224.0.0.5 and 224.0.0.6)
# OSPF Authentication
# Interface Authentication
Router(config)# interface gi0/1
Router(config-if)# ip ospf authentication # Simple password
Router(config-if)# ip ospf authentication-key cisco123
# Area Authentication
Router(config-router)# area 0 authentication # Simple authentication for area
Router(config-router)# area 0 authentication message-digest # MD5 for area
# OSPF Troubleshooting
Router# debug ip ospf hello # Debug hello packets
Router# debug ip ospf adj # Debug adjacency formation
Router# debug ip ospf lsa-generation # Debug LSA generation
Router# clear ip ospf process # Clear OSPF process (restarts)
bash
# BGP Characteristics:
# - Path Vector Protocol
# - Policy-based routing
# - Used between Autonomous Systems (Inter-AS)
# - Administrative Distance: eBGP 20, iBGP 200
# - TCP port 179
# Network Advertisement
Router(config-router)# network 192.168.1.0 mask 255.255.255.0 # Advertise network
Router(config-router)# redistribute connected # Redistribute connected routes
Router(config-router)# redistribute static # Redistribute static routes
# AS Path Manipulation
Router(config)# route-map PREPEND permit 10
Router(config-route-map)# set as-path prepend 65001 65001 # Prepend AS
Router(config-router)# neighbor 192.168.1.2 route-map PREPEND out
# BGP Communities
Router(config-router)# neighbor 192.168.1.2 send-community # Send community
attribute
Router(config)# route-map SET_COMMUNITY permit 10
Router(config-route-map)# set community 65001:100
# BGP Verification
Router# show ip bgp # BGP table
Router# show ip bgp summary # BGP neighbor summary
Router# show ip bgp neighbors # Detailed neighbor info
Router# show ip bgp neighbors 192.168.1.2 advertised-routes # Advertised routes
Router# show ip bgp neighbors 192.168.1.2 received-routes # Received routes
Router# show ip bgp 192.168.1.0 # Specific route details
# BGP Troubleshooting
Router# debug ip bgp # BGP debugging
Router# debug ip bgp updates # BGP update messages
Router# clear ip bgp * # Clear all BGP sessions
Router# clear ip bgp 192.168.1.2 # Clear specific neighbor
bash
# IS-IS Characteristics:
# - Link State Protocol
# - OSI protocol adapted for IP
# - Two levels: L1 (intra-area), L2 (inter-area)
# - Administrative Distance: 115
# IS-IS Configuration
Router(config)# router isis AREA1 # IS-IS process name
Router(config-router)# net 49.0001.1921.6800.1001.00 # NET address
Router(config-router)# is-type level-2-only # Router type
Router(config-router)# metric-style wide # Wide metrics
# IS-IS Verification
Router# show isis neighbors # IS-IS neighbors
Router# show isis database # IS-IS database
Router# show isis topology # IS-IS topology
bash
# Protocol Selection Criteria:
# Network Size:
# - Small (< 50 routers): Static, RIP, EIGRP
# - Medium (50-500 routers): EIGRP, OSPF
# - Large (500+ routers): OSPF, IS-IS, BGP
# Convergence Speed:
# - Fastest: EIGRP (sub-second)
# - Fast: OSPF (seconds)
# - Slow: RIP (minutes)
# Vendor Support:
# - Cisco-specific: EIGRP (though now open standard)
# - Multi-vendor: OSPF, RIP, BGP, IS-IS
# Administrative Distances:
# Connected: 0
# Static: 1
# EIGRP Internal: 90
# OSPF: 110
# IS-IS: 115
# RIP: 120
# EIGRP External: 170
# iBGP: 200
Port security restricts network access by controlling which MAC addresses can connect to switch ports,
providing Layer 2 security against unauthorized access.
bash
# Port Security Features:
# - Limits MAC addresses per port
# - Learns MAC addresses dynamically or statically
# - Provides violation actions when limits exceeded
# - Supports aging to allow MAC address changes
# - Works only on access ports (not trunk ports)
# Prerequisites for Port Security
Switch(config)# interface fastethernet 0/1
Switch(config-if)# switchport mode access # Must be access port
Switch(config-if)# switchport access vlan 10 # Assign to VLAN (optional)
bash
# Enable Port Security
Switch(config)# interface fastethernet 0/1
Switch(config-if)# switchport port-security # Enable port security
bash
# Violation Actions determine what happens when security is violated:
# Example Scenarios:
# Office Environment: Use shutdown (most secure)
# Conference Room: Use restrict (allows legitimate disconnects/reconnects)
# Public Area: Use protect (prevent log flooding)
bash
# Aging allows MAC addresses to be removed after inactivity
# Useful for shared ports or temporary connections
# Enable Aging
Switch(config-if)# switchport port-security aging time 10 # 10 minutes
Switch(config-if)# switchport port-security aging time 1440 # 24 hours
Switch(config-if)# switchport port-security aging time 0 # Disable aging
# Aging Types
Switch(config-if)# switchport port-security aging type absolute # Absolute timer
Switch(config-if)# switchport port-security aging type inactivity # Inactivity
timer
# Absolute Aging:
# - MAC addresses age out after specified time regardless of activity
# - Timer starts when MAC is learned
# - Good for temporary access (guest users)
# Inactivity Aging:
# - MAC addresses age out only if inactive for specified time
# - Timer resets on each frame from that MAC
# - Good for workstations that may go idle
bash
# Voice VLAN Considerations
Switch(config-if)# switchport access vlan 10 # Data VLAN
Switch(config-if)# switchport voice vlan 20 # Voice VLAN
Switch(config-if)# switchport port-security maximum 3 # PC + Phone + Phone's PC
Switch(config-if)# switchport port-security mac-address sticky
# SNMP Integration
Switch(config)# snmp-server enable traps port-security # Enable SNMP traps
Switch(config)# snmp-server host 192.168.1.100 version 2c public port-security
bash
# Port Security Status
Switch# show port-security # Global port security status
Switch# show port-security interface fa0/1 # Specific interface
Switch# show port-security address # All secure addresses
Switch# show port-security address interface fa0/1 # Interface secure addresses
bash
# Common Port Security Issues:
# Clear Commands
Switch# clear port-security all # Clear all port security
Switch# clear port-security configured # Clear configured addresses
Switch# clear port-security dynamic interface fa0/1 # Clear dynamic on interface
Switch# clear port-security sticky interface fa0/1 # Clear sticky on interface
bash
# Configuration Templates:
# Global Configuration
Switch(config)# errdisable recovery cause psecure-violation
Switch(config)# errdisable recovery interval 600 # 10-minute recovery
Switch(config)# snmp-server enable traps port-security # SNMP notifications
bash
# Port Security with 802.1X
# Both can coexist - 802.1X provides user authentication
# Port security provides MAC address control
Switch(config)# interface fa0/1
Switch(config-if)# dot1x pae authenticator
Switch(config-if)# switchport port-security
Switch(config-if)# switchport port-security maximum 2
ACLs provide packet filtering capabilities to control network traffic flow and implement security policies.
bash
# ACL Processing Rules:
# 1. Processed top-down (first match wins)
# 2. Implicit deny at the end of every ACL
# 3. Applied inbound or outbound on interfaces
# 4. Numbered or named ACLs supported
# 5. Standard ACLs: Source IP only
# 6. Extended ACLs: Source, destination, protocol, ports
bash
# Standard ACL Characteristics:
# - Numbers 1-99 and 1300-1999
# - Filter based on source IP address only
# - Less granular control
# - Lower processing overhead
bash
# Extended ACL Characteristics:
# - Numbers 100-199 and 2000-2699
# - Filter based on multiple criteria:
# * Source and destination IP addresses
# * Protocol type (TCP, UDP, ICMP, etc.)
# * Source and destination port numbers
# * TCP flags, ICMP types, etc.
bash
# Time-based ACLs allow filtering based on time of day and day of week
# Useful for business hour restrictions, maintenance windows, etc.
# Define Time Range
Router(config)# time-range BUSINESS_HOURS
Router(config-time-range)# periodic weekdays 08:00 to 18:00 # Monday-Friday 8AM-
6PM
Router(config-time-range)# exit
bash
# Network Object Groups
Router(config)# object-group network INTERNAL_NETWORKS
Router(config-network-group)# 192.168.1.0 255.255.255.0
Router(config-network-group)# 192.168.2.0 255.255.255.0
Router(config-network-group)# 10.1.1.0 255.255.255.0
Router(config-network-group)# exit
bash
# Display ACLs
Router# show access-lists # All ACLs
Router# show access-lists 100 # Specific numbered ACL
Router# show ip access-lists # IP ACLs only
Router# show ip access-lists WEB_TRAFFIC # Specific named ACL
bash
# Common ACL Issues and Solutions:
bash
# Reflexive ACLs (Session-based filtering)
Router(config)# ip access-list extended OUTBOUND
Router(config-ext-nacl)# permit tcp 192.168.1.0 0.0.0.255 any reflect TCP_TRAFFIC
Router(config-ext-nacl)# permit udp 192.168.1.0 0.0.0.255 any reflect UDP_TRAFFIC
Router(config-ext-nacl)# exit
Overview
Site-to-Site VPNs connect two remote networks securely over an untrusted network
(typically the Internet) by creating an encrypted “tunnel.”
Components:
bash
Router(config)# hostname HQ-Router
HQ-Router(config)# ip domain-name company.com
bash
HQ-Router(config)# crypto key generate rsa modulus 2048
bash
HQ-Router(config)# crypto isakmp policy 10
HQ-Router(config-isakmp)# authentication pre-share
HQ-Router(config-isakmp)# encryption aes 256
HQ-Router(config-isakmp)# hash sha256
HQ-Router(config-isakmp)# group 14
HQ-Router(config-isakmp)# lifetime 86400
HQ-Router(config-isakmp)# exit
bash
HQ-Router(config)# crypto isakmp key YourPreSharedKey address 203.0.113.10
bash
HQ-Router(config)# crypto ipsec transform-set TS esp-aes esp-sha256
HQ-Router(config-ipsec)# mode tunnel
HQ-Router(config-ipsec)# exit
bash
HQ-Router(config)# access-list 110 permit ip 10.1.1.0 0.0.0.255 192.168.1.0 0.0.0.255
HQ-Router(config)# access-list 110 permit ip 192.168.1.0 0.0.0.255 10.1.1.0 0.0.0.255
bash
HQ-Router(config)# crypto map VPN-MAP 10 ipsec-isakmp
HQ-Router(config-crypto-map)# set peer 203.0.113.10
HQ-Router(config-crypto-map)# set transform-set TS
HQ-Router(config-crypto-map)# match address 110
HQ-Router(config-crypto-map)# set pfs group14
HQ-Router(config-crypto-map)# exit
bash
HQ-Router(config)# interface GigabitEthernet0/0
HQ-Router(config-if)# crypto map VPN-MAP
HQ-Router(config-if)# ip address 198.51.100.1 255.255.255.252
HQ-Router(config-if)# no shutdown
bash
HQ-Router# show crypto isakmp sa
# Displays Phase 1 (IKE) Security Associations
Additional Security
bash
# Exclude addresses (reserved/not assigned dynamically)
Router(config)# ip dhcp excluded-address 192.168.1.1 192.168.1.10
bash
# Define Bootfile and Next Server (common in PXE boot environments)
Router(dhcp-config)# bootfile filename.bin
Router(dhcp-config)# next-server 192.168.1.254
# Configure DHCP option 150 (common for Cisco IP Phone TFTP server)
Router(dhcp-config)# option 150 ip 192.168.1.100
bash
# Bind specific IP to MAC address
Router(config)# ip dhcp pool PRINTER
Router(dhcp-config)# host 192.168.1.100 255.255.255.0
Router(dhcp-config)# client-identifier 0100.1111.2222.3333
Router(dhcp-config)# default-router 192.168.1.1
Router(dhcp-config)# exit
bash
# Enable DHCP relay on non-DHCP server interfaces
Router(config)# interface vlan 20
Router(config-if)# ip helper-address 192.168.1.254
Router(config-if)# exit
bash
show ip dhcp binding # Displays current leases
show ip dhcp pool # Pool statistics and usage
show ip dhcp conflict # Lease conflicts
debug dhcp detail # DHCP packet debug
bash
zone "example.com" {
type master;
file "/etc/named/example.com.zone";
allow-update { none; };
};
bash
$TTL 86400
@ IN SOA ns1.example.com. admin.example.com. (
2023080101 ; serial
3600 ; refresh (1 hour)
1800 ; retry (30 minutes)
604800 ; expire (1 week)
86400 ; minimum (1 day)
)
IN NS ns1.example.com.
IN NS ns2.example.com.
ns1 IN A 192.168.1.10
ns2 IN A 192.168.1.11
www IN A 192.168.1.20
ftp IN CNAME www
bash
options {
forwarders {
8.8.8.8;
8.8.4.4;
};
};
DNS Troubleshooting:
bash
show hosts # Check hostname resolution (Cisco)
nslookup example.com # Query domain
dig example.com # Advanced queries (Linux)
Problem: Single point of failure when hosts use only one default gateway.
Solution: Multiple routers share a virtual IP address as the default gateway.
Characteristics:
bash
# Primary Router Configuration
Router1(config)# interface GigabitEthernet0/1
Router1(config-if)# ip address 192.168.1.2 255.255.255.0
Router1(config-if)# standby 1 ip 192.168.1.1 # Virtual IP
Router1(config-if)# standby 1 priority 110 # Higher priority
(default 100)
Router1(config-if)# standby 1 preempt # Take over when
available
Router1(config-if)# standby 1 preempt delay minimum 60 # Wait 60 seconds
before preempting
Router1(config-if)# standby 1 timers 1 3 # Hello 1 sec, hold 3
sec
Router1(config-if)# standby 1 authentication text cisco123 # Authentication
Router1(config-if)# standby 1 track GigabitEthernet0/0 20 # Track interface,
decrement priority by 20
# Verification Commands
Router# show standby # All HSRP groups
Router# show standby brief # Brief status
Router# show standby GigabitEthernet0/1 # Specific interface
Router# debug standby # HSRP debugging
Router# show track # Object tracking
status
Characteristics:
bash
# Master Router Configuration
Router1(config)# interface GigabitEthernet0/1
Router1(config-if)# ip address 192.168.1.2 255.255.255.0
Router1(config-if)# vrrp 1 ip 192.168.1.1 # Virtual IP
Router1(config-if)# vrrp 1 priority 120 # Higher priority
Router1(config-if)# vrrp 1 preempt # Enable preemption
Router1(config-if)# vrrp 1 preempt delay minimum 60 # Preemption delay
Router1(config-if)# vrrp 1 timers advertise 1 # Advertisement
interval
Router1(config-if)# vrrp 1 timers learn # Learn timers from
master
Router1(config-if)# vrrp 1 authentication text cisco123 # Authentication
Router1(config-if)# vrrp 1 track 1 decrement 30 # Object tracking
# Verification Commands
Router# show vrrp # All VRRP groups
Router# show vrrp brief # Brief status
Router# show vrrp interface GigabitEthernet0/1 # Specific interface
Router# debug vrrp # VRRP debugging
Characteristics:
bash
# Router 1 Configuration
Router1(config)# interface GigabitEthernet0/1
Router1(config-if)# ip address 192.168.1.2 255.255.255.0
Router1(config-if)# glbp 1 ip 192.168.1.1 # Virtual IP
Router1(config-if)# glbp 1 priority 120 # AVG priority
Router1(config-if)# glbp 1 preempt # Enable preemption
Router1(config-if)# glbp 1 preempt delay minimum 60 # Preemption delay
Router1(config-if)# glbp 1 timers 3 10 # Hello 3 sec, hold
10 sec
Router1(config-if)# glbp 1 load-balancing round-robin # Load balancing
method
Router1(config-if)# glbp 1 authentication text cisco123 # Authentication
# Router 2 Configuration
Router2(config)# interface GigabitEthernet0/1
Router2(config-if)# ip address 192.168.1.3 255.255.255.0
Router2(config-if)# glbp 1 ip 192.168.1.1 # Same virtual IP
Router2(config-if)# glbp 1 priority 100 # Lower priority
Router2(config-if)# glbp 1 timers 3 10
Router2(config-if)# glbp 1 load-balancing round-robin
Router2(config-if)# glbp 1 authentication text cisco123
# Verification Commands
Router# show glbp # All GLBP groups
Router# show glbp brief # Brief status
Router# show glbp GigabitEthernet0/1 # Specific interface
Router# debug glbp # GLBP debugging
bash
# Configure Inside and Outside Interfaces
Router(config)# interface GigabitEthernet0/0
Router(config-if)# ip nat inside # Internal network
interface
Router(config-if)# exit
# Verification Commands
Router# show ip nat translations # Active translations
Router# show ip nat translations verbose # Detailed
translations
Router# show ip nat statistics # NAT statistics
Router# clear ip nat translation * # Clear all
translations
bash
# Define Internal Hosts (Access List)
Router(config)# access-list 1 permit 192.168.1.0 0.0.0.255 # Allow entire subnet
Router(config)# access-list 1 permit 192.168.2.0 0.0.0.255 # Allow another subnet
Router(config)# access-list 1 deny any # Explicit deny
# Verification Commands
Router# show ip nat pool # NAT pools
Router# show ip nat translations # Active translations
Router# show ip nat statistics # Pool utilization
Use Case: Many internal hosts sharing one or few external IP addresses.
bash
# PAT with Interface Overload (Most Common)
Router(config)# access-list 1 permit 192.168.0.0 0.0.255.255 # All private networks
Router(config)# ip nat inside source list 1 interface GigabitEthernet0/1 overload
bash
# Comprehensive Verification
Router# show ip nat translations # All active
translations
Router# show ip nat translations inside 192.168.1.10 # Specific inside host
Router# show ip nat translations outside 203.0.113.10 # Specific outside
address
Router# show ip nat statistics # NAT statistics and
hits
Router# show running-config | include nat # NAT configuration
# NAT Debugging
Router# debug ip nat # Basic NAT debugging
Router# debug ip nat detailed # Detailed NAT
debugging
Router# undebug all # Turn off debugging
bash
# Configure NTP Client
Router(config)# ntp server 129.6.15.28 # NIST time server
Router(config)# ntp server pool.ntp.org # NTP pool
Router(config)# ntp server 216.239.35.0 prefer # Google (preferred)
Router(config)# ntp server 192.168.1.100 version 4 # Local NTP server
with version
NTP Authentication
bash
# Enable NTP Authentication
Router(config)# ntp authenticate # Enable
authentication
Router(config)# ntp authentication-key 1 md5 NTPSecretKey123 # Authentication key
Router(config)# ntp authentication-key 2 md5 AnotherKey456 # Multiple keys
Router(config)# ntp trusted-key 1 # Mark key as trusted
Router(config)# ntp trusted-key 2 # Additional trusted
key
bash
# Create Access Lists for NTP
Router(config)# access-list 10 permit 192.168.100.0 0.0.0.255 # Management network
Router(config)# access-list 20 permit 192.168.1.0 0.0.0.255 # LAN network
Router(config)# access-list 30 permit any # Allow all for query
bash
# NTP Status Commands
Router# show ntp status # NTP synchronization
status
Router# show ntp associations # NTP server
associations
Router# show ntp associations detail # Detailed
association info
Router# show clock # Current system time
Router# show calendar # Hardware calendar
# NTP Statistics
Router# show ntp statistics # NTP packet
statistics
Router# show ntp statistics peer # Per-peer statistics
# NTP Debugging
Router# debug ntp packet # NTP packet
debugging
Router# debug ntp sync # NTP synchronization
debugging
Router# debug ntp adjust # Clock adjustment
debugging
Router# undebug all # Turn off debugging
SNMPv2c Configuration
bash
# Basic SNMPv2c Configuration
Router(config)# snmp-server community public ro # Read-only community
Router(config)# snmp-server community private rw # Read-write community
Router(config)# snmp-server community monitor ro 10 # Community with ACL
# System Information
Router(config)# snmp-server contact "admin@company.com" # Contact information
Router(config)# snmp-server location "Data Center Rack 1" # Physical location
Router(config)# snmp-server chassis-id "Router-HQ-01" # Chassis identifier
# Trap Destinations
Router(config)# snmp-server host 192.168.1.100 version 2c public # Trap receiver
Router(config)# snmp-server host 192.168.1.101 version 2c monitor # Another
receiver
Router(config)# snmp-server trap-source GigabitEthernet0/0 # Source
interface
bash
# SNMPv3 Groups (Security Levels)
Router(config)# snmp-server group ADMIN v3 auth # Authentication
required
Router(config)# snmp-server group MONITOR v3 noauth # No authentication
Router(config)# snmp-server group SECURE v3 priv # Authentication +
Privacy
# SNMPv3 Users
Router(config)# snmp-server user admin ADMIN v3 auth sha AdminAuth123
Router(config)# snmp-server user admin ADMIN v3 auth sha AdminAuth123 priv aes 128
AdminPriv456
Router(config)# snmp-server user monitor MONITOR v3 auth md5 MonitorAuth789
Router(config)# snmp-server user secure SECURE v3 auth sha SecureAuth123 priv des
SecurePriv456
# SNMPv3 Views (Restrict Access to Specific MIBs)
Router(config)# snmp-server view READONLY iso included # Full read access
Router(config)# snmp-server view READONLY cisco.2 excluded # Exclude Cisco
private MIB
Router(config)# snmp-server view SYSONLY system included # System MIB only
bash
# SNMP Status Commands
Router# show snmp # SNMP configuration
Router# show snmp community # Community strings
Router# show snmp user # SNMPv3 users
Router# show snmp group # SNMPv3 groups
Router# show snmp view # SNMPv3 views
Router# show snmp host # Trap destinations
# SNMP Statistics
Router# show snmp statistics # SNMP packet
statistics
Router# show snmp engineID # SNMP engine ID
# SNMP Testing
Router# snmpwalk -v2c -c public localhost 1.3.6.1.2.1.1 # Test SNMP walk
Router# snmpget -v3 -u admin -a SHA -A AdminAuth123 localhost 1.3.6.1.2.1.1.1.0
# SNMP Debugging
Router# debug snmp packet # SNMP packet
debugging
Router# debug snmp detail # Detailed SNMP
debugging
Router# undebug all # Turn off debugging
Syslog - System Logging and Monitoring
Syslog Configuration
bash
# Basic Syslog Configuration
Router(config)# logging 192.168.1.200 # Syslog server
Router(config)# logging host 192.168.1.201 # Additional server
Router(config)# logging host 192.168.1.202 transport udp port 1514 # Custom port
# Logging Levels
Router(config)# logging trap emergencies # Level 0 - most
critical
Router(config)# logging trap alerts # Level 1
Router(config)# logging trap critical # Level 2
Router(config)# logging trap errors # Level 3
Router(config)# logging trap warnings # Level 4 (common)
Router(config)# logging trap notifications # Level 5
Router(config)# logging trap informational # Level 6 (verbose)
Router(config)# logging trap debugging # Level 7 (very
verbose)
# Facility Codes
Router(config)# logging facility local0 # Local facility 0
Router(config)# logging facility local7 # Local facility 7
Router(config)# logging facility mail # Mail facility
# Source Interface
Router(config)# logging source-interface GigabitEthernet0/0 # Source interface
Router(config)# logging source-interface Loopback0 # Loopback interface
# Console Logging
Router(config)# logging console warnings # Console level
Router(config)# logging console critical # Only critical to
console
# Terminal/VTY Logging
Router(config)# logging monitor informational # Monitor level
Router(config)# terminal monitor # Enable on current
session
Router(config)# logging synchronous # Synchronous console
logging
bash
# Logging Discriminators (Filter Messages)
Router(config)# logging discriminator IMPORTANT mnemonics drops BADMAC
Router(config)# logging host 192.168.1.200 discriminator IMPORTANT
# Archive Logging
Router(config)# archive
Router(config-archive)# log config
Router(config-archive-log-cfg)# logging enable # Log configuration
changes
Router(config-archive-log-cfg)# logging size 1000 # Archive size
Router(config-archive-log-cfg)# hidekeys # Hide sensitive
information
bash
# Show Logging Information
Router# show logging # All logging
information
Router# show logging summary # Logging summary
Router# show logging history # Historical log
events
Router# show logging onboard # Onboard failure
logging
# Logging Statistics
Router# show logging statistics # Logging statistics
Router# show logging facilities # Available facilities
# Clear Logs
Router# clear logging # Clear log buffer
Router# clear logging onboard # Clear onboard logs
# Logging Debugging
Router# debug logging # Debug logging
process
Router# undebug all # Turn off debugging
# Test Logging
Router# send log "Test message from router" # Send test message
QoS Overview
QoS Tools:
• Classification: Identify traffic types
• Marking: Set priority bits (DSCP, CoS)
• Shaping: Smooth traffic to prevent bursts
• Policing: Drop or mark excess traffic
• Queuing: Prioritize packet transmission
bash
# Class Maps for Classification
Router(config)# class-map match-all VOICE_TRAFFIC
Router(config-cmap)# match ip dscp ef # Expedited Forwarding
Router(config-cmap)# match protocol rtp audio # RTP audio protocol
Router(config-cmap)# exit
bash
# Policy Map Configuration
Router(config)# policy-map QOS_POLICY
Router(config-pmap)# class VOICE_TRAFFIC
Router(config-pmap-c)# priority percent 20 # 20% priority queue
Router(config-pmap-c)# set ip dscp ef # Mark as EF
Router(config-pmap-c)# exit
Traffic Shaping
bash
# Shaping Policy Map
Router(config)# policy-map SHAPING_POLICY
Router(config-pmap)# class class-default
Router(config-pmap-c)# shape average 1000000 # 1 Mbps average rate
Router(config-pmap-c)# shape peak 1500000 # 1.5 Mbps peak rate
Router(config-pmap-c)# service-policy QOS_POLICY # Nested policy
Router(config-pmap-c)# exit
# Percentage-based Shaping
Router(config)# policy-map PERCENTAGE_SHAPING
Router(config-pmap)# class class-default
Router(config-pmap-c)# shape average percent 80 # 80% of interface
bandwidth
Router(config-pmap-c)# exit
# Adaptive Shaping
Router(config)# policy-map ADAPTIVE_SHAPING
Router(config-pmap)# class class-default
Router(config-pmap-c)# shape adaptive 2000000 # Adaptive shaping 2
Mbps
Router(config-pmap-c)# exit
Traffic Policing
bash
# Single-Rate Policing
Router(config)# policy-map POLICING_POLICY
Router(config-pmap)# class BUSINESS_CRITICAL
Router(config-pmap-c)# police 2000000 conform-action transmit exceed-action drop
Router(config-pmap-c)# exit
# Two-Rate Policing
Router(config-pmap)# class WEB_TRAFFIC
Router(config-pmap-c)# police cir 1000000 bc 31250 pir 1500000 be 46875 conform-
action transmit exceed-action set-dscp-transmit af31 violate-action drop
Router(config-pmap-c)# exit
# Percentage-based Policing
Router(config-pmap)# class STREAMING
Router(config-pmap-c)# police percent 10 conform-action transmit exceed-action drop
Router(config-pmap-c)# exit
Hierarchical QoS
bash
# Child Policy Map
Router(config)# policy-map CHILD_POLICY
Router(config-pmap)# class VOICE_TRAFFIC
Router(config-pmap-c)# priority percent 50 # 50% priority
Router(config-pmap-c)# exit
Router(config-pmap)# class VIDEO_TRAFFIC
Router(config-pmap-c)# bandwidth remaining percent 60 # 60% of remaining
Router(config-pmap-c)# exit
Router(config-pmap)# class class-default
Router(config-pmap-c)# bandwidth remaining percent 40 # 40% of remaining
Router(config-pmap-c)# exit
bash
# Apply QoS Policy to Interface
Router(config)# interface GigabitEthernet0/1
Router(config-if)# service-policy input INPUT_POLICY # Inbound policy
Router(config-if)# service-policy output OUTPUT_POLICY # Outbound policy
Router(config-if)# exit
# QoS on Subinterfaces
Router(config)# interface GigabitEthernet0/1.10
Router(config-subif)# service-policy output VLAN10_POLICY
Router(config-subif)# exit
# Verification Commands
Router# show policy-map # All policy maps
Router# show policy-map QOS_POLICY # Specific policy map
Router# show policy-map interface GigabitEthernet0/1 # Interface policy
statistics
Router# show class-map # All class maps
Router# show queueing interface GigabitEthernet0/1 # Queueing information
# Advanced Verification
Router# show policy-map interface GigabitEthernet0/1 input # Input policy only
Router# show policy-map interface GigabitEthernet0/1 output # Output policy only
Router# show interfaces GigabitEthernet0/1 stats # Interface statistics
bash
# Prerequisites for SSH
Router(config)# hostname R1 # Hostname required
Router(config)# ip domain-name company.com # Domain name required
bash
# SSH Algorithm Configuration
Router(config)# ip ssh server algorithm encryption aes128-ctr aes256-ctr
Router(config)# ip ssh server algorithm mac hmac-sha1 hmac-sha2-256
Router(config)# ip ssh server algorithm kex diffie-hellman-group14-sha1
bash
# Basic Telnet Configuration
Router(config)# line vty 0 4
Router(config-line)# password TelnetPass123 # VTY password
Router(config-line)# login # Enable password auth
Router(config-line)# transport input telnet # Telnet only
Router(config-line)# exec-timeout 5 0 # 5-minute timeout
bash
# Console Port Security
Router(config)# line console 0
Router(config-line)# password ConsolePass123 # Console password
Router(config-line)# login # Enable
authentication
Router(config-line)# exec-timeout 15 0 # 15-minute timeout
Router(config-line)# logging synchronous # Synchronous logging
Router(config-line)# history size 50 # Command history
Router(config-line)# speed 115200 # Console speed
Router(config-line)# stopbits 1 # Stop bits
Router(config-line)# databits 8 # Data bits
Router(config-line)# parity none # No parity
bash
# SSH Verification
Router# show ssh # Active SSH sessions
Router# show ip ssh # SSH configuration
Router# show crypto key mypubkey rsa # RSA public key
Router# show users # Current users
Router# show line # Line status
# Troubleshooting Commands
Router# debug ssh # SSH debugging
Router# debug telnet # Telnet debugging
Router# debug aaa authentication # Authentication
debugging
Router# undebug all # Turn off debugging
# Clear Sessions
Router# clear line vty 1 # Clear specific VTY
line
Router# disconnect ssh 192.168.1.100 # Disconnect SSH
session
bash
# Enhanced Security Configuration
Router(config)# security authentication failure rate 3 log # Failed attempt
logging
Router(config)# login block-for 300 attempts 3 within 60 # Account lockout
Router(config)# login quiet-mode access-class 99 # Quiet mode ACL
Layer 2 Security
DHCP Snooping
Purpose: Prevents rogue DHCP servers and ensures only authorized DHCP messages pass through the
network.
How it works:
Configuration:
bash
# Enable DHCP snooping globally
Switch(config)# ip dhcp snooping
Verification:
bash
Switch# show ip dhcp snooping
Switch# show ip dhcp snooping binding
Switch# show ip dhcp snooping statistics
Switch# show ip dhcp snooping vlan 10
Purpose: Prevents ARP spoofing attacks by inspecting ARP packets against DHCP snooping database.
How it works:
• Validates ARP packets’ source MAC and IP against DHCP snooping table.
• Blocks invalid ARP packets.
• Trusted interfaces are those connected to switches/routers.
Configuration:
bash
# Enable DAI globally per VLAN
Switch(config)# ip arp inspection vlan 10,20
Verification:
bash
Switch# show ip arp inspection
Switch# show ip arp inspection statistics
Switch# show ip arp inspection interfaces
Switch# show ip arp inspection statistics vlan 10
Port Security
Purpose: Limits the number of MAC addresses on a switch port, preventing unauthorized devices.
Features:
Configuration:
bash
# Basic port security on access port
Switch(config)# interface GigabitEthernet1/1
Switch(config-if)# switchport mode access
Switch(config-if)# switchport port-security
Switch(config-if)# switchport port-security maximum 2
Switch(config-if)# switchport port-security violation shutdown
Switch(config-if)# switchport port-security mac-address sticky
Switch(config-if)# no shutdown
Violation Actions:
Action Description
shutdown Puts port in err-disabled state (default)
restrict Drops violating frames; increments violation count; sends alerts
protect Drops violating frames silently, no alerts
bash
Switch(config-if)# switchport port-security aging time 30
Switch(config-if)# switchport port-security aging type inactivity
Verification:
bash
Switch# show port-security interface GigabitEthernet1/1
Switch# show port-security
Switch# show port-security address
Switch# show errdisable recovery
AAA Overview
Local AAA
bash
# Enable AAA
Router(config)# aaa new-model
# Define local user
Router(config)# username admin privilege 15 secret AdminPass123
# Line configuration
Router(config)# line vty 0 4
Router(config-line)# login authentication default
Router(config-line)# authorization exec default
Router(config-line)# accounting exec default
Router(config-line)# exit
RADIUS AAA
bash
# Define RADIUS Server
Router(config)# radius server RADIUS-SERVER
Router(config-radius-server)# address ipv4 192.168.100.10 auth-port 1812 acct-port
1813
Router(config-radius-server)# key RadiusSecret123
Router(config-radius-server)# exit
# Enable AAA
Router(config)# aaa new-model
bash
Router# show aaa users
Router# show aaa sessions
Router# show aaa servers
Router# show radius servers
Router# show accounting
Router# debug aaa authentication
Router# debug radius
Router# debug tacacs
Router# undebug all
bash
ap(config)# dot11 ssid HomeWPA
ap(config-ssid)# authentication open
ap(config-ssid)# authentication key-management wpa
ap(config-ssid)# wpa-psk ascii 0 MyWpaPass
ap(config-ssid)# exit
bash
ap(config)# dot11 ssid OfficeWPA2
ap(config-ssid)# authentication open
ap(config-ssid)# authentication key-management wpa version 2
ap(config-ssid)# wpa-psk ascii 0 MySecurePass
ap(config-ssid)# exit
WLC Example:
bash
(Cisco Controller)# config wlan security wpa2 enable 1
(Cisco Controller)# config wlan security wpa2 ciphers aes enable 1
(Cisco Controller)# config wlan security wpa2 akm psk enable 1
(Cisco Controller)# config wlan security wpa2 akm psk set-key ascii YourPSK 1
Autonomous AP Example:
bash
ap(config)# aaa new-model
ap(config)# radius-server host 192.168.1.100 key radiuskey
WLC Example:
bash
(Cisco Controller)# config wlan security wpa2 enable 1
(Cisco Controller)# config wlan security wpa2 akm 802.1x enable 1
(Cisco Controller)# config wlan radius_server auth add 1 192.168.1.100 radiuskey
(Cisco Controller)# config wlan enable 1
WPA3-Personal (SAE)
Autonomous AP Example:
bash
ap(config)# dot11 ssid HomeWPA3
ap(config-ssid)# authentication open
ap(config-ssid)# authentication key-management sae
ap(config-ssid)# wpa3-sae password MyWPA3SuperSecret
ap(config-ssid)# exit
WLC Example:
bash
(Cisco Controller)# config wlan security wpa3 enable 2
(Cisco Controller)# config wlan security wpa3 akm 802.1x enable 2
(Cisco Controller)# config wlan security pmf required 2
# Add RADIUS server as usual for 802.1X authentication
bash
ap(config)# dot11 ssid CorpWPA3
ap(config-ssid)# authentication open
ap(config-ssid)# authentication key-management sae
ap(config-ssid)# authentication key-management 802.1x
ap(config-ssid)# wpa3-sae password WPA3RADIUSSecret
ap(config-ssid)# exit
• Allows both WPA2 (PSK) and WPA3 (SAE) clients to connect during migration.
Example:
bash
ap(config-ssid)# authentication key-management wpa version 2
ap(config-ssid)# authentication key-management sae
ap(config-ssid)# wpa-psk ascii 0 SharedTransitionKey
ap(config-ssid)# wpa3-sae password SharedTransitionKey
Best Practices:
Introduction
Automation and programmability have become critical in modern network operations. They enable
consistent, rapid, and scalable network configurations, minimize human errors, and provide flexibility to
adapt networks dynamically.
Key Concepts
1. Automation
2. Programmability
text
- name: Configure router interface and OSPF
hosts: routers
gather_facts: no
connection: network_cli
tasks:
- name: Configure interface GigabitEthernet0/1
ios_config:
lines:
- description Configured by Ansible
- ip address 10.1.1.1 255.255.255.0
- no shutdown
parents: interface GigabitEthernet0/1
• RESTful APIs use HTTP(S) methods (GET, POST, PUT, DELETE) to manage network device
configurations.
• Data formats: JSON, XML.
• Cisco devices support RESTCONF (REST over HTTP for network management).
• Example: GET interfaces info, POST to configure interface.
CRUD Operations
python
import requests
import json
url = "https://192.168.1.1/restconf/data/ietf-
interfaces:interfaces/interface=GigabitEthernet1"
headers = {
"Content-Type": "application/yang-data+json",
"Accept": "application/yang-data+json",
}
Model-Driven Telemetry
• Puppet and Chef use declarative languages and agents to enforce network configurations.
• Define desired state; agents ensure devices match the state.
• Used in large-scale, multi-vendor environments.
Cisco DNA Center and Automation