Copying the config from a Cisco switch to OSX via TFTP

I wanted to copy the configuration information from a Cisco switch onto my local machine, which runs Mac OS X (Mountain Lion). You can do this via TFTP, since the switch has a TFTP client and OS X comes with a TFTP server.

You probably need to turn off the OS X firewall if you have it running (System Preferences -> Security & Privacy -> Firewall).

To start the TFTP server on OS X:

$ sudo launchctl load -w /System/Library/LaunchDaemons/tftp.plist

The server uses /private/tftpboot as its root directory for the files.

If you want to copy a file to a TFTP server, a file with the same name must already exist at the destination and be world-writeable. Otherwise you’ll get an “Access denied” everywhere, even if the destination directory is world-writeable.

Therefore, you’ll want to do something like this:

$ sudo touch /private/tftpboot/config.txt
$ sudo chmod a+w /private/tftpboot/config.txt

Next, log in to the switch via ssh and then copy the running config back to your local machine. In this example, my local machine has the IP 192.168.3.2:

# copy running-config tftp://192.168.3.2/config.txt

The /private/tftpboot/config.txt file should now be populated with the configuration info for the switch.

Once you’re done, you can turn off the TFTP server on your local machine:

$ sudo launchctl unload /System/Library/LaunchDaemons/tftp.plist

I tried this with a Cisco Catalyst 2960 switch, but I suspect it will also work for other devices such as Nexus switches and ASAs.

This entry was posted in sysadmin. Bookmark the permalink.

4 Responses to Copying the config from a Cisco switch to OSX via TFTP

  1. Anand says:

    worked like a charm . thnx

  2. Mike says:

    Didn’t work for me. Cisco 3850 to OS X ver 10.9.5 😦

  3. Rag says:

    It works. I tried this on cisco2811.

Leave a comment