Cisco Router/Switch Commands

Copyright Paul W. Nieto

All Rights Reserved

Command

Use and Prompt/Command Mode

Enable

Enter privileged mode from user mode

Prompt : Router>

en  (short for enable)

Enter privileged mode form user mode

Prompt : Router>

configure terminal

Enter privileged mode form user mode

Prompt : Router#

config t

Short for Configure terminal

clock set

clock set 21:22:00 28 April 2004

Prompt: Router#

sh history

Shows last commands entered, 10 by default

Prompt: Router#   Prompt: Router>

terminal history size

Change size of history buffer

Terminal history size 0-256

terminal no editing

Turns off advanced editing commands

See editing commands section

Prompt: Router#

terminal editing

Turn on advanced editing

Prompt: Router#

hostname (hostname nameofhost)

Used to name the host

Prompt : Router(config)#

sh clock

See router time & date

enable secret

Used to access global mode. This password is encrypted

Prompt : Router(config)#

no enable secret

Removes secret password

enable password

Prompt : Router(config)#

line

Take you to configuration mode to set user mode passwords      

Prompt : Router(config)#

aux

Short for auxiliary

s

Short for serial

con

Short for console

line aux  (line aux 0 4)

Takes you to auxiliary interface configuration mode

Prompt : Router(config)#

line console (line console 0)

Takes you to the console interface configuration mode

Prompt : Router(config)#

line vty (line vty 0 4)

Takes you to the Telnet configuration mode

Prompt : Router(config)#

login

Used before setting the line password after the line command

prompt : Router(config-line)#

password  (password name of password)

Used to set the password for the line vty, console 0

Prompt : Router(config-line)#

no login

Used to have no login password on the vty

Prompt : Router(config-line)

service password-encryption

Used to set all routers passwords in encryption

Prompt : Router(config)#

banner

Used to create a banner

Prompt : Router(config)#

banner motd

Used to create a Message of the Day Banner

Prompt : Router(config)#

ctrl z

Leave the global configuration mode/back to privileged mode

exit

1. Return to privileged mode form global config

also

1. Used to leave the terminal session – logs out of router.

Disable

Leaves Privileged mode, goes to User mode

exec-timeout  (exec-timeout  5 30)

Configures Timeout for idle exec sessions in this example it is 5 minutes and 30 seconds

Prompt : Router(config-line)#

logging synchronous

Log messages will not disrupt the command. They will be displayed on another line

Prompt : Router(config-line)#

int serial  (int serial 0)

Used to configure the serial interface

Prompt : Router(config)#

shutdown

Used to shut down the serial interface, after using the int serial command. Interface is shut down by default

Prompt : Router(config-if)#

no shutdown

Enables the serial interface

Prompt : Router(config-if)#

int Ethernet

To configure the ether net interface

ip address (ip address 1.1.14.1 255.255.0.0)

 

Used to enter the IP address of an interface

Prompt: Router(Config-if)#

Also used on switches for administrative purposes

ip netmask-format

Changes netmask to bit count, decimal or hexadecimal.

ip default gateway

Ip default gateway is set on switch or router

Prompt: DeviceName(config)#

 

 

show controllers serial 0

Used to view idb, buffer sized and what type of cable (DCE or DTE) is being use

Prompt: Router#

clock rate (clock rate 6400)

Sets the serial clock rte in bps

Prompt: Router (config-if) #

bandwidth (bandwidth 64)

Sets the serial bandwidth in KPS

Prompt: Router (config-if) #

media-type (media-type 10baset)

Used to configure an Ethernet media type on routers that do not autosence, such as the Cisco 4000 series

Prompt: Router (config-if) #

router rip

network xxx.xxx.xxx

Used to select RIP as the routing protocol

Network Address MUST follow

Prompt: Router (config)#

router igrp 10

network xxx.xxx.xxx

Used to config routing with igrp. Note the a number must follow, Network command MUST follow

Prompt: Router (config)#

show (followed by more information)

Used to show an interface version, running config, etc

no router rip

Removes RIP as routing protocol. Does not need network number after command.

sh

Short for show

show interface (show interface s 0)

Used to view and verify the configuration of an interface

show running-config

Used to view the entire configuration of a router RAM

Prompt: Router #

sh run

Short for show running-config

Prompt: Router#

sh running

short for show running-config

Prompt: Router#

sh start

Show start up configurations of router NVRAM

Prompt: Router#

sh startup-config

Show start up configurations of router NVRAM

Prompt: Router#

sh spantree

Shows spantree settings

show version

to view, type of processor, router uptime, IOS image file, where IOS image file was loaded from, physical interfaces, configuration register value, reason for restart – power on, reload or error.

prompt: router #

sh ver

short for show version

copy running-config startup-config

copies the current running configuration into the NVRAM where it is than called the startup-config

prompt router#

copy run start

short for copy running-config startup-config

copy startup-config running-config

copies the current startup-config  from the NVRAM , making it the current running configuration.

prompt router#

copy start run

short for copy startup-config running-config

Copy startup-config tftp

Copies start up  configuration to a tftp server

Copy tftp running config

Retrieves the stored configuration file and restores it to the running-config file of the router .

Copy flash TFTP

Backup up the Cisco IOS image to a TFTP server

Router #

Copy TFTP flash

To restore or upgrade the Cisco IOS from TFTP server to the router

Router #

cdp

when found in a command line this is a reference to Cisco discovery protocol

no ip domain-lookup

To stop domain look up (specially for incorrectly typed commands)

cdp run

to enable cdp on a router where it has been disabled. (cdp is enabled by default)

prompt: router #

no cdp run

to disable cdp on ALL interfaces. this is done for security and to eliminate unnecessary protocols an messages

prompt: router #

cdp enable

this is used to enable cdp on a specific interface

you must be in configuration mode

no cdp enable

this is used to disable cdp on a specific interface

you must be in configuration mode

show cdp

shows packet timer information

shows neighbor router hostnames and IP address   ***

prompt: router #

show cdp entry

gives information for a specific neighbor

prompt: router

sh cdp entry *

Show for all routers

show cdp interface

shows interface status and configuration details

prompt: router

show cdp neighbors

shows cdp neighbor entries such as device id, local interface, holdtime, capability, platform and port id.

prompt: router #

show cdp nei

short for show cdp neighbors

show cdp traffic

shows cdp statistics on each interface

prompt: router

cdp timer

used to set the cdp timer on a router, in seconds.

prompt : router(config)#

 

 

cdp holdtime

used to set the cdp hold time on a router, in seconds.

prompt : router(config)#

show cdp neighbors detail

similar, but more detailed output as the show cdp neighbors command. displays: id, network protocol, net work address, interface , duplex mode, capabilities, platform, version, holdtime, native VLAN, VTP management domain

prompt: router #

show cdp entry (followed by device id)

gives same output as show cdp neighbors detail command, but is intended for a specific device.

Show access-lists

Monitor access list statements

ctrl  + shift + 6 (Telnet)

toggles between multiple telnet sessions

ctrl + b  (Telnet)

ends a telnet sessions

logout (Telnet)

ends a telnet sessions

exit (Telnet)

ends a telnet sessions

clear line x (Telnet)

ends a telnet sessions

disconnect (Telnet)

ends a telnet session

show sessions

shows sessions on a router

prompt : router #

sh sessions

short for show sessions

show users

shows users and IP address of users

show users no alias

show IP of users connected instead of alias IP address

prompt : router #

sh users

short for show users

clear line (clear line 15)

disconnects whoever is connected to the router

send (send 11 | * )

sends a message to the user connected on the given line and all other lines

ping

Packet Internet Groper – Works with

config-register

Resets the configuration register (0x2102 is default)

Router (config) #

Confreg

To set the router Configuration register form the ROM Monitor Mode

configure memory

Loads configuration information form NVRAM into FLASH RAM

Boot system flash

Boots up a Cisco Router using the first file in the FLASH

Boot System Rom

Boots the Cisco Router using the file name specified in FLASH

Boot System flash filename

Boots the Cisco Router using the specified file in flash

ip route

to set up static routes on a Cisco router

no ip route

Removes static IP routes.

no ip route <ip nework><subnet><ip address from>

Prompt: Router (config)#

ip route 0.0.0.0 0.0.00 172.16.40.1

ip classless

Create a default route to get to all networks from 172.16.40.1

IP classless – tells router not to drop packets to unknown networks, rather forward them to default route

ip classless

tells router not to drop packets to unknown networks, rather forward them to default route

ip route 0.0.0.0 0.0.00 172.16.40.1

ip classless

Deletes a default route to get to all networks from 172.16.40.1

No ipclassless – tells router to drop packets to unknown networks, rather forward them to default route

no ip classless

Router drops packets to unknown networks

Delete vtp

Resets the config revision number to ensure that you do not overwrite the current VLANS on other switches.

NOTE: Highest config revision number takes precedence in a conflict

show ip interface

1. To determine whether or not there are any access lists set on an interface.

2. Displays IPX status and parameters.

3.  Helps identify the problems with ICP interface, for example IPX traffic being lost through a router interface.

Show ipx servers

Allows user to see SAP protocol and SAP tables.

Lists servers Listed through SAP advertisements

sh ip route

Used to show routing table on a router

Prompt : Router#

show frame-relay pvc

 

used on a router to display congestion counters for PVCs

sh ip protocol

Show ip routing  protocol on router, network, distance, and gateway…

Show number of hops allowed by routing protocol

isdn switch-type

 

first command that should be used when setting up ISDN D channel communication

ipx network 1a encapsulation sap

 

command to configure an interface to encapsulate IPX packets in the default frame type of NetWare 3.12

access-list access- list-number {permit|deny}{test conditions}

permit traffic based on addressing or protocol type

Prompt: Router (config)#

 

 

 

 

vlan <vlan #> Name <vlan name>

To create a VLAN

Prompt: switch(config)#

vlan-membership static 10

To assign a static port to a VLAN 10

Prompt: (config-if)#

trunk on

Port will trunk and let other side know it must trunk

Prompt: (config-if)       

trunk off

Port will never trunk and will use DISL to let other side know it cannot trunk.

Prompt: (config-if)

trunk desirable

Cases the port to want to trunk as opposed to doing whatever the other side wants. Prompt: (config-if)

trunk auto

Port will do what ever the other side wants

Prompt: (config-if)

trunk nonegotiate

Absolutely will not trunk and will not use DISL to tell the other side that is currently trunking.

sh spantree

Shows spantree settings

 

 

 

 

Vtp

VLAN Trunking Protocol

vtp serverName

Configure switch as a vtp server

Prompt: switch (config)#

vtp server prune enable

Enables vtp pruning

Prompt: switch(config)#

vtp domain

To name the vtp switch domain

Prompt: switch(config)#

vtp password

Enable password on VTP – case sensitive and ALL switches must share same exact password

Prompt: switch(config)#

show interface serial 0

To see if frame connection is active

sh int serial 0

Same as: show interface serial 0

interface serial0

Enter configuration mode for frame packet encapsulation

Int s0

Same as: interface serial0

sh int

Allows you to check the Network Control Protocol (NCP) and the LCP (Link Control Protocol) for PPP

status inquiry

Gives LMI message to tell whether PVC is up or down

 

 

 

Edit Commands

Ctrl + A

To beginning of line

Ctrl + E

To end of line

Ctrl + F

Forward one character

Ctrl + B

Back one character

Ctrl + P

Show last command

Up arrow

Show last command

Ctrl + P

Aborts configuration mode / also repeats previous command on CLI

 

 

 

Ping -  Packet Internet Groper  - works with following protocols, WORD, Apollo, AppleTalk, cins, decent, clns, ip, ipx, vines, xns

 

Trace- ( like tracert) works with WORD, AppleTalk, clns, IP, oldvines, vines

 

 

 

 

 

 

Router Configuration Register Values *

Bits

Function

0-3

Boot field. Used when router is started.

4, 5

Not defined.

6

Determines if NVRAM is loaded at start.  (0) load NVRAM   (1) ignore NVRAM 

7

Original Equipment Manufacturer (OEM). Shows if a router was produced by an original manufacturer or is a Cisco product.

8

Console break Key Control. Console break Key used to switch between router modes.

9

Not defined.

10

Controls host part of Internet broadcast address. Enables a network administrator to  change the host address

11-12

Speed at which data transmission take place form the console – default 9600.

13

Used if router start up sequence fails. This bit allows router to start through ROM.

14

Controls network and subnet parts of a broadcast address.

15

Used to activate diagnostic messages.

Basic configuration values and meanings

0x2102

Default for 2500 series – boot IOS form flash

0x0102

No boot system commands in the saved config

0x2100

Boot to Rom Monitor Mode

0x2101

Boot to subset IOS or ROM

0x2102-f

Boot according to boot commands in saved configuration

*Register values are in Hexadecimal form. Default value is 0x2102.

 

 

 

Router Password Recovery

 

1 Start router

2. Press break command during boot

3. Wait for ROM monitor prompt

4. Reset bit 6 by changing it form 0 to 1. This is done by changing the default 0x2102 to 0x2142

5. Reload router

6. Enter privileged mode by typing reset

7. Type enable

8. Copy the startup-config file to the running config-file – startup-config running-config

9. Set the new password – enable secret NameOfPassword

10. Reset the configuration register back to original value type config t , than type config-register 0x2102

 

 

 

 

A few common Router responses:

Response

Commend Entered

Meaning

&

Ping

Packet TTL exceeded

I

Ping

Ping interrupted

!

Ping

Successful receipt of echo reply

EX

Show  host

Entry has aged out or expired

U

Trace

Port was unreachable

 

 

 

 

Router IOS command Modes

Mode

Access Method

Prompt

User Exec

Press ENTER