Thursday, September 05, 2013

Installing TFTP Server on Ubuntu

TFTP Server is usefull for PXE booting or configuring automatic back up of Cisco routers and Switches etc. Installing TFTP Server can be done in a few steps :

We are going install TFTP Server on a machine running Ubuntu ( version 10.04 32 bit Desktop Edition).

Steps to Install and Configure TFTP Server on Ubuntu

  1. Step 1: Install TFTP Server
  2. Either you can install using command line or Go to Ubuntu Software center. In command line type"sudo apt-get install tftpd-hpa" Or Search for tftpd-hpa in Software Center and click install
  3. Step 2: Configure
  4. Configuration file of tftpd-hpa is in /etc/defualt/tftpd-hpa. Edit this file to change the default root directory and other Options.
    Default file contents will be similar to this:
    # /etc/default/tftpd-hpa
    
    TFTP_USERNAME="tftp"
    TFTP_DIRECTORY="/tftproot"
    TFTP_ADDRESS="0.0.0.0:69"
    TFTP_OPTIONS="--secure"
    
    You can edit TFTP_DIRECTORY line to change the default root directory( Root directory is the directory which will store all the files you upload to the TFTP server or the directory from which the files will be downloaded from TFTP Server ). By default, there should be a file with same name as the file you are about to upload to TFTP server. This default feature may create problems during Get/Put to TFTP server. So better edit this TFTP_OPTIONS to allow the TFTP Server to create a new file when there is no file with the name found. So after editing tftpd-hpa looks like this:
    TFTP_USERNAME="tftp"
    TFTP_DIRECTORY="/home/john/tftproot"
    TFTP_ADDRESS="0.0.0.0:69"
    TFTP_OPTIONS="--secure --create"
    
  5. Step 3: Restart TFTP Server
  6. Restart TFTP Server service using "sudo service tftpd-hpa restart" command.
Now test using some TFTP client in some other machine to connect and GET or PUT some file to the TFTP Server.