{"id":247832,"date":"2022-07-27T09:34:25","date_gmt":"2022-07-27T01:34:25","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=247832"},"modified":"2022-07-22T10:39:02","modified_gmt":"2022-07-22T02:39:02","slug":"linux-tftp","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/linux-tftp.html","title":{"rendered":"\u5982\u4f55\u5728 Linux \u4e0a\u8bbe\u7f6e\u53e4\u8001\u53c8\u7b80\u5355\u7684 TFTP \u670d\u52a1\u5668"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u60a8\u77e5\u9053\u6d41\u884c\u7684\u6587\u4ef6\u4f20\u8f93\u534f\u8bae\u6709\u4e00\u4e2a\u66f4\u7b80\u5355\u7684\u66ff\u4ee3\u65b9\u6848\u5417\uff1f\u5b83\u5c31\u662f TFTP\uff0c\u4ee5\u4e0b\u662f\u5728 Linux \u4e0a\u8bbe\u7f6e\u5b83\u7684\u65b9\u6cd5\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

TFTP\uff08Trivial File Transfer Protocol\uff0c\u7b80\u5355\u6587\u4ef6\u4f20\u8f93\u534f\u8bae\uff09\u4e8e 1980 \u5e74\u9996\u6b21\u88ab\u5b9a\u4e49\u3002\u5b83\u662f\u4e00\u4e2a\u76f8\u5f53\u53e4\u8001\u7684\u534f\u8bae\uff0c\u4e8e 1981 \u5e74 6 \u6708\u7531 Karen R. Sollins \u5728 RFC 783\uff08\u5f81\u6c42\u610f\u89c1\uff09\u4e2d\u4f5c\u4e3a TFTP \u534f\u8bae\u4fee\u8ba2\u7248 2 \u53d1\u5e03\u3002<\/p>\n

\u65e9\u671f\uff0cTFTP \u7684\u4e3b\u8981\u76ee\u6807\u662f\u901a\u8fc7\u7f51\u7edc\u53d1\u9001\u548c\u63a5\u6536\u6587\u4ef6\u3002\u7279\u522b\u662f\uff0c\u5b83\u7528\u4e8e\u4f20\u8f93\u5f15\u5bfc\u671f\u95f4\u6240\u9700\u7684\u6587\u4ef6\uff0c\u4ee5\u4f7f\u7cfb\u7edf\u80fd\u591f\u901a\u8fc7\u7f51\u7edc\u5f15\u5bfc\u3002<\/p>\n

\u4e0b\u9762\u4ecb\u7ecd\u5982\u4f55\u5728 Linux \u673a\u5668\u4e0a\u8bbe\u7f6e TFTP \u670d\u52a1\u5668\u3002<\/p>\n

\u4ec0\u4e48\u662f TFTP\uff1f<\/strong><\/div>\n

TFTP \u4ecd\u7528\u4e8e\u6587\u4ef6\u4f20\u8f93\u76ee\u7684\uff0c\u5b83\u652f\u6301\u7684\u529f\u80fd\u6ca1\u6709\u6839\u672c\u53d8\u5316\u3002TFTP \u7528\u4e8e\u901a\u8fc7 UDP\/IP \u4e0b\u8f7d\u548c\u53d1\u9001\u6587\u4ef6\u3002\u5b83\u6ca1\u6709\u5176\u4ed6\u6587\u4ef6\u4f20\u8f93\u534f\u8bae\u4e2d\u5e38\u89c1\u7684\u8eab\u4efd\u548c\u6388\u6743\u63a7\u5236\u3001\u6587\u4ef6\u5217\u8868\u3001\u5220\u9664\u6216\u91cd\u547d\u540d\u7b49\u9644\u52a0\u529f\u80fd\u3002<\/p>\n

\u4e0e\u5728\u4f20\u8f93\u5c42\u4f7f\u7528 TCP \u7684\u9ad8\u7ea7\u6587\u4ef6\u4f20\u8f93\u534f\u8bae\u4e0d\u540c\uff0c\u5b83\u5de5\u4f5c\u5728 UDP \u534f\u8bae\u4e0a\uff0c\u4e0d\u5177\u6709\u68c0\u67e5\u5c5e\u4e8e\u6587\u4ef6\u7684\u6570\u636e\u5305\u662f\u5426\u4f1a\u53d1\u9001\u5230\u53e6\u4e00\u7aef\u7b49\u529f\u80fd\u3002\u7531\u4e8e\u8fd9\u4e2a\u9650\u5236\uff0c\u5b83\u66f4\u9002\u5408\u5728\u5c40\u57df\u7f51\u4e2d\u4f7f\u7528\uff0c\u800c\u4e0d\u662f\u5728\u4e92\u8054\u7f51\u6216\u5e7f\u57df\u7f51\u4e2d\u4f7f\u7528\u3002<\/p>\n

\u5c3d\u7ba1\u4e0a\u9762\u5217\u51fa\u4e86\u6240\u6709\u8fd9\u4e9b\u770b\u4f3c\u4e0d\u5229\u7684\u7279\u6027\uff0c\u4f46 TFTP \u534f\u8bae\u975e\u5e38\u5f3a\u5927\u7684\u4e00\u4e2a\u65b9\u9762\u662f\u5b83\u7684\u7b80\u5355\u6027\u3002\u4e0e\u5176\u66ff\u4ee3\u65b9\u6848\u76f8\u6bd4\uff0c\u8be5\u534f\u8bae\u7684\u5b9e\u73b0\u975e\u5e38\u5bb9\u6613\uff0c\u5373\u4f7f\u5bf9\u4e8e\u6ca1\u6709\u64cd\u4f5c\u7cfb\u7edf\u7684\u73af\u5883\u4e5f\u662f\u5982\u6b64\u3002\u7531\u4e8e\u8fd9\u4e2a\u7279\u6027\uff0c\u5b83\u5728\u5d4c\u5165\u5f0f\u7cfb\u7edf\u4e2d\u6709\u5e7f\u6cdb\u7684\u4f7f\u7528\u9886\u57df\u3002<\/p>\n

\u5728 Linux \u4e0a\u5b89\u88c5 TFTP \u670d\u52a1\u5668<\/strong><\/div>\n

\u4f7f\u7528\u5d4c\u5165\u5f0f\u8bbe\u5907\u65f6\uff0c\u5b89\u88c5 TFTP \u670d\u52a1\u5668\u670d\u52a1\u5f88\u91cd\u8981\u3002\u5728 Linux \u7cfb\u7edf\u4e0a\uff0c\u53ef\u4ee5\u8fd0\u884c\u591a\u4e2a TFTP \u670d\u52a1\u5668\u5b9e\u73b0\u3002\u5982\u679c\u60a8\u4f7f\u7528\u7684\u662f\u57fa\u4e8e Debian \u7684\u53d1\u884c\u7248\uff0c\u60a8\u53ef\u4ee5\u5b89\u88c5tftpd-hpa\u3001tftpd\u6216atftpd\u8f6f\u4ef6\u5305\u3002\u5982\u679c\u60a8\u4e0d\u786e\u5b9a\u9009\u62e9\u54ea\u4e00\u4e2a\uff0c\u8bf7\u8003\u8651\u5b89\u88c5 tftpd-hpa \u8f6f\u4ef6\u5305\u3002<\/p>\n

\r\n\u250c\u2500\u2500(linuxmi\u327flinuxmi)-[~\/linuxmi.com]\r\n\u2514\u2500$ sudo apt-get install tftpd-hpa\r\n<\/pre>\n

\"\"<\/p>\n

\u5b89\u88c5\u540e\uff0cTFTP \u670d\u52a1\u5c06\u5f00\u59cb\u4fa6\u542c UDP \u7aef\u53e3 69\u3002\u8981\u901a\u8fc7 TFTP \u670d\u52a1\u5668\u5c06\u6587\u4ef6\u63d0\u4f9b\u7ed9\u5176\u4ed6\u7cfb\u7edf\uff0c\u60a8\u9700\u8981\u8bb0\u4f4f\u4e00\u4e9b\u5148\u51b3\u6761\u4ef6\uff1a
\n\u7b2c\u4e00\u662f\u5c06\u6240\u9700\u6587\u4ef6\u590d\u5236\u5230 TFTP \u4e3b\u76ee\u5f55\u6216\u8be5\u4e3b\u76ee\u5f55\u4e0b\u7684\u76ee\u5f55\uff0c\u7b2c\u4e8c\u662f\u4f7f\u6587\u4ef6\u6743\u9650\u5bf9\u516c\u4f17\u53ef\u89c1
\n\u8981\u627e\u51fa TFTP \u670d\u52a1\u5668\u4e3b\u76ee\u5f55\u662f\u4ec0\u4e48\uff0c\u60a8\u53ef\u4ee5\u67e5\u770b\/etc\/default\/tftpd-hpa\u6587\u4ef6\u4e2d\u7684TFTP_DIRECTORY\u53d8\u91cf\u3002\u901a\u5e38\uff0c\u60a8\u4f1a\u770b\u5230\/var\/lib\/tftpboot\u6216\/srv\/tftp \u4e4b\u7c7b\u7684\u76ee\u5f55\u3002\u5982\u679c\u9700\u8981\uff0c\u60a8\u53ef\u4ee5\u66f4\u6539\u6b64\u76ee\u5f55\u5e76\u91cd\u65b0\u542f\u52a8\u670d\u52a1\u3002<\/p>\n

\r\n\u250c\u2500\u2500(linuxmi\u327flinuxmi)-[~\/linuxmi.com]\r\n\u2514\u2500$ cat \/etc\/default\/tftpd-hpa\r\n<\/pre>\n

\"\"<\/p>\n

\u4e3a\u4e86\u4fbf\u4e8e\u4f7f\u7528\uff0c\u5982\u679c\u60a8\u5c06\u76f8\u5173 TFTP \u4e3b\u76ee\u5f55\u7684\u6240\u6709\u8005\u66f4\u6539\u4e3a\u60a8\u7684\u7528\u6237\u5e10\u6237\uff0c\u5219\u65e0\u9700\u5728\u8fd0\u884c\u7684\u6bcf\u4e2a\u547d\u4ee4\u4e2d\u6dfb\u52a0 sudo \u524d\u7f00\u3002\u4f7f\u7528 chown \u547d\u4ee4\u5c06\u6240\u6709\u6743\u4ece root \u66f4\u6539\u4e3a\u5f53\u524d\u7528\u6237\uff1a<\/p>\n

\r\nsudo chown -R $USER \/srv\/tftp\r\n<\/pre>\n

TFTP \u670d\u52a1\u5668\u5305\u540d\u79f0\u548c\u9ed8\u8ba4\u4e3b\u76ee\u5f55\u53ef\u80fd\u56e0\u4f7f\u7528\u7684 Linux \u53d1\u884c\u7248\u800c\u5f02\u3002<\/p>\n

\u4f7f\u7528 TFTP \u670d\u52a1\u5668\u53d1\u9001\u6587\u4ef6<\/strong><\/div>\n

\u6709\u65f6\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0cTFTP \u662f\u5c06\u6587\u4ef6\u4ece\u5d4c\u5165\u5f0f Linux \u7cfb\u7edf\u79fb\u52a8\u5230\u5916\u90e8\u73af\u5883\u7684\u552f\u4e00\u9009\u62e9\u3002\u4f8b\u5982\uff0c\u6709\u65f6\u7cfb\u7edf\u53ef\u80fd\u4e0d\u652f\u6301\u4efb\u4f55\u53ef\u7528\u4e8e\u4f20\u8f93\u6587\u4ef6\u7684\u53ef\u5199\u5a92\u4f53\u3002<\/p>\n

\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u7531\u4e8e TFTP \u5ba2\u6237\u7aef\u53ef\u80fd\u4f1a\u5728busybox\u4e2d\u7f16\u8bd1\uff0c\u60a8\u53ef\u4ee5\u5c06\u7cfb\u7edf\u4e2d\u4fdd\u5b58\u7684\u6587\u4ef6\u53d1\u9001\u5230\u7f51\u7edc\u4e0a\u7684 TFTP \u670d\u52a1\u5668\u3002<\/p>\n

\u8981\u4f7f\u7528 TFTP \u5ba2\u6237\u7aef\u5e94\u7528\u7a0b\u5e8f\uff0c\u8bf7\u53d1\u51fabusybox tftp\u547d\u4ee4\uff1a<\/p>\n

\r\nbusybox tftp\r\n<\/pre>\n

\u8981\u5c06\u793a\u4f8b\u6587\u4ef6\u53d1\u9001\u5230 TFTP \u670d\u52a1\u5668\uff0c\u60a8\u9700\u8981\u4f7f\u7528\u5982\u4e0b\u547d\u4ee4\uff1a<\/p>\n

\r\nbusybox tftp -l example.bin -p 192.168.1.111\r\n<\/pre>\n

\u867d\u7136\u4e0a\u9762\u7684\u547d\u4ee4\u662f\u6b63\u786e\u7684\uff0c\u4f46\u5728\u5c06\u6587\u4ef6\u4f20\u8f93\u5230 TFTP \u670d\u52a1\u5668\u65f6\u4f1a\u51fa\u9519\u3002\u7531\u4e8e\u8fd4\u56de\u7684\u9519\u8bef\u6d88\u606f\u4e0d\u662f\u4e0d\u8a00\u81ea\u660e\u7684\uff0c\u56e0\u6b64\u5f88\u96be\u7406\u89e3\u771f\u6b63\u7684\u95ee\u9898\u662f\u4ec0\u4e48\u3002<\/p>\n

\u8fd9\u91cc\u7684\u95ee\u9898\u662f\u56e0\u4e3a TFTP \u670d\u52a1\u5668\u4e0a\u7684\u4e00\u4e9b\u5b89\u5168\u7a0b\u5e8f\u3002TFTP \u8981\u6c42\u5177\u6709\u76f8\u540c\u540d\u79f0\u7684\u6587\u4ef6\u5e94\u4f4d\u4e8e\u5c06\u5199\u5165\u6587\u4ef6\u7684\u76ee\u5f55\u4e2d\uff0c\u4f5c\u4e3a\u6587\u4ef6\u4e0a\u4f20\u7684\u5148\u51b3\u6761\u4ef6\uff0c\u5e76\u4e14\u8be5\u6587\u4ef6\u7684\u5199\u5165\u6743\u9650\u5e94\u53ef\u4f9b\u6240\u6709\u4eba\u4f7f\u7528\u3002<\/p>\n

\u6362\u8a00\u4e4b\uff0c\u65e0\u6cd5\u901a\u8fc7 TFTP \u5ba2\u6237\u7aef\u4e0a\u4f20 TFTP \u670d\u52a1\u5668\u4e0a\u4e0d\u5b58\u5728\u7684\u6587\u4ef6\u3002\u5982\u679c\u60a8\u521b\u5efa\u4e00\u4e2a\u540c\u540d\u7684\u7a7a\u6587\u4ef6\u5e76\u7f16\u8f91\u5176\u8bbf\u95ee\u6743\u9650\uff0c\u5219\u4e0a\u8ff0\u4e0a\u4f20\u8fc7\u7a0b\u5c06\u6210\u529f\u3002\u4e3a\u6b64\uff0c\u60a8\u5fc5\u987b\u5728\u76f8\u5173\u7684 TFTP \u670d\u52a1\u5668\u4e3b\u76ee\u5f55\u4e2d\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n

\r\ncd \/srv\/tftp  \r\ntouch example.bin\r\nchmod 666 example.bin\r\n<\/pre>\n

\u73b0\u5728\u60a8\u53ef\u4ee5\u6210\u529f\u6267\u884c\u4e0a\u4f20\u4e86\u3002<\/p>\n

\u4e5f\u53ef\u4ee5\u7981\u7528\u4e0a\u8ff0\u5b89\u5168\u63aa\u65bd\u5e76\u8ba9 TFTP \u670d\u52a1\u5668\u521b\u5efa\u4e00\u4e2a\u4e0d\u5b58\u5728\u7684\u6587\u4ef6\u3002\u4e3a\u6b64\uff0c\u60a8\u53ef\u4ee5\u5728\u542f\u52a8tftpd-hpa\u5e94\u7528\u7a0b\u5e8f\u65f6\u4f7f\u7528-c\u6216--create\u53c2\u6570\u3002\u5c06\u6b64\u53c2\u6570\u6dfb\u52a0\u5230\/etc\/default\/tftpd-hpa\u6587\u4ef6\u4e2d\u73b0\u6709\u7684TFTPD_OPTIONS\u53d8\u91cf\u5c31\u8db3\u591f\u4e86\uff1a<\/p>\n

\r\n# \/etc\/default\/tftpd-hpa  \r\nTFTP_USERNAME=\"tftp\"  \r\nTFTP_DIRECTORY=\"\/srv\/tftp\"  \r\nTFTP_ADDRESS=\"0.0.0.0:69\"  \r\nTFTP_OPTIONS=\"--secure --create\"\r\n<\/pre>\n
\u4e3a\u4ec0\u4e48\u4f7f\u7528 TFTP \u670d\u52a1\u5668\u8fdb\u884c\u6587\u4ef6\u4f20\u8f93\uff1f<\/strong><\/div>\n

TFTP \u6700\u91cd\u8981\u7684\u4f18\u70b9\u662f\u901f\u5ea6\u5feb\uff0c\u5e76\u4e14\u53ef\u4ee5\u5e2e\u52a9\u60a8\u8282\u7701\u65f6\u95f4\u3002\u5b83\u662f\u5c06\u7f51\u7edc\u8bbe\u5907\u7684\u914d\u7f6e\u6587\u4ef6\u4f20\u8f93\u5230\u5176\u4ed6\u7cfb\u7edf\u7684\u7406\u60f3\u9009\u62e9\u3002\u6b64\u5916\uff0c\u5b83\u5177\u6709\u975e\u5e38\u7b80\u5355\u7684\u4f7f\u7528\u6807\u51c6\u3002\u5b83\u53ef\u4ee5\u4e0e\u57fa\u4e8e Windows \u548c Linux \u7684\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u7684\u8f6f\u4ef6\u4e00\u8d77\u8f7b\u677e\u8fd0\u884c\u3002\u6700\u540e\uff0c\u5728\u6280\u672f\u4e0a\u65e0\u6cd5\u4f7f\u7528 FTP \u7684\u60c5\u51b5\u4e0b\uff0cTFTP \u603b\u662f\u53ef\u4ee5\u633d\u6551\u5c40\u9762\u3002<\/p>\n

\u5f53\u7136\uff0c\u6700\u5927\u7684\u7f3a\u70b9\u662f\u4e0d\u5b89\u5168\u3002\u56e0\u6b64\uff0c\u4f7f\u7528 TFTP \u670d\u52a1\u5668\u4f20\u8f93\u6587\u4ef6\u65f6\u5fc5\u987b\u975e\u5e38\u5c0f\u5fc3\u3002<\/p>\n

\u9664\u4e86\u6587\u4ef6\u4f20\u8f93\u4e4b\u5916\uff0c\u60a8\u4e0d\u80fd\u4f7f\u7528 TFTP \u670d\u52a1\u5668\u6267\u884c\u6587\u4ef6\u5220\u9664\u3001\u7f16\u8f91\u548c\u4fee\u6539\u7b49\u529f\u80fd\u3002\u5bf9\u4e8e\u90a3\u4e9b\u4f7f\u7528\u6216\u5bfb\u6c42\u9ad8\u7ea7\u7cfb\u7edf\u7684\u4eba\u6765\u8bf4\uff0c\u6b64\u529f\u80fd\u662f\u4e00\u4e2a\u4e3b\u8981\u7f3a\u70b9\u3002\u6700\u540e\uff0c\u5b83\u4e0d\u9700\u8981\u8eab\u4efd\u9a8c\u8bc1\uff0c\u5982\u679c\u60a8\u8ba4\u771f\u5bf9\u5f85\u81ea\u5df1\u7684\u5b89\u5168\u6027\uff0c\u8fd9\u662f\u4e00\u4e2a\u4e3b\u8981\u7f3a\u70b9\u3002<\/p>\n

\u5728\u5176\u4ed6\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u8bbe\u7f6e TFTP<\/strong><\/div>\n

\u5982\u679c\u8981\u5728 Windows \u4e0a\u4f7f\u7528 TFTP\uff0c\u5219\u65e0\u9700\u5b89\u88c5\u4efb\u4f55\u7b2c\u4e09\u65b9\u8f6f\u4ef6\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u63a7\u5236\u9762\u677f\u4e2d\u7684\u6253\u5f00\u6216\u5173\u95ed Windows \u529f\u80fd\u9009\u9879\u542f\u7528 TFTP\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

TFTP\uff08Trivial File Transfer Protocol\uff0c\u7b80\u5355\u6587\u4ef6\u4f20\u8f93\u534f\u8bae\uff09\u4e8e 1980 \u5e74\u9996\u6b21 […]<\/p>\n","protected":false},"author":370,"featured_media":169967,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-247832","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/247832","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/370"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=247832"}],"version-history":[{"count":3,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/247832\/revisions"}],"predecessor-version":[{"id":247838,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/247832\/revisions\/247838"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/169967"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=247832"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=247832"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=247832"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}