Build a tftp server in ubuntu

Source: Internet
Author: User
Tags file transfer protocol


1.1 build a tftp server
TFTP (Trivial File Transfer Protocol, simple File Transfer Protocol) is a UDP-based Protocol for simple File Transfer between the client and the server, suitable for applications with low overhead and no complexity. The TFTP protocol is designed for small file transfer. files can only be obtained from the server or written to the server. directories cannot be listed or authenticated.
In Embedded Linux development, the TFTP protocol is used in many occasions and is even indispensable, especially in the kernel debugging stage, it is convenient and fast to load and run the kernel from the server through the TFTP protocol in U-Boot.
By default, the TFTP service and TFTP server are not installed in general releases. The TFTP service depends on the network daemon service program. You can choose to install inetd or the upgraded xinetd, install tftp and tftp-server, and then modify or create/etc/xinetd. d/tftp configuration file, and then restart xinetd to start the TFTP service. Regardless of the release version, the installation of the TFTP server is like this, but the installation commands for different releases are different. The following uses ubuntu as an example to describe.
Install xinetd:
Ky @ ubuntu :~ $ Sudo apt-get install xinetd
Install tftp and tftpd:
Ky @ ubuntu :~ $ Sudo apt-get install tftp tftpd
Or install the enhanced tftp version tftp-hpa:
Ky @ ubuntu :~ $ Sudo apt-get install tftp-hpa tftpd-hpa
Create a configuration file. Create the/etc/xinetd. d/tftp file and write the following content:
Service tftp
{
Socket_type = dgram
Protocol = udp
Wait = yes
User = root
Server =/usr/sbin/in. tftpd
Server_args =-s/var/tftpboot/
Disable = no
Per_source = 11
CPIs = 100 2
Flags = IPv4
}
The/var/tftpboot directory set by server_args is the directory of the tftp server, and the access permission is set to 777:
Ky @ ubuntu :~ $ Sudo mkdir-pv/var/tftpboot/
Ky @ ubuntu :~ $ Sudo chmod 777/var/tftpboot/
Start or restart the xinetd service:
Ky @ ubuntu :~ $ Sudo/etc/init. d/xinetd start or restart
Local test. Create a ky file in the/tftpboot directory, start another terminal, and enter:
Ky @ ubuntu :~ $ Tftp 127.0.0.1
Tftp> get ky # get The ky File
Tftp> q # exit tftp
Enter the ls command on the terminal to view the ky file obtained by ftp in the current directory.
Use the Development Board to verify whether the tftp server is available. Start the Development Board, enter the U-Boot command line, and use the tftp Command to load files in the tftp server, such:
U-Boot $ tftp 80008000 zImage
ENET: auto-negotiation complete
ENET: Link status up
ENET: FULL DUPLEX
ENET: 100 MBase
MAC: 00: 61: 62: 69: 6e: 67
TFTP from server 192.168.1.3; our IP address is 192.168.1.5
Filename 'zimage '.
Load address: 0x80008000
Loading :#################################
Done
Bytes transferred= 479927 (752b7 hex)
Note:
(1) Use the Development Board to communicate with the customer system installed on the Virtual Machine in TFTP mode. You must set the virtual network card to the Bridged mode. static IP addresses are recommended.
(2) If the above settings are correct but tftp still fails, check whether the firewall of the host is disabled.



Author's Network

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.