CCNA R&S - Cisco Commands List. Portable Command Guide
CCNA R&S - Cisco Commands List. Portable Command Guide
This guide has included all the CCNA commands that an exam candidate may need to solve CCNA
simulation lab, and to solve switching and routing problems in real networks.
Router Modes:
Router>: User mode = Limited to basic monitoring commands
Router#: Privileged mode (exec-level mode) = Provides access to all other router commands
Router(config)#: global configuration mode = Commands that affect the entire system
Router(config-if)#: interface mode = Commands that affect interfaces
Router(config-subif)#: subinterface mode = Commands that affect subinterfaces
Router(config-line)#: line mode = Commands that affect in lines modes (console, vty, aux…)
Router(config-router)#: router configuration mode
Changing switch hostname
Switch(config)#hostname SW1
Configuring passwords
SW1(config)#line con 0
SW1(config-line)#password cisco
SW1(config-line)#login
SW1(config)#line vty 0 4
SW1(config-line)#password cisco
SW1(config-line)#login
Encrypting passwords
SW1(config)#service password-encryption
Configuring banners
SW1(config)#banner motd $
=================================
UNAUTHORIZED ACCESS IS PROHIBITED
=================================
$
Giving the switch an IP address
SW1(config)#interface vlan 1
SW1(config-if)#ip address 172.16.1.1 255.255.255.0 (or dhcp)
SW1(config-if)#no shutdown
Saving configuration
SW1#wr
Building configuration…
[OK] Short for write memory.
Working environment
(name lookup, history, exec-timeout and logging behavior)
SW1(config)#no ip domain-lookup
SW1(config)#line vty 0 4
SW1(config-line)#history size 15
SW1(config-line)# exec-timeout 10 30
SW1(config-line)#logging synchronous Also valid for line con 0
Enable vty lines to use SSH: The size of the key modulus in
SW1(config)#line vty 0 4 the range of 360 to 2048.
SW1(config-line)#login local You can set vty lines to use
SW1(config-line)#transport input telnet ssh only telnet or only ssh or both
as in the example.
Aliases
Configuring VLANs
Configuring Trunks
Configuring VTP
STP optimization
Hard coding the root bridge (changing bridge priority): Priority must be a multiply of
SW1(config)#spanning-tree vlan 1 root primary 4096
SW1(config)#spanning-tree vlan 1 root secondary Portfast and BPDU guard are
SW1(config)#spanning-tree [vlan 1] priority 8192 enabled only on interfaces
connected to end user hosts
Changing the STP mode:
SW1(config)#spanning-tree mode rapid-pvst (options: mst, pvst, rapid-
pvst)
Provides informational
messages about the changes in
SW1#debug spanning-tree events the STP topology
Router(config)#hostname R1
Rl(config)#enable secret cisco
Rl(config)#line con 0
Rl(config-line)#password cisco
Rl(config-line)#login
Rl(config-line)»logging synchronous
Rl(config-line)#exec-timeout 30 0
Rl(config-line)#exit
Rl(config)#line vty 0 4
Rl(config-line)#password cisco
Rl(config-line)#login
Rl(config-line)»logging synchronous
Rl(config-line)#exec-timeout 30 0
Rl(config-line)#exit
Rl(config)#line aux 0
Rl(config-line)#password cisco
Rl(config-line)#login
Rl(config-line)Slogging synchronous
Rl(config-line)#exec-timeout 30 0
Rl(config-line)#exit
Rl(config)#banner motd $
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
UNAUTHORIZED ACCESS IS PROHIBITED This section includes IOS
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- commands that are absolutely
$ identical on both routers and
Rl(config)#alias exec c configure terminal switches, except the part of line
Rl(config)#alias exec s show ip interface brief aux 0 which is configured only
Rl(config)#alias exec sr show running-config on router because switches do
Rl(config)#no ip domain-lookup not have an auxiliary port.
Rl(config)#service password-encryption
Rl(config)#ip domain-name example.com
Rl(config)#username admin password cisco
Rl(config)#crypto key generate rsa
How many bits in the modulus [512]: 1024
Rl(config)#ip ssh version 2
Rl(config)#line vty 0 4
Rl(config-line)#login local
Rl(config-line)#transport input telnet ssh
Rl(config-if)#exit
Static routes
Default Route
RIPv2 Configuration
Rl(config)#router rip
Rl(config-router)#version 2
Rl(config-router)#network 10.0.0.0 (written as an original class A)
Rl(config-router)#no autosummary
RIPv2 Verification
OSPF Configuration
OSPF verification
EIGRP Configuration
EIGRP Authentication
EIGRP Verification
Standard ACL
Plane the location (router and interface) and direction (in or out) on
that interface:
– Standard ACL should be placed as close as possible to the destination
of the packet.
– Identify the source IP addresses of packets as they go in the direction
that the ACL is examining.
Extended ACL
Note:
– Extended ACL should be placed as close as possible to the source of the
packet.
– Extended ACL matches packets based on source & des. IP addresses,
protocol, source & des. Port numbers and other criteria as well.
Rl(config)#access-list 101 remark MY_ACCESS_LIST
Rl(config)#access-list 101 deny ip host 10.1.1.1 host 10.2.2.2
Rl(config)#access-list 101 deny tcp 10.1.1.0 0.0.0.255 any eq 23
Rl(config)#access-list 101 deny icmp 10.1.1.1 0.0.0.0 any
Rl(config)#access-list 101 deny tcp host 10.1.1.0 host 10.0.0.1 eq 80
Rl(config)#access-list 101 deny udp host 10.1.1.7 eq 53 any
Rl(config)#access-list 101 permit ip any any
Rl(config)#interface fastEthernet 0/0 Extended ACL number ranges:
Rl(config-if)#ip access-group 101 in 100 – 199 and 2000 – 2699.
Named ACL
Note:
– Named ACLs use names to identify ACLs rather than numbers, and
commands that permit or deny traffic are written in a sub mode called
named ACL mode (nacl).
– Named ACL enables the editing of the ACL (deleting or inserting
statements) by sequencing statements of the ACL.
Verifying ACLs
DHCP Server
Define network and mask to use in this pool and the default gateway:
R1(dhcp-config)»network 192.168.1.0 255.255.255.0 R1(dhcp-
config)»default-router 192.168.1.1
Define one or more DNS server (OPTIONAL):
R1(dhcp-config)»dns-server 213.131.65.20 8.8.8.8
Confine the lease time (OPTIONAL):
Rl(dhcp-config)lease 2 (days)
Define one or more scopes of excluded (reserved) addresses
(OPTIONAL):
Rl(config)#ip dhcp excluded-address 192.168.1.1 192.168.1.100
Rl(config)#ip dhcp excluded-address 192.168.1.200 192.168.1.254
PPP Configuration
PPP Authentication
CHAP
PAP
Frame Relay
Static NAT
The same as dynamic NAT with the use of the overload keyword at
the end of NAT statement:
Rl(config)#ip nat inside source list 3 pool PUB overload