HOWTO: Multiple | includes with Cisco IOS

I have found it quite useful in the past to use multiple includes when searching for information on Cisco devices. Recently, I noticed a customer who had a port down in a port-channel. I then wanted to know what other port-channels had only 1 member, indicating something was down. For something like this, multiple includes become very handy. A normal “show interface gives way too much information.

rtra#sh int port-channel 1
Port-channel1 is up, line protocol is up (connected)
Hardware is EtherChannel, address is 0019.e8f7.9b9a (bia 0019.e8f7.9b9a)
Description: po1.rtrb
MTU 1500 bytes, BW 3000000 Kbit, DLY 10 usec,
reliability 255/255, txload 91/255, rxload 90/255
Encapsulation ARPA, loopback not set
Full-duplex, 1000Mb/s, link type is auto, media type is unknown
Media-type configured as  connector
input flow-control is off, output flow-control is unsupported
Members in this channel: Gi1/0/1 Gi1/0/26 Gi2/0/3
ARP type: ARPA, ARP Timeout 04:00:00
Last input never, output 00:00:00, 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)
30 second input rate 1070140000 bits/sec, 144160 packets/sec
30 second output rate 1072744000 bits/sec, 156507 packets/sec
1671100505275 packets input, 1585187716875702 bytes, 0 no buffer
Received 25759047 broadcasts (0 multicasts)
183 runts, 0 giants, 0 throttles
183 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
0 watchdog, 25759047 multicast, 0 pause input
0 input packets with dribble condition detected
1816857829511 packets output, 1585976492275229 bytes, 0 underruns
0 output errors, 0 collisions, 3 interface resets
0 babbles, 0 late collision, 0 deferred
0 lost carrier, 0 no carrier, 0 PAUSE output
0 output buffer failures, 0 output buffers swapped out
In my case, the multiple includes would work perfectly and give me just the information I wanted. Here is what I would do:

rtra#show interface | i Port-channel|Member
Port-channel1 is up, line protocol is up (connected)
Members in this channel: Gi1/0/1 Gi1/0/26 Gi2/0/3
Port-channel2 is up, line protocol is up (connected)
Members in this channel: Gi1/0/28 Gi2/0/7 Gi2/0/27
Port-channel3 is up, line protocol is up (connected)
Members in this channel: Gi1/0/13
Port-channel4 is down, line protocol is down (notconnect)
Port-channel5 is up, line protocol is up (connected)
Members in this channel: Gi1/0/17
Port-channel6 is up, line protocol is up (connected)
Members in this channel: Gi1/0/14 Gi2/0/14
As you can see, the information was greatly reduced and it was only exactly what I wanted. This way, I can tell which port-channels are having a possible issue because they only have 1 member. Another good example is for seeing interface name and duplex/speed settings.

switch-a#sh int | i Gig|duplex
GigabitEthernet1/1 is up, line protocol is up (connected)
  Full-duplex, 100Mb/s, media type is 10/100/1000BaseT
GigabitEthernet1/2 is down, line protocol is down (notconnect)
  Auto-duplex, Auto-speed, media type is 10/100/1000BaseT
GigabitEthernet1/3 is up, line protocol is up (connected)
  Full-duplex, 1000Mb/s, media type is 10/100/1000BaseT
GigabitEthernet1/4 is up, line protocol is up (connected)
  Full-duplex, 1000Mb/s, media type is 10/100/1000BaseT
GigabitEthernet1/5 is up, line protocol is up (connected)
  Full-duplex, 1000Mb/s, media type is 10/100/1000BaseT
GigabitEthernet1/6 is up, line protocol is up (connected)
  Full-duplex, 1000Mb/s, media type is 10/100/1000BaseT

As you can see the possibilities are endless and only limited by your needs at any given time. If you have any questions or comments, please feel free to contact me.

This entry was posted in How-to. Bookmark the permalink.

One Response to HOWTO: Multiple | includes with Cisco IOS

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>