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: ...") |
|||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
[[Category:Linux]] | [[Category:Linux]] | ||
+ | |||
+ | |||
+ | =Requirement= | ||
+ | |||
+ | The configuration rely on a NFS boot-up image. | ||
+ | |||
Line 38: | Line 44: | ||
− | = | + | =Default configuration= |
+ | |||
+ | <big>''Note:''</big> | ||
+ | |||
+ | All the following examples will have 2 different kernel: | ||
+ | * 1 kernel for Debian Wheezy (QA) | ||
+ | * 1 kernel for Ubuntu 14.04 (Production) | ||
+ | |||
+ | Each kernel can be used by several NFS images as long as the images has the right kernel's libraries and modules. | ||
− | Create the default configuration file | + | |
+ | ==Create / edit the default configuration file== | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
Line 47: | Line 62: | ||
</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: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | # Debian 7.x | + | # Debian 7.x (QA) |
LABEL wheezy | LABEL wheezy | ||
# Kernel | # Kernel | ||
KERNEL images/wheezy/vmlinuz | KERNEL images/wheezy/vmlinuz | ||
# Initrd + NFS root file | # Initrd + NFS root file | ||
− | APPEND initrd=images/wheezy/initrd.img root=/dev/nfs nfsroot=172.16.50.2:/nfs/ | + | APPEND initrd=images/wheezy/initrd.img root=/dev/nfs nfsroot=172.16.50.2:/nfs/qa |
− | + | # Ubuntu 14.04 (prod) | |
− | # Ubuntu 14.04 | ||
LABEL trusty | LABEL trusty | ||
# Kernel | # Kernel | ||
KERNEL images/trusty/vmlinuz | KERNEL images/trusty/vmlinuz | ||
# Initrd + NFS root file | # Initrd + NFS root file | ||
− | APPEND initrd=images/trusty/initrd.img root=/dev/nfs nfsroot=172.16.50.2:/nfs/ | + | APPEND initrd=images/trusty/initrd.img root=/dev/nfs nfsroot=172.16.50.2:/nfs/prod |
Line 73: | Line 91: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | * Each LABEL is a specific | + | * 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 | ||
− | + | ||
+ | |||
+ | ==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 (QA) | ||
+ | LABEL wheezy | ||
+ | MENU LABEL Debian 7.x [wheezy] - QA | ||
+ | MENU DEFAULT | ||
+ | KERNEL images/wheezy/vmlinuz | ||
+ | APPEND initrd=images/wheezy/initrd.img root=/dev/nfs nfsroot=172.16.50.2:/nfs/qa | ||
+ | |||
+ | # Ubuntu 14.04 (prod) | ||
+ | LABEL trusty | ||
+ | MENU LABEL Ubuntu 14.04 [trusty] - Production | ||
+ | KERNEL images/trusty/vmlinuz | ||
+ | APPEND initrd=images/trusty/initrd.img root=/dev/nfs nfsroot=172.16.50.2:/nfs/prod | ||
+ | |||
+ | MENU END | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | |||
+ | Note all the "MENU" commands + PROMPT 0 |
Latest revision as of 14:35, 21 August 2014
Contents
Requirement
The configuration rely on a NFS boot-up image.
Boot order
TFTP can manage different configurations, up to 1 per host!
This is how a ThinClient (= netBoot client) will retrieve its configuration:
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 (QA)
- 1 kernel for Ubuntu 14.04 (Production)
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 (QA)
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/qa
# Ubuntu 14.04 (prod)
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/prod
# 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
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 (QA)
LABEL wheezy
MENU LABEL Debian 7.x [wheezy] - QA
MENU DEFAULT
KERNEL images/wheezy/vmlinuz
APPEND initrd=images/wheezy/initrd.img root=/dev/nfs nfsroot=172.16.50.2:/nfs/qa
# Ubuntu 14.04 (prod)
LABEL trusty
MENU LABEL Ubuntu 14.04 [trusty] - Production
KERNEL images/trusty/vmlinuz
APPEND initrd=images/trusty/initrd.img root=/dev/nfs nfsroot=172.16.50.2:/nfs/prod
MENU END
Note all the "MENU" commands + PROMPT 0