Copy Running Config in One Line on Cisco

ciscocisco-iosswitch

I want to make a script to copy the running config of a switch 4506 in one line.
So far, I see two option :

copy run tftp:

sw#copy run tftp://10.0.0.1/cfg.cfg
Address or name of remote host [10.0.0.1]? 
Destination filename [cfg.cfg]? 

Cons: need confirmation, press enter.

Info : I have define the ip tftp source-interface Vlan10 with management vlan to have connectivity.

or

show running-config | redirect tftp://10.0.0.1/run-R1.cfg

sw#show running-config | redirect tftp://10.0.0.1/run-R1.cfg
.....
%Error opening tftp://10.0.0.1/run-R1.cfg (Timed out)
sw#sh ip route 10.0.0.1 
% Subnet not in table

Cons: the ip source of the redirect is an private IP 172.16.0.2 due this is a transit subnet. So no connectivity with the outgoing interface IP but connectivity with the managment subnet. as you can see below.

sw#ping 10.0.0.1 source vlan 10    
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.0.1, timeout is 2 seconds:
Packet sent with a source address of 172.16.0.2 
.....
Success rate is 0 percent (0/5)
sw#ping 10.0.0.1 source vlan 11
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.0.1, timeout is 2 seconds:
Packet sent with a source address of <Public_IP> 
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/6/8 ms
sw#

ip tftp source-interface Vlan10 does not help with redirect

Questions :
– Is there the possibility of no confirmation copy with 'copy run tftp:' ?
– How can I define for all packet sourced on switch should be sourced with a defined IP ?

Best Answer

Try turning file prompt behavior to quiet.

6506(config)#file prompt quiet
6506(config)#end
6506#copy run tftp://192.168.1.1/file.txt
.....