Using SNMP to Copy a New IOS Image
Problem
You want use SNMP to remotely upgrade a router’s IOS.
Solution
Before you can upload or download the router’s IOS image to a TFTP server, you have to set up a valid read-write SNMP community string:
Router#configure terminalEnter configuration commands, one per line. End with CNTL/Z. Router(config)#snmp-server communityORARWrwRouter(config)#end
Then you can download a copy of your router’s current IOS file to your TFTP server with the following Unix commands:
Freebsd%touchFreebsd%/tftpboot/c2600-jk9o3s-mz.122-7a.binchmod 666Freebsd%/tftpboot/c2600-jk9o3s-mz.122-7a.binsnmpset –v1 -cORARW Router.1.3.6.1.4.1.9.2.10.9.172.25.1.1enterprises.9.2.10.9.172.25.1.1 = "c2600-jk9o3s-mz.122-7a.bin" Freebsd%s c2600-jk9o3s-mz.122-7a.bin
Use the following commands to upload an IOS file from your TFTP server to the router’s flash memory:
Freebsd%chmod 666Freebsd%/tftpboot/c2600-jk9o3s-mz.122-7a.binsnmpset –v1 -cORARW Router.1.3.6.1.4.1.9.2.10.6.0 i1enterprises.9.2.10.6.0 = 1 Freebsd%snmpset –v1 -cORARWRouter.1.3.6.1.4.1.9.2.10.12.172.25.1.1senterprises.9.2.10.12.172.25.1.1 = "c2600-jk9o3s-mz.122-7a.bin" Freebsd%c2600-jk9o3s-mz.122-7a.bin
Discussion
The first example demonstrates how to use SNMP to force a router to download its IOS file to a TFTP server. Most TFTP servers will not accept an incoming transfer unless the destination file is world writable. On Unix computers, the touch command creates a file, and the chmod command gives ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access