Monday, June 20, 2011

A great way to copy files on cisco routers without FTP

So some of the readers of this blog might already know this little trick, and what's more some of you might be surprised I didn't know about this until recently! Again props to Alastair my coworker, he has given me some great tips so far!

We are going to use a putty program to copy a file to our flash (could be an IOS or whatever you like really) without having to use FTP, simply over SSH, this is super useful for those times when:

1. You don't have an FTP server handy
2. Your behind NAT so you can't just start an FTP server
3. Your behind a restrictive firewall

How do? Easy,

First, go to putty and download this:

http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

Go to "PSCP.exe" and download it.

My recommendation is to put it in c:\windows\system32\ or somewhere else in your path, by doing this you can use when your in the command line at any path (it is a command line app)


Ok, next we need to add this simple command to your router:


PeterCCIE18371(config)#ip scp server enable


THE above command is the KEY command guys

Also, you will need to have aaa new-model enabled (you don't already? why not?) and make sure your AAA authorization network is OK, so for example:

aaa authorization network

You will also need to have SSH enabled, so make sure you have something like this under your VTY Lines:

line vty 0 15
exec-timeout 800 0
transport input telnet ssh
!

and make sure you have a crypto key generated

crypto key generate RSA modulus 1024


now with all that done, let's actually try a copy

go to a dos prompt and check this out:




C:\Temp>pscp -scp FILE.CSV admin@HOSTNAMEORIPHERE:FILE.CSV1
Using keyboard-interactive authentication.
Password:
FILE.CSV | 0 kB | 0.7 kB/s | ETA: 00:00:00 | 100%

replace HOSTNAMEORIPHERE with your IP address and you will see how it all works.

So there you have it! easy way to copy without FTP! Great isn't it!

Cheers
Pete






2 comments: