Basic Operations #
Navigation and User Interface #
Navigate Between IOS Modes #
- Move between User EXEC mode and Privileged EXEC mode
Switch> enable Switch# disable Switch>
- Move between Privileged EXEC mode and Global Configuration mode
Switch# configure terminal Switch(config)# exit Switch#
- Move from any sub-configuration mode to Privileged EXEC mode
Switch(config-line)# end Switch# % or Switch(config-line)# <Ctrl+Z> Switch#
- Use the
do
command to run User EXEC mode commands whlie in EXEC modeSwitch(config)# do show running-config
Commands Shortening #
Commands and keywords can be shortened to the minimum number of characters that identify a unique selection.
Switch# conf t
Switch(config)#
Switch# con t
% Ambiguous command: “con t”
Keyboard Shortcuts #
Shortcut | Description |
---|---|
? | List available commands. |
Tab | Autocomplete & check if the current command is viable. |
Ctrl + Z | Return to Privileged EXEC Mode. |
Ctrl + Shift + 6 | Cancel Cisco IOS process. |
Up Arrow / Down Arrow | Scroll through previously entered commands. |
Device Configuration #
Configure Hostname #
Switch# configure terminal
Switch(config)# hostname <hostname>
<hostname>(config)#
Configure Password #
-
Console Access password
Switch(config)# line console 0 Switch(config-line)# password <password> Switch(config-line)# login Switch(config-line)# exit Switch(config)#
-
Privileged EXEC Access password
Switch(config)# enable password <password>
Configure Users and their Secrets #
-
Console Access secret
Switch(config)# username <user> secret <password> Switch(config)# line console 0 Switch(config-line)# login local Switch(config-line)# exit Switch(config)#
-
Privileged EXEC Access secret
Switch(config)# enable secret <password>
Configure a Range of Interfaces #
Switch(config)# interface range GigabitEthernet0/<start>-<end>
Delete Specific Configuration #
Switch(config)# interface <interface>
Switch(config-if)# no <configuration_command>
Banner Message Configuration #
The delimiter can be any character, being used to mark the start and end of message.
Switch(config)# banner motd !
<message>
!
Switch(config)#
SSH Configuration #
-
Configure hostname and domain name
Switch(config)# hostname <hostname> Switch(config)# ip domain-name <domain_name>
-
Configure RSA key pair
Switch(config)# crypto key generate rsa ! Choose modulus length = 1024
-
Choose SSH version
Switch(config)# ip ssh version 2
-
Allow users to login by SSH
Switch(config)# line vty 0 15 Switch(config-line)# transport input ssh Switch(config-line)# login local
Save the Configuration File #
To save the running configuration to the startup configuration, use one of the following commands.
Switch# copy running-config startup-config
% or
Switch# write memory
Verify and Monitor Cisco Device #
Switch# show running-config
Switch# show startup-config
Switch# show interfaces
Switch# show arp
Switch# show version
Network Discovery #
Cisco Discovery Protocol #
-
Show all CDP neighbors
Switch# show cdp neighbors
-
Show details of one neighbor
Switch# show cdp entry <device_id>
-
Disable CDP globally
Switch(config)# no cdp run
-
Disable CDP for an interface
Switch(config)# interface <interface> Switch(config-if)# no cdp enable
Link Layer Discovery Protocol #
-
Enable LLDP globally
Switch(config)# lldp run
-
Enable LLDP for an interface
Switch(config)# interface <interface> Switch(config-if)# lldp receive Switch(config-if)# lldp transmit
-
Show all LLDP neighbors
Switch# show lldp neighbors
Device Management and Security #
Shut Down Unused Ports #
-
Identify unused ports
Switch# show interfaces status
-
Shut down unused ports
Switch(config)# interface <interface> Switch(config-if)# shutdown
Force Other Users to Logout #
-
Check current connections
Switch# show users
Line User Host(s) Idle Location * 0 con 0 idle 00:00:00 2 vty 0 user2 idle 00:00:45 3 vty 1 user3 idle 00:00:23
-
Disconnect a user session by clearing a VTY line
Switch# clear line vty <line_num>
Password Recovery #
-
Initialize the flash file system
The system has been interrupted ...
switch: flash_init
-
Display the contents of the flash memory
switch: dir flash:
Directory of flash:/ 13 drwx 192 Mar 01 1993 22:30:48 c2960-lanbase-mz.122-25.FX 11 -rwx 5825 Mar 01 1993 22:31:59 config.text 18 -rwx 720 Mar 01 1993 02:21:30 vlan.dat
-
Rename
config.text
switch: rename flash:config.text flash:config.bak
-
Boot the system
switch: boot
-
Skip the initial configuration dialog
In order to access the device manager, ... [...] Would you like to enter the initial configuration dialog?
[yes/no]: no
-
Restore the configuration file and running-config
Switch> enable Switch# copy running-config startup-config Switch# copy flash:config.bak flash:config.text Switch# copy startup-config running-config
-
Update the console password
Switch(config)# line console 0 Switch(config-line)# password passwd Switch(config-line)# login
-
Save the configuration to startup-config
Switch# copy running-config startup-config
Reset the Switch #
-
Initialize the flash file system
The system has been interrupted ...
switch: flash_init
-
Display the contents of the flash memory
switch: dir flash:
Directory of flash:/ 13 drwx 192 Mar 01 1993 22:30:48 c2960-lanbase-mz.122-25.FX 11 -rwx 5825 Mar 01 1993 22:31:59 config.text 18 -rwx 720 Mar 01 1993 02:21:30 vlan.dat
-
Delete
config.text
andvlan.dat
switch: delete flash:config.text switch: delete flash:vlan.dat
-
Boot the system
switch: boot
-
Skip the initial configuration dialog
In order to access the device manager, ... [...] Would you like to enter the initial configuration dialog?
[yes/no]: no