Cisco Commands: Difference between revisions
From Lucca's Wiki
Jump to navigationJump to search
No edit summary |
|||
| Line 1: | Line 1: | ||
= Cisco IOS Command Reference = | |||
= | |||
A quick-reference guide for common Cisco IOS commands on switches and routers. | |||
---- | |||
== System & Routing Basics == | |||
=== Enable IPv4 Routing (Layer 3 Switches) === | |||
<pre> | |||
ip routing | |||
</pre> | |||
=== Enable IPv6 Routing (Routers) === | |||
<pre> | |||
ipv6 unicast-routing | |||
</pre> | |||
---- | |||
== Device & System Information == | |||
=== Show MAC Address Table === | |||
<pre> | |||
show mac address-table | |||
</pre> | |||
=== Show OS and Device Version === | |||
<pre> | |||
show version | |||
</pre> | |||
=== Show Logged-in Users === | |||
<pre> | |||
show users | |||
</pre> | |||
=== Show Files === | |||
<pre> | |||
dir | |||
dir nvram: | |||
</pre> | |||
---- | |||
== Configuration Files == | |||
Show running config | === Show Configurations === | ||
<pre> | |||
show running-config | |||
show startup-config | |||
</pre> | |||
Show | === Show Interface Config === | ||
<pre> | |||
show run interface g0/0 | |||
</pre> | |||
Filter | === Filter Running Config (grep-like) === | ||
<pre> | |||
show run | include {searchterm} | |||
show run | begin {searchterm} | |||
show run | section {section-name} | |||
</pre> | |||
=== Save Running Config === | |||
<pre> | |||
copy running-config startup-config | |||
copy run start | |||
wr | |||
</pre> | |||
---- | |||
== User Privileges & Security == | |||
=== Enter Privileged Mode === | |||
<pre> | |||
enable | |||
</pre> | |||
=== Set Encrypted Enable Password === | |||
<pre> | |||
enable secret ThisisaSecret | |||
</pre> | |||
=== Encrypt Plaintext Passwords (Weak Encryption) === | |||
<pre> | |||
service password-encryption | |||
</pre> | |||
---- | |||
== Interface & Network Status == | |||
=== Interface IP Summary === | |||
<pre> | |||
show ip interface brief | |||
show ipv6 interface brief | |||
</pre> | |||
=== Routing Table === | |||
<pre> | |||
< | show ip route | ||
</pre> | |||
---- | |||
== VLAN & Switching == | |||
Show | === Show VLANs === | ||
<pre> | |||
show vlan brief | |||
</pre> | |||
=== Show Interface VLAN Details === | |||
<pre> | |||
show interface g0/1 switchport | |||
</pre> | |||
=== Show Trunk Interfaces === | |||
<pre> | |||
show int trunk | |||
</pre> | |||
< | === Clear Tables === | ||
<pre> | |||
clear mac address-table | |||
clear arp-cache | |||
</pre> | |||
---- | |||
== Telnet & Remote Access == | |||
=== Connect via Telnet === | |||
<pre> | |||
connect {DeviceName} | |||
</pre> | |||
=== Show Hosts & Sessions === | |||
<pre> | |||
show hosts | |||
show sessions | |||
</pre> | |||
=== Disconnect Session === | |||
<pre> | |||
disconnect {DeviceName} | |||
</pre> | |||
Enable | === Suspend Active Session === | ||
<pre> | |||
Ctrl+Shift+6, then x | |||
</pre> | |||
---- | |||
== SSH Configuration == | |||
=== Basic SSH Setup === | |||
<pre> | |||
ip domain-name cisco.com | |||
crypto key generate rsa | |||
ip ssh version 2 | |||
</pre> | |||
=== Remove RSA Keys === | |||
<pre> | |||
crypto key zeroize rsa | |||
</pre> | |||
=== Create Local User === | |||
<pre> | |||
username admin secret ccna | |||
</pre> | |||
=== Set Default Gateway === | |||
<pre> | |||
ip default-gateway 192.168.10.1 | |||
</pre> | |||
=== Enable SSH on VTY Lines === | |||
<pre> | |||
line vty 0 15 | |||
transport input ssh | transport input ssh | ||
login local | login local | ||
exit | exit | ||
</pre> | |||
---- | |||
== Global Configuration Mode == | |||
=== | === Enter Global Config === | ||
< | <pre> | ||
configure terminal | |||
</pre> | |||
=== Disable DNS Lookup on Typos === | |||
<pre> | |||
no ip domain-lookup | |||
</pre> | |||
=== Set MOTD Banner === | |||
<pre> | |||
banner motd MESSAGEHERE | |||
</pre> | |||
=== Set Hostname === | |||
<pre> | |||
hostname HOSTNAME | |||
</pre> | |||
---- | |||
== Line Configuration == | |||
=== Console Line === | |||
<pre> | |||
line con 0 | |||
password itsasecret | |||
login | |||
</pre> | |||
=== VTY Lines === | |||
<pre> | |||
line vty 0 15 | |||
password itsasecret | |||
login | |||
</pre> | |||
---- | |||
== Interface Configuration == | |||
=== Interface Selection === | |||
<pre> | |||
interface vlan 1 | |||
interface fa0/1 | |||
interface range fa0/2-3 | |||
</pre> | |||
=== | === Enable Interface === | ||
<pre> | |||
no shutdown | |||
</pre> | |||
=== | === Assign IPv4 Address === | ||
<pre> | |||
ip address 192.168.0.1 255.255.255.0 | |||
</pre> | |||
---- | |||
== VLAN Configuration == | |||
==== | |||
=== Create / Configure VLAN === | |||
<pre> | |||
vlan 10 | |||
name MyAwesomeVlan | |||
</pre> | |||
---- | |||
== Switchport Configuration == | |||
=== Access Port === | |||
<pre> | |||
switchport mode access | |||
switchport access vlan 10 | |||
</pre> | |||
=== Trunk Port === | |||
<pre> | |||
switchport trunk encapsulation dot1q | |||
switchport mode trunk | |||
</pre> | |||
=== Trunk VLAN Settings === | |||
<pre> | |||
switchport trunk allowed vlan 10,20,33,99 | |||
switchport trunk native vlan 99 | |||
</pre> | |||
---- | |||
== | == IPv6 Interface Configuration == | ||
=== Assign IPv6 Address === | |||
<pre> | |||
ipv6 address 2001:DB8:CAFE:1::1/64 | |||
</pre> | |||
=== Assign Link-Local Address === | |||
<pre> | |||
ipv6 address fe80::1 link-local | |||
</pre> | |||
Remove | === Remove IPv6 Addresses === | ||
<pre> | |||
no ipv6 address 2001:DB8:CAFE:1::1/64 | |||
no ipv6 address | |||
</pre> | |||
Revision as of 21:50, 15 January 2026
Cisco IOS Command Reference
A quick-reference guide for common Cisco IOS commands on switches and routers.
System & Routing Basics
Enable IPv4 Routing (Layer 3 Switches)
ip routing
Enable IPv6 Routing (Routers)
ipv6 unicast-routing
Device & System Information
Show MAC Address Table
show mac address-table
Show OS and Device Version
show version
Show Logged-in Users
show users
Show Files
dir dir nvram:
Configuration Files
Show Configurations
show running-config show startup-config
Show Interface Config
show run interface g0/0
Filter Running Config (grep-like)
show run | include {searchterm}
show run | begin {searchterm}
show run | section {section-name}
Save Running Config
copy running-config startup-config copy run start wr
User Privileges & Security
Enter Privileged Mode
enable
Set Encrypted Enable Password
enable secret ThisisaSecret
Encrypt Plaintext Passwords (Weak Encryption)
service password-encryption
Interface & Network Status
Interface IP Summary
show ip interface brief show ipv6 interface brief
Routing Table
show ip route
VLAN & Switching
Show VLANs
show vlan brief
Show Interface VLAN Details
show interface g0/1 switchport
Show Trunk Interfaces
show int trunk
Clear Tables
clear mac address-table clear arp-cache
Telnet & Remote Access
Connect via Telnet
connect {DeviceName}
Show Hosts & Sessions
show hosts show sessions
Disconnect Session
disconnect {DeviceName}
Suspend Active Session
Ctrl+Shift+6, then x
SSH Configuration
Basic SSH Setup
ip domain-name cisco.com crypto key generate rsa ip ssh version 2
Remove RSA Keys
crypto key zeroize rsa
Create Local User
username admin secret ccna
Set Default Gateway
ip default-gateway 192.168.10.1
Enable SSH on VTY Lines
line vty 0 15 transport input ssh login local exit
Global Configuration Mode
Enter Global Config
configure terminal
Disable DNS Lookup on Typos
no ip domain-lookup
Set MOTD Banner
banner motd MESSAGEHERE
Set Hostname
hostname HOSTNAME
Line Configuration
Console Line
line con 0 password itsasecret login
VTY Lines
line vty 0 15 password itsasecret login
Interface Configuration
Interface Selection
interface vlan 1 interface fa0/1 interface range fa0/2-3
Enable Interface
no shutdown
Assign IPv4 Address
ip address 192.168.0.1 255.255.255.0
VLAN Configuration
Create / Configure VLAN
vlan 10 name MyAwesomeVlan
Switchport Configuration
Access Port
switchport mode access switchport access vlan 10
Trunk Port
switchport trunk encapsulation dot1q switchport mode trunk
Trunk VLAN Settings
switchport trunk allowed vlan 10,20,33,99 switchport trunk native vlan 99
IPv6 Interface Configuration
Assign IPv6 Address
ipv6 address 2001:DB8:CAFE:1::1/64
Assign Link-Local Address
ipv6 address fe80::1 link-local
Remove IPv6 Addresses
no ipv6 address 2001:DB8:CAFE:1::1/64 no ipv6 address