top of page
Writer's pictureMc Cube

Dive into Show commands




Introduction

What can you see when you use show commands? In theory everything. But everything is far too much for everyone so this whole lab is designed to let you see some really cool show commands and how to filter them with some different combinations.


Instructions


In this lab (Download lab pack here) everything is already configured for you. So, this should be entirely about discovering information from different locations. This lab itself is running a fair few different things; OSPF, DHCP, RPVST+ and static routing to name a few of the more prominent ones. There is no answer or configuration files because of the nature of this lab.


We aim to use show commands on different devices to gather information about all of these different elements.


** Note - This lab was built primarily in Packet Tracer. A big difference between it and CML being the number of interfaces on the switches.


Activity

Let's start in the LAN, these switches are working hard but let's see what information we can pull out of them.

A great place to start is

S1#show running-config
Building configuration...
Current configuration : 1863 bytes
!
hostname S1
!
[LOADS OF INFORMATION]
!
end

S1#

When you are troubleshooting show run is a great command when you suspect that the problem is a manual configuration error. On a switch however you get a lot of information about interfaces, and what if we are only interested in the Spanning tree config?

Time for our first pipe!

on the keyboard this is commonly the backslash (\) character on your keyboard combined with the Shift key [Shift+\] and will look like this |.

What can we do with a pipe? a simple way to think about a "piped" command is that you want to run the command and do something else with the output of that command.

In the cisco IOS there are 4 main filters

  • Section

  • Exclude

  • Include

  • Begin

We will aim to use all of these in this lab to varying degrees.


Section

Let's start with "section" this is one of the really useful output modifiers. We mentioned earlier that we want to see only the spanning tree configuration. So, let's pipe for that section.


S1# show running-config | section spanning-tree
spanning-tree mode rapid-pvst
spanning-tree extend system-id
S1#

As you can see, we now only see the information contained within the spanning tree part of the configuration. It is good to note that with all of these commands that case sensitivity is important to remember. Notice that with a capital "S" this command returns nothing.

S1#
S1#show running-config | section Spanning-tree
S1#

As long as you know the sections of an output command this tool is excellent, practice with it.

S1#
S1#show running-config | section line
S1#show running-config | section line con
S1#show running-config | section interface
S1#show running-config | section interface FastEthernet
S1#

Exclude

Next let's look at the exclude filter. We will move on to S2 for this one.

On a switch "Show ip interface Brief" is a useful command, but again shows a lot. In this instance we do not want to see interfaces that are down. So, we can exclude them.

S2#show ip interface brief | exclude down
Interface              IP-Address      OK? Method Status                Protocol 
Port-channel1          unassigned      YES manual up                    up 
Port-channel2          unassigned      YES manual up                    up 
FastEthernet0/1        unassigned      YES manual up                    up 
FastEthernet0/2        unassigned      YES manual up                    up 
FastEthernet0/3        unassigned      YES manual up                    up 
FastEthernet0/21       unassigned      YES manual up                    up 
FastEthernet0/22       unassigned      YES manual up                    up 
FastEthernet0/23       unassigned      YES manual up                    up 
FastEthernet0/24       unassigned      YES manual up                    up 
S2#

Include

Inversely we can get similar output with the include filter for up interfaces. You may notice the column headers are no where to be seen.

S2#show ip interface brief | include up
Port-channel1          unassigned      YES manual up                    up 
Port-channel2          unassigned      YES manual up                    up 
FastEthernet0/1        unassigned      YES manual up                    up 
FastEthernet0/2        unassigned      YES manual up                    up 
FastEthernet0/3        unassigned      YES manual up                    up 
FastEthernet0/21       unassigned      YES manual up                    up 
FastEthernet0/22       unassigned      YES manual up                    up 
FastEthernet0/23       unassigned      YES manual up                    up 
FastEthernet0/24       unassigned      YES manual up                    up 
S2#

Some other fun ones to try

S2#
S2#show ip int br | exclude Gig
S2#show ip int br | exclude Fast
S2#show ip int br | exclude Port
S2#show ip int br | include 0/21
S2#show ip int br | include 0/2
S2#

Begin

On to S3, let's have a look at the begin filter.

If you issue the command show interface fastethernet 0/1 you will get a lot of output relating to layer 1 and 2 information.


S3# show interface fastEthernet 0/1
FastEthernet0/1 is up, line protocol is up (connected)
  Hardware is Lance, address is 0001.967a.7e01 (bia 0001.967a.7e01)
  Description: LINK TO VLAN10-PC
 BW 100000 Kbit, DLY 1000 usec,
     reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation ARPA, loopback not set
  Keepalive set (10 sec)
  Full-duplex, 100Mb/s
  input flow-control is off, output flow-control is off
  ARP type: ARPA, ARP Timeout 04:00:00
  Last input 00:00:08, output 00:00:05, output hang never
  Last clearing of "show interface" counters never
  Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
  Queueing strategy: fifo
  Output queue :0/40 (size/max)
  5 minute input rate 0 bits/sec, 0 packets/sec
  5 minute output rate 0 bits/sec, 0 packets/sec
     956 packets input, 193351 bytes, 0 no buffer
     Received 956 broadcasts, 0 runts, 0 giants, 0 throttles
     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
     0 watchdog, 0 multicast, 0 pause input
     0 input packets with dribble condition detected
     2357 packets output, 263570 bytes, 0 underruns
     0 output errors, 0 collisions, 10 interface resets
     0 babbles, 0 late collision, 0 deferred
     0 lost carrier, 0 no carrier
     0 output buffer failures, 0 output buffers swapped out
S3#

There could be an instance where you are interested in the tail end of this output that details where we can see things like dropped packets. The trick here is to find text on the line you are wanting to start the output from. For this example, I will use the "956 packets input" line

S3# show interface fastEthernet 0/1 | begin packets input
     956 packets input, 193351 bytes, 0 no buffer
     Received 956 broadcasts, 0 runts, 0 giants, 0 throttles
     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
     0 watchdog, 0 multicast, 0 pause input
     0 input packets with dribble condition detected
     2357 packets output, 263570 bytes, 0 underruns
     0 output errors, 0 collisions, 10 interface resets
     0 babbles, 0 late collision, 0 deferred
     0 lost carrier, 0 no carrier
     0 output buffer failures, 0 output buffers swapped out
S3# 

Begin will show everything after a certain point in the output. You see it used in the routing table "Begin gateway" as a method to exclude all the codes.


Others/Combination show commands

Hopefully, you are starting to see what each filter command can do at this stage.

  • Section can show you certain sections of configuration

  • Begin shows you configuration from a certain point onwards

  • Include and exclude do or do not display certain lines within configuration that match desired string.

Can we make further use out of these commands?


So here are a few scenarios that you may want to use different commands on.


Is the IP address configured on the Router?

R1# show run | include 10.1.2.1
 ip address 10.1.2.1 255.255.255.0
R1#
R1# show ip int br | include 10.1.2.1
GigabitEthernet0/0/0   10.1.2.1        YES manual up                    up 
R1#

Maybe you want to see the entry in a routing table for a specific route, rather than looking at all the information

R1#
R1#show ip route 10.2.3.0
Routing entry for 10.2.3.0/24
Known via "ospf 999", distance 110, metric 2, type intra area
  Last update from 10.1.2.2 on GigabitEthernet0/0/0, 00:00:21 ago
  Routing Descriptor Blocks:
  * 10.1.2.2, from 207.165.111.101, 00:00:21 ago, via GigabitEthernet0/0/0
      Route metric is 2, traffic share count is 1
R1#
R1# show ip route | include 10.2.3.0
O       10.2.3.0/24 [110/2] via 10.1.2.2, 00:00:07, GigabitEthernet0/0/0
R1#

Or specific protocol routes

R1#
R1#show ip route | include 110/
O       10.2.3.0/24 [110/2] via 10.1.2.2, 00:05:01, GigabitEthernet0/0/0
O       172.16.1.3/32 [110/3] via 10.1.2.2, 00:05:01, GigabitEthernet0/0/0
O       172.16.2.3/32 [110/3] via 10.1.2.2, 00:05:01, GigabitEthernet0/0/0
O       172.16.3.3/32 [110/3] via 10.1.2.2, 00:05:01, GigabitEthernet0/0/0
O*E2 0.0.0.0/0 [110/1] via 10.1.2.2, 00:05:01, GigabitEthernet0/0/0
R1#
R1#show ip route ospf
     10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
O       10.2.3.0 [110/2] via 10.1.2.2, 00:05:23, GigabitEthernet0/0/0
     172.16.0.0/32 is subnetted, 3 subnets
O       172.16.1.3 [110/3] via 10.1.2.2, 00:05:23, GigabitEthernet0/0/0
O       172.16.2.3 [110/3] via 10.1.2.2, 00:05:23, GigabitEthernet0/0/0
O       172.16.3.3 [110/3] via 10.1.2.2, 00:05:23, GigabitEthernet0/0/0
O*E2 0.0.0.0/0 [110/1] via 10.1.2.2, 00:05:23, GigabitEthernet0/0/0
R1#

Perhaps you want to see the OSPF configuration on the router.

R3#show running-config | section ospf
 ip ospf 999 area 0
router ospf 999
 router-id 33.33.33.33
 log-adjacency-changes
 passive-interface Loopback1
 passive-interface Loopback2
 passive-interface Loopback3
 network 172.16.1.0 0.0.0.255 area 0
 network 172.16.2.0 0.0.0.255 area 0
 network 10.2.3.0 0.0.0.255 area 0
R3#

It is good to note the highlighted area, what is this? it isn't part of the OSPF router configuration but is a section within running config related to ospf. It looks like an interface command. So here is a fun one. Stinging Pipes together.

R3#show running-config | section interface | ospf
interface Loopback1
 ip address 172.16.1.3 255.255.255.0
interface Loopback2
 ip address 172.16.2.3 255.255.255.0
interface Loopback3
 ip address 172.16.3.3 255.255.255.0
 ip ospf 999 area 0
interface GigabitEthernet0/0/0
 ip address 10.2.3.3 255.255.255.0
 duplex auto
 speed auto
interface GigabitEthernet0/0/1
 no ip address
 duplex auto
 speed auto
 shutdown
interface GigabitEthernet0/0/2
 no ip address
 duplex auto
 speed auto
 shutdown
interface Vlan1
 no ip address
 shutdown
router ospf 999
 router-id 33.33.33.33
 log-adjacency-changes
 passive-interface Loopback1
 passive-interface Loopback2
 passive-interface Loopback3
 network 172.16.1.0 0.0.0.255 area 0
 network 172.16.2.0 0.0.0.255 area 0
 network 10.2.3.0 0.0.0.255 area 0
R3# 

Although it does give more information than we need it is still good to be able to see which interface is also taking part in ospf (Loopback3). This is one example of stringing pipes, but you can use it in multiple places.



R1#show ip route | include 10.1.2.0|192.168.30.
C       10.1.2.0/24 is directly connected, GigabitEthernet0/0/0
     192.168.30.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.168.30.0/24 is directly connected, GigabitEthernet0/0/1.30
L       192.168.30.1/32 is directly connected, GigabitEthernet0/0/1.30
R1#
S2# show ip interface brief | include 0/3 |0/2 |0/10
FastEthernet0/2        unassigned      YES manual up                  up 
FastEthernet0/3        unassigned      YES manual up                  up 
FastEthernet0/10       unassigned      YES manual down                down 
GigabitEthernet0/2     unassigned      YES manual down                down 
S2#

is there a different between the above and this?

S2# show ip interface brief | include 0/3|0/2|0/10

Why do you think that is?

238 views0 comments

Recent Posts

See All

Comments


bottom of page