Difference between revisions of "TFTP server PXE configuration"

(Created page with "Category:Linux =Boot order= TFTP can manage different configurations, up to 1 per host! This is how a ThinClient (= netBoot client) will retrieve its configuration: ...")
 
Line 38: Line 38:
  
  
=Create default configuration==
+
=Default configuration=
  
 +
<big>''Note:''</big>
  
Create the default configuration file:
+
All the following examples will have 2 different kernel:
 +
* 1 kernel for Debian Wheezy
 +
* 1 kernel for Ubuntu 14.04
 +
 
 +
Each kernel can be used by several NFS images as long as the images has the right kernel's libraries and modules.
 +
 
 +
 
 +
 
 +
==Create / edit the default configuration file==
  
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
Line 47: Line 56:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 +
 +
==Simple configuration==
 +
 +
This is just a text display + user input. The user must type the name of the image he want to use.
  
 
Put the following:
 
Put the following:
Line 57: Line 70:
 
     # Initrd + NFS root file
 
     # Initrd + NFS root file
 
     APPEND initrd=images/wheezy/initrd.img root=/dev/nfs nfsroot=172.16.50.2:/nfs/wheezy
 
     APPEND initrd=images/wheezy/initrd.img root=/dev/nfs nfsroot=172.16.50.2:/nfs/wheezy
 
  
 
# Ubuntu 14.04
 
# Ubuntu 14.04
Line 73: Line 85:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
* Each LABEL is a specific configuration that will displayed on the NetBoot menu.
+
* Each LABEL is a specific name that will displayed on boot
 +
 
 
* PROMPT 0 = enable user prompt so you can choose the configuration
 
* PROMPT 0 = enable user prompt so you can choose the configuration
 +
 
* TIMEOUT 0 = timeout (in seconds) before the default option is chosen. 0 == no timeout
 
* TIMEOUT 0 = timeout (in seconds) before the default option is chosen. 0 == no timeout
  
  
  
Note that I used a reference to "trusty/", that's a folder I need to create later on.
+
 
 +
 
 +
==Graphic menu==
 +
 
 +
===Set up background image===
 +
 
 +
In a "graphic" menu you can set an image as menu background.
 +
 
 +
Remember:
 +
* You'll have to specify the exact size of the picture later on - so note the picture size !! Recommendation: '''640x480'''
 +
* Remember that the SysLinux cannot display more than depth=16 and 65536 colors
 +
 
 +
 
 +
ImageMagic command to convert a picture:
 +
 
 +
<syntaxhighlight lang="bash">
 +
convert -depth 16 -colors 65536 my_custom_image.png splash.png
 +
</syntaxhighlight>
 +
 
 +
 
 +
Then copy the splash:
 +
 
 +
<syntaxhighlight lang="bash">
 +
cp splash.png /tftpboot/pxelinux.cfg/
 +
chown -R root:root /tftpboot/pxelinux.cfg/splash.png
 +
</syntaxhighlight>
 +
 
 +
 
 +
 
 +
===Menu content===
 +
 
 +
Put:
 +
 
 +
<syntaxhighlight lang="bash">
 +
#### GENERIC OPTIONS #####
 +
# Enable graphical menu
 +
DEFAULT pxelinux.cfg/vesamenu.c32
 +
# Prompt for user input? (0 = choose from menu, 1 = you can type anything)
 +
PROMPT 0
 +
# Allow or not the user to left the menu (1 = user is locked to the menu)
 +
NOESCAPE 1
 +
# Time before using default option
 +
TIMEOUT 50
 +
 
 +
 
 +
#### Menu settings #####
 +
MENU TITLE my super netboot menu
 +
# Setup background image (the resolution is $WIDTH $HEIGHT and must match the given picture)
 +
MENU RESOLUTION 640 480
 +
MENU BACKGROUND pxelinux.cfg/splash.png
 +
# Setup text properties
 +
MENU WIDTH 80
 +
MENU ROWS 14
 +
MENU MARGIN 10
 +
 
 +
 
 +
#### Distributions #####
 +
# Debian wheezy
 +
LABEL wheezy
 +
    MENU LABEL Debian 7.x [wheezy]
 +
    MENU DEFAULT
 +
    KERNEL images/wheezy/vmlinuz
 +
    APPEND initrd=images/wheezy/initrd.img root=/dev/nfs nfsroot=172.16.50.2:/nfs/wheezy
 +
 
 +
# Ubuntu 14.04
 +
LABEL trusty
 +
    MENU LABEL Ubuntu 14.04 [trusty]
 +
    KERNEL images/trusty/vmlinuz
 +
    APPEND initrd=images/trusty/initrd.img root=/dev/nfs nfsroot=172.16.50.2:/nfs/trusty
 +
 
 +
MENU END
 +
</syntaxhighlight>
 +
 
 +
 
 +
Note all the "MENU" commands + PROMPT 0

Revision as of 10:55, 21 August 2014



Boot order

TFTP can manage different configurations, up to 1 per host!

This is how a ThinClient (= netBoot client) will retrieve its configuration:


TFTP getConfiguration()


As you can see you have 3 possibilities:


1. MAC @ filter. Configuration file name must be:

  • Start with ARP type '01-'
  • all in lower case hexadecimal
  • dash '-' separators instead of ';'

for example a MAC @ 88:99:AA:BB:CC:DD would search for the filename 01-88-99-aa-bb-cc-dd.


2. IP @ filter. Configuration file name must be:

  • host IP / network address in hexadecimal
  • all in upper case

e.g. 192.0.2.91 -> C000025B


3. Default configuration


To learn more about all the available option, check out http://www.syslinux.org/wiki/index.php/PXELINUX



Default configuration

Note:

All the following examples will have 2 different kernel:

  • 1 kernel for Debian Wheezy
  • 1 kernel for Ubuntu 14.04

Each kernel can be used by several NFS images as long as the images has the right kernel's libraries and modules.


Create / edit the default configuration file

vim /tftpboot/pxelinux.cfg/default


Simple configuration

This is just a text display + user input. The user must type the name of the image he want to use.

Put the following:

# Debian 7.x
LABEL wheezy
    # Kernel
    KERNEL images/wheezy/vmlinuz 
    # Initrd + NFS root file
    APPEND initrd=images/wheezy/initrd.img root=/dev/nfs nfsroot=172.16.50.2:/nfs/wheezy

# Ubuntu 14.04
LABEL trusty
    # Kernel
    KERNEL images/trusty/vmlinuz 
    # Initrd + NFS root file
    APPEND initrd=images/trusty/initrd.img root=/dev/nfs nfsroot=172.16.50.2:/nfs/trusty


# Prompt user for selection
PROMPT 1
# No timeout
TIMEOUT 0
  • Each LABEL is a specific name that will displayed on boot
  • PROMPT 0 = enable user prompt so you can choose the configuration
  • TIMEOUT 0 = timeout (in seconds) before the default option is chosen. 0 == no timeout



Graphic menu

Set up background image

In a "graphic" menu you can set an image as menu background.

Remember:

  • You'll have to specify the exact size of the picture later on - so note the picture size !! Recommendation: 640x480
  • Remember that the SysLinux cannot display more than depth=16 and 65536 colors


ImageMagic command to convert a picture:

convert -depth 16 -colors 65536 my_custom_image.png splash.png


Then copy the splash:

cp splash.png /tftpboot/pxelinux.cfg/
chown -R root:root /tftpboot/pxelinux.cfg/splash.png


Menu content

Put:

#### GENERIC OPTIONS #####
# Enable graphical menu
DEFAULT pxelinux.cfg/vesamenu.c32
# Prompt for user input? (0 = choose from menu, 1 = you can type anything)
PROMPT 0
# Allow or not the user to left the menu (1 = user is locked to the menu)
NOESCAPE 1
# Time before using default option
TIMEOUT 50


#### Menu settings #####
MENU TITLE my super netboot menu
# Setup background image (the resolution is $WIDTH $HEIGHT and must match the given picture)
MENU RESOLUTION 640 480
MENU BACKGROUND pxelinux.cfg/splash.png
# Setup text properties
MENU WIDTH 80
MENU ROWS 14
MENU MARGIN 10


#### Distributions #####
# Debian wheezy
LABEL wheezy
    MENU LABEL Debian 7.x [wheezy]
    MENU DEFAULT
    KERNEL images/wheezy/vmlinuz 
    APPEND initrd=images/wheezy/initrd.img root=/dev/nfs nfsroot=172.16.50.2:/nfs/wheezy

# Ubuntu 14.04
LABEL trusty
    MENU LABEL Ubuntu 14.04 [trusty]
    KERNEL images/trusty/vmlinuz
    APPEND initrd=images/trusty/initrd.img root=/dev/nfs nfsroot=172.16.50.2:/nfs/trusty

MENU END


Note all the "MENU" commands + PROMPT 0