{"id":174,"date":"2010-12-11T16:28:16","date_gmt":"2010-12-11T08:28:16","guid":{"rendered":"http:\/\/www.ipcpu.com\/?p=174"},"modified":"2010-12-11T16:28:16","modified_gmt":"2010-12-11T08:28:16","slug":"linux-pxe","status":"publish","type":"post","link":"https:\/\/c.ipcpu.com\/2010\/12\/linux-pxe\/","title":{"rendered":"\u4f7f\u7528PXE\u5b89\u88c5Linux"},"content":{"rendered":"

Version:v1.0.0
\nDate:2010-12-11
\nAuthor:ipcpu
\nCopyright:GPL v3<\/p>\n

\u5982\u4eca\u5e02\u9762\u4e0a\u7684\u5927\u90e8\u5206\u7f51\u5361\u90fd\u6709PXE\u529f\u80fd\u4e86\uff0c\u670d\u52a1\u5668\u7684\u5c31\u66f4\u4e0d\u7528\u8bf4\u4e86\uff0cPXE\u7684\u597d\u5904\u5728\u4e8e\u53ef\u4ee5\u5728\u6ca1\u6709\u5149\u9a71\u60c5\u51b5\u4e0b\uff0c\u4e5f\u80fd\u5bf9\u7cfb\u7edf\u8fdb\u884c\u5b89\u88c5\u3002\u8fd9\u5c31\u5927\u5927\u65b9\u4fbf\u4e86\u6211\u4eec\u8fd9\u4e9bSA\u4eec\u3002<\/p>\n

\u672c\u6587\u5206\u6210Linux\u7248\u548cWindows\u7248\u4e24\u4e2a\u7248\u672c\u3002\u4e3b\u8981\u8003\u8651\u5230\u5f88\u591aSA\u4f7f\u7528\u7684\u7b14\u8bb0\u672c\u7535\u8111\u662fWindows\uff0c\u5728\u81ea\u5df1\u7684\u5c0f\u672c\u672c\u4e0a\u90e8\u7f72PXE\u542f\u52a8\u670d\u52a1\uff0c\u5c31\u53ef\u4ee5\u62ff\u7740\u5c0f\u672c\u5230\u5904\u7528\u4e86\u3002<\/p>\n

\u4f7f\u7528PXE\u5b89\u88c5\u7cfb\u7edf\u6211\u4eec\u9700\u8981\u7528\u5230\uff1a<\/p>\n

DHCP \u670d\u52a1\u5668\u8f6f\u4ef6\uff1a<\/strong><\/span>\u7528\u4e8e\u7ed9PXE\u5ba2\u6237\u7aef\u5206\u914dIP\u5730\u5740\u548c\u542f\u52a8\u6587\u4ef6<\/p>\n

TFTP \u670d\u52a1\u5668\u8f6f\u4ef6<\/strong>\uff1a<\/span>\u5411PXE\u5ba2\u6237\u7aef\u4f20\u9001\u542f\u52a8\u65f6\u6240\u9700\u8981\u7684\u6587\u4ef6<\/p>\n

HTTP\/NFS\/FTP\/\u8f6f\u4ef6<\/strong><\/span>\uff1a\u4e3b\u8981\u63d0\u4f9b\u7cfb\u7edf\u5b89\u88c5\u76d8\u7684\u5168\u90e8\u6587\u4ef6\u3002\uff08\u8fd9\u4e9b\u534f\u8bae\u8f83TFTP\u7a33\u5b9a\uff09<\/p>\n

\u7b2c\u4e00\u90e8\u5206 Linux\u7248<\/strong><\/h1>\n

\u5176\u5b9e\u7f51\u4e0a\u6709\u5f88\u591a\u7684\u6559\u7a0b\uff0c\u6211\u4eec\u968f\u4fbf\u6311\u4e00\u4e2ahttp:\/\/bbs.linuxtone.org\/thread-1586-1-1.html<\/a><\/p>\n

1.<\/strong>\u00a0\u00a0\u00a0\u00a0\u9996\u5148\u662f\u642d\u5efaDHCP\u670d\u52a1\u5668<\/strong>\uff0c\u8fd9\u4e2a\u7528yum\u5b89\u88c5\u4e00\u4e0b\u5c31\u53ef\u4ee5\u4e86\u3002\u8fd9\u91cc\u4ecd\u7136\u53ea\u628a\u4eba\u5bb6\u7684\u914d\u7f6e\u6587\u4ef6\u8d34\u4e00\u4e0b\u518d\u89e3\u91ca\u4e00\u4e0b\u3002<\/p>\n

# more \/etc\/dhcpd.conf
\n#
\nddns-update-style interim;
\nignore client-updates;
\nallow booting;
\nallow bootp;
\nsubnet 4.4.4.0 netmask 255.255.255.0 {<\/p>\n

option routers 4.4.4.1;
\noption subnet-mask 255.255.255.0;
\noption domain-name-servers 4.4.4.1;
\noption time-offset -18000;
\nrange dynamic-bootp 4.4.4.201 4.4.4.209; #\u9700\u8981\u5206\u914d\u7684IP\u6bb5
\ndefault-lease-time 21600;
\nmax-lease-time 43200;
\nnext-server 4.4.4.1; #\u8fd9\u91cc\u6307\u5b9aTFTP\u670d\u52a1\u5668IP\u5730\u5740
\nfilename \u201c\/pxelinux.0\u2033; #\u8fd9\u91cc\u6307\u5b9a\u542f\u52a8\u6587\u4ef6\uff0c\u6211\u4eec\u7edf\u4e00\u4f7f\u7528syslinux
\n}<\/p>\n

\u914d\u7f6e\u5b8c\u542f\u52a8\u670d\u52a1\u5373\u53ef\u3002<\/span><\/p>\n

2.<\/strong>\u00a0 \u00a0 \u00a0 \u00a0\u00a0\u00a0TFTP\u670d\u52a1\u5668\u642d\u5efa<\/strong><\/p>\n

Linux\uff08\u8fd9\u91cc\u4ee5CentOS\u4e3e\u4f8b\uff09\u7684TFTP\u670d\u52a1\u5668\u65f6\u4f7f\u7528xinetd\u6765\u7ba1\u7406\u7684\uff0c\u5b89\u88c5TFTP\u7684\u65f6\u5019\u4e0d\u8981\u5fd8\u4e86\u8981\u4e0dxinetd\u4e5f\u88c5\u4e0a\u3002\uff08xinetd\u73b0\u5728\u5df2\u7ecf\u4e0d\u662f\u9ed8\u8ba4\u5b89\u88c5\u7684\u4e86\uff09<\/p>\n

\u4fee\u6539\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n

#more \/etc\/xinetd.d\/tftp<\/p>\n

service tftp
\n{
\ndisable = no #\u9ed8\u8ba4\u662fyes \u6539\u4e3ano<\/p>\n

\u2026\u2026<\/p>\n

}<\/p>\n

\u6539\u5b8c\u540e\u542f\u52a8\u6216\u8005\u91cd\u542fxinetd\u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n

\u8fd9\u91cc\u8fd8\u8981\u8bf4\u660e\u4e00\u70b9\uff0c\u82e5\u679c\u4f7f\u7528\u7684yum\u6216\u8005rpm\u6765\u5b89\u88c5\u7684\u8bdd\uff0c\u4f1a\u81ea\u52a8\u751f\u6210\/tftpboot \u6587\u4ef6\u5939\uff0c\u8fd9\u4e2a\u6587\u4ef6\u5939\u5c31\u662fTFTP\u7684\u6839\u76ee\u5f55\u3002<\/p>\n

3.<\/strong>\u00a0 \u00a0 \u00a0 \u00a0\u00a0\u00a0\u914d\u7f6ePXE\u542f\u52a8\u9700\u8981\u7684\u6587\u4ef6<\/strong>\uff0c\u628a\u4ed6\u4eec\u7edf\u4e00\u653e\u5230TFTP\u6839\u76ee\u5f55<\/p>\n

A\uff0epxelinux.0<\/span><\/strong>\u00a0<\/span>\u8fd9\u4e2a\u6587\u4ef6\u5728\u7cfb\u7edf\u4e2d\u8def\u5f84\u662f\/usr\/lib\/syslinux\/pxelinux.0 \uff08\u4e5f\u53ef\u4ee5\u4ece\u5b98\u7f51\u4e0b\u8f7d\uff09<\/p>\n

B\uff0e vmlinuz\u00a0<\/span><\/span><\/strong>\u8fd9\u4e2a\u6587\u4ef6\u5728\u5b89\u88c5\u5149\u76d8\u7684isolinux\u76ee\u5f55<\/p>\n

C\uff0e initrd.img<\/span><\/strong>\u00a0<\/span>\u8fd9\u4e2a\u6587\u4ef6\u5728\u5b89\u88c5\u5149\u76d8\u7684isolinux\u76ee\u5f55<\/p>\n

D\uff0e\u5728TFTP\u6839\u76ee\u5f55\u65b0\u5efapxelinux.cfg\u76ee\u5f55<\/span><\/strong>\uff08\u6ce8\u610f\u662f\u76ee\u5f55\uff09<\/p>\n

E\uff0e pxelinux.cfg\/default\u00a0<\/span><\/span><\/strong>\u628a\u5b89\u88c5\u5149\u76d8isolinux\/isolinux.cfg\u590d\u5236\u5e76\u91cd\u547d\u540d\u4e3apxelinux.cfg\/default<\/p>\n

\u547d\u4ee4\u5982\u4e0bcp \/mnt\/isolinux\/isolinux.cfg \/tftpboot\/pxelinux.cfg\/default<\/p>\n

F\uff0e splash.lss<\/span><\/strong>\u8fd9\u4e2a\u6587\u4ef6\u5728\u5b89\u88c5\u5149\u76d8\u7684isolinux\u76ee\u5f55(\u8fd9\u4e2a\u6587\u4ef6\u5176\u5b9e\u662f\u4e00\u4e2a\u56fe\u7247\uff0c\u5c31\u662f\u542f\u52a8CentOs\u5b89\u88c5\u663e\u793a\u7684\u90a3\u4e2a\u56fe\u7247\uff0c\u53ef\u4ee5\u52a0\u4e5f\u53ef\u4ee5\u4e0d\u52a0)<\/p>\n

\u914d\u7f6e\u5b8c\u4ee5\u4e0a\u51e0\u9879\u5c31\u53ef\u4ee5\u4f7f\u7528PXE\u542f\u52a8\u6765\u6d4b\u8bd5\u4e86\uff0c\u5982\u679c\u6ca1\u95ee\u9898\u4f1a\u8fdb\u5165\u5b89\u88c5\u754c\u9762\u3002<\/p>\n

\"pxe1\"<\/a><\/p>\n

\"pxe2\"<\/a><\/p>\n

4.<\/strong>\u00a0 \u00a0 \u00a0 \u00a0\u00a0\u00a0\u914d\u7f6eHTTP\/NFS\/FTP<\/strong><\/p>\n

\u8fd9\u4e00\u60f3\u6211\u5c31\u7701\u7565\u4e86\uff0c\u5475\u5475\u3002<\/p>\n

\u7b2c\u4e8c\u90e8\u5206 Windows\u7248<\/h1>\n

Linux\u4e0b\u7684\u4e1c\u897f\u771f\u662f\u590d\u6742\uff0c\u4ec0\u4e48\u4e1c\u897f\u90fd\u8981\u81ea\u5df1\u53bb\u4fee\u6539\u3002\u4e0b\u9762\u6211\u4eec\u6765\u770bWindows\u4e0b\u7684\u914d\u7f6e\u3002<\/p>\n

\u6211\u4eec\u7528\u5230\u4e86\u4e00\u4e2a\u8f6f\u4ef6TFTPD32\uff0c\u8fd9\u662f\u4e00\u4e2a\u5f00\u6e90\u8f6f\u4ef6\uff0c\u7f51\u4e0a\u6d41\u4f20\u4e86\u5f88\u591a\u7248\u672c\uff0c\u5927\u5bb6\u6ce8\u610f\u9009\u62e9\uff0c\u6709\u4e9b\u7248\u672c\u662f\u4e0d\u652f\u6301TFTP\u5b50\u76ee\u5f55\u7684\uff0c\u5177\u4f53\u53ef\u4ee5\u4ea7\u770bTFTP\u65e5\u5fd7\u6765\u5224\u65ad\u9519\u8bef\u3002<\/p>\n

\u8fd9\u4e2a\u8f6f\u4ef6\u81ea\u5e26TFTP\u548cDHCP\u670d\u52a1\u5668\uff0c\u5927\u5bb6\u53ef\u4ee5\u81ea\u884c\u8bbe\u5b9a\u3002<\/p>\n

\"pxe3\"<\/a><\/p>\n

\u540c\u6837\u628a\u6240\u9700\u8981\u7684\u6587\u4ef6\u653e\u5230TFTP\u6839\u76ee\u5f55\u5373\u53ef\u3002<\/p>\n

\u5176\u4ed6\u8d44\u6599\uff1a<\/strong><\/p>\n

TFTPD32\u5b98\u65b9\u7f51\u7ad9\uff1ahttp:\/\/tftpd32.jounin.net\/<\/p>\n

Syslinux\u5b98\u65b9\u7f51\u7ad9\uff1ahttp:\/\/syslinux.zytor.com\/wiki\/index.php\/The_Syslinux_Project<\/p>\n

\u4e0b\u671f\u9884\u544a\uff1a<\/strong><\/p>\n

\u6211\u4f1a\u5728\u4e0b\u4e00\u7bc7\u6587\u7ae0\u4e2d\u89e3\u91ca\u81ea\u5b9a\u4e49PXE\u542f\u52a8\u754c\u9762\u3002\u5982\u4f55\u5b9e\u73b0\u4e0b\u56fe\u7684\u6548\u679c\u3002<\/p>\n

\"pxe4\"<\/a><\/p>\n

\n

\u8f6c\u8f7d\u8bf7\u6ce8\u660e\uff1aIPCPU-\u7f51\u7edc\u4e4b\u8def<\/a> » \u4f7f\u7528PXE\u5b89\u88c5Linux<\/a><\/p>","protected":false},"excerpt":{"rendered":"

Version:v1.0.0 Date:2010-12-11 Author:ipcpu Copyright:GPL v3 \u5982\u4eca\u5e02\u9762\u4e0a\u7684\u5927\u90e8\u5206\u7f51\u5361\u90fd\u6709PXE\u529f\u80fd\u4e86\uff0c\u670d\u52a1\u5668\u7684\u5c31\u66f4\u4e0d\u7528\u8bf4\u4e86\uff0cPXE\u7684\u597d\u5904\u5728\u4e8e\u53ef\u4ee5\u5728\u6ca1\u6709\u5149\u9a71\u60c5\u51b5\u4e0b\uff0c\u4e5f\u80fd\u5bf9\u7cfb\u7edf\u8fdb\u884c\u5b89\u88c5\u3002\u8fd9\u5c31\u5927\u5927\u65b9\u4fbf\u4e86\u6211\u4eec\u8fd9\u4e9bSA\u4eec\u3002 \u672c\u6587\u5206\u6210Linux\u7248\u548cWindows\u7248\u4e24\u4e2a\u7248\u672c\u3002\u4e3b\u8981\u8003\u8651\u5230\u5f88\u591aSA\u4f7f\u7528\u7684\u7b14\u8bb0\u672c\u7535\u8111\u662fWindows\uff0c\u5728\u81ea\u5df1\u7684\u5c0f\u672c\u672c\u4e0a\u90e8\u7f72PXE\u542f\u52a8\u670d\u52a1\uff0c\u5c31\u53ef\u4ee5\u62ff\u7740\u5c0f\u672c\u5230\u5904\u7528\u4e86\u3002 \u4f7f\u7528PXE\u5b89\u88c5\u7cfb\u7edf\u6211\u4eec\u9700\u8981\u7528\u5230\uff1a DHCP \u670d\u52a1\u5668\u8f6f\u4ef6\uff1a\u7528\u4e8e\u7ed9PXE\u5ba2\u6237\u7aef\u5206\u914dIP\u5730\u5740\u548c\u542f\u52a8\u6587\u4ef6 TFTP \u670d\u52a1\u5668\u8f6f\u4ef6\uff1a\u5411PXE\u5ba2\u6237\u7aef\u4f20\u9001\u542f\u52a8\u65f6\u6240\u9700\u8981\u7684\u6587\u4ef6 HTTP\/NFS\/FTP\/\u8f6f\u4ef6\uff1a\u4e3b\u8981\u63d0\u4f9b\u7cfb\u7edf\u5b89\u88c5\u76d8\u7684\u5168\u90e8\u6587\u4ef6\u3002\uff08\u8fd9\u4e9b\u534f\u8bae\u8f83TFTP\u7a33\u5b9a\uff09 \u7b2c\u4e00\u90e8\u5206 Linux\u7248 \u5176\u5b9e\u7f51\u4e0a\u6709\u5f88\u591a\u7684\u6559\u7a0b\uff0c\u6211\u4eec\u968f\u4fbf\u6311\u4e00\u4e2ahttp:\/\/bbs.linuxtone.org\/thread-1586-1-1.html 1.\u00a0\u00a0\u00a0\u00a0\u9996\u5148\u662f\u642d\u5efaDHCP\u670d\u52a1\u5668\uff0c\u8fd9\u4e2a\u7528yum\u5b89\u88c5\u4e00\u4e0b\u5c31\u53ef\u4ee5\u4e86\u3002\u8fd9\u91cc\u4ecd\u7136\u53ea\u628a\u4eba\u5bb6\u7684\u914d\u7f6e\u6587\u4ef6\u8d34\u4e00\u4e0b\u518d\u89e3\u91ca\u4e00\u4e0b\u3002 # more \/etc\/dhcpd.conf # ddns-update-style interim; ignore client-updates; allow booting; allow bootp; subnet 4.4.4.0 netmask 255.255.255.0 { option routers 4.4.4.1; option subnet-mask 255.255.255.0; option domain-name-servers 4.4.4.1; option time-offset -18000; range dynamic-bootp 4.4.4.201 4.4.4.209; #\u9700\u8981\u5206\u914d\u7684IP\u6bb5 default-lease-time 21600; max-lease-time 43200; […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3,13],"tags":[17,19],"_links":{"self":[{"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/posts\/174"}],"collection":[{"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/comments?post=174"}],"version-history":[{"count":0,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/posts\/174\/revisions"}],"wp:attachment":[{"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/media?parent=174"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/categories?post=174"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/tags?post=174"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}