Freebie

Switches

Ethernet LAN

An Ethernet LAN is a group of devices connected at Layer 2, sharing the same broadcast domain. A LAN switch forwards frames based on destination MAC addresses. When a frame arrives, the switch records the source MAC address and the ingress port, building a MAC address table. When forwarding, the switch looks up the destination MAC. If it finds a match, it forwards the frame out only that port (filtering). If no match exists, it floods the frame out all ports except the one it arrived on (unknown unicast flooding).

EXEC commands

Use these Privileged EXEC commands to verify switch state without modifying configuration. They cover the MAC address table, interface status, SSH settings, DHCP leases, running configuration, and session history. Run them during initial setup to confirm your configuration took effect, and during troubleshooting to isolate where a problem exists.

MAC address table

CommandModeDescription
show mac address-tablePrivileged EXECDisplays all MAC address table entries
show mac address-table dynamicPrivileged EXECDisplays only dynamically learned entries
show mac address-table dynamic vlan vlan-idPrivileged EXECFilters dynamic entries by VLAN
show mac address-table dynamic address mac-addrPrivileged EXECFilters dynamic entries by MAC address
show mac address-table dynamic interface interface-idPrivileged EXECFilters dynamic entries by interface
show mac address-table countPrivileged EXECDisplays the number of entries per VLAN
show mac address-table aging-timePrivileged EXECDisplays the MAC address aging timer
clear mac address-table dynamicPrivileged EXECClears dynamic entries; optionally filter by vlan vlan-number, interface interface-id, or address mac-addr

Interfaces

CommandModeDescription
show interfaces id countersPrivileged EXECDisplays traffic counters for an interface
show interfaces statusPrivileged EXECDisplays status, duplex, and speed for all interfaces
show interfaces vlan numberPrivileged EXECDisplays status and statistics for a VLAN SVI
show interfaces [ type number ] statusPrivileged EXECDisplays status for all interfaces or a specific one
show interfaces [ type number ]Privileged EXECDisplays detailed statistics for all interfaces or a specific one
show interfaces descriptionPrivileged EXECDisplays interface descriptions and operational status

Running configuration

CommandModeDescription
show running-configPrivileged EXECDisplays the current running configuration
show running-config | begin line vtyPrivileged EXECDisplays running config starting from the VTY line section
show running-config interface type numberPrivileged EXECDisplays running config for a specific interface
show running-config allPrivileged EXECDisplays running config including default values

SSH and security

CommandModeDescription
show crypto key mypubkey rsaPrivileged EXECDisplays the device’s RSA public key
show ip sshPrivileged EXECDisplays SSH version and configuration settings
show sshPrivileged EXECDisplays active SSH sessions

IP and DHCP

CommandModeDescription
show dhcp leasePrivileged EXECDisplays DHCP lease information obtained by the switch
show ip default-gatewayPrivileged EXECDisplays the configured default gateway

Session

CommandModeDescription
terminal history size xPrivileged EXECTemporarily sets the command history buffer size for the session
show historyPrivileged EXECDisplays the command history for the current session

Interface configuration

Interface configuration mode controls the behavior of individual switch ports. Use interface to enter a single port or interface range to apply the same settings to multiple ports at once. From there, you set speed, duplex, shutdown state, and a description to document port purpose. Prefixing any command with no returns that setting to its default. Use default interface to reset all settings on a port at once.

CommandModeDescription
interface type port-numberGlobal configEnters interface config mode for a specific port
interface range type port-number - end-port-numberGlobal configEnters interface config mode for a range of ports
shutdownInterface configAdministratively disables the interface
no shutdownInterface configEnables an administratively disabled interface
speed [10|100|1000|auto]Interface configSets the interface speed or enables autonegotiation
duplex [auto|full|half]Interface configSets the duplex mode or enables autonegotiation
description textInterface configAdds a text description to the interface
no speedInterface configRemoves the configured speed and returns to default
no duplexInterface configRemoves the configured duplex and returns to default
no descriptionInterface configRemoves the interface description
default interface interface-idGlobal configResets all interface settings to defaults
[no] mdix autoInterface configEnables or disables automatic MDI-X crossover detection

Login Security commands

Unsecured console and VTY lines leave the device open to anyone who can reach it physically or over the network. IOS offers two authentication models: line password authentication (login + password) applies a single shared password to the line, while local authentication (login local + username secret) requires per-user credentials stored on the device. For remote access, always use SSH instead of Telnet. Telnet sends credentials in plaintext; SSH encrypts the session.

CommandModeDescription
line console 0Global configEnters line config mode for the console port
line vty first-vty last-vtyGlobal configEnters line config mode for VTY lines (remote access)
loginLine configEnables line password authentication
password passwordLine configSets the plain-text line password
login localLine configEnables local user account authentication
username name secret passwordGlobal configCreates a local user with a hashed password
crypto key generate rsa modulus bitsGlobal configGenerates RSA keys for SSH (512-2048 bits)
transport input [telnet|ssh|all|none]Line configRestricts allowed remote access protocols on the line
ip domain name fqdnGlobal configSets the domain name, required for SSH key generation
hostname nameGlobal configSets the device hostname, required for SSH key generation
ip ssh version 2Global configForces SSHv2 only

IPv4 configuration

CommandModeDescription
interface vlan numberGlobal configEnters interface config for the management VLAN (SVI)
ip address ip-addr subnet-maskInterface configAssigns a static IP address
ip address dhcpInterface configConfigures the interface to obtain an address from DHCP
ip default-gateway addrGlobal configSets the default gateway for management traffic
ip name-server server-ip-1 server-ip-2Global configConfigures DNS server addresses

Other configuration

CommandModeDescription
hostname nameGlobal configSets the device hostname
enable secret passwordGlobal configSets a hashed password for privileged EXEC access
history size lengthLine configSets the command history buffer size for the line
logging synchronousLine configPrevents log messages from interrupting command input
[no] logging consoleGlobal configEnables or disables log messages to the console