PXE Server

Wikis > Informatique > Linux > PXE > PXE Server

== Modifier la configuration du dhcp ==

*/etc/dhcp/dhcpd.conf

### PXE ###
### Permet le boot réseau pour TFTP ###
allow bootp;
allow booting;

subnet 172.11.0.0 netmask 255.255.255.0 {
	option broadcast-address 172.11.0.255;
	option routers 172.11.0.254;
	allow unknown-clients;
        ### Addresse du serveur TFTP qui contient les menus et images PXE ###
	next-server 172.11.0.250;
        ### Nom du fichier à télécharger ###
	filename "pxelinux.0";
	range 172.11.0.51 172.11.0.100;
}

== Installation et configuration du serveur TFTP ==

Pour le serveur TFTP, j’ai choisis « tftpd-hpa »

Pour l’installer:

aptitude install tftpd-hpa

*/etc/default/tftpd-hpa

# /etc/default/tftpd-hpa

RUN_DAEMON="yes"
OPTIONS="-l -s -v -v /srv/tftp"
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/srv/tftp"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="--secure --ipv4"

L’option  »’ipv4 »’ est importante lorsque le système ne prend pas en compte les adresses  »’IPV6 »’, comme sur un RasberryPi par exemple

== Création du menu PXE et des différentes installations ==

A la racine du serveur PXE (/srv/tftp/ dans mon exemple), copier les fichiers menu.c32 et pxelinux.0 qui se trouvent dans /usr/lib/syslinux (debian).

Toujours à la racine, créer un répertoire pxelinux.cfg (mkdir  »’/srv/tftp/pxelinux.cfg »’) et un fichier default dans pxelinux.cfg (touch  »’/srv/tftp/pxelinux.cfg/default »’).

C’est le fichier default qui sera affiché par défaut lors du boot sur le réseau.

Comme vous pouvez le voir, des fichiers de configurations du type [[Fichier de configuration Kickstart|kickstart]] et [[Fichier de configuration Preseed|preseed]] sont utilisés

==== Les fichiers menu ====

*/srv/tftp/pxelinux.cfg/default

DEFAULT vesamenu.c32
PROMPT 0
TIMEOUT 600
ONTIMEOUT local
MENU include colors.css
MENU BACKGROUND background-pxe.png

MENU TITLE NEWYORK PXE by LANGUILLE11

LABEL CentOS
        MENU LABEL CentOS
        KERNEL vesamenu.c32
        APPEND pxelinux.cfg/centos

LABEL Debian
        MENU LABEL Debian
        KERNEL vesamenu.c32
        APPEND pxelinux.cfg/debian

LABEL Proxmox
        MENU LABEL Proxmox
        KERNEL vesamenu.c32
        APPEND pxelinux.cfg/proxmox

LABEL Ubuntu
        MENU LABEL Ubuntu
        KERNEL vesamenu.c32
        APPEND pxelinux.cfg/ubuntu

LABEL Tools
        MENU LABEL Tools
        KERNEL vesamenu.c32
        APPEND pxelinux.cfg/tools

*/srv/tftp/pxelinux.cfg/centos

include colors.css
MENU BACKGROUND images/centos/centos.png

MENU TITLE CENTOS

LABEL Main Menu
        MENU LABEL Main Menu
        KERNEL vesamenu.c32
        APPEND pxelinux.cfg/default

LABEL DOREMI CentOS 5 x86_64 standard
        MENU LABEL DOREMI CentOS 5 x86_64 standard
        KERNEL images/centos/5/x64/vmlinuz
        APPEND initrd=images/centos/5/x64/initrd.img ramdisk_size=16432 ksdevice=eth0 ip=dhcp vga=normal linux ks=http://172.11.0.238/install/CentOS_repository/5/os/x86_64/ks.cfg

LABEL DOREMI CentOS 5 x86_64 preconfigured noGui
        MENU LABEL DOREMI CentOS 5 x86_64 preconfigured noGui
        KERNEL images/centos/5/x64/vmlinuz
        APPEND initrd=images/centos/5/x64/initrd.img ramdisk_size=16432 ksdevice=eth0 ip=dhcp vga=normal linux ks=http://172.11.0.238/install/CentOS_repository/5/os/x86_64/ks_without_gui.cfg

LABEL DOREMI CentOS 6 x86_64 standard
        MENU LABEL DOREMI CentOS 6 x86_64 standard
        KERNEL images/centos/6/x64/vmlinuz
        APPEND initrd=images/centos/6/x64/initrd.img ramdisk_size=16432 ksdevice=eth0 ip=dhcp vga=normal linux ks=http://172.11.0.238/install/CentOS_repository/6/os/x86_64/ks.cfg

LABEL DOREMI CentOS 6 x86_64 preconfigured noGui
        MENU LABEL DOREMI CentOS 6 x86_64 preconfigured noGui
        KERNEL images/centos/6/x64/vmlinuz
        APPEND initrd=images/centos/6/x64/initrd.img ramdisk_size=16432 ksdevice=eth0 ip=dhcp vga=normal linux ks=http://172.11.0.238/install/CentOS_repository/6/os/x86_64/ks_without_gui.cfg

*/srv/tftp/pxelinux.cfg/debian

include colors.css
MENU BACKGROUND images/debian/debian.png

MENU TITLE DEBIAN

LABEL Main Menu
        MENU LABEL Main Menu
        KERNEL vesamenu.c32
        APPEND pxelinux.cfg/default

LABEL Debian 6 32 bit standard
        MENU LABEL Debian 6 32 bit standard
        KERNEL images/debian/6/x32/linux
        APPEND initrd=images/debian/6/x32/initrd.gz ramdisk_size=16432 vga=normal root=/dev/rd/0 devfs=mount,dall rw --

LABEL Debian 6 64 bit standard
        MENU LABEL Debian 6 64 bit standard
        KERNEL images/debian/6/x64/linux
        APPEND initrd=images/debian/6/x64/initrd.gz ramdisk_size=16432 vga=normal root=/dev/rd/0 devfs=mount,dall rw --

LABEL Debian 7 32 bit standard
        MENU LABEL Debian 7 32 bit standard
        KERNEL images/debian/7/x32/linux
        APPEND initrd=images/debian/7/x32/initrd.gz ramdisk_size=16432 vga=normal root=/dev/rd/0 devfs=mount,dall rw --

LABEL Debian 7 64 bit standard
        MENU LABEL Debian 7 64 bit standard
        KERNEL images/debian/7/x64/linux
        APPEND initrd=images/debian/7/x64/initrd.gz ramdisk_size=16432 vga=normal root=/dev/rd/0 devfs=mount,dall rw --

*/srv/tftp/pxelinux.cfg/proxmox

include colors.css
MENU BACKGROUND images/proxmox/proxmox.png

MENU TITLE Proxmox Installation

LABEL Main Menu
        MENU LABEL Main Menu
        KERNEL vesamenu.c32
        APPEND pxelinux.cfg/default

LABEL Proxmox 2.1
        MENU LABEL Proxmox 2.1
        KERNEL images/proxmox/2.1/linux
        APPEND initrd=images/proxmox/2.1/initrd.img vga=791 video=vesafb:ywrap,mtrr ramdisk_size=16777216 splash=verbose

*/srv/tftp/pxelinux.cfg/ubuntu

include colors.css
MENU BACKGROUND images/ubuntu/ubuntu.png

MENU TITLE UBUNTU

LABEL Main Menu
	MENU LABEL Main Menu
	KERNEL vesamenu.c32
	APPEND pxelinux.cfg/default

LABEL Ubuntu 10.04 32 bit
	MENU LABEL Ubuntu 10.04 32 bit
	KERNEL images/ubuntu/10/x32/linux
	APPEND initrd=images/ubuntu/10/x32/initrd.gz vga=normal --quiet

LABEL Ubuntu 10.04 64 bit
	MENU LABEL Ubuntu 10.04 64 bit
	KERNEL images/ubuntu/10/x64/linux
	APPEND initrd=images/ubuntu/10/x64/initrd.gz vga=normal --quiet

LABEL Ubuntu 12.04 32 bit
	MENU LABEL Ubuntu 12.04 32 bit
	KERNEL images/ubuntu/12/x32/linux
	APPEND initrd=images/ubuntu/12/x32/initrd.gz vga=normal --quiet

LABEL Ubuntu 12.04 64 bit
	MENU LABEL Ubuntu 12.04 64 bit
	KERNEL images/ubuntu/12/x64/linux
	APPEND initrd=images/ubuntu/12/x64/initrd.gz vga=normal --quiet

LABEL Ubuntu 12.10 32 bit
	MENU LABEL Ubuntu 12.10 32 bit
	KERNEL images/ubuntu/quantal/x32/linux
	APPEND initrd=images/ubuntu/quantal/x32/initrd.gz vga=normal --quiet

LABEL Ubuntu 12.10 64 bit
	MENU LABEL Ubuntu 12.10 64 bit
	KERNEL images/ubuntu/quantal/x64/linux
	APPEND initrd=images/ubuntu/quantal/x64/initrd.gz vga=normal --quiet

*/srv/tftp/pxelinux.cfg/tools

include colors.css
MENU BACKGROUND images/tools/tools.png

MENU TITLE Tools Menu

LABEL Main Menu
        MENU LABEL Main Menu
        KERNEL vesamenu.c32
        APPEND pxelinux.cfg/default

LABEL memtest
        MENU LABEL memtest
        KERNEL images/tools/memtest/memtest
        TEXT HELP
	 Run memory test using Memtest86+
	 ENDTEXT

LABEL GParted
        MENU LABEL Gparted
        KERNEL vesamenu.c32
        APPEND pxelinux.cfg/gparted

LABEL Clonezilla
        MENU LABEL Clonezilla
        KERNEL vesamenu.c32
        APPEND pxelinux.cfg/clonezilla

Les différentes installations se trouve dans le dossier images à la racine de tftp. Les fichier utiles sont ceux contenu dans images/pxeboot qui se trouve à la racine d’une images linux ou directement sur le ftp des repos de chaque distributions.

==== Arborescence finale du serveur tftp ====

/srv/tftp/
├── colors.css
├── background-pxe.png
├── images
│   ├── centos
│   │   ├── 5
│   │   │   └── x64
│   │   │       ├── initrd.img
│   │   │       └── vmlinuz
│   │   ├── 6
│   │   │   └── x64
│   │   │       ├── initrd.img
│   │   │       └── vmlinuz
│   │   └── centos.png
│   ├── debian
│   │   ├── 6
│   │   │   ├── x32
│   │   │   │   ├── initrd.gz
│   │   │   │   └── linux
│   │   │   └── x64
│   │   │       ├── initrd.gz
│   │   │       └── linux
│   │   ├── 7
│   │   │   ├── x32
│   │   │   │   ├── initrd.gz
│   │   │   │   └── linux
│   │   │   └── x64
│   │   │       ├── initrd.gz
│   │   │       └── linux
│   │   └── debian.png
│   ├── proxmox
│   │   ├── 2.1
│   │   │   ├── initrd.img
│   │   │   └── linux
│   │   └── proxmox.png
│   ├── tools
│   │   ├── clonezilla
│   │   │   ├── clonezilla.png
│   │   │   ├── x32
│   │   │   │   ├── filesystem.squashfs
│   │   │   │   ├── initrd.img
│   │   │   │   └── vmlinuz
│   │   │   └── x64
│   │   │       ├── filesystem.squashfs
│   │   │       ├── initrd.img
│   │   │       └── vmlinuz
│   │   ├── gparted
│   │   │   ├── filesystem.squashfs
│   │   │   ├── gparted.png
│   │   │   ├── initrd.img
│   │   │   └── vmlinuz
│   │   ├── memtest
│   │   │   └── memtest
│   │   └── tools.png
│   └── ubuntu
│       ├── 10
│       │   ├── x32
│       │   │   ├── initrd.gz
│       │   │   └── linux
│       │   └── x64
│       │       ├── initrd.gz
│       │       └── linux
│       ├── 12
│       │   ├── x32
│       │   │   ├── initrd.gz
│       │   │   └── linux
│       │   └── x64
│       │       ├── initrd.gz
│       │       └── linux
│       ├── quantal
│       │   ├── x32
│       │   │   ├── initrd.gz
│       │   │   └── linux
│       │   └── x64
│       │       ├── initrd.gz
│       │       └── linux
│       └── ubuntu.png
├── menu.c32
├── pxelinux.0
├── pxelinux.cfg
│   ├── centos
│   ├── clonezilla
│   ├── debian
│   ├── default
│   ├── gparted
│   ├── proxmox
│   ├── tools
│   └── ubuntu
└── vesamenu.c32