Sunday, July 10, 2011

Putty & SCP => File transfer to Cisco IOS through SSH Tunnel

Had the problem that I had to update an IOS Device with only SSH access available. Solution is to use SCP over a SSH Tunnel.

To do this, go to Change settings =>  Connection => SSH => Tunnels. Replace with the IP you want to connect to. Before you define the local port, you should verify that it's unused. Doesn't need to be 22 on local side.

 Remember to press the Add button before clicking Apply. Otherwise your settings will be lost.

Next check in a DOSs box the listening TCP ports. After entering "netstat -an -p TCP" you should find an entry like "  TCP               Listening".

Now you have to prepare the router for SCP connection. The device should already be reachable via SSH.

Enter this in your router config:

aaa new-model
aaa authentication login default local
aaa authorization exec default local
username scp secret password
ip scp server enable

That's it! Now you can move files to & from your device. I prefer to use the Putty SCP client pscp.

Copy files from flash:
pscp -scp -pw password scp@ "C:\Users\andre\Downloads\test.pcap"
test.pcap             | 30 kB |  30.6 kB/s | ETA: 00:00:00 | 100%

Copy files to flash:
pscp -scp -pw password "C:\Users\andre\Downloads\cme-151-4Mv1\cme-151-4Mv1\CME 8.6\CME 8.6.0 GUI\CME8.6.0GUI.tar" scp@

This works for all TCP based protocols. Makes life a lot easier ....

Cisco link for SCP:

No comments: