At some point, it’s a good idea to conduct a router inventory to determine which routers you have as well as their models, RAM, Flash, IOS versions, and serial numbers. I mention the serial number specifically because you need it to both track your routers and to register for a Cisco SMARTnet service contract.

How do you collect these numbers without physically going to each and every router in your organization? Here’s how to determine those serial numbers remotely.

Issues to consider

One challenge with determining the serial number of your router is that there are so many different serial numbers — the processor board ID, serial numbers on every interface card, the chassis serial number, and many others.

In some cases, you may even find that none of the serial numbers that you find by connecting to the router actually match the serial number on the sticker on the outside of the router. In addition, the results that you get will vary from router platform to router platform.

On newer routers such as the Cisco 2800 Series and 3800 Series, the serial number on the outside of the router, the processor ID, and the hardware chassis serial number are all the same. Even better, you can access this unique number via Telnet, SSH, or SNMP.

On the other hand, older routers make things more confusing. For example, if you have a Cisco 2500 Series router, you can’t find the number on the sticker on the outside of the router by connecting to the device over the network. In fact, I opened up a Cisco TAC case, and they told me this was “by design.”

One workaround to this issue is to manually enter the physical serial number from the outside of the router into the configuration of the router. That way, you can access it via SNMP.

You can manually set the chassis serial number using the following command:

snmp-server chassis-id

For more information, check out “How To Collect Chassis Information (including the Chassis Serial Number) For Routers And Catalyst Switches Using SNMP” on Cisco’s Web site.

How do I find the serial numbers?

Here are three options for remotely retrieving serial numbers over the network. These solutions assume that you have a newer router in which the output of the serial number from the IOS matches the physical router serial number, that you have programmed the serial number into the IOS, or that you are comfortable using the serial number that the IOS provides.

Due to the varied number of routers and the varied functionality in the router IOS between versions and router models, I can’t guarantee that the following steps will work on your router or in your IOS. While I have searched for a slick, easy method to retrieve router serial numbers across all router models and IOS versions, I haven’t come across a solution yet.

Option 1: Telnet or SSH

The easiest way to retrieve the serial numbers from your router is to Telnet or SSH to the router and use the show inventory command. Here’s a sample of the output:

Router# show inventory

NAME: "3845 chassis", DESCR: "3845 chassis, Hw Serial#: FBX0943A51E, Hw Revision: 1.0" PID: CISCO3845 , VID: V01 , SN: FCC01235BXN

NAME: "c3845 Motherboard with Gigabit Ethernet", DESCR: "c3845 Motherboard with Gigabit Ethernet" PID: CISCO3845-MB , VID: V02 , SN: FSC0921215M

NAME: "Clear/Subrate T3/E3 WAN", DESCR: "Clear/Subrate T3/E3 WAN" PID: , VID: 1.0, SN: FVC09234ABM

The chassis hw serial# section designates the serial number that is physically on the router.

Option 2: Use SNMP from the command line

You can retrieve the same chassis hardware serial number from the command line using simple network management protocol (SNMP). I did this in Windows XP by downloading two free utilities, using a text file as my source list of routers, and writing a short windows .bat file to process it for me. (If you have Linux, you should already have the snmp-get command and awk command available.)

To begin, download the Net-SNMP tools so you can use the snmpget command. You can use this tool to get the chassis hw serial# information from a single router with a single command. Here’s an example:

snmpget -v1 -c communitystring hostorIP mib-2.47.1.1.1.1.11.1

The output looks like this:

SNMPv2-SMI::mib-2.47.1.1.1.1.11.1 = STRING: "FDC01235PAN"

If you want to write a batch file to automate the process, follow these steps:

  1. Download Gawk for Windows (awk) to parse the output from the snmpget command.
  2. Install both tools in the same directory.
  3. Create a text file that lists the router hostnames or IP addresses; name it Routers.txt.
  4. Put the following in a batch file (I called mine Getsnscript.tx) and run it:
@echo off
for /F %%1 in ('type routers.txt') do snmpget -v1 -c cisco %%1 mib-2.47.1.1.1.1.11.1 | awk -F" " "{ print $4 }"

The output might look something like this:

C:netsnmpbin> getsnscript.bat

"FO234C35PXN"

"FTX093431P1"

"FO234C35PXN"

If you want, you can redirect it to a text file and import that text file to a spreadsheet. Of course, you can also get much more complex with the script and retrieve more information.

For more information on the SNMP string I used, check out the Cisco’s Unique Device Identifier Retrieval Web page.

Option 3: Use SNMP from a GUI application

Of course, there are always GUI applications that can accomplish the same thing as CLI scripts. I’ve found that Kiwi CatTools (freeware for up to five devices) does a fine job of retrieving the serial number of routers and provides a nice inventory. Figure A offers a snapshot of the Kiwi CatTools output.

Figure A

In addition, I checked with PacketTrap, and its pt360 Tool Suite will begin supporting this feature in the next release. Perhaps there are other applications out there that you’ve used before. If so, please share them in the discussion area.

Another thought I had was to write a TCL script to retrieve serial numbers. However, since I’m not a TCL programmer, this probably isn’t the best option for me.

Conclusion

If your routers are newer and the results of the show inventory command are accurate, you should be able to easily retrieve your router’s proper chassis serial number remotely over the network. However, with older models, you may have to first manually enter the router serial number into the IOS to be able to remotely retrieve it.

Inventorying your routers’ serial numbers is an important activity that every network administrator needs to be able to do — both to keep track of what you have and to properly register for support and maintenance from Cisco Systems.

Want to learn more about router and switch management? Automatically sign up for our free Cisco Routers and Switches newsletter, delivered each Friday!

Subscribe to the Developer Insider Newsletter

From the hottest programming languages to commentary on the Linux OS, get the developer and open source news and tips you need to know. Delivered Tuesdays and Thursdays

Subscribe to the Developer Insider Newsletter

From the hottest programming languages to commentary on the Linux OS, get the developer and open source news and tips you need to know. Delivered Tuesdays and Thursdays