Copy IOS between routers


This is one of those small Cisco features which you be useful to some of you and it’s not really good documented on the internet from what I’ve noticed, besides as you know for instance when you’re in Data Centre or in another country or a continent for that matter and by accident you realised that you forgot to take your memory stick with you from your office with a device IOS image on it and it just happens to be that you must upgrade/downgrade or simply upload a different  IOS onto a device right away otherwise you’d better not come back to the office , well then you know you have a small problem 🙂

If you have your Cisco account associated with your Company I guess you can always download an image from Cisco website but what if you don’t have any internet access , it’s 4am in the morning and your network has to be up and running by 5am !! Believe these kind of things happen very often and you’ve got experience them 🙂

As simple thing as this can cause a major network downtime for your local or one of the remote offices.

We all make mistakes and the idea is to learn from them because it seems like when you know your way around Cisco IOS then there’s always a solution.

So here we go! You’re in New York and must immediately upload new code of IOS onto the New York router so it matches for whatever reason Tokyo version code (your workmates in London can do it in their own time 🙂

IOS_COPYYou have OSPF running across

You telnet or SSH to your Tokyo router from New York and :

STEP 1
Enable web service
Tokyo(config)#ip http server

TEST
New_York#telnet 150.1.20.0 80
Trying 150.1.20.0, 80 … Open

sdasd
HTTP/1.1 400 Bad Request
Date: Fri, 01 Mar 2002 00:31:26 GMT
Server: cisco-IOS
Accept-Ranges: none

400 Bad Request
[Connection to 150.1.20.0 closed by foreign host]

 

We see that we have a connection from New York to Tokyo open on port 80
I’ve typed in some gibberish “sdasd” just to close the connection which is the reason of the “HTTP/1.1 400 Bad Request” output

 

 

 

STEP2
Set http path to be the base file system on flash as this is most likely where Tokyo router will have its image stored for instance c3745-adventerprisek9-mz.124-12.bin
Tokyo(config)#ip http path flash:

 

 

 

STEP3
The user who is going to be doing a transfer must be at privilage level 15 because with web interface you have to have enable mode access in order to get to it
Tokyo(config)#username CISCO password CISCO123
Tokyo(config)#username CISCO privilege 15

 

 

STEP4
Last step let’s copy the image from Tokyo over to New Yorks router flash:

New_York#copy http://CISCO:CISCO123@150.1.20.0/c3745-adventerprisek9-mz.124-12.bin flash:
Destination filename [c3745-adventerprisek9-mz.124-12.bin]?
Erase flash: before copying? [confirm]
Erasing the flash filesystem will remove all files! Continue? [confirm]
Erasing device… eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee …erased
Erase of flash: complete
Loading http://*****:********@150.1.20.0/c3745-adventerprisek9-mz.124-12.bin !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

 

 

Done ! Now you can use this image to boot your router !

 

You can erase the flash as you can see prior to the transfer like I did but depending on the memory on your device you can do either way

Simple stuff and you never know when you’re going to need it

Unfortunately  you won’t be able to use this feature on your GNS3 because GNS3 looks for an image on your PC via tftp and then it loads it when you start your routers but I highly recommend you quickly set it up a lab your office and see what happens. Of course you can test it on your company’s production network but I would not recommend it unless you know exactly what’s going to happen to the traffic if something goes wrong !

TIP : I’ve used /31 subnet mask and assigned ip addresses as per diagram just in case you were not sure if it’s possible !

Enjoy!
Tom

 

 

Advertisements

About ccie4all
Hello, and welcome to the first post of my CCIE blog This blog has got one simple goal and that is to improve our skills in Cisco Networking field so we can become best engineers on a job market. Wordpress Blog https://ccie4all.wordpress.com/ information about the changes made to Gns3 BGP , MPLS and R&S CCIE labs. In order to access and download all provided materials and receive important updates from Gns3 BGP , MPLS and R&S CCIE labs under GNS3 tab in the main header please go ahead and subscribe to https://ccie4all.wordpress.com/ ! All other posts have not been affected and can be accessed at any given time. Enjoy ! Tom

4 Responses to Copy IOS between routers

  1. Praveen says:

    Hi Tom,

    wonderful share have only one doubts…pls explain how we use URL part in copy statement…like http://cisco:cisco@123@ so on i couldn’t understand how u decide this URL pls explain

    • ccie4all says:

      Hello Praveen,

      Thanks so much ! It has saved my life a few times !

      The way we do it is :
      copy http://CISCO:CISCO123@150.1.20.0/c3745-adventerprisek9-mz.124-12.bin flash:
      and this means :
      please copy from a http:// enabled device that use a local username of CISCO followed by a password of CISCO123 (@ means from) ip address 150.1.20.0 which in our case is Tokyo router fa0/0 address (by configuring ip http path flash: on Tokyo the router will go and look directly to its flash directory) and look for an image which in our case is c3745-adventerprisek9-mz.124-12.bin and the last bit flash: means , please send whatever you’ve copied onto our flash directory

      copy = copy
      http:// = from http enabled devise im trying to reach
      CISCO = local username of the remote device
      CISCO123 = local password of the remote device
      @ = from the remote device with ip address (see below)
      150.1.20.0 = remote device ip address we want to copy stuff from
      c3745-adventerprisek9-mz.124-12.bin = IOS image we want to copy from the remote device
      flash: = into our flash directory (in our case New York router)

      Hope this helps !!

      The syntax is pretty straightforward but I totally understand that when it comes to Cisco stuff all of us need to something more than a few times before it becomes logical , I’m on the same boat 🙂

      Best !
      Tom

  2. Baynetwork says:

    cannot seem to scp IOS files between routers (sup720s, SRB2 code). Am … Here I try copying from R2 to R1, R1 initiates the connection. how to take ios backup in cisco router, Networking Tips and Tricks, how to take ios … Check ping status between router and your TFTP server .

    • ccie4all says:

      Hello Baynetwork,

      There are some caveats for Cisco IOS Release 12.2(33)SRB through 12.2(33)SRB6 but as far as I can tell none of them is realated to Secure Copy not working. One of the caveats regarding SCP is that IOS software contains a vulnerability that could allow authenticated users with an attached CLI interface to transfer files to and from a Cisco IOS device that is configured to be an SCP server and there are no workarounds available for this vulnerability apart from disabling either the SCP server or the CLI view feature if these services are not required by administrators.

      Are you trying to copy IOS via TFTP or HTTP ? I take you’ve enabled locally relevant service on one of the routers, either http or tftp ? If http are you able to telnet to your “server router” on port 80 ? If tftp do you point to the correct directory when trying to copy IOS ?

      Best
      Tom

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: