Build a tftp server in ubuntu

Source: Internet
Author: User
1.1 set up the tftp server TFTP (TrivialFileTransferProtocol, Simple File Transfer Protocol). It is a UDP-based protocol for simple file transfer between the client and the server, suitable for applications with low overhead and no complexity. TFTP protocol special...
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

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.