Now that you’ve had an introduction to IOS and learned about the IOS modes in the command-line interface (CLI), it’s time to get our hands dirty in the CLI. We’ll cover the structure and syntax of IOS commands then play with some basic commands to learn how to gather information about our devices.
The Syntax of IOS Commands
If you’ve ever typed commands into a command-line, whether it was DOS, a Windows command prompt, Linux, or any other, you already know that there’s a specific syntax that commands must adhere to. Cisco IOS is no different and, in addition, most commands must be issued in specific IOS modes.
Commands are typically one word and followed by one or more arguments or parameters. In Cisco CLI: IOS Modes, you saw the enable and disable commands. You also saw configure terminal but, in this case, configure was the command and terminal was a parameter.
Let’s jump right in and learn some real commands, shall we?
The first command you’ll learn, show, is used probably more than any other. We use the show command, along with various parameters, to display information about the device we’re working with.
You might remember from Introduction to Cisco Devices and Cisco IOS that a device has both a running configuration and a startup configuration. We can examine the complete running configuration of a router or switch by issuing the show running-configuration command.
Oh, remember how we said that some commands can only be issued in specific modes? Well, this is one of ‘em. First, let’s try to issue this command from user exec mode and see what happens.
Router> show running-configuration ^ % Invalid input detected at '^' marker. Router>
The router didn’t like that very much, did it? That’s because we need to be in privileged exec mode to issue this command. Real quick, though, note that the caret symbol (^) is pointing at the “u” in the word “running”. This is IOS’ way of telling us where the error in our command is.
Alright, let’s go ahead into privileged exec mode and try again.
Router> enable Router# show running-configuration Building configuration... Current configuration : 743 bytes ! version 12.4 service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname Router ! ! no aaa new-model no network-clock-participate slot 1 no network-clock-participate wic 0 ip cef ! ... ! line con 0 line aux 0 line vty 0 4 ! end
I’ve truncated the output above because it’s a few pages long and, honestly, the output isn’t really important at this point. What’s important is that, this time, the router happily executed our command for us.
NOTE: You may have noticed the line that reads hostname Router. That’s the part of the configuration that tells our router what it’s hostname is and, thus, controls how the prompt reads. You’ll learn how to change it in Assigning Hostnames to Cisco Devices.
In the show running-configuration command, show is the command and running-configuration is a parameter, if we want to get technical. There are several other parameters we can pass to the show command. In practice, though, most people (including myself), refer to the whole thing as the command itself (like when we say “run the show version command”).
The show version command provides us with a lot of useful information about the particular device that we’re working with. Unlike show running-configuration, however, we can issue this command from either user exec mode or privileged exec mode.
Router> show version Cisco IOS Software, C2600 Software (C2600-ADVENTERPRISEK9-M), Version 12.4(10a), RELEASE SOFTWARE (fc2) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2006 by Cisco Systems, Inc. Compiled Wed 11-Oct-06 18:15 by prod_rel_team ROM: System Bootstrap, Version 12.2(7r) [cmong 7r], RELEASE SOFTWARE (fc1) Router uptime is 5 hours, 39 minutes System returned to ROM by power-on System image file is "flash:c2600-adventerprisek9-mz.124-10a.bin" This product contains cryptographic features and is subject to United States and local country laws governing import, export, transfer and use. Delivery of Cisco cryptographic products does not imply third-party authority to import, export, distribute or use encryption. Importers, exporters, distributors and users are responsible for compliance with U.S. and local country laws. By using this product you agree to comply with applicable laws and regulations. If you are unable to comply with U.S. and local laws, return this product immediately. A summary of U.S. laws governing Cisco cryptographic products may be found at: http://www.cisco.com/wwl/export/crypto/tool/stqrg.html If you require further assistance please contact us by sending email to email@example.com. Cisco 2610XM (MPC860P) processor (revision 1.0) with 127627K/3445K bytes of memory. Processor board ID JAD06270JTQ M860 processor: part number 5, mask 2 1 FastEthernet interface 4 Serial(sync/async) interfaces 32K bytes of NVRAM. 49152K bytes of processor board System flash (Read/Write) Configuration register is 0x2102 Router>
Whoa, there’s a lot of information in there! A lot of this is always the same regardless of which IOS software (feature set and version) you’re using, but some of it will vary. Let’s examine some of it and see what it’s telling us.
Cisco IOS Software, C2600 Software (C2600-ADVENTERPRISEK9-M), Version 12.4(10a), RELEASE SOFTWARE (fc2)
This first line by itself actually tells us a lot about the router. We can tell that it’s running version 12.4(10a) of the Advanced Enterprise Services feature set. Because some features exist only in certain feature sets or in specific versions, knowing this information can come in real handy.
Router uptime is 5 hours, 39 minutes
This line tells us how longer the router has been running. This value is reset either when the power is turned off or the device is reloaded (rebooted). In this case, the router is part of my home Cisco lab and had been turned off. I turned it on about five hours and 39 minutes ago.
System image file is "flash:c2600-adventerprisek9-mz.124-10a.bin"
This line tells us that the IOS software we’re running is stored in flash and the filename is “c2600-adventerprisek9-mz.124-10a.bin”. This helps us differentiate between IOS files when we have more than one.
Cisco 2610XM (MPC860P) processor (revision 1.0) with 127627K/3445K bytes of memory.
This line tells us what type of hardware the router is and how memory it is equipped with. This router is a Cisco 2610XM and has 128 MB (127627+3445/1024) of RAM. There’s a reason the amount of memory is split up into two parts, but it’s not important to us right now.
1 FastEthernet interface 4 Serial(sync/async) interfaces
This router is equipped with one Fast Ethernet (100 Mbps) interface and four serial interfaces.
32K bytes of NVRAM.
You might remember that the router’s startup configuration is stored in NVRAM. This line tells us that there is 32 Kbytes of NVRAM available, thus our startup configuration cannot be larger than this.
49152K bytes of processor board System flash (Read/Write)
This router has 48 MB of flash available for storage of IOS files (referred to as IOS images). We can store multiple IOS images in flash but, combined, they cannot exceed 48 MB.
Configuration register is 0x2102
We’ll look at configuration registers later (such as when we perform password recovery), but for now just know that 0×2102 is the “normal” setting.
As you can see, there’s a wealth of information to be obtained from that simple command. Let’s go ahead and look at two more that you’ll use over and over again.
show ip interface brief
This command gives us detailed information about the interfaces in the device in a summarized form. Let’s go ahead run it and then examine the output.
Router> show ip interface brief Interface IP-Address OK? Method Status Protocol FastEthernet0/0 unassigned YES unset administratively down down Serial0/0 unassigned YES unset administratively down down Serial0/1 unassigned YES unset administratively down down Serial0/2 unassigned YES unset administratively down down Serial0/3 unassigned YES unset administratively down down Router>
Remember that the output of show version told us there was one fast ethernet and four serial interfaces present in the router? Here we are given a list of all of them as well as status information. Because this router hasn’t been configured, though, there really isn’t much to see.
From this one command, we see all the interfaces present in router as well as their IP addresses, how the IP address was configured, and more. The information in the last two columns is probably the most important, but don’t worry about it right now. We’ll cover all of it in detail later, just remember that values of “up” for Status and Protocol are usually what you want to see (if you expect the interface to be working, that is!).
The last command we’ll look at, for now, is the show interface command. My lab router hasn’t been configured and isn’t connected to a network at this point so the output from this command would be pretty boring. Because of that, I’ve “borrowed” one of AT&T’s routers for this (note that this is a special-purpose router called a “route server”; it doesn’t actually route any data traffic across the Internet).
NOTE: show interface shows the below information for each interface. By supplying an interface name as a parameter, we can limit the output to a single interface, which is what I’ve done in the example below.
route-server> show interface gigabitethernet 0/1 GigabitEthernet0/1 is up, line protocol is up Hardware is BCM1250 Internal MAC, address is 000c.cf58.141b (bia 000c.cf58.141b) Internet address is 18.104.22.168/24 MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec, reliability 255/255, txload 1/255, rxload 1/255 Encapsulation ARPA, loopback not set Keepalive set (10 sec) Full Duplex, 100Mbps, RJ45, media type is RJ45 output flow-control is unsupported, input flow-control is XON ARP type: ARPA, ARP Timeout 04:00:00 Last input 00:00:00, output 00:00:00, output hang never Last clearing of "show interface" counters never Input queue: 13/75/155/0 (size/max/drops/flushes); Total output drops: 3 Queueing strategy: fifo Output queue: 0/40 (size/max) 5 minute input rate 37000 bits/sec, 53 packets/sec 5 minute output rate 36000 bits/sec, 48 packets/sec 81061386 packets input, 64337252 bytes, 37 no buffer Received 12787584 broadcasts (0 IP multicasts) 0 runts, 0 giants, 47 throttles 0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored 0 watchdog, 5201551 multicast, 0 pause input 73385207 packets output, 2890621557 bytes, 0 underruns 1 output errors, 0 collisions, 3 interface resets 0 babbles, 0 late collision, 0 deferred 1 lost carrier, 0 no carrier, 0 PAUSE output 0 output buffer failures, 0 output buffers swapped out route-server>
As you can see, there’s a lot of information returned from this command. For now, I’ll just explain a few parts of it. We’ll look at this output in much more depth later.
Internet address is 22.214.171.124/24
The IP address assigned to the GigabitEthernet 0/1 interface is 126.96.36.199.
Full Duplex, 100Mbps, RJ45, media type is RJ45
Even though this interface is capable of 1 Gbps, it is currently only operating at 100 Mbps. It is capable of sending and receiving data simultaneously (full-duplex) and is using an RJ45 connector (knowing that, we can assume that it’s likely using Category 5 or Category 6 cabling, as opposed to fiber-optics).
5 minute input rate 37000 bits/sec, 53 packets/sec 5 minute output rate 36000 bits/sec, 48 packets/sec
Over the last five minutes, there has been an average of 37,000 bits per second and 53 packets per second arriving on this interface. In addition, an average of 36,000 bits per second and 48 packets per second have been sent out the interface.
81061386 packets input, 64337252 bytes, 37 no buffer
Since the counters were last cleared (which happened, in this case, when the router was last powered on or reloaded), a total of 81,061,386 packets have arrived on the interface. Altogether, those packets accounted for 64,337,252 bytes of traffic.
73385207 packets output, 2890621557 bytes, 0 underruns
Likewise, 73,385,207 packets have been sent out the interface, accounting for 2,890,621,557 bytes of traffic.
In this article, you were introduced to some basic commands in Cisco IOS in order to get a feel for the command-line interface. Next, we’ll look at IOS’ Context-Sensitive Help for those times when you just can’t remember the right command or parameter.