This command replaces the copy verify and copy verify flash commands.
Use the verify command to verify the checksum of a file before using it.
Each software image that is distributed on disk uses a single checksum for the entire image. This checksum is displayed only when the image is copied into flash memory; it is not displayed when the image file is copied from one disk to another.
Supported Platforms Other than the Cisco 7600 Series Router
Before loading or duplicating a new image, record the checksum and MD5 information for the image so that you can verify the checksum when you copy the image into flash memory or onto a server. A variety of image information is available on Cisco.com. For example, you can get the Release, Feature Set, Size, BSD Checksum, Router Checksum, MD5, and Publication Date information by clicking on the image file name prior to downloading it from the Software Center on Cisco.com.
To display the contents of flash memory, use the show flash command. The flash contents listing does not include the checksum of individual files. To recompute and verify the image checksum after the image has been copied into flash memory, use the verify command. Note, however, that the verify command only performs a check on the integrity of the file after it has been saved in the file system. It is possible for a corrupt image to be transferred to the router and saved in the file system without detection. If a corrupt image is transferred successfully to the router, the software will be unable to tell that the image is corrupted and the file will verify successfully.
To use the message-digest5 (MD5) hash algorithm to ensure file validation, use the verify command with the /md5 option. MD5 is an algorithm (defined in RFC 1321) that is used to verify data integrity through the creation of a unique 128-bit message digest. The /md5 option of the verify command allows you to check the integrity of a Cisco IOS software image by comparing its MD5 checksum value against a known MD5 checksum value for the image. MD5 values are now made available on Cisco.com for all Cisco IOS software images for comparison against local system image values.
To perform the MD5 integrity check, issue the verify command using the /md5 keyword. For example, issuing the verify flash:c7200-is-mz.122-2.T.bin /md5command will calculate and display the MD5 value for the software image. Compare this value with the value available on Cisco.com for this image.
Alternatively, you can get the MD5 value from Cisco.com first, then specify this value in the command syntax. For example, issuing the verify flash:c7200-is-mz.122-2.T.bin /md5 8b5f3062c4caeccae72571440e962233 command will display a message verifying that the MD5 values match or that there is a mismatch. A mismatch in MD5 values means that either the image is corrupt or the wrong MD5 value was entered.
Cisco 7600 Series Router
The Readme file, which is included with the image on the disk, lists the name, file size, and checksum of the image. Review the contents of the Readme file before loading or duplicating the new image so that you can verify the checksum when you copy it into the flash memory or onto a server.
Use the verify /md5 command to verify the MD5 signature of a file before using it. This command validates the integrity of a copied file by comparing a precomputed MD5 signature with the signature that is computed by this command. If the two MD5 signatures match, the copied file is identical to the original file.
You can find the MD5 signature that is posted on the Cisco.com page with the image.
You can use the verify /md5 command in one of the following ways:
- Verify the MD5 signatures manually by entering the verify /md5 filename command.
Check the displayed signature against the MD5 signature that is posted on the Cisco.com page.
- Allow the system to compare the MD5 signatures by entering the verify /md5 flash-filesystem:filenam expected-md5-signature command.
After completing the comparison, the system returns with a verified message. If an error is detected, the output is similar to the following:
Router# verify /md5 disk0:c6msfc2-jsv-mz 0f...Done! %Error verifying disk0:c6msfc2-jsv-mz Computed signature = 0f369ed9e98756f179d4f29d6e7755d3 Submitted signature = 0f
To display the contents of the flash memory, enter the show flash command. The listing of the flash contents does not include the checksum of the individual files. To recompute and verify the image checksum after the image has been copied into the flash memory, enter the verify command.
A colon (:) is required after the specified device.
Supported Platforms Other than Cisco 7600 Series Router
The following example shows how to use the verify command to check the integrity of the file c7200-js-mz on the flash memory card inserted in slot 0:
Router# dir slot0: Directory of slot0:/ 1 -rw- 4720148 Aug 29 1997 17:49:36 hampton/nitro/c7200-j-mz 2 -rw- 4767328 Oct 01 1997 18:42:53 c7200-js-mz 5 -rw- 639 Oct 02 1997 12:09:32 rally 7 -rw- 639 Oct 02 1997 12:37:13 the_time20578304 bytes total (3104544 bytes free)Router# verify slot0:c7200-js-mz Verified slot0:c7200-js-mz
In the following example, the /md5 keyword is used to display the MD5 value for the image:
Router# verify /md5 disk1: Verify filename ? c7200-js-mz ...Done!verify /md5 (disk1:c7200-js-mz) = 0f369ed9e98756f179d4f29d6e7755d3
In the following example, the known MD5 value for the image (obtained from Cisco.com) is specified in the verify command, and the system checks the value against the stored value:
Router# verify /md5 disk1:c7200-js-mz ? WORD Expected md5 signature <cr>router# verify /md5 disk1:c7200-js-mz 0f369ed9e98756f179d4f29d6e7755d3...Done!Verified (disk1:c7200-js-mz) = 0f369ed9e98756f179d4f29d6e7755d3
The following example shows how the output of the verify command was enhanced to show the hash value in addition to the entire hash image (CCO hash):
Router# verify disk0:c7200-js-mz%Filesystem does not support verify operationsVerifying file integrity of disk0:c7200-js-mz...Done!Embedded Hash MD5 :CFA258948C4ECE52085DCF428A426DCDComputed Hash MD5 :CFA258948C4ECE52085DCF428A426DCDCCO Hash MD5 :44A7B9BDDD9638128C35528466318183Signature Verified
Cisco 7600 Series Router
This example shows how to use the verify command:
Router# verify cat6k_r47_1.cbi...File cat6k_r47_1.cbi verified OK.
This example shows how to check the MD5 signature manually:
Router# verify /md5 c6msfc2-jsv-mz...Done! verify /md5 (disk0:c6msfc2-jsv-mz) = 0f369ed9e98756f179d4f29d6e7755d3
This example shows how to allow the system to compare the MD5 signatures:
Router# verify /md5 disk0:c6msfc2-jsv-mz 0f369ed9e98756f179d4f29d6e7755d3...Done! verified /md5 (disk0:c6sup12-jsv-mz) = 0f369ed9e98756f179d4f29d6e7755d3Router#
This example shows how to verify the compressed checksum of the Cisco IOS image:
Router# verify /ios disk0:c6k222-jsv-mz Verified compressed IOS image checksum for disk0:c6k222-jsv-mz