Written for IOS and IOS XE on Catalyst switches and ISR routers. Some commands vary by model and software version. Each command shows the mode to type it in. Config blocks start in global config mode (after configure terminal), and indented lines go inside the line above them, as in show running-config. Names, addresses and passwords are examples, so swap in your own.
Modes and getting around #
-
Enter privileged EXEC modeCisco IOS · User EXEC (>)
enable -
Leave privileged EXEC modeCisco IOS · Privileged EXEC (#)
disable -
Enter global configuration modeCisco IOS · Privileged EXEC (#)
configure terminal -
Go back one levelCisco IOS · Global config (config)#
exit -
Go straight back to privileged EXEC modeCisco IOS · Global config (config)#
end -
Run a show command without leaving config modeCisco IOS · Global config (config)#
do show ip interface brief -
List the commands you can use hereCisco IOS · Privileged EXEC (#)
? -
List the options for a commandCisco IOS · Privileged EXEC (#)
show ? -
Show the commands you've typedCisco IOS · Privileged EXEC (#)
show history -
Stop long output pausing at every pageCisco IOS · Privileged EXEC (#)
terminal length 0 -
Show log messages in an SSH sessionCisco IOS · Privileged EXEC (#)
terminal monitor -
Stop log messages interrupting what you typeCisco IOS · Global config (config)#
line console 0 logging synchronous -
Stop mistyped commands being looked up as hostnamesCisco IOS · Global config (config)#
no ip domain-lookup -
Remove a setting by putting no in front of itCisco IOS · Global config (config)#
no banner motd
Filtering output #
-
Show only lines that contain some textCisco IOS · Privileged EXEC (#)
show running-config | include hostname -
Hide lines that contain some textCisco IOS · Privileged EXEC (#)
show ip interface brief | exclude unassigned -
Show output from the first match onwardsCisco IOS · Privileged EXEC (#)
show running-config | begin line vty -
Show one section of the configCisco IOS · Privileged EXEC (#)
show running-config | section interface -
Show one interface's configCisco IOS · Privileged EXEC (#)
show running-config interface GigabitEthernet0/1
Basic setup #
-
Set the device's nameCisco IOS · Global config (config)#
hostname SW1 -
Set the enable passwordCisco IOS · Global config (config)#
enable secret MyEnablePassword -
Create a local admin userCisco IOS · Global config (config)#
username admin privilege 15 secret MyPassword -
Hide plain-text passwords in the configCisco IOS · Global config (config)#
service password-encryption -
Set a login bannerCisco IOS · Global config (config)#
banner motd # Authorised access only # -
Require a local login on the console, with a 10-minute timeoutCisco IOS · Global config (config)#
line console 0 login local exec-timeout 10 0 logging synchronous -
Set the domain nameCisco IOS · Global config (config)#
ip domain-name corp.example.com -
Set a DNS serverCisco IOS · Global config (config)#
ip name-server 1.1.1.1 -
Give a switch a management IP addressCisco IOS · Global config (config)#
interface Vlan1 ip address 192.168.1.10 255.255.255.0 no shutdown -
Set a switch's default gatewayCisco IOS · Global config (config)#
ip default-gateway 192.168.1.1 -
Set the time zoneCisco IOS · Global config (config)#
clock timezone GMT 0 -
Turn on Irish summer timeCisco IOS · Global config (config)#
clock summer-time IST recurring last Sun Mar 1:00 last Sun Oct 2:00 -
Get the time from an NTP serverCisco IOS · Global config (config)#
ntp server 0.pool.ntp.org -
Set the clock by handCisco IOS · Privileged EXEC (#)
clock set 14:30:00 13 November 2026 -
Show the timeCisco IOS · Privileged EXEC (#)
show clock -
Show whether the clock is synced with NTPCisco IOS · Privileged EXEC (#)
show ntp status -
Show NTP servers and their stateCisco IOS · Privileged EXEC (#)
show ntp associations
Save and back up the config #
-
Save the running configCisco IOS · Privileged EXEC (#)
copy running-config startup-config -
Save the running config (short version)Cisco IOS · Privileged EXEC (#)
write memory -
Show the running configCisco IOS · Privileged EXEC (#)
show running-config -
Show the saved configCisco IOS · Privileged EXEC (#)
show startup-config -
Show what's changed since the last saveCisco IOS · Privileged EXEC (#)
show archive config differences nvram:startup-config system:running-config -
Back up the config to a TFTP serverCisco IOS · Privileged EXEC (#)
copy running-config tftp://192.168.1.5/SW1.cfg -
Back up the config to flashCisco IOS · Privileged EXEC (#)
copy running-config flash:SW1-backup.cfg -
Load a config from a TFTP serverCisco IOS · Privileged EXEC (#)
copy tftp://192.168.1.5/SW1.cfg running-configWarning: Merges with the current config rather than replacing it.
-
Replace the running config with a saved oneCisco IOS · Privileged EXEC (#)
configure replace flash:SW1-backup.cfgWarning: Removes anything not in the saved file, which can cut off your connection.
-
Keep an archive of the config every time you saveCisco IOS · Global config (config)#
archive path flash:archive write-memory time-period 1440 -
List archived configsCisco IOS · Privileged EXEC (#)
show archive -
Erase the saved configCisco IOS · Privileged EXEC (#)
write eraseWarning: The device starts with a blank config next time it reloads.
-
Delete a switch's VLAN databaseCisco IOS · Privileged EXEC (#)
delete flash:vlan.datWarning: Removes every VLAN when the switch reloads.
Reload and files #
-
Reload in 10 minutes unless you cancelCisco IOS · Privileged EXEC (#)
reload in 10 -
Cancel a scheduled reloadCisco IOS · Privileged EXEC (#)
reload cancel -
Reload nowCisco IOS · Privileged EXEC (#)
reloadWarning: Drops all traffic through the device while it restarts.
-
List the files in flashCisco IOS · Privileged EXEC (#)
dir flash: -
Show a file's contentsCisco IOS · Privileged EXEC (#)
more flash:SW1-backup.cfg -
Delete a file from flashCisco IOS · Privileged EXEC (#)
delete flash:old.cfgWarning: Deletes the file and can't be undone.
-
Copy a software image from a TFTP serverCisco IOS · Privileged EXEC (#)
copy tftp://192.168.1.5/image.bin flash: -
Check a software image's MD5 hashCisco IOS · Privileged EXEC (#)
verify /md5 flash:image.bin -
Boot from a specific imageCisco IOS · Global config (config)#
boot system flash:image.bin -
Let the device receive files over SCPCisco IOS · Global config (config)#
ip scp server enable
Show and verify #
-
Show the model, software version and uptimeCisco IOS · Privileged EXEC (#)
show version -
Show interfaces, IP addresses and statusCisco IOS · Privileged EXEC (#)
show ip interface brief -
Show switch ports, VLANs, speed and duplexCisco IOS · Privileged EXEC (#)
show interfaces status -
Show one interface's details and countersCisco IOS · Privileged EXEC (#)
show interfaces GigabitEthernet0/1 -
Show interface descriptionsCisco IOS · Privileged EXEC (#)
show interfaces description -
Show interface error countersCisco IOS · Privileged EXEC (#)
show interfaces counters errors -
Show hardware, modules and serial numbersCisco IOS · Privileged EXEC (#)
show inventory -
Show CPU use, busiest processes firstCisco IOS · Privileged EXEC (#)
show processes cpu sorted -
Show CPU use over timeCisco IOS · Privileged EXEC (#)
show processes cpu history -
Show memory useCisco IOS · Privileged EXEC (#)
show memory statistics -
Show temperature, fans and power suppliesCisco IOS · Privileged EXEC (#)
show environment all -
Show the logCisco IOS · Privileged EXEC (#)
show logging -
Show neighbouring Cisco devicesCisco IOS · Privileged EXEC (#)
show cdp neighbors -
Show neighbouring Cisco devices in detail, with IP addressesCisco IOS · Privileged EXEC (#)
show cdp neighbors detail -
Show neighbouring devices using LLDPCisco IOS · Privileged EXEC (#)
show lldp neighbors -
Show the MAC address tableCisco IOS · Privileged EXEC (#)
show mac address-table -
Find the port a MAC address is onCisco IOS · Privileged EXEC (#)
show mac address-table address aabb.cc00.0100 -
Show the MAC addresses on a portCisco IOS · Privileged EXEC (#)
show mac address-table interface GigabitEthernet0/1 -
Show the ARP tableCisco IOS · Privileged EXEC (#)
show ip arp -
Find the IP address for a MAC addressCisco IOS · Privileged EXEC (#)
show ip arp | include aabb.cc00.0100 -
Show who's logged inCisco IOS · Privileged EXEC (#)
show users -
Show the licence summaryCisco IOS · Privileged EXEC (#)
show license summary -
Collect everything for a support caseCisco IOS · Privileged EXEC (#)
show tech-support
Interfaces #
-
Add a description to an interfaceCisco IOS · Global config (config)#
interface GigabitEthernet0/1 description Uplink to core -
Turn an interface onCisco IOS · Global config (config)#
interface GigabitEthernet0/1 no shutdown -
Turn an interface offCisco IOS · Global config (config)#
interface GigabitEthernet0/1 shutdownWarning: Disconnects whatever is plugged into the port.
-
Turn an interface off and on againCisco IOS · Global config (config)#
interface GigabitEthernet0/1 shutdown no shutdown -
Configure several interfaces at onceCisco IOS · Global config (config)#
interface range GigabitEthernet0/1 - 24 description User ports -
Set an interface's speed and duplexCisco IOS · Global config (config)#
interface GigabitEthernet0/1 speed 1000 duplex full -
Give a router interface an IP addressCisco IOS · Global config (config)#
interface GigabitEthernet0/0 ip address 192.168.1.1 255.255.255.0 no shutdown -
Get an interface's IP address from DHCPCisco IOS · Global config (config)#
interface GigabitEthernet0/0 ip address dhcp no shutdown -
Add a second IP address to an interfaceCisco IOS · Global config (config)#
interface GigabitEthernet0/0 ip address 10.0.0.1 255.255.255.0 secondary -
Create a loopback interfaceCisco IOS · Global config (config)#
interface Loopback0 ip address 10.255.255.1 255.255.255.255 -
Reset an interface to its defaultsCisco IOS · Global config (config)#
default interface GigabitEthernet0/1Warning: Removes all of the interface's settings.
-
Reset an interface's countersCisco IOS · Privileged EXEC (#)
clear counters GigabitEthernet0/1 -
List ports shut down by an error (err-disabled)Cisco IOS · Privileged EXEC (#)
show interfaces status err-disabled -
Bring err-disabled ports back automatically after 5 minutesCisco IOS · Global config (config)#
errdisable recovery cause all errdisable recovery interval 300 -
Show Power over Ethernet use per portCisco IOS · Privileged EXEC (#)
show power inline -
Turn off Power over Ethernet on a portCisco IOS · Global config (config)#
interface GigabitEthernet1/0/1 power inline never
VLANs and trunks #
-
Create a VLAN and name itCisco IOS · Global config (config)#
vlan 10 name Users -
List VLANs and their portsCisco IOS · Privileged EXEC (#)
show vlan brief -
Delete a VLANCisco IOS · Global config (config)#
no vlan 10Warning: Ports in the VLAN stop passing traffic until you move them.
-
Make a port an access port in a VLANCisco IOS · Global config (config)#
interface GigabitEthernet0/1 switchport mode access switchport access vlan 10 -
Add a voice VLAN for an IP phoneCisco IOS · Global config (config)#
interface GigabitEthernet0/1 switchport mode access switchport access vlan 10 switchport voice vlan 20 -
Make a port a trunk carrying some VLANsCisco IOS · Global config (config)#
interface GigabitEthernet0/24 switchport mode trunk switchport trunk allowed vlan 10,20,30Warning: Replaces the trunk's allowed VLAN list. Use add to include one more without removing the others.
-
Set trunk encapsulation on switches that ask for itCisco IOS · Global config (config)#
interface GigabitEthernet0/24 switchport trunk encapsulation dot1q -
Add a VLAN to a trunkCisco IOS · Global config (config)#
interface GigabitEthernet0/24 switchport trunk allowed vlan add 40 -
Remove a VLAN from a trunkCisco IOS · Global config (config)#
interface GigabitEthernet0/24 switchport trunk allowed vlan remove 40 -
Change a trunk's native VLANCisco IOS · Global config (config)#
interface GigabitEthernet0/24 switchport trunk native vlan 99 -
Stop a port negotiating trunking (DTP)Cisco IOS · Global config (config)#
interface GigabitEthernet0/24 switchport nonegotiate -
Show trunk ports and their VLANsCisco IOS · Privileged EXEC (#)
show interfaces trunk -
Show a port's VLAN and trunk settingsCisco IOS · Privileged EXEC (#)
show interfaces GigabitEthernet0/1 switchport -
Route between VLANs on a Layer 3 switchCisco IOS · Global config (config)#
ip routing interface Vlan10 ip address 192.168.10.1 255.255.255.0 no shutdown -
Route between VLANs on a router (router on a stick)Cisco IOS · Global config (config)#
interface GigabitEthernet0/0.10 encapsulation dot1Q 10 ip address 192.168.10.1 255.255.255.0 -
Park unused ports in an unused VLAN and shut themCisco IOS · Global config (config)#
interface range GigabitEthernet0/20 - 23 switchport mode access switchport access vlan 999 shutdown -
Stop the switch sharing VLANs with VTPCisco IOS · Global config (config)#
vtp mode transparent -
Show VTP settingsCisco IOS · Privileged EXEC (#)
show vtp status
Spanning tree #
-
Show spanning treeCisco IOS · Privileged EXEC (#)
show spanning-tree -
Show spanning tree for one VLANCisco IOS · Privileged EXEC (#)
show spanning-tree vlan 10 -
Show a spanning tree summaryCisco IOS · Privileged EXEC (#)
show spanning-tree summary -
Use Rapid PVST+Cisco IOS · Global config (config)#
spanning-tree mode rapid-pvst -
Make this switch the root for a VLANCisco IOS · Global config (config)#
spanning-tree vlan 10 root primary -
Set a switch's spanning tree priority for a VLANCisco IOS · Global config (config)#
spanning-tree vlan 10 priority 4096 -
Turn on PortFast for a port with a PC or server on itCisco IOS · Global config (config)#
interface GigabitEthernet0/1 spanning-tree portfast -
Turn on BPDU guard for a portCisco IOS · Global config (config)#
interface GigabitEthernet0/1 spanning-tree bpduguard enable -
Turn on PortFast for every access portCisco IOS · Global config (config)#
spanning-tree portfast default -
Turn on BPDU guard for every PortFast portCisco IOS · Global config (config)#
spanning-tree portfast bpduguard default -
Stop a port becoming the path to a new root (root guard)Cisco IOS · Global config (config)#
interface GigabitEthernet0/24 spanning-tree guard root
EtherChannel #
-
Bundle two ports with LACPCisco IOS · Global config (config)#
interface range GigabitEthernet0/23 - 24 channel-group 1 mode active -
Make a port-channel a trunkCisco IOS · Global config (config)#
interface Port-channel1 switchport mode trunk -
Balance traffic by source and destination IPCisco IOS · Global config (config)#
port-channel load-balance src-dst-ip -
Show EtherChannel statusCisco IOS · Privileged EXEC (#)
show etherchannel summary -
Show LACP neighboursCisco IOS · Privileged EXEC (#)
show lacp neighbor
Switch security #
-
Allow up to 2 MAC addresses on a port and remember themCisco IOS · Global config (config)#
interface GigabitEthernet0/1 switchport mode access switchport port-security switchport port-security maximum 2 switchport port-security violation restrict switchport port-security mac-address sticky -
Show port security for every portCisco IOS · Privileged EXEC (#)
show port-security -
Show port security for one portCisco IOS · Privileged EXEC (#)
show port-security interface GigabitEthernet0/1 -
Turn on DHCP snooping and trust the uplinkCisco IOS · Global config (config)#
ip dhcp snooping ip dhcp snooping vlan 10 interface GigabitEthernet0/24 ip dhcp snooping trust -
Show DHCP snooping bindingsCisco IOS · Privileged EXEC (#)
show ip dhcp snooping binding -
Turn on Dynamic ARP Inspection and trust the uplinkCisco IOS · Global config (config)#
ip arp inspection vlan 10 interface GigabitEthernet0/24 ip arp inspection trust -
Limit broadcast traffic on a portCisco IOS · Global config (config)#
interface GigabitEthernet0/1 storm-control broadcast level 5.00 -
Stop sending CDP on a portCisco IOS · Global config (config)#
interface GigabitEthernet0/1 no cdp enable -
Turn off CDP everywhereCisco IOS · Global config (config)#
no cdp run -
Turn on LLDPCisco IOS · Global config (config)#
lldp run -
Turn off the web interfaceCisco IOS · Global config (config)#
no ip http server no ip http secure-server
Static routing #
-
Turn on routing on a Layer 3 switchCisco IOS · Global config (config)#
ip routing -
Add a static routeCisco IOS · Global config (config)#
ip route 10.20.0.0 255.255.0.0 192.168.1.254 -
Add a default routeCisco IOS · Global config (config)#
ip route 0.0.0.0 0.0.0.0 203.0.113.1 -
Add a backup default route used only if the main one failsCisco IOS · Global config (config)#
ip route 0.0.0.0 0.0.0.0 198.51.100.1 250 -
Drop traffic to a networkCisco IOS · Global config (config)#
ip route 10.99.0.0 255.255.0.0 Null0 -
Remove a static routeCisco IOS · Global config (config)#
no ip route 10.20.0.0 255.255.0.0 192.168.1.254 -
Show the routing tableCisco IOS · Privileged EXEC (#)
show ip route -
Show static routesCisco IOS · Privileged EXEC (#)
show ip route static -
Show which route a destination usesCisco IOS · Privileged EXEC (#)
show ip route 10.20.1.5 -
Show which routing protocols are runningCisco IOS · Privileged EXEC (#)
show ip protocols
IPv6 #
-
Turn on IPv6 routingCisco IOS · Global config (config)#
ipv6 unicast-routing -
Give an interface an IPv6 addressCisco IOS · Global config (config)#
interface GigabitEthernet0/0 ipv6 address 2001:db8:1::1/64 -
Add an IPv6 default routeCisco IOS · Global config (config)#
ipv6 route ::/0 2001:db8::1 -
Show IPv6 interfacesCisco IOS · Privileged EXEC (#)
show ipv6 interface brief -
Show the IPv6 routing tableCisco IOS · Privileged EXEC (#)
show ipv6 route
OSPF #
-
Start OSPF and add a network to area 0Cisco IOS · Global config (config)#
router ospf 1 router-id 1.1.1.1 network 192.168.1.0 0.0.0.255 area 0 -
Turn on OSPF on an interfaceCisco IOS · Global config (config)#
interface GigabitEthernet0/0 ip ospf 1 area 0 -
Stop OSPF on all interfaces except the ones you nameCisco IOS · Global config (config)#
router ospf 1 passive-interface default no passive-interface GigabitEthernet0/0 -
Advertise a default route into OSPFCisco IOS · Global config (config)#
router ospf 1 default-information originate -
Set an interface's OSPF costCisco IOS · Global config (config)#
interface GigabitEthernet0/0 ip ospf cost 10 -
Treat a link as point-to-point in OSPFCisco IOS · Global config (config)#
interface GigabitEthernet0/0 ip ospf network point-to-point -
Turn on OSPF authentication on an interfaceCisco IOS · Global config (config)#
interface GigabitEthernet0/0 ip ospf authentication message-digest ip ospf message-digest-key 1 md5 MyOspfKey -
Show OSPF neighboursCisco IOS · Privileged EXEC (#)
show ip ospf neighbor -
Show OSPF interfacesCisco IOS · Privileged EXEC (#)
show ip ospf interface brief -
Show routes learned from OSPFCisco IOS · Privileged EXEC (#)
show ip route ospf -
Show the OSPF databaseCisco IOS · Privileged EXEC (#)
show ip ospf database -
Restart OSPFCisco IOS · Privileged EXEC (#)
clear ip ospf processWarning: Drops every OSPF neighbour while they reconnect.
BGP #
-
Start BGP and add a neighbourCisco IOS · Global config (config)#
router bgp 65001 neighbor 203.0.113.1 remote-as 65000 -
Advertise a network in BGPCisco IOS · Global config (config)#
router bgp 65001 network 198.51.100.0 mask 255.255.255.0 -
Show BGP neighbours and their stateCisco IOS · Privileged EXEC (#)
show ip bgp summary -
Show the BGP tableCisco IOS · Privileged EXEC (#)
show ip bgp -
Refresh routes from a BGP neighbour without dropping itCisco IOS · Privileged EXEC (#)
clear ip bgp 203.0.113.1 soft
Gateway redundancy (HSRP) #
-
Share a gateway address between two switchesCisco IOS · Global config (config)#
interface Vlan10 standby 1 ip 192.168.10.1 standby 1 priority 110 standby 1 preempt -
Show HSRP statusCisco IOS · Privileged EXEC (#)
show standby brief
Access lists #
-
Create a standard ACL that allows a networkCisco IOS · Global config (config)#
access-list 10 permit 192.168.1.0 0.0.0.255 -
Create an ACL that blocks Telnet and allows everything elseCisco IOS · Global config (config)#
ip access-list extended BLOCK-TELNET deny tcp any any eq 23 permit ip any any -
Create an ACL that only allows web traffic to a serverCisco IOS · Global config (config)#
ip access-list extended WEB-IN permit tcp any host 192.168.1.20 eq 443 permit tcp any host 192.168.1.20 eq 80 deny ip any any log -
Apply an ACL to traffic coming into an interfaceCisco IOS · Global config (config)#
interface GigabitEthernet0/0 ip access-group WEB-IN inWarning: Anything the ACL doesn't permit is blocked. Make sure you have another way in, such as the console, before you apply it over SSH.
-
Remove an ACL from an interfaceCisco IOS · Global config (config)#
interface GigabitEthernet0/0 no ip access-group WEB-IN in -
Only allow SSH from the management networkCisco IOS · Global config (config)#
access-list 10 permit 192.168.1.0 0.0.0.255 line vty 0 15 access-class 10 inWarning: Make sure you have another way in, such as the console, before you apply it over SSH.
-
Insert a line into an ACL at a set positionCisco IOS · Global config (config)#
ip access-list extended WEB-IN 15 permit tcp any host 192.168.1.20 eq 8443 -
Delete one line from an ACLCisco IOS · Global config (config)#
ip access-list extended WEB-IN no 15 -
Renumber an ACL's lines in steps of 10Cisco IOS · Global config (config)#
ip access-list resequence WEB-IN 10 10 -
Show ACLs and how many packets each line matchedCisco IOS · Privileged EXEC (#)
show ip access-lists -
Show which ACLs are applied to an interfaceCisco IOS · Privileged EXEC (#)
show ip interface GigabitEthernet0/0 | include access list -
Reset ACL match countersCisco IOS · Privileged EXEC (#)
clear ip access-list counters
NAT #
-
Mark the inside and outside interfaces for NATCisco IOS · Global config (config)#
interface GigabitEthernet0/1 ip nat inside interface GigabitEthernet0/0 ip nat outside -
Share one public IP address with the inside network (PAT)Cisco IOS · Global config (config)#
access-list 1 permit 192.168.1.0 0.0.0.255 ip nat inside source list 1 interface GigabitEthernet0/0 overload -
Map a public IP address to an inside serverCisco IOS · Global config (config)#
ip nat inside source static 192.168.1.20 203.0.113.10 -
Forward a port to an inside serverCisco IOS · Global config (config)#
ip nat inside source static tcp 192.168.1.20 443 interface GigabitEthernet0/0 443 -
Show NAT translationsCisco IOS · Privileged EXEC (#)
show ip nat translations -
Show NAT statisticsCisco IOS · Privileged EXEC (#)
show ip nat statistics -
Clear all NAT translationsCisco IOS · Privileged EXEC (#)
clear ip nat translation *Warning: Drops connections that are using NAT right now.
DHCP server and relay #
-
Keep some addresses out of DHCPCisco IOS · Global config (config)#
ip dhcp excluded-address 192.168.1.1 192.168.1.20 -
Create a DHCP poolCisco IOS · Global config (config)#
ip dhcp pool USERS network 192.168.1.0 255.255.255.0 default-router 192.168.1.1 dns-server 1.1.1.1 8.8.8.8 lease 7 -
Always give a device the same addressCisco IOS · Global config (config)#
ip dhcp pool PRINTER host 192.168.1.50 255.255.255.0 hardware-address aabb.cc00.0100 -
Forward DHCP requests to a server on another networkCisco IOS · Global config (config)#
interface Vlan10 ip helper-address 192.168.1.5 -
Show DHCP leasesCisco IOS · Privileged EXEC (#)
show ip dhcp binding -
Show DHCP pools and how full they areCisco IOS · Privileged EXEC (#)
show ip dhcp pool -
Show DHCP address conflictsCisco IOS · Privileged EXEC (#)
show ip dhcp conflict -
Clear all DHCP leasesCisco IOS · Privileged EXEC (#)
clear ip dhcp binding *
SSH and remote access #
-
Set up SSH from scratchCisco IOS · Global config (config)#
hostname SW1 ip domain-name corp.example.com crypto key generate rsa modulus 2048 ip ssh version 2 username admin privilege 15 secret MyPassword line vty 0 15 login local transport input ssh -
Only allow SSH, not TelnetCisco IOS · Global config (config)#
line vty 0 15 transport input ssh -
Log out idle remote sessions after 10 minutesCisco IOS · Global config (config)#
line vty 0 15 exec-timeout 10 0 -
Limit SSH login attempts and timeCisco IOS · Global config (config)#
ip ssh authentication-retries 3 ip ssh time-out 60 -
Block logins for 2 minutes after 5 failures in a minuteCisco IOS · Global config (config)#
login block-for 120 attempts 5 within 60 -
Show SSH settingsCisco IOS · Privileged EXEC (#)
show ip ssh -
Show current SSH sessionsCisco IOS · Privileged EXEC (#)
show ssh -
SSH from this device to anotherCisco IOS · Privileged EXEC (#)
ssh -l admin 192.168.1.20 -
Disconnect a remote sessionCisco IOS · Privileged EXEC (#)
clear line vty 0
AAA, RADIUS and TACACS+ #
-
Turn on AAA with local usersCisco IOS · Global config (config)#
aaa new-model aaa authentication login default local aaa authorization exec default localWarning: Changes how everyone logs in. Create a local user first and keep a session open while you test.
-
Add a RADIUS serverCisco IOS · Global config (config)#
radius server NPS1 address ipv4 192.168.1.5 auth-port 1812 acct-port 1813 key MyRadiusKey -
Log in with RADIUS, falling back to local usersCisco IOS · Global config (config)#
aaa authentication login default group radius local -
Add a TACACS+ serverCisco IOS · Global config (config)#
tacacs server ISE1 address ipv4 192.168.1.6 key MyTacacsKey -
Log in with TACACS+, falling back to local usersCisco IOS · Global config (config)#
aaa authentication login default group tacacs+ local -
Log every admin command to TACACS+Cisco IOS · Global config (config)#
aaa accounting commands 15 default start-stop group tacacs+ -
Test a login against RADIUSCisco IOS · Privileged EXEC (#)
test aaa group radius admin MyPassword new-code -
Show AAA servers and their stateCisco IOS · Privileged EXEC (#)
show aaa servers
Logging and SNMP #
-
Send logs to a syslog serverCisco IOS · Global config (config)#
logging host 192.168.1.5 logging trap informational -
Keep more log messages on the deviceCisco IOS · Global config (config)#
logging buffered 64000 -
Add the date and time to log messagesCisco IOS · Global config (config)#
service timestamps log datetime msec localtime show-timezone -
Clear the logCisco IOS · Privileged EXEC (#)
clear logging -
Set up SNMPv3 with authentication and encryptionCisco IOS · Global config (config)#
snmp-server group MONITOR v3 priv snmp-server user monitor MONITOR v3 auth sha MyAuthPass priv aes 128 MyPrivPass -
Set up read-only SNMPv2cCisco IOS · Global config (config)#
snmp-server community MyReadOnlyString ROWarning: SNMPv2c sends the community string in plain text. Use SNMPv3 where you can.
-
Set the SNMP location and contactCisco IOS · Global config (config)#
snmp-server location Dublin office snmp-server contact [email protected] -
Show SNMP settings and countersCisco IOS · Privileged EXEC (#)
show snmp
Troubleshooting #
-
Check you can reach an addressCisco IOS · Privileged EXEC (#)
ping 192.168.1.1 -
Ping from a specific interfaceCisco IOS · Privileged EXEC (#)
ping 8.8.8.8 source GigabitEthernet0/1 -
Ping 100 timesCisco IOS · Privileged EXEC (#)
ping 8.8.8.8 repeat 100 -
Trace the route to an addressCisco IOS · Privileged EXEC (#)
traceroute 8.8.8.8 -
Test whether a TCP port is openCisco IOS · Privileged EXEC (#)
telnet 192.168.1.20 443 -
Find interfaces that went up or downCisco IOS · Privileged EXEC (#)
show logging | include UPDOWN -
Test a copper cableCisco IOS · Privileged EXEC (#)
test cable-diagnostics tdr interface GigabitEthernet1/0/1 -
Show the cable test resultCisco IOS · Privileged EXEC (#)
show cable-diagnostics tdr interface GigabitEthernet1/0/1 -
Copy a port's traffic to another port (SPAN)Cisco IOS · Global config (config)#
monitor session 1 source interface GigabitEthernet0/1 monitor session 1 destination interface GigabitEthernet0/24Warning: The destination port stops passing its normal traffic.
-
Show port mirroring sessionsCisco IOS · Privileged EXEC (#)
show monitor session 1 -
Debug ping trafficCisco IOS · Privileged EXEC (#)
debug ip icmpWarning: Debug output can overload a busy device. Turn it off with undebug all.
-
Show which debugs are onCisco IOS · Privileged EXEC (#)
show debugging -
Turn off all debuggingCisco IOS · Privileged EXEC (#)
undebug all
Switch stacks #
-
Show stack members and their rolesCisco IOS · Privileged EXEC (#)
show switch -
Make a stack member more likely to be the active switchCisco IOS · Global config (config)#
switch 1 priority 15 -
Change a stack member's numberCisco IOS · Global config (config)#
switch 2 renumber 3Warning: Takes effect when the member reloads, and its ports are renamed.
Password recovery (routers) #
-
In ROMMON, skip the saved config on next bootCisco IOS · ROMMON (rommon>)
confreg 0x2142 -
In ROMMON, restart the routerCisco IOS · ROMMON (rommon>)
reset -
After recovery, boot normally againCisco IOS · Global config (config)#
config-register 0x2102 -
Show the config registerCisco IOS · Privileged EXEC (#)
show version | include register