CCNA-QUESTIONS.com

Cisco Configuration CLI Commands Cheat Sheet
Basic Router Configuration
Prompt / ModeCommandDescription
R(config)#hostname <hostname>Set hostname for the device.
R(config)#no ip domain-lookupDisable IP domain lookup; prevents timeout on incorrect commands.
R(config)#banner motd $ <message> $Set Message of the Day (MOTD) banner. Use $ to end multi-line messages.
R(config)#line console 0Enter console line configuration mode.
R(config-line)#logging synchronousPrevents logging output from interrupting the console session.
R(config-line)#password <password>Set an unsecure password for the console port.
R(config-line)#loginEnable required console port login password.
R(config-line)#no loginDisable login requirement.
R(config)#line vty 0 4Enter telnet/SSH configuration mode.
R(config-line)#password <password>Set a password for telnet/SSH.
R(config-line)#loginEnable required console port login password.
R(config)#interface vlan1Enter VLAN1 interface configuration mode.
R(config-if)#ip address <ip> <subnet>Configure VLAN IP address and subnet (used for telnet).
R(config-if)#no shutdownManually enable the interface.
R(config)#enable secret <password>Enable a secure password for privileged mode.
R(config)#service password-encryptionManually encrypt passwords.
R#copy running-config startup-configSave the running configuration to startup-config.
Secure Shell (SSH) Setup
Prompt / ModeCommandDescription
R(config)#ip domain-name <any.com>Set the domain name.
R(config)#username <username> password <password>Configure local username and password for SSH login.
R(config)#crypto key generate RSAGenerate RSA keys (Choose key size between 360-4096, typically 1024).
R(config)#ip ssh version 2Enable SSH version 2.
R(config)#line console 0Enter Line Console 0 configuration.
R(config-line)#password <password>Set password for Line Console.
R(config)#line vty 0 4Enter telnet/SSH configuration mode.
R(config-line)#login localUse local database for login authentication.
R(config-line)#transport input ssh telnetConfigure access protocols (Telnet optional).
R#show ip sshDisplay SSH version and options.
DHCP Configuration
Prompt / ModeCommandDescription
R(config-if)#ip helper-address <ip>Set the address of the DHCP server.
R(config)#ip dhcp pool <pool-name>Enable DHCP configuration mode or create an IP address pool.
R(dhcp-config)#network <network> <subnet>Configure a DHCP network segment.
R(dhcp-config)#default-router <ip>Set the default gateway.
R(dhcp-config)#domain-name <domain>Specify the domain name for a DHCP client.
R(config)#ip dhcp excluded-address <start-ip> <end-ip>Exclude addresses from DHCP assignment.
R#show ip dhcp bindingDisplay active DHCP-assigned IPs.
R#show ip dhcp poolShow DHCP pool summary.
Switchport Security
Prompt / ModeCommandDescription
S(config-if)#switchport mode <access/trunk>Set switchport to access or trunk mode.
S(config-if)#switchport port-securityEnable switchport security.
S(config-if)#switchport port-security maximum <number>Limit to one MAC address per switchport.
S(config-if)#switchport port-security mac-address <mac-address>Specify allowed MAC address.
S(config-if)#switchport port-security mac-address stickyDynamically learn MAC address.
S(config-if)#switchport port-security violation <protect/restrict/shutdown>Set security violation action.
Access Control Lists (ACLs)
Prompt / ModeCommandDescription
R(config)#access-list <#> <permit/deny> <source> <wildcard>Create a standard ACL rule.
R(config)#access-list 101 <permit/deny> <protocol> <source> <source-wildcard> <destination> <destination-wildcard> <port>Create an extended ACL.
R(config-if)#ip access-group <#> in/outApply ACL to an interface (inbound/outbound).
R#show ip access-listsDisplay all ACLs.
OSPF Configuration
Prompt / ModeCommandDescription
R(config)#router ospf <process-id>Enable OSPF and enter router configuration mode.
R(config-router)#router-id <router-id>Set OSPF router ID (e.g., 4.4.4.4).
R(config-router)#network <network> <wildcard> area <#>Advertise network in OSPF LSAs.
R(config-if)#ip ospf <process-id> area <#>Configure OSPF on an interface.
R(config-router)#passive-interface <interface>Set an interface as passive.
R(config-router)#passive-interface defaultMake all interfaces passive by default.
R#show ip ospfDisplay OSPF configuration.
R#show ip ospf neighborShow OSPF neighbors.
R#show ip ospf databaseDisplay OSPF database.
Network Address Translation (NAT)
Prompt / ModeCommandDescription
R(config-if)#ip nat <inside/outside>Configure NAT direction.
R(config)#ip nat inside source static <local-ip> <global-ip>Configure static NAT.
R(config)#ip nat pool <pool-name> <start-ip> <end-ip> netmask <netmask>Define NAT pool.
R(config)#ip nat inside source list <acl-number> pool <pool-name>Enable dynamic NAT using an ACL.
R(config)#ip nat inside source list <acl-number> interface <interface> overloadConfigure PAT (NAT overload).
R#show ip nat translationsDisplay NAT table.
Network Time Protocol (NTP)
Prompt / ModeCommandDescription
R(config)#ntp server <ip-address>Set NTP server.
R(config)#clock timezone <timezone>Set time zone.
R#show ntp statusShow NTP sync status.