Copy From switch or router to TFTP Server

wylewyle Member Posts: 5 ■□□□□□□□□□
http://www.cisco.com/public/technotes/smbsa/en/us/general/tftp.pdf
Cisco doc in above link was giving a clear step by step guidance for setting up TFTP server. However, the author skipped a very important step - did not provide the command in step#3.
So far I have installed 3 tftp servers softwares, and one ftp in 5 days, in which None of them worked! So I followed this Cisco doc to get an a to z solutions.
Unfortunately, I was tricked in the last step.


In above link:
Steps#1 & 2 are clear
suddenly the author says in step#3:
3. Access your Cisco device, "open a TFTP connection to the IP address of your computer", and specify the exact name of the file you want to download.
//Then the author goes on..
4. TFTP displays output similar to this example during the file transfer. //Done!




2 Questions:
1. Can somebody provides the command syntax in which I can execute in my router to "open a TFTP connection to the IP address of my PC"?
Given that my PC and router are in the same Subnet/Vlan - so there's no connectivity issues as they can ping each others.
2. Also, does the command syntax vary if my Cisco device is a router or a switch? If it does vary, what would be the switch's?


Thanks in advance!

Comments

  • azaghulazaghul Member Posts: 569 ■■■■□□□□□□
    From the cisco CLI with TFTPd32 running...using the screen shots in the PDF

    From TFTP to Switch/Router
    copy tftp://192.168.10.2/c3750-ipservicesk9-mz.150-4T.bin flash:c3750-ipservicesk9-mz.150-4T.bin
    

    From Switch/Router to TFTP
    copy flash:c3750-ipservicesk9-mz.150-4T.bin tftp://192.168.10.2/c3750-ipservicesk9-mz.150-4T.bin
    

    Replacing "192.168.10.2" with your IP address, and "c3750-ipservicesk9-mz.150-4T.bin" with the name of the file you are trying to copy... Syntax is the same...

    I usually run TFTPd32 from the same directory as the file I'm copying, just for simplicity.
  • wylewyle Member Posts: 5 ■□□□□□□□□□
    Thanks azaghul for your prompt response..


    I executed your command and it seems to be working. However, I'm running into a different errors.



    1. Copying from a Switch:
    S1#dir flash:
    Directory of flash:/c3560-ipbase-mz.122-25.SEE3/


    6 -rwx 6427865 Mar 1 1993 00:13:55 +00:00 c3560-ipbase-mz.122-25.SEE3.bin
    7 drwx 4096 Mar 1 1993 00:14:12 +00:00 html
    408 -rwx 414 Mar 1 1993 00:14:41 +00:00 info


    15998976 bytes total (7842816 bytes free)
    S1#copy flash:c3560-ipbase-mz.122-25.SEE3.bin tftp://10.0.0.2/c3560-ipbase-mz.122-25.SEE3.bin


    Address or name of remote host [10.0.0.2]?
    Destination filename [c3560-ipbase-mz.122-25.SEE3.bin]?
    %Error opening tftp://10.0.0.2/c3560-ipbase-mz.122-25.SEE3.bin (Socket error)
    S1#
    End




    2. Copying from a router:
    **************************
    R2#sh ver
    Cisco IOS Software, 2800 Software (C2800NM-ADVSECURITYK9-M), Version 12.4(17), RELEASE SOFTWARE (fc1)
    Technical Support: Support and Documentation - Cisco Systems
    Copyright (c) 1986-2007 by Cisco Systems, Inc.
    Compiled Fri 07-Sep-07 16:46 by prod_rel_team


    ROM: System Bootstrap, Version 12.3(8r)T7, RELEASE SOFTWARE (fc1)


    R2 uptime is 2 hours, 6 minutes
    System returned to ROM by power-on
    System image file is "flash:c2800nm-advsecurityk9-mz.124-17.bin"

    R2#Copy flash:c2800nm-advsecurityk9-mz.124-17.bin tftp://10.0.0.2/c2800nm-advsecurityk9-mz.124-17.bin
    Address or name of remote host [10.0.0.2]?
    Destination filename [c2800nm-advsecurityk9-mz.124-17.bin]?
    %Error opening flash:c2800nm-advsecurityk9-mz.124-17.bin (No such device)
    **************************End


    Few things to mention which might help diagnose this errors:
    a) My TFTP is listening on port 0.0.0.0:69
    { UDP 0.0.0.0:67
    [tftpd32.exe]
    UDP 0.0.0.0:69
    [tftpd32.exe]
    b) I tried executing the syntax with/out creating empty .bin files on tftp directory with names similar to the switch/router binaries - results were similar

    P.S. Switch location is in between the router and the PC which is running the tftp server. The PC is in Vlan 10, and the switch port in router side is a trunk. The router sub-interface is 10.0.0.1, which is the default gateway for the PC "PC IP 10.0.0.2". The PC & router ping each others through the switch. Hope this helps if not confuses..
  • wylewyle Member Posts: 5 ■□□□□□□□□□
    I did copy the other way around. Created a dummy file in my server directory and try to copy it to the router:

    ___________
    R2#copy tftp: flash:
    Address or name of remote host [10.0.0.2]?
    Source filename [/10.0.0.2/TestAug52015.bin]? TestAug52015.bin
    Destination filename [TestAug52015.bin]?
    Accessing tftp://10.0.0.2/TestAug52015.bin...
    Loading TestAug52015.bin from 10.0.0.2 (via GigabitEthernet0/1.10): !
    [OK - 0 bytes]


    %Error opening flash:TestAug52015.bin (No such device)
    ______________ End

    I think creating a file named TestAug52015.bin in the router flash before copying would solve the problem, but the question is how can I create that file inside the router flash.. any idea
  • clarsonclarson Member Posts: 903 ■■■■□□□□□□
    I always do a ping to verify connectivity.
    you could have issues such as a firewall, no default gateway set, etc.
  • wylewyle Member Posts: 5 ■□□□□□□□□□
    Thanks Clarson for your response. As I mentioned above, the router is the default gateway of the PC, and they both ping each others. So there's no connectivity issues. Posting of my last two comments were delayed for review purpose as I'm a new member, so It looks you posted your response before my comments show up. Would you please go over my last two comments and give me feedback.
    Thanks!
  • azaghulazaghul Member Posts: 569 ■■■■□□□□□□
    Try turning off the firewall/antivirus/antimalware on your PC, these can/may cause problems.
  • marcelkouamemarcelkouame Registered Users Posts: 1 ■□□□□□□□□□
    for this part:

    1. Copying from a Switch:
    S1#dir flash:
    Directory of flash:/c3560-ipbase-mz.122-25.SEE3/


    6 -rwx 6427865 Mar 1 1993 00:13:55 +00:00 c3560-ipbase-mz.122-25.SEE3.bin
    7 drwx 4096 Mar 1 1993 00:14:12 +00:00 html
    408 -rwx 414 Mar 1 1993 00:14:41 +00:00 info


    15998976 bytes total (7842816 bytes free)
    S1#copy flash:c3560-ipbase-mz.122-25.SEE3.bin tftp://10.0.0.2/c3560-ipbase-mz.122-25.SEE3.bin


    Address or name of remote host [10.0.0.2]?
    Destination filename [c3560-ipbase-mz.122-25.SEE3.bin]?
    %Error opening tftp://10.0.0.2/c3560-ipbase-mz.122-25.SEE3.bin (Socket error)
    S1#
    End


    are you able to show arp to see if you're getting a mac address?


    EDIT Sorry - you did say that you can ping. I think Phantasm has the best answer here.
  • phantasmphantasm Member Posts: 995
    OP, try as azaghul stated above and disable the firewall on your PC. That stupid thing causes a lot of problems.

    Things to check:

    1. It's better if your PC is connected to an access port on the switch (trunk port to a host is not needed unless your host needs multiple VLANs; IE Hypervisor)
    2. PC and Switch IP need to be in the same subnet
    3. Make sure you can ping in both directions (sanity check)
    4. Make sure TFTPd is running on your PC
    "No man ever steps in the same river twice, for it's not the same river and he's not the same man." -Heraclitus
  • clarsonclarson Member Posts: 903 ■■■■□□□□□□
    %Error opening flash:TestAug52015.bin (No such device)
    ______________ End

    I think creating a file named TestAug52015.bin in the router flash before copying would solve the problem, but the question is how can I create that file inside the router flash.. any idea

    as far creating a file, you could use the copy command. copy startup flash:yourfile
    but the error about opening flash and no such device, seems to point to a problem with your flash card. Do a dir flash: and see if that shows the file on the flash card.
  • wylewyle Member Posts: 5 ■□□□□□□□□□
    Thank you all for your help.. every comment posted here has contributed in solving a problem..
    As Clarson suspected, there was a problem with my router flash.. I bought another router and it did work fine.
    Phantasm helped with keeping the PC & switch in the same subnet - as previously I did not assign the switch a vlan int with IP.. how idiot was I icon_sad.gif
    Thanx Azaghul for the syntax..
    Everything is working fine now
Sign In or Register to comment.