Showing posts with label tftp. Show all posts
Showing posts with label tftp. Show all posts

Monday, 3 March 2014

TFTP Server on Linux Mint / Ubuntu


Steps to Install and Configure TFTP Server on Ubuntu

Step 1: 

Install TFTP Server 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

Step 2: 

Configure Configuration file of tftpd-hpa is in /etc/default/tftpd-hpa. Edit this file to change the default root directory and other Options.
Default file contents will be similar to this:


# /etc/default/tftpdhpa
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/var/lib/tftpboot"
TFTP_ADDRESS="[::]: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/len/tftproot" 
TFTP_ADDRESS="0.0.0.0:69" 
TFTP_OPTIONS="--secure --create"

Step 3: Restart TFTP Server Restart TFTP Server service using "sudo service tftpd-hpa restart"

Further to this to ensure the TFTP server respond to  broadcast requests (This is used on devices liek Cisco Access points to update firmware) Change it to the following type configuration:

Change /etc/default/tftpd-hpa from:
# /etc/default/tftpd-hpa

TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/var/lib/tftpboot"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="--secure --timeout 30"
to:

# /etc/default/tftpd-hpa

TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/var/lib/tftpboot"
TFTP_ADDRESS="255.255.255.255:69"
TFTP_OPTIONS="--secure --timeout 30"

Key change being 0.0.0.0 to 255.255.255.255

For troubleshooting:
add the -vvvv option to the config
TFTP_OPTIONS="--secure --create -vvvv --timeout 30"

and tail the /var/log/syslog file