pxe网络启动
Have you ever needed to troubleshoot or diagnose a problematic computer and you forgot where the utility CD is? We’ll show you how to utilize network booting (PXE) with FOG to make that problem a thing of the past.
您是否曾经需要对计算机进行故障排除或诊断,而忘记了实用程序CD的位置? 我们将向您展示如何将网络启动(PXE)与FOG结合使用,使该问题成为过去。
Image by h.koppdelaney
PXE概述 (Overview of PXE)
PXE (Pre eXecution Environment), affectionately pronounced Pixie (as in fairy dust), is a method of having an end computer (client) boot using only its network card. This method of booting was created way back in 1999 and as long as the computer in question is connected to the network (and supports this standard), it is possible to circumvent the normal boot procedure (I.E. Power on –> BIOS –> HD/CD) and do some nifty stuff starting from troubleshooting, to using a liveOS and even re-imaging the machine…. but we are getting ahead of our selves lets get back to the beginning.
PXE(预执行环境),亲切地称为Pixie(如仙尘),是一种仅使用其网卡引导终端计算机(客户端)的方法。 这种引导方法是在1999年创建的,只要有问题的计算机连接到网络(并支持该标准),就有可能绕过正常的引导过程(即IE Power on –> BIOS –> HD / CD),并做一些漂亮的事情,从故障排除到使用liveOS甚至重新映像机器……。 但是我们要超越自我,让我们回到起点 。
When using PXE the boot process is changed from the normal order to:
使用PXE时,引导过程从正常顺序更改为:
Power on –> BIOS –> Network Card’s PXE stack –> Network Boot Program (NBP) downloaded using TFTP from server to Client’s RAM –> NBP’s responsibility to perform the next step (a.k.a. 2nd stage boot).
开机–> BIOS –>网卡的PXE堆栈–>使用TFTP从服务器下载到网络启动程序(NBP)到客户端的RAM –> NBP负责执行下一步(又称为第二阶段启动)。
Using the “PXElinux” NBP, it is possible to setup the server for more then just one PXE boot program for our clients. In a sense, it is the secret ingredient that enables us to perform all of the above and then some. For a more in depth explanation of the entire process, its history and some of the infrastructure options it and gPXE (which is a more evolved cousin) enable, see this lecture on YouTube from their developers. Also, below is a video of a setup from 2008 that quickly goes over some of the boot possibilities.
使用“ PXElinux ” NBP,可以为我们的客户端设置服务器,而不仅仅是一个PXE引导程序。 从某种意义上说,正是秘密成分使我们能够执行上述所有任务,然后再执行某些任务。 要更深入地说明整个过程,其历史以及它和gPXE(一个更先进的表亲)支持的一些基础架构选项,请参阅开发者在YouTube上的本讲座 。 另外,以下是2008年安装程序的视频,可以快速介绍一些启动可能性。
Note: In this video, the deprecated UDA project is used as the base for the server, and the annotations were aimed to explain to a friend the (at the time) recent additions made to it.
注意:在此视频中,已弃用的UDA项目用作服务器的基础,并且注释的目的是向朋友说明(当时)最近对其进行的添加。
目标 (Goal)
This guide will be the first of a series of guides about PXEing. In this guide, we will lay the foundations which we will build upon in future articles.
本指南将是有关PXEing的一系列指南中的第一本。 在本指南中,我们将为以后的文章奠定基础。
建议,假设和前提条件 (Recommendations, Assumptions and Prerequisites)
The client machine you are testing with, supports PXE bootingand you know how to enable it.
与您一起测试的客户端计算机支持PXE引导,并且您知道如何启用它。
- This guide was written and tested using Debian Squeeze, Ubuntu server 9.10 and Linux Mint10. Therefore it is assumed that you have a Debian based system to work with as well. 本指南是使用Debian Squeeze,Ubuntu服务器9.10和Linux Mint10编写和测试的。 因此,假定您还具有一个基于Debian的系统。
You may want to have a look at How to Setup Software RAID for a Simple File Server and How to Setup Network Link aggregation (802.3ad), because the disk and network bandwidth demands on this kind of a server can get real high real fast. Building on the foundation of a server with high resiliency for its network and disk subsystems is highly recommended.
您可能想看一下如何为简单文件服务器设置软件RAID和如何设置网络链接聚合(802.3ad) ,因为此类服务器对磁盘和网络带宽的需求会很快提高。 强烈建议在具有高弹性的服务器基础上为其网络和磁盘子系统构建服务器。
- You will see me use VIM as the editor program, this is just because I’m used to it… you may use any other editor that you’d like. 您会看到我将VIM用作编辑器程序,这仅仅是因为我已经习惯了……您可以使用任何其他想要的编辑器。
安装–利用FOG进行繁重的工作 (Installation – The heavy lifting by leveraging FOG)
FOG is a free, open source computer cloning solution created by *Chuck Syperski and Jian Zhang. FOG takes regularly available software (like Apache, MySQL and tftpd-hpa to mention a few) and packages them into a free and productized PC Lifecycle management (PCLM) solution. Using this free PCLM it is possible to backup a computers state by imaging it, deploy programs and settings (I.E. Firefox, Office, Printers & etc’) and configuration policies (I.E. automatic logoff and screen saver settings) to mention a few, through one central web interface. Note: An interview with Chuck and Jian about FOG is available at the Tightwad Tech.
FOG是由* Chuck Syperski和Jian Zhang创建的免费的开源计算机克隆解决方案。 FOG接收定期可用的软件(例如Apache,MySQL和tftpd-hpa等),并将其打包到免费的产品化PC生命周期管理(PCLM)解决方案中。 使用此免费的PCLM,可以通过对计算机状态进行映像,部署程序和设置(例如Firefox,Office,打印机等)和配置策略(例如,自动注销和屏幕保护程序设置)来备份计算机状态,从而一举多得中央Web界面。 注意 :可以在Tightwad Tech上对Chuck和Jian进行有关FOG的采访。
Using FOG as the foundation for your PXE server, is a great shortcut to having all of the necessary parts like TFTP and if required, DHCP in place without having to install and configure them manually, while granting you all of FOG’s functionality as a bonus.
使用光纤陀螺作为PXE服务器的基础,是一个伟大的快捷方式,让所有喜欢TFTP必要的部分,并且如果需要的话,DHCP到位无需安装并手动配置,同时授予您所有的陀螺的功能作为奖金 。
As our goal is to add functionality to this already great system, we will not cover how to use FOG itself, nor its installation procedure in depth. FOG’s wiki, with their written & video how-tos is sufficiently robust to get the in depth information, if you want to geek through it. The summarized steps are:
因为我们的目标是为这个已经很好的系统添加功能,所以我们将不讨论FOG本身的使用方法,也不深入介绍其安装过程。 FOG的Wiki及其书面和视频操作方法足够强大,可以深入了解深度信息(如果您想浏览一下)。 概括的步骤是:
-
sudo mkdir -p /opt/fog-setup
cd /opt/fog-setupsudo mkdir -p /opt/fog-setup
cd /opt/fog-setup Download the latest FOG packagefrom sourceforge to the directory created in the previous step.
从sourceforge下载最新的FOG软件包到上一步中创建的目录。
Extract the package and start the installation.
解压缩软件包并开始安装。
sudo tar -xvzf fog*
cd fog*
cd bin
sudo ./installfog.shsudo tar -xvzf fog*
cd fog*
cd bin
sudo ./installfog.shYou will be prompted several times by the installer:
安装程序将多次提示您:
1. What version of Linux would you like to run the installation for? – 2 (again, assuming a Debian based system is used)
1.您要运行哪个版本的Linux? – 2(同样,假设使用基于Debian的系统)
2. What type of installation would you like to do? [N] – Enter
2.您想进行哪种类型的安装? [N] –输入
3. What is the IP address to be used by this FOG Server? [
3.此FOG服务器使用的IP地址是什么? [
server-IP-detected-on-eth0] – Enter.
服务器IP在eth0上检测到 ] –输入。
4. Would you like to setup a router address for the DHCP server? [Y/n] – Enter.
4.您想为DHCP服务器设置路由器地址吗? [是/否] –输入。
5. Would you like to setup a DNS address for the DHCP server and client boot image? [Y/n] – Enter.
5.您想为DHCP服务器和客户端启动映像设置DNS地址吗? [是/否] –输入。
6. Would you like to change the default network interface from eth0? If you are not sure, select No. [y/N] – Enter.
6.您想从eth0更改默认网络接口吗? 如果不确定,请选择“否”。[y / N] –输入。
7. Would you like to use the FOG server for dhcp service? [Y/n] – *Enter
7.您想将FOG服务器用于dhcp服务吗? [是/否] – *输入
8. This version of FOG has internationalization support, would you like to install the additional language packs? [Y/n] – n.
8.此版本的FOG具有国际化支持,您是否要安装其他语言包? [Y / n] – n。
9. Are you sure you wish to continue (Y/N) – Y.
9.确定要继续(Y / N)–是。
10. Acknowledge and follow the on screen instructions for
10.确认并按照屏幕上的说明进行操作
“MySQL“.
“ MySQL ” 。
11. Leave the
11.离开
MySQL password blank for the root account.
root帐户的MySQL密码为空 。
12. Would you like to notify the FOG group about this installation? – Y (recommended)
12.您想通知FOG组有关此安装的信息吗? – Y(推荐)
Image from the FOG wiki.
图片来自FOG Wiki。
- Go to the Fog address with your browser and follow the on screen instructions. 使用浏览器转到雾地址,然后按照屏幕上的说明进行操作。
*Note: Assuming you do NOT have another DHCP or that it is not setup to handle PXE. If you want to configure your existing DHCP, see Configure DHCP for PXE.
* 注意 :假设您没有其他DHCP或未将其设置为处理PXE。 如果要配置现有的DHCP,请参阅为PXE配置DHCP 。
As far as installing FOG goes, that should be it. Again, while FOG is a great system, using it, is not the focus of this guide, and we encourage you to head over to it’s wiki so you can get a better grasp of FOG’s abilities and how it can help you to manage your clients lifecycle.
就安装FOG而言,应该就是这样。 再说一次,虽然FOG是一个很好的系统,但使用它并不是本指南的重点,我们鼓励您访问它的Wiki,以便您可以更好地了解FOG的能力以及它如何帮助您管理客户生命周期。
If all when well you should be able to PXE boot your client machine (usually F12) and get greeted by FOG’s default menu. Image captured by Hotfortech.
如果一切顺利,您应该可以PXE引导您的客户端计算机(通常为F12)并受到FOG的默认菜单的欢迎。 图片由Hotfortech捕获。
As a quick “taste of things to come” you may select the “Run Memtest86+” option and get greeted by the Memtest program we covered in our “Diagnose PC Hardware Problems with an Ubuntu Live CD” guide.
作为一种快速的“ 体验 ”,您可以选择“运行Memtest86 +”选项,并受到“使用Ubuntu Live CD诊断PC硬件问题 ”指南中介绍的Memtest程序的欢迎。
File and directory Structures
文件和目录结构
As stated earlier, our aim is to extend FOG’s abilities and to that end we will need to add some files and directories.
如前所述,我们的目标是扩展FOG的功能,为此,我们将需要添加一些文件和目录。
Create the subdirectory structure:
创建子目录结构:
sudo mkdir -p /tftpboot/howtogeek/menus
sudo mkdir -p /tftpboot/howtogeek/linux
sudo mkdir -p /tftpboot/howtogeek/pics
sudo mkdir -p /tftpboot/howtogeek/utils
sudo mkdir -p /tftpboot/howtogeek/menus
sudo mkdir -p /tftpboot/howtogeek/linux
sudo mkdir -p /tftpboot/howtogeek/pics
sudo mkdir -p /tftpboot/howtogeek/utils
These sub-directories will serve as templates for all the pictures, programs and configurations we will use to extend FOG.
这些子目录将用作我们用于扩展FOG的所有图片,程序和配置的模板。
Adjusting the “default” configuration file
调整“默认”配置文件
We will build a new main menu, and put all of the FOG functions into their own sub-menu.
我们将建立一个新的主菜单,并将所有FOG功能放入其自己的子菜单中。
Copy the /tftpboot/pxelinux.cfg/default configuration file into howtogeek/menus/fog.cfg
将/tftpboot/pxelinux.cfg/默认配置文件复制到howtogeek / menus / fog.cfg
sudo cp /tftpboot/pxelinux.cfg/default /tftpboot/howtogeek/menus/fog.cfg
sudo cp /tftpboot/pxelinux.cfg/default /tftpboot/howtogeek/menus/fog.cfg
Now edit the content of the original “default” file:
现在,编辑原始“默认”文件的内容:
sudo vim /tftpboot/pxelinux.cfg/default
sudo vim /tftpboot/pxelinux.cfg/default
Make its content look like this:
使它的内容如下所示:
DEFAULT vesamenu.c32
MENU TITLE FOG 0.32 + HowToGeek's enhancements
MENU INCLUDE /pxelinux.cfg/master.cfg
menu color title 1;36;44 #ff8c00 #00000000 std
LABEL FOG
MENU LABEL Manual FOG
MENU DEFAULT
KERNEL vesamenu.c32
APPEND howtogeek/menus/fog.cfg
DEFAULT vesamenu.c32
MENU TITLE FOG 0.32 + HowToGeek's enhancements
MENU INCLUDE /pxelinux.cfg/master.cfg
menu color title 1;36;44 #ff8c00 #00000000 std
LABEL FOG
MENU LABEL Manual FOG
MENU DEFAULT
KERNEL vesamenu.c32
APPEND howtogeek/menus/fog.cfg
LABEL Utils MENU
LABEL Utilities
KERNEL vesamenu.c32
APPEND howtogeek/menus/utils.cfg
LABEL Utils MENU
LABEL Utilities
KERNEL vesamenu.c32
APPEND howtogeek/menus/utils.cfg
LABEL Linux
MENU LABEL Linux stuff
KERNEL vesamenu.c32
APPEND howtogeek/menus/linux.cfg
LABEL fog.local
localboot 0
MENU LABEL Boot from hard disk
TEXT HELP Boot from the local hard drive. If you are unsure, select this option.
ENDTEXT
PROMPT 0 TIMEOUT 300
ONTIMEOUT fog.local
LABEL Linux
MENU LABEL Linux stuff
KERNEL vesamenu.c32
APPEND howtogeek/menus/linux.cfg
LABEL fog.local
localboot 0
MENU LABEL Boot from hard disk
TEXT HELP Boot from the local hard drive. If you are unsure, select this option.
ENDTEXT
PROMPT 0 TIMEOUT 300
ONTIMEOUT fog.local
When we finish, this configuration will give you 3 sub-menus: “Utilities”, “Manual FOGing”, “Linux stuff”.
完成后,此配置将为您提供3个子菜单:“实用程序”,“手动FOGing”,“ Linux内容”。
Create the “master” file
创建“主”文件
The master file allows us to make global changes to the look and feel of the menus without reentering them individually over and over. Things like the default background picture, border stile, position Etc’, will all be consolidated in this master.cfg file.
主文件使我们可以对菜单的外观进行整体更改,而不必一遍又一遍地重新输入。 诸如默认背景图片,边框,位置Etc'之类的内容都将合并到此master.cfg文件中。
Create the file:
创建文件:
sudo vim /tftpboot/pxelinux.cfg/master.cfg
sudo vim /tftpboot/pxelinux.cfg/master.cfg
Make it’s content look like:
使它的内容看起来像:
MENU BACKGROUND fog/genie.png menu color screen 37;40 #80ffffff #00000000 std menu color border 30;44 #9370db #00000000 std menu color title 1;36;44 #ff8c00 #00000000 std menu color unsel 37;44 #ffffffff #00000000 std menu color hotkey 1;37;44 #ffffffff #00000000 std menu color sel 7;37;40 #4eee94 #9370db all menu color hotsel 1;7;37;40 #e0400000 #20ff8000 all menu color disabled 1;30;44 #60cccccc #00000000 std menu color scrollbar 30;44 #40000000 #00000000 std menu color tabmsg 31;40 #90ffff00 #00000000 std menu color cmdmark 1;36;40 #c000ffff #00000000 std menu color cmdline 37;40 #c0ffffff #00000000 std menu color pwdborder 30;47 #80ffffff #20ffffff std menu color pwdheader 31;47 #80ff8080 #20ffffff std menu color pwdentry 30;47 #80ffffff #20ffffff std menu color timeout_msg 37;40 #80ffffff #00000000 std menu color timeout 1;37;40 #c0ffffff #00000000 std menu color help 37;40 #c0ffffff #00000000 std menu color msg07 37;40 #90ffffff #00000000 std
菜单背景fog / genie.png菜单彩色屏幕37; 40#80ffffff#00000000标准菜单颜色边框30; 44#9370db#00000000标准菜单颜色标题1; 36; 44#ff8c00#00000000标准菜单颜色unsel 37; 44 #ffffffff #00000000标准菜单颜色快捷键1; 37; 44 #ffffffff#00000000标准菜单颜色sel 7; 37; 40#4eee94#9370db所有菜单颜色快捷键1; 7; 37; 40#e0400000#20ff8000禁用所有菜单颜色1; 30 ; 44#60cccccc#00000000标准菜单颜色滚动条30; 44#40000000#00000000标准菜单颜色tabmsg 31; 40#90ffff00#00000000标准菜单颜色cmdmark 1; 36; 40#c000ffff#00000000标准菜单颜色cmdline 37; 40#c0ffffff #00000000 std菜单颜色pwdborder 30; 47#80ffffff#20ffffff std菜单颜色pwdheader 31; 47#80ff8080#20ffffff std菜单颜色pwdentry 30; 47#80ffffff#20ffffff std菜单颜色timeout_msg 37; 40#80ffffff#00000000 std菜单颜色超时1; 37; 40#c0ffffff#00000000 std菜单颜色帮助37; 40#c0ffffff#00000000 std菜单颜色msg07 37; 40#90ffffff#00000000 std
MENU MARGIN 0 MENU PASSWORDMARGIN 3 MENU ROWS 15 MENU TABMSGROW 21 MENU CMDLINEROW 20 MENU PASSWORDROW 11 MENU TIMEOUTROW 20 MENU HSHIFT 0 MENU VSHIFT 0
菜单边距0菜单密码边距3菜单行15菜单TABMSGROW 21菜单CMDLINEROW 20菜单PASSWORDROW 11菜单TIMEOUTROW 20菜单HSHIFT 0菜单VSHIFT 0
The configuration above, will create the purple borders and highlighting, if you whish to have a different look and feel, simply change the values. To set a background picture, put a picture in the “/tftproot” directory and point the “MENU BACKGROUND
” to the picture’s relative path (we recommend using pictures with resolution of 640*480). For example the full path for the above configured picture would be: “/tftproot/fog/bg.png“.
上面的配置将创建紫色边框并突出显示,如果您希望拥有不同的外观,只需更改值即可。 要设置背景图片,请将图片放在“ / tftproot ”目录中,然后将“ MENU BACKGROUND
Background ”指向图片的相对路径(我们建议使用分辨率为640 * 480的图片)。 例如,上面配置的图片的完整路径为:“ /tftproot/fog/bg.png ”。
Connect the FOG sub-menu to the main menu
将FOG子菜单连接到主菜单
Because we made a simple copy of the original configuration file into the menus sub-directory (keeping its color schema, timeouts and alike), if you go into this sub-menu now from the PXE booted client, it would work, but you will not be able to return to the main menu without rebooting the machine.
因为我们将原始配置文件的一个简单副本复制到菜单子目录(保留其颜色架构,超时等),所以如果您现在从PXE引导的客户端进入该子菜单,它将可以使用,但是您将如果不重新启动机器,将无法返回主菜单。
So edit the /tftpboot/howtogeek/menus/fog.cfg file:
因此,编辑/tftpboot/howtogeek/menus/fog.cfg文件:
sudo vim /tftpboot/howtogeek/menus/fog.cfg
sudo vim /tftpboot/howtogeek/menus/fog.cfg
Add this entry after the “menu color title” entry and before the FOG functions:
在“菜单颜色标题”条目之后和FOG功能之前添加此条目:
LABEL back
MENU LABEL ..
KERNEL vesamenu.c32
APPEND pxelinux.cfg/default
LABEL back
MENU LABEL ..
KERNEL vesamenu.c32
APPEND pxelinux.cfg/default
Create the sub menu skeletons
创建子菜单框架
We have created 4 sub-menus, three of them are up to us to fill. To do so, lets create the template that we will be building on.
我们创建了4个子菜单,其中三个由我们决定。 为此,让我们创建将要构建的模板。
Create the template file:
创建模板文件:
sudo vim /tftpboot/howtogeek/menus/template.cfg
sudo vim /tftpboot/howtogeek/menus/template.cfg
Make this its content:
使其内容为:
MENU INCLUDE /pxelinux.cfg/master.cfg
#MENU BACKGROUND howtogeek/pics/fog-sub.jpg
LABEL back MENU LABEL ..
KERNEL vesamenu.c32
APPEND pxelinux.cfg/default
MENU INCLUDE /pxelinux.cfg/master.cfg
#MENU BACKGROUND howtogeek/pics/fog-sub.jpg
LABEL back MENU LABEL ..
KERNEL vesamenu.c32
APPEND pxelinux.cfg/default
Lets set the stage for additional sub-menus, which will be covered in future guides:
让我们为其他子菜单打下基础,以后的指南将介绍这些子菜单:
cd /tftpboot/howtogeek/menus/
sudo cp template.cfg ./utils.cfg
sudo cp template.cfg ./linux.cfg
cd /tftpboot/howtogeek/menus/
sudo cp template.cfg ./utils.cfg
sudo cp template.cfg ./linux.cfg
That’s it, the basic layout is now ready and from now on, we only need to build upon it, which we will in future guides. Until these future guides arrive, you are encouraged to get familiar with FOG as it is an exciting ride upon it’s self.
就是这样,现在已经准备好基本布局,从现在开始,我们只需要在此基础上进行构建,我们将在以后的指南中进行介绍。 在这些未来的指南出现之前,我们鼓励您熟悉FOG,因为它是令人兴奋的旅程。
Update: The future is here :)
更新:未来就在这里:)
How To Network Boot (PXE) The Ubuntu LiveCD How to Network Boot the BitDefender Rescue CD (PXE) How to Setup Network Bootable Utility Discs Using PXE
如何网络启动(PXE)Ubuntu LiveCD 如何网络启动BitDefender Rescue CD(PXE) 如何使用PXE设置网络可启动实用程序光盘
Go FOG yourself
自己去雾
翻译自: https://www.howtogeek.com/57601/what-is-network-booting-pxe-and-how-can-you-use-it/
pxe网络启动