Difference between revisions of "Pxe"
imported>ThorstenStaerk (Created page with "'''PXE''' stands for '''P'''reboot E'''x'''ecution '''E'''nvironment. It is used to boot a computer using bootstrap information from over the network. == Overview == The ty...") |
imported>ThorstenStaerk |
||
Line 1: | Line 1: | ||
'''PXE''' stands for '''P'''reboot E'''x'''ecution '''E'''nvironment. It is used to boot a computer using [[bootstrap]] information from over the network. | '''PXE''' stands for '''P'''reboot E'''x'''ecution '''E'''nvironment. It is used to boot a computer using [[bootstrap]] information from over the network. | ||
− | + | = Overview = | |
− | |||
The typical PXE boot looks like this: | The typical PXE boot looks like this: | ||
# Computer ''A'' starts. It's [[BIOS]] is set to do a PXE [[boot]], so booting from the network. | # Computer ''A'' starts. It's [[BIOS]] is set to do a PXE [[boot]], so booting from the network. | ||
Line 9: | Line 8: | ||
# Computer ''A'' executes the kernel just as if it had from its local [[hard disk]]. | # Computer ''A'' executes the kernel just as if it had from its local [[hard disk]]. | ||
− | + | = How to start = | |
− | == | + | == DHCP == |
− | To allow your computers to boot from the network, they first need an IP address. So, set up a dhcp-server. Make sure /etc/dhcpd.conf contains the following lines: | + | To allow your computers to boot from the network, they first need an IP address. So, [[set up a dhcp-server]]. Make sure /etc/dhcpd.conf contains the following lines: |
allow booting; | allow booting; | ||
allow bootp; | allow bootp; | ||
Line 22: | Line 21: | ||
/etc/init.d/dhcpd restart | /etc/init.d/dhcpd restart | ||
− | == | + | == TFTP == |
After your computers have received their IP address, they start asking for their booting file from the TFTP-server, in this case ''192.168.0.5''. So, make sure they can get it. [[Install]] [[tftp]], syslinux and copy its pxelinux.0 to /tftpboot/. Activate the tftp server. Test it: | After your computers have received their IP address, they start asking for their booting file from the TFTP-server, in this case ''192.168.0.5''. So, make sure they can get it. [[Install]] [[tftp]], syslinux and copy its pxelinux.0 to /tftpboot/. Activate the tftp server. Test it: | ||
tftp ''192.168.0.5'' -c get pxelinux.0 | tftp ''192.168.0.5'' -c get pxelinux.0 | ||
Test your configuration now by booting a connected computer from PXE. You should get an error message saying that the configuration file pxelinux.cfg/default has not been found. | Test your configuration now by booting a connected computer from PXE. You should get an error message saying that the configuration file pxelinux.cfg/default has not been found. | ||
− | + | == pxelinux.cfg/default == | |
Create a /tftpboot/pxelinux.cfg/default like this: | Create a /tftpboot/pxelinux.cfg/default like this: | ||
default linux | default linux | ||
Line 38: | Line 37: | ||
append initrd=initrd.img | append initrd=initrd.img | ||
− | + | == Change initial ramdisk == | |
If you now want to change the initrd to actually do something, you can do it like this: | If you now want to change the initrd to actually do something, you can do it like this: | ||
cd /tftpboot | cd /tftpboot | ||
Line 54: | Line 53: | ||
Your new [[initrd]] is now called newinitrd.gz. | Your new [[initrd]] is now called newinitrd.gz. | ||
− | + | = See also = | |
* [[diskless workstation]] | * [[diskless workstation]] | ||
* [http://en.wikipedia.org/wiki/Preboot_Execution_Environment Wikipedia on PXE] | * [http://en.wikipedia.org/wiki/Preboot_Execution_Environment Wikipedia on PXE] |
Revision as of 13:29, 20 August 2012
PXE stands for Preboot Execution Environment. It is used to boot a computer using bootstrap information from over the network.
Contents
Overview
The typical PXE boot looks like this:
- Computer A starts. It's BIOS is set to do a PXE boot, so booting from the network.
- Computer A acquires an IP address from dhcp server B.
- Computer A downloads its booting files (initrd and kernel) via tftp from B.
- Computer A executes the kernel just as if it had from its local hard disk.
How to start
DHCP
To allow your computers to boot from the network, they first need an IP address. So, set up a dhcp-server. Make sure /etc/dhcpd.conf contains the following lines:
allow booting; allow bootp; authoritative; # I am the one and only here
Make sure your "subnet" section contains the following lines:
next-server 192.168.0.5; filename "pxelinux.0";
Make sure you have restarted your dhcpd:
/etc/init.d/dhcpd restart
TFTP
After your computers have received their IP address, they start asking for their booting file from the TFTP-server, in this case 192.168.0.5. So, make sure they can get it. Install tftp, syslinux and copy its pxelinux.0 to /tftpboot/. Activate the tftp server. Test it:
tftp 192.168.0.5 -c get pxelinux.0
Test your configuration now by booting a connected computer from PXE. You should get an error message saying that the configuration file pxelinux.cfg/default has not been found.
pxelinux.cfg/default
Create a /tftpboot/pxelinux.cfg/default like this:
default linux timeout 0 prompt 1 display display.msg label linux kernel vmlinuz append initrd=initrd.img
Change initial ramdisk
If you now want to change the initrd to actually do something, you can do it like this:
cd /tftpboot mkdir tmp cd tmp cp ../initrd.img ./initrd.gz gunzip initrd.gz mkdir tmp2 cd tmp2 cpio -id < ../initrd
Do the needed changes now in this folder. Then pack the initrd again:
find . | cpio --create --format='newc' > ../newinitrd cd .. gzip newinitrd
Your new initrd is now called newinitrd.gz.