At the Circus we have a network management server that runs all of the normal services needed to manage a small network and so I rarely need to fire up the tftp server on my laptop. Today was one of those days I needed a quick tftp server and I spent too much time figuring it out. This is my attempt to remedy that shortcoming.
What is ironic is that after I googled around I found that I had “self documented” in the /private/tftpboot directory, unfortunately I expected the tftp directory for the tftp server to be in /tftpboot. I realize I can just put a symlink from /tftpboot to /private/tfpboot but I learned when working on AIX it is better to understand the file system layout of a UNIX vendor that it is to make it like another OS. It will bite you eventually.
Here is a listing of the /private/tftboot directory, you will notice the very last file is tftp.txt. That is where I told myself how to do this in the past. It also appears most of the IOS images were for the testlab.
asa821-k8.bin c1841-adventerprisek9-mz.150-1.M.bin c2500-is-l.123-26.bin c2600-adventerprisek9-mz.124-25c.bin c3560e-ipbasek9npe-mz.122-55.SE1.bin c3620-j1s3-mz.123-26.bin c3640-a3js-mz.124-25b.bin c3640.txt tftp.txt
This is what I had listed in the tftp.txt file. It tells how to start and stop a service in Mac OSX using launchctl.
sudo launchctl load -F /System/Library/LaunchDaemons/tftp.plist sudo launchctl unload -F /System/Library/LaunchDaemons/tftp.plist
For thoroughness I am including the tftp.plist file below. If I wanted the tftp daemon to start every time I turned on my laptop I would change Disabled to EnableTransactions.
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Disabled</key> <true/> <key>Label</key> <string>com.apple.tftpd</string> <key>ProgramArguments</key> <array> <string>/usr/libexec/tftpd</string> <string>-s</string> <string>/private/tftpboot</string> </array> <key>inetdCompatibility</key> <dict> <key>Wait</key> <true/> </dict> <key>InitGroups</key> <true/> <key>Sockets</key> <dict> <key>Listeners</key> <dict> <key>SockServiceName</key> <string>tftp</string> <key>SockType</key> <string>dgram</string> </dict> </dict> </dict> </plist>