O'Reilly logo

Cisco IOS Cookbook, 2nd Edition by Ian Brown, Kevin Dooley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Copying an IOS Image Through the Console

Problem

You want to load an IOS image into your router through a serial connection to the console or AUX ports.

Solution

You can use the following set of commands to copy an IOS image onto a router through either the console or the AUX port:

Router1#copy xmodem: slot1: 
                        **** WARNING ****
x/ymodem is a slow transfer protocol limited to the current speed
settings of the auxiliary/console ports. The use of the auxilary
port for this download is strongly recommended.
During the course of the download no exec input/output will be
available.
                        ---- ******* ----


Proceed? [confirm] <enter>
Destination filename []? c3620-ik9s-mz.122-12a.bin
Erase slot1: before copying? [confirm] <enter>
Use crc block checksumming? [confirm] <enter>
Max Retry Count [10]: <enter>
Perform image validation checks? [confirm] <enter>
Xmodem download using crc checksumming with image validation
Continue? [confirm]  <enter>
Ready to receive file...........CC  <start xmodem file transfer here>
4294967295 bytes copied in 1450.848 secs (1271445669961 bytes/sec)
Router1#

Tip

Cisco highly recommends using the AUX port for this procedure rather than the console port because the AUX port supports hardware flow control.

Discussion

It can be quite useful to be able to load an IOS image through a serial connection, particularly if you don’t have access to a TFTP server, or if the router doesn’t have any accessible LAN interfaces. Although this feature is rarely used, Cisco does support xmodem and ymodem file transfers through a serial connection.

We also recommend enabling the CRC checksum feature when you use xmodem to download an IOS image through a serial connection. This will help ensure the integrity of the file transfer.

We should stress that this process can be extremely slow. Don’t even attempt to download an IOS image at the default speed of 9,600 bps unless you have an entire day to kill. We highly recommend increasing the speed to the highest value that your terminal emulation package will support. We have found that 115,200 bps provides the maximum throughput with the most reliability. The speed command allows you to change the speed of an asynchronous serial port:

Router1#configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.
Router1(config)#line aux 0
Router1(config-line)#speed 115200
Router1(config-line)#end
Router1#

In this example, we used Hyperterminal because it is included with the Windows operating system. However, almost any terminal emulation program that supports xmodem or ymodem protocols will work. In fact, we have found significant differences in download times between the various emulation packages, and Hyperterminal tends to be one of the slowest. Other packages such as ProComm tend to be somewhat faster. But they all work.

Even after we increased the speed of the Aux port to 115,200 bps, the file transfer took nearly 25 minutes to complete. By comparison, loading the same IOS version via TFTP through an Ethernet connection took less than four minutes. So, in general, we don’t recommend using this method unless you can’t use TFTP for some reason.

The first step, once you have a copy of the IOS image on your computer, is to connect to the router’s AUX port. Set the line speed to 115,200 bps on both the console port and the terminal emulator, and issue the copy command. The router will prompt you to begin the file transfer with the text “Ready to receive file.”

At this point, you should begin your file transfer protocol. If you are using Hyperterminal, select the “Transfer” drop-down menu, and then click on “Send-file.” It will prompt you for the file name and location, and protocol type. Enter the name of the IOS image, and then select “Xmodem” to start the file transfer.

During the file transfer, the connection is busy transferring the file, so the router can’t display any messages. This is normal. However, most terminal emulator programs provide a status window to let you keep track of the file transfer.

When the transfer is complete, the terminal emulator will drop out of the file transfer mode and the router will put up its normal prompt again. At this point, we highly recommend checking the new IOS image to make sure that it copied successfully. You can verify the file size as follows:

Router1#show slot1:

PCMCIA Slot1 flash directory:
File  Length   Name/status
  1   11922512  c3620-ik9s-mz.122-12a.bin  
[11922576 bytes used, 4592496 available, 16515072 total]
16384K bytes of processor board PCMCIA Slot1 flash (Read/Write)

In this case, we loaded the image into the PCMCIA device in slot 1. If you put the image somewhere else, such as the internal flash memory, you would use the command show flash: instead.

If the file size is correct, check the image’s checksum by using the verify command:

Router1#verify slot1:c3620-ik9s-mz.122-12a.bin  
Verified slot1:c3620-ik9s-mz.122-12a.bin
Router1#

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required