Trivial File Transfer Protocol (TFTP) Installation.

Install and Test TFTP Server in Host Ubuntu machine:

  •  TFTP, a lightweight file transfer protocol, uses other software to get running: xinetd.
  • The xinetd program performs a neat job: it waits for network connections on ports (as specified in the/etc/services file) and, when a connection occurs, remaps the standard in  and out to the read and write of the network connection.
  • This trick means that the program run by xinetd has code that uses file semantics (like scanf() and printf()) and reads and writes over a network connection.
  • Not all distributions have xinetd installed by default, so you may need to install it using your distribution’s package-management system.

1. Install following packages.

$ sudo apt-get install xinetd tftpd tftp

2. Create /etc/xinetd.d/tftp and put this entry

# default: off
# description: The tftp server serves files using the trivial file transfer
# protocol. The tftp protocol is often used to boot diskless
# workstations, download configuration files to network-aware printers,
# and to start the installation process for some operating systems.
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
disable = no
per_source = 11s
cps = 100 2
}

The lines of interest in this file are server_args, which indicates the directory where TFTP stores and looks for files. The kernel that is downloaded to the board needs to be placed in this directory.

3. Create a folder /tftpboot this should match whatever you gave in server_args. mostly it will be tftpboot

$ sudo mkdir /tftpboot
$ sudo chmod -R 777 /tftpboot
$ sudo chown -R nobody /tftpboot

4. Restart the xinetd service.

$ sudo /etc/init.d/xinetd restart

Now  tftp server will be up and starts running.

5. Create a file named test with some content in /tftpboot path of the tftp server

$ touch   /tftpboot/test
$ sudo chmod -R 777 /tftpboot

Obtain the ip address of the tftp server using: ifconfig command.

example we will consider the ip address as 192.168.1.2

6. Now in some other terminal and folder  follow the following steps.

$ tftp 192.168.1.2
tftp> get test
Sent 159 bytes in 0.0 seconds
tftp> quit
$ ls test

You can try the same test on another computer on the network, to ensure that you can connect to the host from another machine (across the wire, as a network-person would say). If TFTP works from localhost but not from another computer, chances are the firewall is still running. Stop this service, and try again.

Let me know if you have any questions or comments.

Reference:

Pro Embedded Linux

Advertisements

About VinayMahadev

I am passionate about Embedded Linux systems . I believe in "If you want to learn something, read about it. If you want to understand something, write about it. If you want to master something, teach it". Here I am just trying to connect the Dots.
Gallery | This entry was posted in Uncategorized. Bookmark the permalink.

One Response to Trivial File Transfer Protocol (TFTP) Installation.

  1. Pingback: U-boot: ARM Versatile Express Emulation On Qemu With NFS as Rootfs | LearningFromU

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s