CCNA Commands
CCNA Commands
In this series of 4-5 posts, well try to create a simple Cisco Commands Cheat Sheet as a reference
for CCNA students.
Router Modes:
Configuring passwords:
SW1(config)# enable secret cisco ! MD5 hash
SW1(config)# enable password notcisco ! Clear text
Encrypting passwords:
SW1(config)# service password-encryption
Configuring banners:
SW1(config)# banner motd $
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
UNAUTHORIZED ACCESS IS PROHIBITED
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
$
Saving configuration:
SW1# copy running-config startup-config
Destination filename [startup-config]? ! Press enter to confirm file name.
Building configuration
[OK]
Working environment:
name lookup, history, exec-timeout and logging behavior, also valid for line con 0.
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
Aliases:
Used to create shortcuts for long commands.
Shows information about the switch and its interfaces, RAM, NVRAM, flash, IOS, etc.
Enjoy !
The sticky keyword is used to let the interface dynamically learns and configures the MAC
addresses of the currently connected hosts.
Configuring VLANs:
SW1(config)# vlan 10
SW1(config-vlan)# name SALES
Assign an access interface to access a specific VLAN:
Configuring Trunks:
SW1(config)# interface fastEthernet 0/1
SW1(config-if)# switchport mode trunk ! options: access, trunk, dynamic auto,
dynamic desirable
SW1(config-if)# switchport trunk allowed vlan add 10 ! options: add, remove,
all, except
SW1(config-if)# shutdown
Prevent trunking by disabling auto negotiation on the interface:
Configuring VTP:
The transparent VTP mode is used when an engineer wants to deactivate VTP on a particular switch
Portfast and BPDU guard are enabled only on interfaces connected to end user hosts
Enjoy !
This section includes IOS commands that are absolutely identical on both routers and switches,
except the part of line aux 0 which is configured only on router because switches do not have an
auxiliary port.
Router(config)# hostname R1
R1(config)# enable secret cisco
R1(config)# line con 0
R1(config-line)# password cisco
R1(config-line)# login
R1(config-line)# logging synchronous
R1(config-line)# exec-timeout 30 0
R1(config-line)# exit
R1(config)# line vty 0 4
R1(config-line)# password cisco
R1(config-line)# login
R1(config-line)# logging synchronous
R1(config-line)# exec-timeout 30 0
R1(config-line)# exit
R1(config)# line aux 0
R1(config-line)# password cisco
R1(config-line)# login
R1(config-line)# logging synchronous
R1(config-line)# exec-timeout 30 0
R1(config-line)# exit
R1(config)# banner motd $
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
UNAUTHORIZED ACCESS IS PROHIBITED
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
$
R1(config)# alias exec c configure terminal
R1(config)# alias exec s show ip interface brief
R1(config)# alias exec sr show running-config
R1(config)# no ip domain-lookup
R1(config)# service password-encryption
R1(config)# ip domain-name example.com
R1(config)# username admin password cisco
R1(config)# crypto key generate rsa
How many bits in the modulus [512]: 1024
R1(config)# ip ssh version 2
R1(config)# line vty 0 4
R1(config-line)# login local
R1(config-line)# transport input telnet ssh
Clock rate is set only on the DCE side, typically the ISP side. On your router which is DTE you
dont need to set clocking.
Static route:
Default Route:
R1(config)# ip route 0.0.0.0 0.0.0.0 199.1.1.1
RIPv2 Configuration:
R1(config)# router rip
R1(config-router)# version 2
R1(config-router)# network 10.0.0.0 ! written as an original class A
R1(config-router)# no auto-summary
R1(config-router)# passive-interface serial 0/0
RIPv2 Verification:
OSPF Configuration:
Changing the reference bandwidth that used by OSPF to calculate the cost:
R1(config-router)# auto-cost reference-bandwidth 1000 ! in Mbps
Disabling OSPF on a certain interface (Optional):
OSPF verification:
EIGRP Configuration:
R1(config-router)# no auto-summary
Disable EIGRP on a specific interface (Optional):
R1(config-router)# maximum-paths 6
R1(config-router)# variance 4
Change interface Hello and Hold timers (Optional):
EIGRP Authentication:
The key-string value and the mode must be the same on both routers. Lifetime options of the keys
requires the clock of the routers to be set correctly, better use NTP, or it can cause problems
R1(config-keychain)# key 1
R1(config-keychain-key)# key-string1stKEY
EIGRP Verification:
Enjoy !
Named ACL:
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:
Shows all ACLs configured on a router with counters at the end of each statement:
DHCP Server
R1(dhcp-config)lease 2 ! Days
Define one or more scopes of excluded (reserved) addresses (OPTIONAL):
Shows the status of the specified pool and the leased addresses from that pool:
Enjoy !
PPP Configuration:
R1(config)# interface serial 0/0
R1(config-if)# encapsulation ppp
PPP Authentication:
CHAP:
Configure the hostname:
! The password used is shared password, that means it must be the same on both
routers
ALPHA(config)# username BETA password XYZ
Enable CHAP authentication on the interface:
PAP:
Configure the hostname:
Frame Relay:
Static NAT:
Define the outside and inside interfaces:
Useful in viewing the configuration of NAT pool and the inside and outside interfaces:
Enjoy !