CCNA Commands
CCNA Commands
(File management)
show file systems shows memory and storage of IOS device
more flash0:/wotemp/fred shows FILE content of that directory on flash
copy tftp flash copies the IOS image from a TFTP server into flash (upgrade)
copy ftp://[ftp_username]:[password]@[ftp_ip]/[path] flash complete statement of above
or ip ftp username [ftp_username] locally save a username password of ftp user on device
ip ftp passsword [password]
copy ftp://[ftp_ip]/[path]
verify /md5 flash0:/C2900........ .bin [hash_value] to verify the MD5 hash of IOS image on device and cisco website
[to enable SCP first enable SSH login, define privilege to an existing user then:]
# username [IOS_user] privilege-level 15 password [password]
# ip scp server enable
(Boot)
(default register bit is 0x2102)
# config-register 0x2100 load ROMMON OS no need to copy run sta.
boot system [flash | flash: file_name | tftp filename ip_address] set boot system setting to look for first file, specific
file or a file in TFTP
bootfiled: 0= ROMMON OS 1=First OS in flash 2-F=First *boot system option> First OS in flash
show version [ | i 0x] shows IOS details or directly shows register bit + previous boot process
(AAA)
(config)#line [console 0 | vty 0 15] brings the config to set security through console or vty lines
login local to be checked against locally configured username. Userbased login
login to require the line (console 0 or vty 0 15) to ask for a password
access-list x in according to access-list x, incoming vty sessions will be filtered
exec-timeout 5 30 sets the session time out separately for con and vty to 5minutes and 30 seconds
(Banners)
config# banner x .... (enter) x MOTD banner x to be begining and end of msg.
banner login x ... (enter) x login banner
banner exec x ... (enter) x after-login exec banner
no banner [motd | login | exec] disables banner one by one.
show run | in banner
line# exec-time out x to set the season time out on vty to x value or 0 if never time out
line# history size x define number of commands in history buffer. arrow up
terminal history size x changes the buffer size only for running session
show history shows the history of buffer
(to config SSH connection on vty lines with login local to make SSH possible)
config# hostname x
ip domain-name farid.net
crypto key generate rsa to generate SSH key on vty based on hostname and domain name > x.farid.net
show crypto key mypubkey rsa shows the public key of ssh
transport input [all | none | ssh | telnet] to support neither or SSH or Telnet only over vty
ip ssh version 2 optional command to set the SSH version to 2 only. preferred
show ip ssh status about SSH server it self
show ssh status of clients currently connected to device
show mac-address-table or show mac address-table [dynamic | static | secure | address xxx.xxx.xxx] Show Mac add table
of switch
show mac address-table int gi1/0/3 show learnt address of specific interface
show mac address-table dynamic vlan x show diynamic addresses per vlan ID
show mac address-table [aging-time | count] shows the aging time or count of dynamic/static per VLAN
#clear mac address-table dynamic clears entries from mac table
(Access list)
#show access-lists Shows current IPv4 Access lists entries
#show ip access-lists Shows current IPv4 and IPv6 Access lists entries
config# access-list {1-99 | 1300-1999} {permit | deny} x.x.x.x standard ACL
access-list {1-99 | 1300-1999} {permit | deny} x.x.x.x 0.0.0.255
int# ip access-group [access-list_number] [in | out] to assign an access list to interface (location) and define
flow in/out (direction)
config# ip access-list extended xxx enters to access-list #xxx in extended mode
permit ip 10.10.10.0 0.0.0.255 host 10.0.0.2 permits Vlan 10 to 02 (default +10)
15 permit ip 10.10.10.0 0.0.0.255 host 10.0.0.2 permits Vlan 10 to 02 with seq #15 in list
15 permit ip host 10.10.10.7 host 10.10.60.20 permits only host to host in 2 Vlans
no 15 removes entry seq #15
access-list deny udp any host 10.0.0.0 0.0.255.255 deny ip udp packets from any node to subnet 10.0.0.0 /16
access-list 178 permit tcp 172.16.1.0. 0.0.0.255 172.16.3.0. 0.0.0.255 eq 21 permit TCP (all) packets from first subnet
to destined subnet (port 21)
access-list 2019 deny udp host 10.10.0.1 ne 68 10.0.0.0 0.0.0.255 range 21 23 deny udp ports which are not on port 68
from host 10.10.0.1 to other subnet on their port 21 to 23
access-list 106 deny tcp any host 10.1.1.1 eq telnet
no access-list 100 permit tcp any 172.16.0.0 0.0.255.255 ne www removes entry for permit all tcp packets from any
source to mentioned subnet excpet if it's http
legend of port comparative operators [ eq: = (equalt) lt: < (lower than) ne: != (not equal) gt: > (greater
than) range: x to y ]
for port and well-known command keyword refer to P. 620 and P. 636
# access-list 1 permit 1.1.1.1
access-list 1 permit 2.2.2.2
or for named standard access list:
# ip access-list standard name or ip access-list extended name
permit 1.1.1.1
permit 2.2.2.2
ip access-list extended farid creates extended ACL under name of farid and place to acl config mode of farid
ip access-lists extended xxx
ip access-lists resequence xxx 1 2 sets the increment of xxx access list to +2 and starting #1
permit any determine the implicit end of list default permit behavior of IOS if no ACL match found
deny any mention to make the default implicit deny register counter of denied packets
access-list# access-list remark xxx leave txt documentation that stays with that ACL
int# no ip access-group x disables the ACL assigned to interface. advised when making changes to ACL
line# access-class number | name [in | out] line subcommand to enable ACLs on vty lines
(IPv6)
ipv6 unicast-routing to globally enable IPv6 on IOS
ipv6 address address/prefix_length to set the IPv6 on the interface
ipv6 address address/prefix_length eui-64 tell router to find Interface ID accoring to EUI-64. No space /Prefix
ipv6 address dhcp tell the router to learn it's IPV6 using DHCP
ipv6 address autoconfig tell the router to learn it's IPV6 using SLAAC
ipv6 address address link-local to configure link-local address based on FE80::/10 rule
(if not set, interface will calculate link-local using EUI-64 even if unicast address doesn't use EUI-64)
ipv6 enable to just enable IPv6 capability on link to operate over link local without unicast IPv6
ip address 2001:1:1:2::99/128 anycast to set a secondary IP on the interface as anycast service on the router P. 722
show ipv6 interface brief show details of ipv6 with no prefix length info
show ipv6 interface [x] details of ipv6 per interfaces
show ipv6 route [connected | local] shows ipv6 addresses connected to router
ipv6 route 2001:db8:11111:2::/64 [2001:db8:1111:2::3 or s0/0/0] to set static route (R1 to R2) R2 needs a static route to
R1 also
next hop can be global unicast or link local address. if link local needs to have local router's outgoing interface as well!
ipv6 route 2001:db8:1111:2::/64 s0/0/0 FE80::FF:FE00:2 format of referring a next hop link local
show ipv6 route static shows all statically set routes
show ipv6 route 2001:db8:1111:2::22 show the preferred route to that particular address
ipv6 route 3444:4:4:4::/64 3444:2:2:2::2 130 to set floating administrative distance of 130 for a static route
ipv6 address autoconfig [default] tells router to use SLAAC to build it's IPv6 and sets the next-hop as default path ::/0
ipv6 route ::/0 S0/0/1 to set a default route. THIS IS A GLOBAL CONFIG COMMAND NOT AN INTERFACE
COMMAND!
(Log)
config# [no] logging console 1 step setting to view log messages for console users for all severities
config# [no] logging monitor (and) ...
+ # terminal [no] monitor two step setting to enable log on SSH and Telnet user and then receive them on that
session
config# logging buffered to save the log copies into RAM
# show logging to view saved logs and configured setting
config# logging {address | hostname} to set an external syslog server as saved log location
config# no service timestamps toggle off time stamp of logs
service sequence-numbers toggle on the sequence number
logging [console | monitor | buffered | trap] 4 trigger logs for level 0-4 messages to console, vty, RAM and
syslog server
or logging [...trap...] [warning |error | information | ....] may use the keyword of levels as well P.783
# clear logging to clear buffered logs
logging synchronous tell the device to show syslogs only after show commands
debug to let the IOS issue all levels of logs even upon log out. has many options, for troubleshooting
debug ip rip or ntp or all capture and view rip advertisements and activities [ *debug ?]
logging monitor debug to enable debug for vty users
show process cpu lists cpu usage
(Clock)
show clock shows time
config# clock timezone xxx +8 sets timezone to country xxx with +8 zonetime
clock summer-time yyy recurring set daylight saving in spring and fall
# clock set 13:15:00 27 Jan 2019 set time in 24h format
# ntp server [address | hostname] to set device the NTP client of that referred address
# ntp master x to tell device to act as a NTP server with stratum level of x
ntp source loopback [loopback_number] to assign a virtual interaface as ntp source on the device
show ntp associations showing conferencing of ntp server and clients
show ntp status lists details of ntp on device
config# interface loopback [integer_number] to set an internal loopback interface for ntp. prevent ntp master failure if
interface is failed
int# ip address 10.10.10.50 255.255.255.0 to give the loopback virtual interface an address
show interfaces loopback x details of loopback x
(Network Discovery)
show cdp neighbors [number] one line summary of neighbor devices DOES NOT SHOW IOS VERSION!
show cdp neighbors detail details of neighbors including IOS model
show cdp entry name filers details of neighbor based on their hostname including their IOS model
[no] cdp run globally enable or disable cdp on all interfaces
int# [no] cdp enable enable or disable cdp on particular interface
show cdp [interface x] shows cdp setting globally or on interface x
show cdp traffic shows global statistics for cdp transmissions
# aaa authentication login default authenticate console, vty and aux using AAA
# aaa authentication [login | line] default <method1> <method2> tries other methods of authentication if AAA is not
reachable
aaa authentication login default aaa-group-name [local | line] if AAA group was not available use line or local logins
SWITCH
(to configure VLAN 1's IP address on Switch so that it can communicate over network and with gateway)
config# interface vlan 1
no switchport [turns the SW L2 int into a L3 compatible interface like router]
ip address 192.168.1.5 255.255.255.0 or ip address dhcp
no shutdown
ip default gateway 192.168.1.1 no need if it's on dynamic IP dhcp
show dhcp lease to see the temporarily leased ip address and other parameters
show ip default-gateway to show the default gateway leased by DHCP
(VLAN Management)
(config)#vlan x [or vlan x,y,z]
name xxx set name of xxx for vlan x
show vlan showing vlans per interface
show vlan [brief |name x | id x | summary] show VLAN info associated with parameter
show vlan id x only shows VLAN x associated with interfaces and trunks carrying that VLAN
show interface gi1/0/11 switchport shows info of the port 1line-1line statuses
show interface gi1/0/11 shows more detail on that interface
show interface trunk show interfaces set as trunk
(config)#interface fa0/x
(no) switcport mode access/trunk/dynamic set interface access mode
(no) switchport access vlan x set (only) access ports to Vlans
interface range gi1/0/11 - 12
switchport trunk encapsulation [dot1q | isl | negotiate] to choose Trunking protocol
switchport nonegotiate a security step to disable DTP negotiations altogether on interface
[no] shutdown vlan x to securely shutdown ports on vlan x. it brings the vlan status as act/1shut
c# vtp mode [server | client | transparent] to set enable VLAN Trunking Protocol mode (updates every 5 min)
c# vtp mode off to disable VTP
# show vtp status to show status of current config on VTP (domain, mode, pruning, MD5)
c# vtp domain [domain-name] group vtp client and servers under the domain name
c# vtp password [password] set a security layer to authorize server/client switches (case-sensitive)
# show vtp password reveal VTP password if set
c# vtp pruning make the domain-wide VTP pruning choice. get rid of unused VLANs in switches
c# vtp version [1 | 2] usage of v.1 or v.2 VTP (compatible together)
# vtp primary select the primary VTP server
# debug sw-vlan vtp [events | packets | pruning | xmit] debug VTP factors
show interfaces switchport detail info per each and every interface stating TRUNK ports
show interfaces status per 1 line status on interfaces
show interfaces description line status and protocol status with description of interfaces
(STP)
# spanning-tree pathcost method long to change port costs to new criteria of cost values p.55
# spanning-tree mode pvst activate PerVLAN STP on switch
# spanning-tree mode rapid-pvst activate PerVLAN RapidSTP on switch
# spanning-tree mode mst activate Multiple Instances of STP on switch. not per vlan *not in CCNA
# spanning-tree vlan vlan-id root [primary | secondary] manipulate the BID to be main or backup, changes the priority
int # spanning-tree vlan vlan-id priority x define priority to BID to pvst. x to be only multiples of 4096 ranged 0-65535
int # spanning-tree [vlan vlan-id] cost y to define an interface STP cost per VLAN (p. 75), on Trunks
int # spanning-tree cost y to define an interface STP cost for all VLANs, on Trunks !!! check on show run
int # spanning-tree [vlan vlan-id] port-priority x change the port priority for the give VLAN only (x defaults to 128. range 0
255) lower better
int# spanning-tree portfast [disable] enable/disable portfast on access ports. no enable keyword for
enabling
int# spanning-tree [bpduguard | bpdufilter] enable | disable enables BPDU guard or filter on portfast
# [no] spanning-tree portfast default enable/disable portfast on all interfaces by default
# [no] spanning-tree portfast bpduguard default enable/disable PBDU guard on all interfaces by default. portfast keyword
needed
# show spanning-tree [interface x] [detail] shows [details] of STP per/all interface. includes portfast and bpdu guard and etc.
# show spanning-tree vlan 10 shows STP info on vlan 10. Root SW, Local SW, int status
# show spanning-tree [vlan_id] root shows root bridge per VLAN or all VLANs
# show spanning-tree vlan 10 bridge shows local bridge info but with separation of priority and VLAN part of BID
# show spanning-tree int fa0/1 portfast 1-line lists the portfast status of interface for all VLANs. if enabled and if UP
# show spanning-tree summary shows global STP configs. including if portfast and bpdu guard is enabled by default
# show spanning-tree vlan x int gi0/2 state identifies state of a certain int in a particular VLAN STP
# show int status err-disabled to show the port-fast ints which are in error disabled mode (eg. by BPDU guard
violence)
# debug spanning-tree events STP event debugging
ROUTER
show controllers s0/0 confirms the serial connection and clockrate speed
clockrate 128000 puts the serial port clock rate to 128Kbps value supplied by DCE side
bandwidth 1544 puts the bandwidth of interface to 1544kbps
line aux 0 reach aux line configuration mode
show ip route [connected | static | rip] lists routes in routing table
show ip route 192.168.2.0 lists best route with their administrative distance for that subnet
clear ip route * with a parameter of * will remove all RIP routes
show ip protocols info about RIP config, advertisin groutes, neighboring RIP routes, passive, etc.
show ip rip database lists prefix/length of local router's rip best routes
(#router rip) network x
passive-interface g0/1 make the LAN int passive. listens to RIP but doesn't advertise routes
passive-interface default
no passive interface s0/0/0 white list Serial 0/0/0 as an active
(#router rip) maximum-paths 4 set the router equal-cost load balancing feature to UP TO 4 concurrent routes
(#router rip) no auto-summary disable the auto summarization feature on router
show arp or show ip arp shows ARP table of containing IPs and their MAC addresses
clear ip arp [ip address] clears an ip address from arp table
(create default route to router that knows and advertises the default route 0.0.0.0 /0)
# ip route 0.0.0.0 0.0.0.0 192.168.0.1
router rip
default-information originate <<< on the router that points traffic to default route
show vlans showing vlans and their interfaces and native vlan
ip route (dest ip) (dest mask) (next hop ip) or (outgoing port) to create static route in a router
^ permanent to create permanent non-removable static routes ignores router check on route and remains on int
failure
^ 130 sets the administrative distance to value of 130
ip route (dest ip) 255.255.255.255 (next hop ip) or (outgoing port) to set host specific static route
ip route 0.0.0.0 0.0.0.0 (next hop ip) or (outgoing port) creates static route that matches all! packets
(int#) ip address dhcp int will learn the ip, subnet mask, dns and default gateway from dhcp
ip helper-address server-ip to define DHCP server on client routers
(NAT configuration)
intA# ip nat inside configure interface as inside nat
intB# ip nat outside configure another interface as outside nat
STATIC NAT:
# ip nat inside source static 10.1.1.2 200.1.1.2 assign client IP from nat interface inside
# ip nat outside source static 10.1.1.1 200.1.1.1 assign client IP from nat interface outside
DYNAMIC Pool:
# ip nat pool [name] [first_address] [last_address] netmask [subnet-mask] registering a pool of public IPs
# access-list x permit 10.1.1.2 0.0.0.2555
# access-list x permit 10.1.1.1 0.0.0.2555
# ip nat inside source list acl_number pool pool_name [overload] assigns the inside global IPs and an ACL
that allows inside local IPs
overload indicates PAT. with this parameter, port address translation will be activated if not it will be NAT only.
.......................... Similar config when ISP leased dynamic public IP (Inside Global)
intA# ip nat inside configure interface as inside nat
intB# ip nat outside configure another interface as outside nat
ip address dhcp >if the public IP is dynamically leased by ISP
>no need for Pool creation
# access-list x permit 10.1.1.2 0.0.0.2555
# access-list x permit 10.1.1.1 0.0.0.2555
# ip nat inside source list acl_number interface_number [overload] >if the public IP is dynamically leased by ISP
r# default-information originate always always advertise the default route no matter if it works or not
# debug ip ospf [hello | adj]
# router ospf 1
[no] shutdown disables ospf 1 but doesn't remove configs
(EIGRP)
# show ip eigrp topology [subnet/prefix] shows the successor and feasible successor routes
# show ip eigrp interfaces [detail] [S0/0] show ints that router has activated EIGRP which are not passive[more details on
timers and split horizon]
# show ip eigrp neighbors listing neighbors based on their interface IP address (not router ID)
# show route ip eigrp [subnet_mask]
# show ip eigrp toplogy | section 10.10.10.0
# show ip eigrp topology all-links shows ALL routes even though they are not successor or FS
# show ip eigrp topology x.x.x.x/xx shows the Successor and FS routes to that subnet in metric break down (NICE)
c# router eigrp <as-number> create EIGRP enter Router config mode
network x.x.x.x [0.0.255.255]
r# eigrp router-id x.x.x.x optionally choosing a router ID
int# ip hello-interval eigrp x <time> optionally set a different hello interval time
int# ip hold-time eigrp x <time> optionally change hold timer
int# bandwidth <value> optionally change the default bw (Kbps)
int# delay <value> optionally change the default delay (tens of microseconds)
r# maximum-paths <number> optionally change the maximum equal cost paths (defaults to 4)
r# variance <1-128> optionally change the sensitivity of variance to choose load balanced successor
r# [no] auto-summary optionally enable/disable automatic summarization
# debug eigrp fsm displays changes to EIGRP successor and FS routes (NICE)
# debug eigrp packets displays other packets including protocol authentication error logs
# router eigrp 1
[no] shutdown
(BGP)
# router bpp <local_asn> locally define the ASN to edge router
neighbor <remote_ip_address> remote-as <remote_asn> manually define a BGP neighbor
network x.x.x.x mask 255.255.0.0 inject a router to BGP to be compared, verified and then
advertised to neighbor
[no] neighbor <peer_ip_address> shutdown disable neighbor using interface address
r# bgp router-id set router ID of BGP
# show tcp brief shows the status of BGP neighbor
# show ip bpg summary show one per line details of BGP local and neighbors
# show ip bgp lists the BGP table p.316
# show ip router 192.0.2.0 255.255.255.0 longer-prefixes lists all routes in the range of 192.0.2.0 /24
# ip route 192.0.2.0 255.255.255.0 null0 adds a discard route to be only advertised to ISP over BGP not to specify
a real usable local route
(to configure VLAN 1's IP address on Switch so that it can communicate over network and with gateway)
# show ip protocols [to show which routing protocol is running with some statistics about that protocol]
# trace 192.168.1.1 [perform a trace route to that IP address]
# show ip rip database [to show any relieved ip routes which might not make it into table]
rip# default-information originate [will inject default static route and advertises to RIP neighbors usually 0.0.0.0 0.0.0.0 to
internet]
rip# timers basic 10 90 90 120 [to change the active, invalid, hold down and flush timer in RIP, do on all routers]
int# ip summary-address rip 10.1.0.0 255.255.0.0 [to manually ad a summarizable range after no autosummary]
ospf# area 0 range 10.1.0.0 255.255.0.0 [to manually summarize ranges of IPs to different OSPF areas to reduce table
load]
area 1 range 10.0.0.0 255.255.0.0
int# switchport trunk native vlan 199 [to set the trunks to a modified native vlan. needs to be done on all trunks]
int# no switchport [turns a L3 Switch interface into a L3 capable interface which then accepts IP]
(HDLC/PPP)
int# ip address <address> <mask> ip is optional for ppp
optional: int# encapsulation [hdlc | ppp] is the default encap if ppp is not overwritten
int# no shutdown if disabled before
int# clock rate <speed> if using DTE/DCE in lab. use this on router with DCE cable (female)
int# bandwidth <speed-in-kbps>
int# description <text>
# show controller serial 0/0 shows the status of DCE/DTE, clockrate etc. in HDLC link activated int
int# ppp authentication [pap chap] | [chap pap] to set both configs and then choose which first to try
*configs related to linking serial interfaces into multilink 1. should be done on both routers all serial links available
int# interface seraial 0/0
encapsulation ppp
ppp multilink enable multilink
no ip address serial interfaces should NOT have L3 address
ppp multilink group 1 join the int into the same group number as multilink
[pap or chap authentication goes here]
# show ppp multilink shows info about the available multilinks and affiliated L2 interfaces