slitaz-doc-wiki-data view pages/en/guides/pxe.txt @ rev 100

Update pages folder.
author Christopher Rogers <slaxemulator@gmail.com>
date Thu Sep 15 06:34:46 2011 +0000 (2011-09-15)
parents 31e05b24f4f6
children
line source
1 ====== PXE =======
3 The //Preboot eXecution Environment// (or //PXE//, pronounced 'pixie') is the process of booting a computer from a network connection. It is comparable to booting a LiveCD from a remote CD drive.
5 This network boot method requires:
7 * a server to store files running DHCP and TFTP (each could be on a separate server);
8 * a client with a PXE boot-loader, stored in the BIOS firmware. It maybe disk-less.
10 \\
12 ===== PXE Server Set-Up =====
14 A PXE server comprises:
16 * a DHCP server to accept clients;
17 * a DHCP boot-file to configure them;
18 * a TFTP server to deliver an OS.
20 ==== Quick start with the Live CD ====
22 The SliTaz LiveCD can be used as a PXE server. To begin the process, launch the Netbox application (from the System Tools menu).
24 * From the //Static IP// tab, click //Start//.
25 * This box will be the DHCP server. It can't use DHCP to get an IP configuration.
27 <note tip>Since SliTaz 3.0 the Netbox application is now split into Netbox and Serverbox. If you are running a recent SliTaz version, please read **Serverbox application** instead of **Server tab** below</note>
29 * From the //Server// tab, select the //INETD// sub-tab and ensure the //tftpd// line is **uncommented** in /etc/initd.conf. This is the default behaviour. Click //Start//.
30 * This will launch the TFTP server, which will deliver the SliTaz LiveCD across the network.
32 * From the //Server// tab, select the //PXE// sub-tab.
34 * Edit the configuration to add your boot options.
35 * This will update the DHCP server configuration automatically.
37 * From the //Server// tab, select the //DHCP// sub-tab. Check that the configuration aligns with your network. The previous step has added the lines //boot_file// and //siaddr//. Click //Start//.
38 * This will launch the the DHCP server. If clients to do not receive an IP address, check this configuration.
40 * Ensure the files //bzImage// and //rootfs.gz// are stored in the // /boot // directory of the LiveCD.
42 ==== Customize your PXE server ====
44 * You can have multiple PXE configurations for the different client groups, see [[http://syslinux.zytor.com/wiki/index.php/PXELINUX#How_do_I_Configure_PXELINUX.3F|PXElinux wiki]].
45 * You can store __/home__ on a client local drive only (like tazusb does), example append __/etc/fstab__ with : <file>/dev/hda1 /home ext3 defaults 0 0</file>
46 * Since SliTaz 3.0, you can have a hydrid installation on (some) clients. These clients have SliTaz installed with some huge packages like libreoffice. They boot with PXE and most of the system runs in RAM except the huge software linked to the hard disk (could be a network disk too). Example, append to __/etc/init.d/local.sh__ :<file>mount -t nfs -o ro bootserver:/slitaz /media/slitaz
47 tazpkg link libre-office /media/slitaz</file>
48 * Since SliTaz 3.0, you can stack multiple initramfs in the pxelinux configuration file - An easy way to upgrade SliTaz and keep your customizations, example :<file>label slitaz
49 kernel /boot/bzImage
50 append initrd=/boot/rootfs.gz,/boot/configs/extra-packages.gz,/boot/configs/special-configuration.gz rw root=/dev/null vga=normal autologin</file>
51 * Example of a PXE server configuration: The [[http://boot.slitaz.org/|SliTaz web boot]] server http://mirror.slitaz.org/pxe/ (start with [[http://mirror.slitaz.org/pxe/pxelinux.cfg/default|pxelinux.cfg/default]])
52 \\
53 ===== PXE Client Set-Up =====
55 Most recent machines with on-board Ethernet have a PXE-capable BIOS. Look for this feature in BIOS menus and the BIOS boot menu and ensure it is activated. It may require you press a key, such as F12, during the boot process.
57 If your computer does not support PXE booting, you can use SliTaz as a client instead. Create a bootable CD-ROM or floppy disk with the // Boot Floppy/CDROM // tool found in the //System Tools// menu.
59 In the PXE Network tab click Write floppy. Use this to boot the client computer.
61 <note tip>Is your Ethernet card not recognised? See [[http://rom-o-matic.net/|ROM-O-Matic]]</note>
63 \\
65 ===== Web Booting =====
67 The SliTaz LiveCD has configuration settings to start your computer via the Internet. This is useful for using a newer version of SliTaz from older media.
69 You can start the automatic process with the following command at the SliTaz LiveCD boot-splash:
71 web
73 That's it!
75 You can find more information on using an Internet connection to boot your computer at the [[http://boot.slitaz.org/|SliTaz Web Boot home-page]].
77 You will need a DHCP server to get an IP address, netmask, gateway address, as per a normal network connection -- a standard home router should be sufficient for this.
79 \\
81 === PXE boot without DHCP server: Web Boot & Command Line ===
83 If you have no device that can function as a DHCP server, you need an IP address with a netmask, gateway address and, optionally, a DNS address.
84 <file>
85 title Slitaz Web
86 kernel /boot/gpxe ip=192.168.0.12/24 gw=192.168.0.1 dns=192.168.0.1 url=http://mirror.slitaz.org/pxe/pxelinux.0
87 </file>
89 You can modify the URL thus:
90 <file>
91 title Slitaz Web
92 kernel /boot/gpxe ip=192.168.0.12/24 gw=192.168.0.1 dns=192.168.0.1 ip=192.168.0.12/24 gw=192.168.0.1
93 dns=192.168.0.1 url=http://mirror.slitaz.org/pxe/pxelinux.0
94 </file>
96 Note that only the following keywords are recognised:
98 * ip=
99 * gw=
100 * dns=
101 * url=
102 * nodhcp (useful to avoid a DHCP timeout error)
104 \\
106 ===== Advanced Web Booting Configuration =====
108 The Web Booting process can be embedded into routers and other devices, as well as being customised.
110 \\
112 === Embedded Web Boot, with PXE boot PROM (PXE forwarder) ===
114 Configure a PXE server with http://download.tuxfamily.org/slitaz/boot/gpxe.pxe as the boot file, a 42Kb second stage loader. This was successfully tested with an [[http://openwrt.org/|OpenWRT]] router:
116 * install http://mirror.slitaz.org/boot/mips/tftpd (mips version) in /jffs/usr/sbin
117 * install gpxe.exe in /jffs/boot
118 * add dhcp bootfile option in dnsmasq config file
120 # echo "dhcp-boot=gpxe.pxe" >> /tmp/dnsmasq.conf
122 Launch the tftp server for your lan (say 192.168.0.1/24)
124 # /jffs/usr/sbin/tftpd 192.168.0.1 /jffs/boot
126 <note tip>You can avoid the tftp server installation and use the SliTaz tftp server directly :
127 # echo "dhcp-boot=gpxe.pxe,mirror.slitaz.org" >> /tmp/dnsmasq.conf
128 </note>
130 \\
132 === Modifying the Default GPXE Web Boot URL ===
134 The URL is stored at offset 519 in 255 bytes max.
136 * Show the current URL with:
138 $ dd bs=1 skip=519 count=255 if=gpxe 2> /dev/null | strings
140 * Change the URL with:
142 $ echo -n "http://myurl.org/myboot" | cat - /dev/zero | dd conv=notrunc bs=1 seek=519 count=255 of=gpxe
144 * Change the URL and IP configuration with:
146 $ echo -n "ip=192.168.0.10/24 gw=192.168.0.1 dns=192.168.0.1 url=http://myurl.org/myboot" | cat - /dev/zero | dd
147 conv=notrunc bs=1 seek=519 count=255 of=gpxe
149 * Remove URL to behave as a normal GPXE with:
151 $ dd if=/dev/zero conv=notrunc bs=1 seek=519 count=255 of=gpxe
153 \\
155 === Hack the gpxe.pxe Default Web Boot URL ===
157 The URL is stored at offset 5 in 255 bytes max.
159 Show the current URL with:
161 $ dd bs=1 skip=5 count=255 if=gpxe.pxe 2> /dev/null | strings
163 Change the URL with:
165 $ echo -n "http://myurl.org/myboot" | cat - /dev/zero | dd conv=notrunc bs=1 seek=5 count=255 of=gpxe.pxe
167 Remove the URL and behave as a normal //gpxe.pxe// with:
168 $ dd if=/dev/zero conv=notrunc bs=1 seek=5 count=255 of=gpxe.pxe
170 \\
172 === Using Redundancy with Web Boot Servers ===
174 Comma separated URL lists are supported.
176 The PXE client will try to load the first URL. If the load fails, it will try the next URL, and so on.
178 Example with current Slitaz Web boot servers :
180 $ echo -n "http://mirror.slitaz.org/pxe/pxelinux.0,http://mirror.switch.ch/ftp/mirror/pxe/pxelinux.0,http:
181 download.tuxfamily.org/slitaz/pxe/pxelinux.0" | cat - /dev/zero | dd conv=notrunc bs=1 seek=519 count=255 of=gpxe
183 ===== Why use PXE ? The VNC example =====
185 Let's say that your company is working on some very sensitive data.
186 You don't want people copying anything on to removable media such as USB keys.
187 Only a few users can use this data.
189 * PXELINUX chooses a special configuration by the MAC address in //pxelinux.cfg/<client-mac-address>//
190 * It checks the md5 (or sha256) password of the user boot entry with menu.c32
191 * It sends a kernel and an initramfs with a **fbvnc** package built by http://tiny.slitaz.org/ (total size < 1.44MB)
192 * The client boots in 1 to 5 seconds with a VNC framebuffer client
193 * The VNC server can send any OS display
194 * The client has no media driver and can use 10 year old hardware
195 * The target OS can run in a VM : more scalable and easier to maintain than multiple desktops
196 * No data is stored on the client machine. It may also have no disk. It only needs an ethernet card
197 * Of course, the sessions in the target OS must have a connection timeout and need a username and a password...
199 ==== Increase security a bit ====
201 The VNC listens to the network without a password
202 (fbvnc has no authentication support) and the VNC traffic is not encrypted on
203 the network.
205 * Build an initramfs with a **fbvnc-ssh** package on http://tiny.slitaz.org/
206 * On the server, VNC should listen on localhost only
207 * The SSH public key of the client is installed in //$HOME/.ssh/authorized_keys// on the VNC server
209 ==== A quick demo ====
211 The menu //Tiny SliTaz// -> //Tiny VNC// of the [[http://boot.slitaz.org/|SliTaz Web Boot]] launches the VNC client without ssh
212 (you need a VNC server running on your network...).
213 <note tip>You can directly download the [[http://mirror.slitaz.org/pxe/tiny/vnc/bzImage.gz|kernel]]
214 and then the [[http://mirror.slitaz.org/pxe/tiny/vnc/rootfs.gz|initramfs]] and test it
215 on your network or with qemu
216 </note>
217 <note tip>Try with the cmdline argument **vga=ask** first. This will find the best
218 VESA mode to use (example **vga=0x33B**)
219 </note>
221 ----
222 \\
223 ^ Page Review Section ^^
224 |Quality| Good |
225 |Review| Minor Updates |
226 |Priority| Medium |
227 |Problems| add a [[http://forum.slitaz.org|forum post link]]|
228 |::: | OR add a [[http://labs.slitaz.org/issues |lab issue tracker link ]]|
229 |How to Improve| Improve readability |
230 |::: | Section in to Client/Server, with Simple/Advanced in each |
231 |::: | |
233 \\
234 ----