Cisco IOS Command List: Router/Switch configuration commands

Router/Switch Configuration Commands List


CommandsDescriptionLabs/Examples:
On Switch:
Switch# delete flash:vlan.dat
Switch# erase startup-config
Switch# reload

On Router:
Router# erase startup-config
Router# reload
Delete/erase the startup configuration for the Router/Switch.
Switch/Router# show clock
Display the current clock settingsclock command current time day display the clock display the clock setting hours hours, minutes, and seconds since the device started minutes month system clock time and date timestamp UTC year
Switch/Router# clock set 15:08:00 Oct 26 2022
Configure the clock24-hour format Set the clock on the router clock setting current time day of the month hh:mm:ss hours, minutes, seconds month of the year set the clock using the clock set command set the date set the time system clock time and date timestamp UTC year
C:\Users\Windows10> ipconfig /all
Verify PC settings and connectivity
PC:Windows> ping 192.168.1.5

//Ping IPv6:
PC:Windows> ping -n 1 2001:db8:acad:1::b
Test the connectivity to PC with IP address 192.168.1.5.

This command, ping -n 1 2001:db8:acad:1::b, sends a single ICMP echo request to the IPv6 address 2001:db8:acad:1::b to test network connectivity. It's a quick network connection test to a specific IPv6 address.
Verify network connectivity Verify connectivity between all devices test connectivity Test End-to-End Connectivity Ping ipv6
Switch/Router(config)# hostname Brand
Assign or change a device name to BrandAssign a device name to each switch router Configure hostname Assign the device name to the router hostname router Name the router hostname switch Give the switch a name Assign a name configure the hostname
Router/Switch(config)# no ip domain-lookup
Prevent/disable unwanted DNS lookups.
Switch/Router(config)# enable secret class
Assign class as the privileged EXEC password
Note: The enable secret password overrides the enable password. If both are configured on the switch, you must enter the enable secret password to enter privileged EXEC mode.
Configure an encrypted password to secure access to privileged mode Assign class as the privileged EXEC encrypted password Use class as the encrypted privileged EXEC password privileged EXEC mode password The enable password should be replaced with the newer encrypted secret password using the enable secret command. Set the enable secret password Privileged EXEC, encrypted
Switch/Router(config)# line console 0
Switch/Router(config)# logging synchronous
Switch/Router(config-line)# password c1sc0
Switch/Router(config-line)# login
Switch/Router(config-line)# exit
Console port access should also be restricted with a password. Use c1sc0 as the console login password in this activity. The default configuration is to allow all console connections with no password needed. To prevent console messages from interrupting commands, use the logging synchronous option.Secure access to the console line console password and enable login password for console access console line password
Switch/Router(config)# line vty 0 15
Switch/Router(config-line)# password c1sc0
Switch/Router(config-line)# login
Configure the virtual terminal (vty) lines for the switch to allow Telnet access. If you do not configure a vty password, you will not be able to use Telnet to access the switch.vty password and enable login
Router/Switch(config)# service password-encryption
Encrypt all clear text passwordsEncrypt all clear-text passwords Encrypt the plaintext passwords Encrypt all plaintext passwords Encrypt the enable and console passwords Encrypt all plain text passwords. encrypt these plain text passwords
Switch(config)# interface vlan 1
Switch(config)# description Vlan 1
Switch(config-if)# ip address 192.168.1.1 255.255.255.0
Switch(config-if)# no shutdown
Configure and enable management interface (SVI) on SwitchConfigure the Switch Management Interface Configure and activate the VLAN interface on the switch Configure addressing Document interfaces with descriptions configure Switch with an IP address Switch IP address
Switch(config)# interface vlan 1
Switch(config-if)# ipv6 address 2001:db8:acad:1::b/64
Switch(config-if)# ipv6 address fe80::b link-local
Switch(config-if)# end
Assign IPv6 addresses to the management interface (SVI) on Switch
Switch# show ipv6 interface vlan1
Verify that the IPv6 addresses are properly assigned to the management interface.
Router# show ipv6 interface g0/0/1
Show IPv6 information on Router
Switch(config)# ip default-gateway 192.168.1.1
Switch(config-if)# exit
Configure the default gateway for the switch.
Switch/Router(config)# banner motd #Authorized Users Only!#
Create a banner that warns anyone accessing the device that unauthorized access is prohibited.Configure a MOTD Banner Create a banner that warns anyone accessing the device that unauthorized access is prohibited Configure an appropriate banner Unauthorized access is strictly prohibited. Configure Message of the day text Configure an appropriate MOTD banner to warn about unauthorized access message-of-the-day (MOTD) banner Configure a message of the day (MOTD) banner
Router/Switch(config)# end
Router/Switch# copy running-config startup-config
or
Router/Switch# copy r s
or
Router/Switch# wr
Save the running configuration to the startup configuration file on non-volatile random access memory (NVRAM).Save Configuration Files to NVRAM Save the running configuration to the startup configuration file save the configuration to NVRAM Save the configuration file to NVRAM Save the configuration to the startup file on non-volatile random access memory (NVRAM) Save your configurations Save configurations Save the configuration file to NVRAM Save the configuration file
Router/Switch# show running-config
Display the current configuration.display the current contents of non-volatile random-access memory (NVRAM) Verify the initial settings by viewing the configuration Verify your configurations by examining the contents of the running-configuration file
Switch# show version
Display the IOS version and other useful switch information.
Router# show flash
Examine the contents of flash
Router/Switch# show ip interface brief
Display the status of the connected interfaces on the switch/router. Verify that the interfaces are configured with the correct IP address and active.Verify the IP address configuration on switch quickly verify that the interfaces are configured with the correct IP address and active Display a summary list of the interfaces displays a brief summary of the current interfaces, statuses, and IP addresses assigned to them verify the interfaces and address Display the status of the connected interfaces on the switch show switch ip address show router ip address
Router/Switch(config)# enable password c1$c0
Set the enable password to c1$c0. This password protects access to privileged mode.Secure privileged mode access Privileged EXEC, unencrypted
Router/Switch> enable
Router/Switch# 
Enter privileged EXEC modeenable privileged EXEC mode
Router/Switch# configure terminal
Enter configuration modeconfig terminal Enter global configuration mode
Router/Switch# show startup-config
Display the current contents of NVRAM.Examine the startup configuration file display the contents of NVRAM
Router# copy startup-config flash
Save the startup configuration file to flash
Router# show ipv6 neighbors
Check the router for any neighbors that it discovered
Router# show interfaces
Displays statistics for all interfaces on the device. However, this command will only display the IPv4 addressing information.displays the statistics for all interfaces configured on a router
Router# show interfaces serial 0/0/0
Displays the information about the Serial 0/0/0 interface onlydefault bandwidth of this interface Display interface information on router
Router#show ip interface
Displays the IPv4 statistics for all interfaces on a router.
Router# show ipv6 interface brief
Displays the IPv6 interface informationsee the IPv6 interface information
Router#show ip route
Displays the contents of the IP routing tables stored in RAM.displays the content of the routing table view the current routing tables Display the routing table on the router Display the routing table
Router# show ipv6 route
Displays the contents of the IPv6 routing tables stored in RAM.display the IPv6 routes
Switch# show mac-address-table
Router# show arp
Router(config)# interface gigabitethernet 0/0
Router(config-if)# ip address 192.168.10.1 255.255.255.0
Router(config-if)# no shutdown
Configure IPv4 address and activate the GigabitEthernet 0/0 interface on RouterConfigure the GigabitEthernet 0/0 interface Configure IP addressing Configure ip address for interface active interface
Router(config)# interface gigabitethernet 0/0
Router(config-if)# ipv6 address 2001:db8:a::1/64
Router(config-if)# ipv6 address FE80::1 link-local
Router(config-if)# no shutdown
Configure IPv6 address and activate the GigabitEthernet 0/0 interface on Router
Router(config)# ipv6 unicast-routing
Enable the router to forward IPv6 packetsImplement the solutions necessary to enable and verify full end-to-end connectivity. enable IPv6 routing
Router(config)# interface g0/0/1
Router(config-if)# description Connected to F0/5 on Switch-1
Configure an interface description for each interface indicating which device is connected to it.Configure an interface description indicating to which device it is connected Configure an interface description for each interface indicating which device is connected to it
Router(config)# security password min-length 10
Configure the system to require a minimum 10 character passwordSet the minimum password length to 10
Router/Switch(config)# ip domain-name CCNA.com
Set the domain name to CCNA.com (case-sensitive for scoring in PT).
Router/Switch(config)# username SSHadmin secret 55Hadm!n2020
Configure the username SSHadmin with an encrypted password of 55Hadm!n2020
Router/Switch(config)# crypto key generate rsa
How many bits in the modulus [512]: 1024
Generate 1024-bit RSA keys.
Router(config)# login block-for 180 attempts 4 within 120
Block anyone for 3 minutes if 4 failed login attempts occur within 2 minuteBlock anyone for 3 minutes who fails to log in after 4 attempts within a 2-minute period
Router/Switch(config)# line vty 0 15
Router/Switch(config-line)# transport input ssh
Router/Switch(config-line)# login local
Configure all VTY lines for SSH access and use the local user profiles for authentication. Router/Switch to accept only SSH connections from remote locationsTelnet was disabled with the transport input ssh command
Router/Switch(config)# line vty 0 15
Router/Switch(config-line)# exec-timeout 6 0
Set the EXEC mode timeout to 6 minutes on the VTY lines (disconnected after 6 minutes of inactivity)
Router/Switch(config)# line console 0
Router/Switch(config-line)# exec-timeout 6 0
Set the EXEC mode timeout to 6 minutes on the console line (disconnected after 6 minutes of inactivity)
C:\Users\WindowsPC > SSH -l jonny 172.16.1.1
Access the command prompt on the desktop of PCA to establish an SSH connection to Router. (Make sure you have IP configured for PCA)
Switch(config)# interface range F0/2-24, G0/2
Switch(config-if-range)# shutdown
Disable all unused switch ports.
show ip arp
Command could be used on a Cisco router to view its ARP table
C:UsersWindowsPC> arp -a
On a Windows PC, the arp –a command is used to display the ARP tableExamine the ARP Process
Switch# show interface vlan1
Examine the characteristics of the SVI for VLAN 1
Switch# show ip interface vlan1
Examine the IP properties of the SVI VLAN 1
Switch# show vlan
Examine the default VLAN settings of the switch.
Switch(config)# vlan 99
Switch(config-vlan)# exit

Switch(config)# interface range gig1/0/1-24
Switch(config-if-range)# switchport access vlan 99
Switch(config-if-range)# exit
Create the new VLAN 99 on the switch and assign all user ports to VLAN 99
Switch# show vlan brief
Verify that the VLANs are assigned to the correct interfacesview the list of VLANs Displays all VLANs configured
Switch# show interface vlan 99
Verify the management VLAN 99 settings.
C:>telnet 10.10.10.2
Login using TelnetUse Command Prompt (CMD) on PC Windows to telnet to Switch or Router with IP address 10.10.10.2
Switch#(config)# vlan 10
Switch#(config-vlan)# name Staff
Create and name VLANs on Switch
Switch(config)# interface f0/11
Switch(config-if)# switchport mode access
Switch(config-if)# switchport access vlan 10
Assign PC port to the VLAN on Switch
Related labs: 3.6.2;
Assign VLANs to the active ports on Switch
Switch(config-vlan)#vlan 150
Switch(config-vlan)#name VOICE
Switch(config)# interface f0/11
Switch(config-if)# mls qos trust cos
Switch(config-if)# switchport voice vlan 150
Assign the VOICE VLAN to FastEthernet 0/11 on Switch
Switch(config)# interface range g0/1 - 2
Switch(config-if)# switchport mode trunk

Switch(config-if)# switchport trunk native vlan 99
Configure G0/1 and G0/2 interfaces on Switch for trunking and use VLAN 99 as the native VLAN for G0/1 and G0/2 interfaces on Switch.
Switch# show interface trunk
Verify trunking is enabled on Switch
Switch# show interface g0/1 switchport
Verify that the native VLAN is now 99
Switch(config)# no vlan 30
Switch(config)# interface f0/24
Switch(config-if)# no switchport access vlan
Switch(config-if)# end
Remove VLAN 30 from the VLAN database. Assume VLAN 30 has been added to the F0/24 interface. When you delete a VLAN, any ports assigned to that VLAN become inactive
Switch(config)# interface vlan 1
Switch(config-if)# no ip address
Remove the management IP address on VLAN 1
123456abcde

boot system

Unprivileged Commands

enable lock ping
telnet traceroute resume
disconnect ssh exit

Privileged Commands

configure terminal debug setup
copy running-config startup-config erase startup-config write
clock set clear reload
write terminal undebug all copy tftp startup-config
copy running-config tftp copy tftp running-config copy startup-config running-config
terminal monitor copy startup-config tftp

Configure Commands

ip domain-lookup no hostname
config-register clock timezone alias exec
logging console do default interface
interface router username
ip classless ip subnet-zero ip default-gateway
ip dhcp pool enable secret ip domain-name
ip host ip http server ip name-server
ip route access-list (standard) access-list (extended)
ip access-list service password-encryption interface loopback
end logging buffered banner motd
router rip router eigrp <As> router ospf <process id>
ip nat pool ip nat inside source list ip nat inside source static
ip dhcp excluded-address enable password

Interface Commands

ip address clock rate encapsulation
bandwidth description duplex
no shutdown / shutdown encapsulation dot1q keepalive
ip access-group ip bandwidth-percent (EIGRP) ip directed-broadcast
ip helper-address (DHCP) ip mtu ip ospf #
ip ospf cost ip ospf priority ip ospf network broadcast
ip ospf network nonbroadcast ip ospf network point-to-point ip ospf network point-to-multipoint
ip ospf hello-interval ip ospf dead-interval cdp enable
ip rip send ip rip receive speed
mac-address ip split-horizon (RIP) ip split-horizon eigrp <As>
encapsulation ppp ppp authentication chap ppp chap hostname
ppp chap password ppp pap sent-username encapsulation frame-relay
frame-relay interface-dlci frame-relay map ip frame-relay inverse-arp
ip nat inside ip nat outside ip nat enable
ip address dhcp ppp authentication pap delay

Line console Commands

logging synchronous login history size
exec-timeout length lockable
password privilege

Line VTY Commands 

logging synchronous login history size
exec-timeout length lockable
password privilege access-class

Show Commands

show access-lists show Running-config show startup-config
show running-config Interface show Clock show controllers
show debug show frame-relay map show frame-relay pvc
show frame-relay lmi show hosts show interfaces
show ip interfaces show ip interface brief show sessions
show tech-support show ip access-lists show ip dhcp binding
show ip dhcp conflicts show ip dhcp pool show dhcp server
show ip eigrp interface show ip eigrp neighbors show ip eigrp topology
show ip ospf interface show ip ospf interface brief show ip ospf neighbor
show ip ospf database show ip route show ip route rip
show ip route eigrp show ip route ospf show ip route connected
show ip nat translations show ip nat statistics show ip protocols
show cdp neighbors show cdp neighbors detail show dhcp lease
Filtering Output *

Router RIP Commands

version 2 no auto-summary network
passive-interface validate-update-source passive-interface default
maximum-paths distribute-list offset-list
distance timers neighbor

Router EIGRP Commands

no auto-summary network distance
distribute-list eigrp router-id passive-interface
passive-interface default variance (EIGRP) offset-list
distance eigrp maximum-paths neighbor

Router OSPF Commands

network
passive-interface router-id passive-interface default
maximum-paths distribute-list auto-cost reference-bandwidth
distance distance ospf neighbor

Debug Commands

debug ip packet debug ip packet detail debug ip routing
debug ip eigrp debug ip ospf adj debug ip ospf events
debug ip ospf packet debug ip rip

Clear Commands

clear ip route * clear ip ospf process clear ip eigrp neighbors

Switch Commands

Privilege Commands

vlan database configure

Vlan Database Commands

vlan exit show
vtp domain vtp pruning vtp server
vtp client vtp transparent vtp password
apply

Configure Commands

vlan interface vlan interface range
vtp mode server vtp mode client vtp mode transparent
vtp domain vtp password spanning-tree backbonefast
vtp pruning spanning-tree portfast ip default-gateway
spanning-tree vlan root primary spanning-tree vlan root secondary spanning-tree vlan priority
spanning-tree uplinkfast

Interface Commands

switchport mode access switchport mode trunk switchport nonegotiate
spanning vlan cost switchport trunk encapsulation dot1q switchport trunk encapsulation isl
switchport trunk native vlan spanning-tree port-priority switchport trunk allowed vlan
switchport access vlan switchport port-security switchport port-security mac-address
spanning-tree vlan port-priority switchport port-security maximum switchport port-security violation
spanning-tree cost spanning-tree guard root
spanning-tree portfast

Show Commands

show vlan show vlan brief show interface trunk
show spanning-tree show spanning-tree vlan show vtp status
show port-sec show mac-address-table show interface

Special Keys Commands

Tab Return (at the –More– prompt) space Bar (at the –More– prompt)
Ctrl-F Esc-B Esc-F
Ctrl-A Ctrl-E Ctrl-D
Esc-D Ctrl-W Ctrl-K
Ctrl-U or Ctrl-X Up Arrow or Ctrl-P Down Arrow or Ctrl-N
Ctrl-Y Ctrl-Z Ctrl-shift-6, x
Subscribe
Notify of
guest

14 Corrections & Clarifications