Latest

Part 1: Cisco Switch commands reference guide

Part 1: Cisco Switch commands reference guide 

Today we will going to talk about the Cisco commands used on the router and the switch and how they are configured. 

Here we start with the part 1 where we will start with the some of the Cisco switch commands. We will come up with part 2 where we will discuss more commands for Cisco switch/router in details.

Part 1: Cisco Switch commands reference guide
Fig 1.1- Cisco Switched Network

Change Switch Hostname
Switch(config)#hostname NDNA_SW

Configuring passwords on Switch
NDNA_SW(config)#enable secret cisco123
NDNA_SW(config)#enable password cisco123

Securing console port
NDNA_SW(config)#line con 0 
NDNA_SW(config-line)#password cisco
NDNA_SW(config-line)#login

Securing terminal lines
NDNA_SW(config)#line vty 0 4 
NDNA_SW(config-line)#password cisco
NDNA_SW(config-line)#login

Encrypting passwords
NDNA_SW(config)#service password-encryption

Configuring banners
NDNA_SW(config)#banner motd $
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 
UNAUTHORIZED ACCESS IS PROHIBITED
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
$

Giving the switch an VLAN with IP address
NDNA_SW(config)#interface vlan 10
NDNA_SW(config-if)#ip address 192.168.1.120 255.255.255.0
NDNA_SW(config-if)#shutdown

Setting the default gateway
NDNA_SW(config)#ip default-gateway 192.168.1.1

Saving configuration
NDNA_SW# copy running-config startup-config Destination filename [startup-config]?
Building configuration…
[OK]

Name lookup, history, exec-timeout and logging behavior
NDNA_SW(config)#no ip domain-lookup
NDNA_SW(config)#line vty 0 4
NDNA_SW(config-line)#history size 15
NDNA_SW(config-line)# exec-timeout 10 30
NDNA_SW(config-line)#logging synchronous

Configuring switch to use SSH
NDNA_SW(config)#ip domain-name example.com (DNS Name)
NDNA_SW(config)#username admin password cisco (Username and Password)
NDNA_SW(config)#crypto key generate rsa (Generate encryption keys)
NDNA_SW(config)#ip ssh version 2 (SSH version)

Enable vty lines to use SSH
NDNA_SW(config)#line vty 0 4 
NDNA_SW(config-line)#login local
NDNA_SW(config-line)#transport input telnet ssh
NDNA_SW(config)#alias exec c configure terminal 
NDNA_SW(config)#alias exec s show ip interface brief
NDNA_SW(config)#alias exec sr show running-config

Description, speed and duplex
NDNA_SW(config)#interface fastEthernet 0/1
NDNA_SW(config-if)#description LINK TO INTERNET ROUTER 
NDNA_SW(config-if)#speed 100 (options: 10, 100, auto) 
NDNA_SW(config)#interface range fastEthernet 0/5 – 10
NDNA_SW(config-if-range)#duplex full (options: half, full, auto)

Verify Basic Configuration

Shows information about the switch and its interfaces, RAM, NVRAM, flash, IOS, etc.
NDNA_SW# show version

Shows the current configuration file stored in DRAM.
NDNA_SW# show running-config

Shows the configuration file stored in NVRAM which is used at first boot process.
NDNA_SW# show startup-config

Lists the commands currently held in the history buffer.
NDNA_SW# show history

Shows an overview of all interfaces, their physical status, protocol status and ip address if assigned.
NDNA_SW# show ip interface brief

Shows detailed information about the specified interface, its status, protocol, duplex, speed, encapsulation, last 5 min traffic.
NDNA_SW# show interface vlan 10

Shows the description of all interfaces
NDNA_SW# show interfaces description

Shows the status of all interfaces like connected or not, speed, duplex, trunk or access vlan.
NDNA_SW# show interfaces status

Shows the public encryption key used for SSH.
NDNA_SW# show crypto key NDNA rsa

Shows information about the leased IP address (when an interface is configured to get IP address via a dhcp server)
NDNA_SW# show dhcp lease