Ocenon Technical Note
Microsoft's free, but rather shy, TFTP server

If you have only the occasional requirement for a TFTP server or a simple requirement that will require little ongoing administration and you're running Windows, it's most likely Microsoft have already provided you with all you need - they've just hidden it from you. This how-to guide explains how to get your free TFTP Server up and running.

Take a look at Wikipedia's article on TFTP for more information.

Remember that TFTP is simple protocol and insecure protocol. If you have sensitive information or configurations to move across your network you should look at a more appropriate mechanism, such as SSH.

Finding the TFTP server daemon

The file you need, "tftpd.exe", may already be installed on your system in the "%SystemRoot%\system32\dllcache" directory.

If it's not already there Windows 2000 Professional, Windows XP, Windows 2000 Server and Windows Server 2003 (and perhaps some others) all come with the software. You'll find a file called "tftpd.ex_" in the "i386" directory on the installation CD, a compressed version of what you need. You can use the command "expand D:\I386\TFTPD.EX_ %SystemRoot%\system32\dllcache" to extract the file to its usual home.

Installing the TFTP service

The following script uses the native XP/2003 "sc.exe" and "reg.exe" commands to install the TFTP Server as a Windows Service.

If you're running Windows 2000 you'll need to get the same commands from the Windows 2000 Resource Kit (see Q251192) and the Windows 2000 Support Tools (see Q301423) or use "instsrv.exe" command (see Q137890) and "regedit.exe" tools instead.

mkdir "%ProgramFiles%\TFTP Server"
mkdir "C:\TFTP Root"
copy "%SystemRoot%\system32\dllcache\tftpd.exe" "%ProgramFiles%\TFTP Server"
sc create TFTPd binPath= "%ProgramFiles%\TFTP Server\tftpd.exe" start= auto DisplayName= "TFTP Server"
reg add HKLM\SYSTEM\CurrentControlSet\Services\TFTPd\Parameters /v "Directory" /d "C:\TFTP Root"

Configuring the TFTP service

The TFTP Server takes its configuration from the Windows Registry. There are five keys you need to worry about, one of which ("Directory") was created above and specifies the where the TFTP Server finds its files on disk. The remaining four keys are listed here.

The following script configures a read-only TFTP server that will serve any filename to clients with IPs in the 192.168.0.* range.

reg add HKLM\SYSTEM\CurrentControlSet\Services\TFTPd\Parameters /v "Masters" /d ""
reg add HKLM\SYSTEM\CurrentControlSet\Services\TFTPd\Parameters /v "Clients" /d "192.168.0.*"
reg add HKLM\SYSTEM\CurrentControlSet\Services\TFTPd\Parameters /v "Readable" /d "*"
reg add HKLM\SYSTEM\CurrentControlSet\Services\TFTPd\Parameters /v "Writable" /d ""

And the Regedit script here does exactly the same thing.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TFTPd\Parameters]
"Masters"=""
"Clients"="192.168.0.*"
"Readable"="*"
"Writable"=""

Managing the TFTP service

The TFTP Server can be started and controlled just like any other Windows Service - from the MMC Services GUI, using "sc start TFTPd", "sc stop TFTPd", "net start TFTPd", "net stop TFTPd" and so on.

If the machine hosting the TFTP Server has a local firewall you might need to add the appropriate rule to allow inbound UDP connections to port 69 (see IANA Well Known Ports).

Where we've used this

For simple corporate installations this software has proved itself to be reliable and trouble free. Deployed scenarios include:-

Please send any comments regarding this article to technotes@ocenon.co.uk