Skip to main content

Cisco IOS Command Examples

Status commands

show interface status
show vlan brief
show ip interface brief
show ip route
show access-lists
show mac address-table
show mac address-table | include xxxx
show ip protocols
show spanning-tree vlan <vlan-id>
show ip dhcp snooping binding

Discovery Protocols

Cisco Discovery Protocol

show cdp neighbors

Enable/Disable

(config)# cdp run
(config)# no cdp run
show lldp neighbors

In the virtual lab environment, when you run the LLDP on a switch, it can discover neighbor routers and switches. But LLDP enabled router will discover only neighbor routers.

Enable/Disable

(config)# lldp run
(config)# no lldp run

Ping an Address

ping 10.10.1.10
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.10.1.10, timeout is 2 seconds:
..!!!
Success rate is 60 percent (3/5), round-trip min/avg/max = 1/1/1 ms

It is common for the first one or two ICMP echo requests to time out. It is usually due to delays that are associated with updating the ARP cache with the MAC address of the local peer.

Configure Interfaces

Individual interface

conf t
int Gi1/0/1
switchport host
switchport access vlan 10
no shut
end

Range of interfaces

config t
interface range Gi1/0/1 - 10
switchport access vlan 10
end

Non sequential range

interface range Gi1/0/1, Gi1/0/5, Gi1/0/7

Set the name of an interface

config t
int Gi1/0/1
description flypdx
end

Tips

When you need to apply a privilege mode command from the configuration mode then an easy way of doing it is to add the “do” keyword before your actual command to save your time from going back and forth between the different modes.

Example

R1(config-if)# do show ip route

Control Plane

Write Memory

wri
write memory
copy running-config startup-config

Activate enable mode

en
enable

Show Open Ports

# show control-plane host open-ports

Disable HTTP Server

# conf t
# no ip http server
# exit

Adjust the Access List

access-list xx permit x.x.x.x x.x.x.x

Routing

Configuring Static Routes

# configure terminal
(config)# ip route <network_id> <subnet_mask> <gateway_ip>
(config)# end

Debug Commands

Be very careful when using debug commands in production environments. Depending on the circumstances, they can have a catastrophic effect on router performance. Until you have experience with debug commands, it is best to consult a senior engineer within your organization on their use.

debug arp
undebug all

A common abbreviation that is used for undebug all is u all.