CCNA Cheat Sheet
CCNA Cheat Sheet
Configure Networking
The following includes basic configure networking commands and their
descriptions:
Get IPv6 address (and default route) via autoconfig: (config-if)# ipv6 address
autoconfig [default]
You can also set both: (config)# ipv6 route 2001:41d0:8:e115::/64 [g1/1] [next hop]
Show interfaces mac, bandwidth, mtu, packet stats, etc.: # show interfaces [if-
name]
Show routes and how they were learned: # show ip[v6] route [static]
Only show ip, status, and operational status: # show ip[v6] interface brief [if-
name]
Similar to show ip int brief, w/ cidr, w/o ok/method: # show protocols [if-name]
Clear the dynamically learned mac address table entries: # clear mac address-
table [dynamic]
Define SPAN #23 input as g1/1: (config)# monitor session 23 source interface g1/1
{rx,tx,both}
Port Security
En/Disable port-security: (config-if)# [no] switchport port-security
Port status, violation mode, max/total MACs and more: # show port-security
[interface g1/1]
[delete vlan or] create vlan and enter config-vlan mode: (config)# [no] vlan 23
Make frames out this port tagged by default: (config-if)# switchport mode trunk
Except for vlan 256, which remains untagged: (config-if)# switchport trunk native
vlan 256
Show vlan settings for all switch ports: # show vlan [{id 23, name
TelephoneSanitizer}] [brief]
Quick way to search the running config: # show run interface vlan 1
Show current DTP mode for g1/1: # show dtp interface g1/1
STP
Spanning Tree Protocol (STP) (802.1D) blocks ports that have repetitive links in
order to prevent layer 2 loops and broadcast storms.
Enable bpdu guard for all portfast enable interfaces: (config)# spanning-tree
portfast bpduguard default
Troubleshoot STP
Who's the root and how do I get there? # show spanning-tree [vlan 1]
Configure g1/1 and g1/2 at the same time: (config)# interface range g1/1 - 2
Includes the combined bandwidth and members as extra info: # show interface
port-channel 1
Configure a Serial
Layer 1 link speed is ordered by a CSU/DSU, in a lab without an external CSU/DSU
and using a DTE (Data Termianl Equipment) cable and DCE (Data Communications
Equipment) cable.
Set clock rate on DCE router side to 128 kbps: (config-if)# clock rate 128000
Verify clock rate for serial interface 1/0: (config)# show controllers serial 1/0
ACLs
Create ACL #23 or append a rule to ACL #23, allow 1.2.x.x: (config)# access-list
23 permit 1.2.3.4 [0.0.255.255]
Renumber ACL Rules, put first on #5, increment by 10: (config)# ip[v6] access-list
resequence local_only 5 10
Create ACL and/or enter config mode for ACL #23: (config)# ip access-list
{standard, extended} 23
Create ACL and/or enter config mode for ACL 'local_only': (config)# ip access-list
{standard, extended} local_only
Interface ACLs
Apply ACL #23 to outgoing packets, not send by the router: (config-if)# ip
access-group 23 out
Apply ACL #42 to incoming packets: (config-if)# ip access-group 42 in
Overwrite the used ACL, only one ACL per if + proto + direction!: (config-if)# ip
access-group local_only in
Show ACLs on g1/1 (When none set shows not set for v4 and nothing for v6): #
show ip interface g1/1 | incl access list
Troubleshooting ACLs
Display all rules in ACL #10 and how often they matched: # show access-list 10
NAT
Local addresses are inside the network. Global addresses are outside the network.
Packets going out, need to change their src, incoming their dest ip: (config-if)#
ip nat outside
Packets going out, need to change their dest, incoming their src ip: (config-if)#
ip nat inside
SNAT
SNAT - statically map an internal ip 1:1 to an external ip: (config)# ip nat inside
source static 10.10.23.2 1.2.3.5
DNAT
Create an IP Address Pool for NATing: (config)# ip nat pool POOL 1.2.3.5 1.2.3.10
netmask 255.255.255.240
DNAT IPs matching ACL #42 1:1 with IPs from nat pool 'POOL': (config)# ip nat
inside source list 42 pool POOL
PAT
Create an ACL identifying 10.10/16: (config)# access-list 10 permit 10.10.0.0
0.0.255.255
PAT IPs matching ACL #10 many:1 with g1/1s public IP: (config)# ip nat inside
source list 10 interface g1/1 overload
Troubleshooting NAT
Show translations are actually used and interfaces are marked in/out
correctly: # show ip nat statistics
Clear dynamic translations. Doesn't mess with SNAT!: # clear ip nat translation
{ip, *}
DHCP Server
Don't distribute these IPs in leases: (config)# ip dhcp excluded-address 10.30.4.1
10.30.4.100
Create and/or enter dhcp config for pool 'PCs': (config)# ip dhcp pool PCs
Define pool addresses: (dhcp-config)# network 10.30.4.0 /24
Troubleshooting DHCP
HSRP
Join HSRP Group: (config-if)# standby [group-number] ip
(optional) Preempt other routers when this router becomes active: (config-if)#
standby [group-number] preempt
Troubleshooting HSRP
HSRP Groups, their VIPs, state, active router, standby router, preemption: #
show standby
SLAs
Create ip sla test #23 and enter its config mode: (config)# ip sla 23
Start test #23 now and until manually stopped: (config)# ip sla schedule 23 life
{forever, seconds} start-time now
Troubleshooting SLAs
Device Management
Set hostname to R1: (config)# hostname R1
Copy something from flash to tftp. Wizard asks for details. It works both ways:
# copy flash0: tftp:
Firmware Management
Boot filename.bin from flash memory: (config)# boot system flash:filename.bin
Set the 16bit Configuration Register value used after reboot: (config)# config-
register 0x2342
License Management
Save a copy of all licenses: # license save flash:licenses.lic
Remove the no longer needed line from the config: (config)# no license boot
module technology-package disable
Product id and serial number needed to order licenses: # show license udi
Reset Password
Show the configuration register in rom monitor: > confreq
Set the configuration register in rom monitor to not load startup-conf: >
confreq 0x2142
Telnet / Console
Make sure to include legal terms to sound smart: (config)# banner login "Insert
snarky banner."
Enter config mode for vty 0 to 4 (up to 15 allowed): (config)# line vty 0 4
Enter config mode for the console port: (config)# line console 0
Set ACL to limit inbound IPs allowed to access vty: (config-line)# access-class 10
in
Overwrite the used ACL, only one ACL per vty + direction!: (config-line)# access-
class 42 in
Create local user with encrypted password: (config)# username h.acker secret
C1sco123
SSH
Required to generate SSH keys: (config)# hostname Fooba
Generate keys like it's 1995! Potentially takes forever: (config)# crypto key
generate rsa modulus 2048
Clock
Show time and date: # show clock
Radius
Local backup user: (config)# username password
Allow that group and local users in: (config)# aaa authentication login group local
TACACS+
Local backup user: (config)# username password
Allow that group and local users in: (config)# aaa authentication login group local
Syslog
Log to this syslog server (name or ip): # logging 10.20.30.40
Only log messages with min. informational sev: # logging trap informational
SNMP
Contact email: (config)# snmp-server contact [email protected]
List connected cisco devices (name, local/remote port, [ip] ..): # show cdp
neighbors [detail]
PPP
Create users for pap auth: (config)# username fnord password pass
Logical speed used for routing cost calc, RSVP: (config-if)# bandwidth 125
Required for CHAP, used as chap client username: (config)# hostname routy1
Create users for chap auth for routy2: (config)# username routy2 password
foobar