This article is the continuation of the previous article, in this article I built a TFTP server on Ubuntu, implemented on the MT7688 Development Board to upload and download Ubuntu files, which for the subsequent development of the program to provide convenience.
First, install the TFTP server: Install TFTP-HPA and TFTPD-HPA software
1.1 Installation of the first software
[Email protected]:/home# apt-get Install TFTP-HPA
Reading Package Lists ... Done
Building Dependency Tree
Reading state information ... Done
The following NEW packages'll be installed:
Tftp-hpa
0 upgraded, 1 newly installed, 0 to remove and 523 not upgraded.
Need to get 19.1 KB of archives.
After this operation, 75.8 KB of additional disk space would be used.
Warning:the following packages cannot be authenticated!
Tftp-hpa
Install these packages without verification [y/n]? Y
Get:1 http://us.archive.ubuntu.com/ubuntu/precise/main tftp-hpa i386 5.2-1ubuntu1 [19.1 KB]
Fetched 19.1 KB in 2s (7,362 b/s)
Selecting previously unselected package tftp-hpa.
(Reading database ... 150828 files and directories currently installed.)
Unpacking Tftp-hpa (from .../tftp-hpa_5.2-1ubuntu1_i386.deb) ...
Processing triggers for man-db ...
Setting up TFTP-HPA (5.2-1UBUNTU1) ...
1.2 Installing a second software
[Email protected]:/home# apt-get Install TFTPD-HPA
Reading Package Lists ... Done
Building Dependency Tree
Reading state information ... Done
The following NEW packages'll be installed:
Tftpd-hpa
0 upgraded, 1 newly installed, 0 to remove and 523 not upgraded.
Need to get 39.4 KB of archives.
After this operation, the additional disk space would be used.
Warning:the following packages cannot be authenticated!
Tftpd-hpa
Install these packages without verification [y/n]? Y
Get:1 http://us.archive.ubuntu.com/ubuntu/precise/main tftpd-hpa i386 5.2-1ubuntu1 [39.4 KB]
fetched 39.4 kB in 0s (45.5 kb/s)
preconfiguring packages ...
Selecting previously unselected package tftpd-hpa.
(Reading database ... 150834 files and directories currently installed.)
Unpacking Tftpd-hpa (from .../tftpd-hpa_5.2-1ubuntu1_i386.deb) ...
Processing triggers for man-db ...
Processing triggers for ureadahead ...
Ureadahead'll be reprofiled on next reboot
Setting up TFTPD-HPA (5.2-1UBUNTU1) ...
TFTPD-HPA start/running, Process 3770
Second, in the home directory to establish the Sharefiles folder, change the permissions of the folder, create a Test.txt file, write the contents of the file.
[Email protected]:/home# dir
Mt7688share OpenWrt Sharefiles
[Email protected]:/home# cd sharefiles/
[Email protected]:/home/sharefiles# ls
Test.txt
[Email protected]:/home/sharefiles# cat Test.txt
This was a test file in Unbuntu. It is mainly used as the TFTP test file!
Third, modify the configuration file
[Email protected]:/home/sharefiles# ls
Test.txt
[Email protected]:/home/sharefiles# vim/etc/default/tftpd-hpa
[Email protected]:/home/sharefiles#
The configuration content is as follows: 192.168.1.107 for my Ubuntu system IP address
#/ETC/DEFAULT/TFTPD-HPA
Tftp_username= "TFTP"
tftp_directory= "/home/sharefiles"
Tftp_address= "192.168.1.107:69"
Tftp_options= "-l-c-S"
Iv. Start-up service
[Email protected]:/home/sharefiles# service TFTPD-HPA Restart
TFTPD-HPA stop/waiting
TFTPD-HPA start/running, Process 3933
[Email protected]:/home/sharefiles# Ps-au | grep TFTPD-HPA
Warning:bad PS syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html
Root 3959 0.0 0.0 4388 832 pts/2 s+ 01:36 0:00 grep--color=auto tftpd-hpa
[Email protected]:/home/sharefiles#
V. Testing
Here is a description: The following IP address is the address of the TFTP server, the following two commands are used on the Development Board, you first telnet to the Development Board to
Tftp-g-r file ip//download files from tftp
Tftp-p-L file ip//uploading files to tftp
5.1 Create a Test.txt test file on the shared directory of the Ubuntu system TFTP server to simply write some content in the file
[Email protected]:/home/sharefiles# ls
Hello Test.txt
[Email protected]:/home/sharefiles# cat Test.txt
This was a test file in Ubuntu
[Email protected]:/home/sharefiles#
5.2 Log in to the MT7688 board via Telnet in Unbuntu and try to download the files in TFTP
[Email protected]:/home/sharefiles# telnet 192.168.1.1
Trying 192.168.1.1 ...
Connected to 192.168.1.1.
Escape character is ' ^] '.
Mediatek Login:admin
Password:
BusyBox v1.12.1 (2015-07-14 09:33:29 CST) built-in shell (ASH)
Enter ' help ' for a list of built-in commands.
# tftp-g-R test.txt 192.168.1.100
# ls
Etc bin Init media etc_ro test.txt
Home mnt var dev tmp
SYS proc USR sbin lib
# cat Test.txt
This was a test file in Ubuntu
The download is successful and the file can be viewed correctly!
5.2 Testing uploads files on the MT7688 board to Ubuntu: I created a 123.txt file on MT7688
is now on the MT7688 Development Board:
# ls
Etc bin Init media etc_ro test.txt
Home mnt var dev tmp
SYS proc USR sbin lib
# Touch 123.txt
# echo "This was a test file in MT7688" >> 123.txt
# Cat 123.txt
This was a test file in MT7688
# tftp-p-L 123.txt 192.168.1.100
# exit
is now on Ubuntu system:
[Email protected]:/home/sharefiles# pwd
/home/sharefiles
[Email protected]:/home/sharefiles# ls
123.txt Hello Test.txt
[Email protected]:/home/sharefiles# cat 123.txt
This was a test file in MT7688
[Email protected]:/home/sharefiles#
Success! On top of the tests, we've implemented a file transfer between Ubuntu and the MT7688 Development Board via the TFTP service! With this feature it is convenient for us to put the Ubuntu system programming program on the development Board to run!
MT7688 Module-based development note 10--enables file transfer between Ubuntu and the Development Board via TFTP