Cisco Commands

From Lucca's Wiki
Jump to navigationJump to search

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

Interface IP Summary (filtered to only interfaces with IPs)

show ip interface brief | exclude unassigned

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

Port Security

Activate Port Security on an interface

The port cannot be a dynamic port:

switchport mode access

Enable Port Security

switchport port-security