Cheatography
https://cheatography.com
Common CLI commnds for Cisco IOS in switches and routers.
This is a draft cheat sheet. It is a work in progress and is not finished yet.
General
Command |
Description |
Displays As |
> en |
Enter Privleged Exec Mode |
# |
# config t |
Enter Global Config Mode |
(config)# |
(config) # int {type} {number} |
Enter Interface Config Mode |
(config-if)# |
(config) # vlan {number} |
Enter VLAN Config Mode |
(config-vlan)# |
(config) # line con 0 |
Enter Console Line Config Mode |
(config-line)# |
(config) # line vty 0 15 |
Enter VTY Line Config Mode |
(config-line)# |
(config) # no ip dom lo |
Stops Router Domain Lookup |
(config) # undebug all |
Stops all Debugs |
# clock set {time} {date} |
Sets manual Time/Date |
# show file systems |
Lists available file systems |
# exit |
Exits current mode/level |
Housekeeping
Command |
Description |
(config) # ho {name} |
Set name of device |
(config) # ena sec {password} |
Set encypted password for Priv Exec Mode |
(config) # ser pass |
Encrypts All Passwords |
(config) # banner motd #{Banner}# |
Creates Message banner |
(config) # security pass min {number} |
Sets min password length |
(config) # login block-for {time} attempts {attempts} within {time} |
Login failure wait time set |
(config-line) # pass {password} |
Sets password for Console Line |
(config-line) # login |
Makes passwords active, use after every password config |
(config-line) # exec-timeout {time} |
Sets login timeout |
(config-if) # shut | no shut |
Enables | Disables interface |
(config-if) #des {description} |
Sets description of interface |
# cop r s |
Copies Running Config to the NVRAM |
SSH Config
Command |
Description |
(config) # ip domain-name {Abxyz.com} |
Sets Domain Name |
(config) # cry key gen rsa general-keys mod 1024 |
Configs complexity of keys |
(config) # username {name} secret {password} |
Sets a UN & encrypted Pass |
(config) # line vty 0 15 |
Configs which VTY lines to use |
(config-line) # login local |
Sets LOGIN |
(config-line) # transport input ssh |
*Defines transport potocol to SSH |
IP Routing Config
Command |
Description |
(config) # ip route network-address subnet-mask {ip-address | exit-intf } |
Static Route Command |
(config) # ip route 0.0.0.0 0.0.0.0 {ip-address | exit-intf } |
Default Static Route Command |
(config) # ip route network-address subnet-mask {admin-distance } |
Floating Static Route Command (Admin distance default value is 1) |
VLAN Config
Command |
Description |
(config) # vlan {vlan-id} |
Create a VLAN |
(config-vlan) # name {vlan-name} |
Specify a unique name to identify the VLAN |
(config-vlan) # end |
Return to the privileged EXEC mode |
(config) # interface {interface_id} |
Enter interface configuration mode |
(config-if) # switchport mode access |
Set the port to access mode. |
(config-if) # switchport access vlan vlan_id |
Assign the port to a VLAN. |
(config-if) # end |
Return to the privileged EXEC mode. |
(config) #show vlan brief |
Display the contents of the vlan.dat file |
(config-if) # mls qos trust [cos | device cisco-phone | dscp | ip-precedence] |
Set the trusted state of an interface |
(config-if) # switchport voice vlan vlan-# |
Assign a voice VLAN to a port |
(config-if) # switchport mode trunk |
Configure a switch port on one end of a trunk link |
(config-if) # switchport trunk native vlan # |
Configure native VLAN |
For a Catalyst switch, the erase startup-config command must accompany the {(config) #delete vlan.dat} command prior to reload to restore the switch to its factory default condition.
PAT Config
Command |
Description |
(config)# ip nat pool NAT-POOL-OVERLOAD 209.165.200.241 209.165.200.250 netmask 255.255.255.224 |
Define a pool of public IPv4 addresses 209.165.200.241 to 209.165.200.250 with pool name NAT-POOL-OVERLOAD. |
(config)# access-list 3 permit 10.0.0.0 0.255.255.255 |
Configure ACL 3 to permit devices from 10.0.0.0/8 network to be translated by NAT. |
(config)# ip nat inside source list 3 pool NAT-POOL-OVERLOAD overload |
Bind NAT-POOL-OVERLOAD with ACL 3. |
(config)# interface Serial0/0/0 R2(config-if)# ip nat inside |
Configure the proper inside NAT interface. |
R2(config)# interface Serial0/1/0 R2(config-if)# ip nat outside |
Configure the proper outside NAT interface. |
CDP Config
Command |
Description |
# show cdp |
Display the status of CDP on R1. |
R1# configure terminal R1(config)# cdp run R1(config)# interface s0/0/0 R1(config-if)# no cdp enable R1(config-if)# end |
Enter Global ConfigurEnable CDP globally on R1. Disable CDP on interface S0/0/0. Use end command to exit Global Configuration mode. |
# show cdp neighbors |
Display the list of CDP neighbors on R1. |
# show cdp neighbors detail |
Display more details from the list of CDP neighbors on R1. |
Clock & NTP Config
Command |
Description |
# show clock detail |
Display the clock |
(config)# clock timezone PST -8 R1(config)# Clock summer-time PDT recurring |
Set the clock time zone to PST (Pacific Standard Time), which is 8 hours later than GMT (-8). Set PDT (Pacific Daylight Time) to summer time recurring. |
(config)# ntp server 209.165.200.225 |
Configure R1 to use an external public NTP server with an IP address of 209.165.200.225. |
# show ntp associations |
Verify that R1 is associated with the NTP server at IP address 209.165.200.225. |
LLDP Config
Command |
Description |
# show lldp |
Display the status of LLDP |
(config)# lldp run R1(config)# interface s0/0/0 R1(config-if)# no lldp transmit |
Enable LLDP globally on R1. Disable LLDP on interface S0/0/0. |
# show lldp neighbors |
Display the list of LLDP neighbors |
# show lldp neighbors detail |
Display more details from the list of LLDP neighbors |
|
|
Shortcuts
Keys |
Action |
Tab |
Completes current abbrv command |
Up Arrow |
Cycles thru previously used commands |
? |
Access HELP |
Ctrl+Shift+6 |
Interupt |
Ctrl+C |
Exits Config |
Ctrl+Z |
Applies command, returns to Priv Exec |
Display / Show Commands
Command |
Description |
# sho run |
Displays Running Configs. |
# sho access-l |
Displays all ACL's. |
# sho access-l {name/number} |
Displays only denoted ACL. |
# sho ipv6 int |
Displays interfaces on IPv6 |
# sho ip route |
Displays all routes attached to router |
# sho ip route static |
Displays all static routes attached to router |
#Sho ip route network |
Displays routes only associated with that network |
show ip nat translations |
nat |
Access Control Lists
Command |
Description |
(config) # access-list _ { deny | permit | remark } {source+wildcard} |
Create ACL. |
(config) # ip access-list standard {name} |
Create Named ACL. |
(config-if) # ip access-group { access-list-number | access-list-name } { in | out } |
Attach ACL to an Interface. |
(config-line) # access-class {number} { in | out } |
ACL for VTY. |
Wildcard Determined by 255.255.255.255-Subnet mask (ex 255.255.255.255-255.255.255.128= Wildcard of 0.0.0.127)
Shortcuts; host = Wilcard of 255.255.255.255 any = Address & WIldcard of 0.0.0.0 0.0.0.0
DHCPv4 Config
Command |
Description |
(config) #ip dhcp excluded-address {low ip range} {high ip range} | {single ip} |
Excludes ip ranges, or single IP's. |
(config) # ip dhcp pool {name} |
Creates named DHCP pool |
(dhcp-config) #net {ipv4net} {subnet} |
Define Range of Addresses |
(dhcp-config) #default-r {gateway} |
Sets Default Gateway |
(dhcp-config) #dns-s {DNS} |
Sets DNS |
(dhcp-config) #domain-n {Axyz.com} |
Sets Domain |
(config) #ip helper-address {ipv4net} |
Sets DHCP Relay |
DHCPv6 Config
Command |
Description |
(config-if) # ipv6 unicast-routing |
Enable IPv6 |
(config-if) # ipv6 dhcp pool {name} |
Name Pool |
(config-if) # address prefix {prefix length} lifetime {infinite | time} |
Statefull Only |
(config-if) # dns-s {IPv6DNS} |
Set IPv6 DNS |
(config-if) # domain-n {Axyz.com} |
Set Domain |
(config-if) # ipv6 dhcp server {name} |
Set Server Name |
See Note Below for Final CMD |
|
(config-if) # ipv6 dhcp relay destination {ipv6net} |
Sets Router as a DHCPv6 Relay |
# debug ipv6 dhcp detail |
Displays debug details |
SLAAC (config-if) # no ipv6 nd managed-config-flag (config-if) # no ipv6 nd other-config-flag Note: No other config required for SLAAC.
Stateless DHCPv6 (config-inf) # ipv6 nd other-config-flag
Statefull DHCPv6 (config-inf) # ipv6 nd managed-config-flag
RIP Config
Command |
Description |
(config) # router rip |
(config-router) #version 2 |
(config-router) # no auto-summary |
modify the default RIPv2 behavior of automatic summarization |
(config) #show ip protocols |
(config) #network ip-address |
(config) #passive-interface |
prevent the transmission of routing updates through a router interface, but still allow that network to be advertised to other routers. |
(config-router) #ip route 0.0.0.0 0.0.0.0 |
propagate a default route in RIP |
(config-router) #default-information originate |
This instructs R1 to originate default information, by propagating the static default route in RIP updates. |
NAT Config
Command |
Description |
(config)# ip nat inside source static 192.168.11.99 209.165.201.5 |
Configure the static translation with an inside local address of 192.168.11.99 and an inside global address of 209.165.201.5. |
(config)# interface Serial0/0/0 , (config-if)# ip nat inside |
Configure the proper inside NAT interface. |
R2(config)# interface Serial0/1/0 , (config-if)# ip nat outside |
Configure the proper outside NAT interface. |
|
(config)# ip nat pool PUBLIC-POOL 209.165.200.241 209.165.200.250 netmask 255.255.255.224 |
Define a pool of public IPv4 addresses 209.165.200.241 to 209.165.200.250 with pool name PUBLIC-POOL. |
R2(config)# access-list 2 permit 192.168.10.0 0.0.0.255 |
Configure ACL 2 to permit devices from 192.168.10.0/24 network to be translated by NAT. |
R2(config)# ip nat inside source list 2 pool PUBLIC-POOL |
Bind PUBLIC-POOL with ACL 2. |
R2(config)# interface Serial0/0/0 R2(config-if)# ip nat inside |
Configure the proper inside NAT interface. |
R2(config)# interface Serial0/1/0 R2(config-if)# ip nat outside |
Configure the proper outside NAT interface. |
ip nat translation timeout |
clear ip nat translation * |
Top is Static Config
Bottom is Dynamic Config
SysLog Config
Command |
Description |
(config) # logging {address} |
Configure the destination hostname or IPv4 address of the syslog. |
(config) # logging trap {level} |
Control the level of messages that will be sent |
(config)# logging source-interface {interface} |
Logging Source |
|