Netboot/Server

From Sidvind
Jump to: navigation, search
Netboot
using pxelinux and tftp.

The first steps to have netbooting is making your DHCP server provide the additional options (where the TFTP server is located and what filename to use), having your TFTP server serve all the necessary files and configure pxelinux.

DHCP/TFTP[edit]

(using ISC DHCP server, but getting dnsmasq serving pxe is very similar; consult the documentation)

<codebox filename="dhcpd.conf" lang="text" highlight="7"> subnet 10.1.2.0 netmask 255.255.255.0 {

 range 10.1.2.50 10.1.2.200;
 option domain-name-servers ns.example.net;
 option routers gw.example.net;
 server-name "name.example.net";
 filename "pxelinux.0";

} </codebox>

"filename" is the name of the file the clients will download from the TFTP server, pxelinux.0 is the default name from syslinux so you might as well keep it. If the TFTP server does not reside on the same machine as DHCP you can use next-server other.example.net; to point it somewhere else.

Next configure a TFTP server of your choice and have it serve a directory, e.g. /var/tftproot.

It is possible to serve different files to different clients, e.g:

 class "auto-00:40:63" {
 	match if substring( hardware, 1, 3) = 00:40:63;
 	filename "other";
 }

Syslinux[edit]

Install syslinux and copy pxelinux.0 and vesamenu.c32 to you TFTP root. Create a directory called pxelinux.cfg and the file pxelinux.cfg/default, that will be where you put the configuration for your pxe environment. vesamenu is used to provide a prettier graphical interface but if thats not what you want you may ignore it (and remove the relevant lines from the config)

<codebox filename="pxelinux.cfg/default" lang="text"> DEFAULT vesamenu.c32 PROMPT 0 TIMEOUT 50 MENU TITLE Sample netboot

LABEL localboot

     localboot 0

</codebox>

This sample will create a pxe netboot which displays the menu with a single entry "localboot" and a 5 second timeout (entered as tenth of seconds). For a full description of the options see the syslinux(1) manpage.

Entries[edit]

<codebox lang="text"> LABEL name

     MENU LABEL Title
     TEXT HELP
        Some additional text
     ENDTEXT
     localboot 0

</codebox>

  • LABEL marks the start of an entry.
  • MENU LABEL is used to give a different (often more verbose) description of the entry (shown when using vesamenu.c32).
  • TEXT HELP is shown to the user when selecting an entry.
  • localboot will continue to boot the system as usual, ignoring pxe.