Wednesday, March 30, 2011

Setting default FTP username and password in Cisco's IOS

In an earlier post I discussed how to setup a kron job to push the running configuration out to a ftp server. One thing I didn't mention was what to do if the ftp server does not allow anonymous access. Well you can pre-configure the IOS the FTP username and password along with other options as well. See below:

Examples:
ip ftp username SomeUserName
ip ftp password SomePassword
ip ftp passive
ip ftp source-interface SomeInterface

Router(config)#ip ftp ?
  passive           Connect using passive mode
  password          Specify password for FTP connections
  source-interface  Specify interface for source address in FTP connections
  username          Specify username for FTP connections

Before configurating the FTP username and password:

Router#copy running-config ftp:
Address or name of remote host []? 10.1.1.1
Destination filename [Router-confg]?
Writing Router-confg
%Error writing ftp://10.1.1.1/Router-confg (Incorrect Login/Password)
Router#

With FTP configured:

Router(config)#ip ftp username backup
Router(config)#ip ftp password backuppass

Router#copy running-config ftp:
Address or name of remote host []? 10.1.1.1
Destination filename [Router-confg]?
Writing Router-confg !
7062 bytes copied in 1.020 secs (6924 bytes/sec)
Router#

This will also work with the cli command as part of a kron policy list.

example:

Rourter(config-kron-policy)#cli cli show run | redirect tftp://10.1.1.1/test.cfg
With the FTP username and password set above this command will now work with a username and password.

No comments:

Post a Comment