Part 2: CLI Commands
How would you view the dhcp lease information for a Switch's Management Port?
enable show dhcp lease
CLI command to enter Configuration Mode
configure terminal
How to copy the running config to the startup config.
copy running-config startup-config
How do you merge the Startup Configuration file with the Running Configuration file?
copy startup-config running-config
How can you turn off name resolution while in the CLI?
no ip domain-lookup
How would you disable unsolicited syslog messages received while logged into the console of a Switch?
no logging console
How do you remove any existing simple passwords from the Switch?
no password
How could you revert to the default speed, duplex, and/or description setting for an interface on a Switch?
no speed no duplex no description
How do you end your CLI session?
quit
CLI command to reboot switch
reload
How do you restore a switch to its default configuration?
write erase erase startup-config erase nvram: reload
How would you enable the unsolicited syslog messages received while logged into the console of a Switch?
logging console
How would you configure the console to only show unsolicited syslog messages and more appropriate times while logged into the console of a Switch?
logging synchronous
How would you get to the telnet configuration?
enable configure terminal line vty 0 15
How can you remove dynamically learned MAC addresses from the MAC address table?
clear mac address-table dynamic
How do you set the hostname of a switch?
****Enter the Global Configuration Mode. hostname x
CLI Command that lists the currently known facts about the switch's operational status.
show
How do you view all the commands currently recorded in the CLI history buffer of a Switch?
show history
How would you view the number of IN & OUT frames that have passed through a Switch's ports?
show interfaces counters
How do you check the statuses of all the ports on a Switch?
show interfaces status
What command allows you to view the status of the SSH server itself on a Switch?
show ip ssh
How do you view a Switch's entire MAC address table?
show mac address-table
How would you find out which port was assigned to a specific MAC address in a Switch's MAC address table?
show mac address-table address (mac address)
How would you view what the age time is set to?
show mac address-table aging-time
How would you view the number of MAC address entries as well the available room for more entries?
show mac address-table count
How do you view only the MAC addresses learned by a Switch?
show mac address-table dynamic
List the common Switch Configuration Modes and the command to enter them.
Global - configure terminal Line Console Configuration - line console 0 Line Telnet Configuration - line vty 0 15 Interface - interface (type) (number) VLAN - vlan (number)
CLI Command that shows live facts about the switch's operational status.
debug
How do you exit Privilege Mode and go back to User Mode?
disable
CLI command to enter Privileged Mode
enable
How do you set the enable password?
enable configure terminal enable secret x
How do you configure a Switch to use DHCP assuming that its Management Port is on VLAN 1?
enable configure terminal interface vlan 1 ip address dhcp no shutdown
How do you set the IP address of a Switch, the SVI is on VLAN 1?
enable configure terminal interface vlan 1 ip address x.x.x.x z.z.z.z no shutdown
How do you set the console to have a local username/password requirement?
enable configure terminal line con 0 login local
How would you get to line configuration mode?
enable configure terminal line console 0
How do you require a switch to request a password and set the password for the console?
enable configure terminal line console 0 login password x
How would you setup Port Security?
enable configure terminal line console 0 or line vty 0 15 interface (interface number) switchport mode access or switchport mode trunk switchport port-security switchport port-security maximum (number) switchport port-security violation (protect or restrict or shutdown) switchport port-security mac-address (address) or switchport port-security mac-address sticky copy running-config startup-config
How would you set the duplex of interface Fa0/1 to Full?
enable configure terminal line console 0 or line vty 0 15 interface Fa0/1 duplex full
How would you set the speed of interface Fa0/1 to 100 Mbps?
enable configure terminal line console 0 or line vty 0 15 interface Fa0/1 speed 100
How do you require a switch to request a password and set the password for telnet?
enable configure terminal line vty 0 15 login password x
How do you set terminal to have a local username/password requirement?
enable configure terminal line vty 0 15 login local
How would you configure what protocols are allowed to remotely access the Switch?
enable configure terminal transport input (options) Options: all - both telnet & ssh none - disable remote access telnet - just telnet ssh - just ssh
How could you assign text to a range of interfaces on a Switch?
enable interface range FastEthernet 0/11 - 20 description End users connect here
How do set the Default Gateway for a Switch?
enable ip default-gateway x.x.x.x
How do you set the DNS server for a Switch?
enable ip name-server (server1 ip) (server2 ip) (server3 ip)...
How do you view the Running Configuration file?
enable show running-config
How do you view the Startup Configuration file?
enable show startup-config
How do you exit configuration mode and return to enable mode?
end or Ctrl+Z
What command changes the default inactivity timeout length of the console and vty connections for a Switch?
exec-timeout (minutes) (seconds)
How would you move from interface configuration mode back to global configuration mode?
exit
How would you change the default CLI history size in the console or vty of a Switch?
history size x
How do you setup SSH?
hostname (hostname) ip domain-name (domain.name) crypto key generate rsa
By default when SSH is enabled on a Switch, it supports both SSH 1 & 2. What is the command to only support SSH 2?
ip ssh version 2 in global configuration mode
Once Port Security has been enabled on a port, what command will no longer show MAC addresses and what commands should you now use?
show mac address-table dynamic (No longer works, MACs are no longer learned dynamically) show mac address-table secure (Lists MACs that use Port Security) show mac address-table static (Lists MACs that use Port Security or are defined statically)
How would you view the learned MAC addresses for a specific port on a Switch?
show mac address-table dynamic interface Fa0/1
How would you view the MAC addresses that are assigned to a specific vlan?
show mac address-table vlan (number)
How can you verify port security?
show port-security interface (interface)
What command allows you to view each host connected to the Switch via SSH?
show ssh
How would you change the CLI history size for the current session?
terminal history size x