PXE

From Hobbynet Admin Wiki
Revision as of 17:07, 29 July 2017 by Hans (talk | contribs)
Jump to navigation Jump to search

pxe

Op de virtuele server 'pxe' draait een PXE-server voor installatie van debian op afstand.

Er wordt door middel van dhcp een extern IP adres uitgedeeld waarmee je een server kan herinstalleren.

Op deze pagina staat complete installatie handleiding: http://www.howtoforge.com/ubuntu_pxe_install_server

tftp

De tftp boot files staan in /var/lib/tftpboot

dhcpd

De dhcp server deelt in drie reeksen uit:

1 in de 2e interne reeks 172.31.1.0/24 van 172.31.1.140 tot 172.31.1.170
2 in de externe reeks 212.72.224.0/26 van 212.72.224.200 tot 212.72.224.210
3 in de externe reeks 212.72.229.0/26 van 212.72.224.200 tot 212.72.229.210

De config van dhcp

default-lease-time 600;
max-lease-time 600;

authoritative;

subnet 172.31.1.0 netmask 255.255.255.0 {
        range 172.31.1.140 172.31.1.170;
        filename "pxelinux.0";
        option domain-name "hobby.nl";
        option subnet-mask 255.255.255.0;
        option domain-name-servers 172.31.1.107, 172.31.1.13, 172.31.1.14;
        option routers 172.31.1.254;
 }

subnet 212.72.224.0 netmask 255.255.255.0 {
        range 212.72.224.200 212.72.224.210;
        filename "pxelinux.0";
        option domain-name "hobby.nl";
        option subnet-mask 255.255.255.0;
        option domain-name-servers 212.72.224.101, 212.72.224.22, 212.72.224.23;
        option routers 212.72.224.1;
 }

subnet 212.72.229.0 netmask 255.255.255.0 {
        range 212.72.229.200 212.72.229.210;
        filename "pxelinux.0";
        option domain-name "hobby.nl";
        option subnet-mask 255.255.255.0;
        option domain-name-servers 212.72.224.101, 212.72.224.22, 212.72.224.23;
        option routers 212.72.229.1;
 }

De client kant

Neem in de lokale DHCP server op:

subnet 192.168.10.0 netmask 255.255.255.0 {
   range 192.168.10.170 192.168.10.199;
   option subnet-mask 255.255.255.0;
   option broadcast-address 192.168.10.255;
   option routers 192.168.10.1;
   filename "pxelinux.0";
   next-server 212.72.224.24;

Het gaat om de laatste twee regels; "filename" en "next-server".

distributies

De globale bestanden voor alle distributies staan in /var/lib/tftpboot/pxelinux.cfg/

ubuntu

Versie 14.04

De installatie bestanden staan in /var/lib/tftpboot/ubuntu-installer-1404

Versie 16.04

De installatie bestanden staan in /var/lib/tftpboot/ubuntu-installer-1604

Versie 17.04

De installatie bestanden staan in /var/lib/tftpboot/ubuntu-installer-1704

Images ophalen van externe server

De boot images worden m.b.v. het script '/var/lib/tftpboot/ubuntu-installer-1604/temp/update' van een externe server opgehaald.

cd /var/lib/tftpboot/ubuntu-installer-1604/temp/
echo Get AMD64 files
lftp -c "open http://nl.archive.ubuntu.com/ubuntu/dists/xenial/main/installer-amd64/current/images/netboot/ubuntu-installer; mirror amd64/"
echo Get i386 files
lftp -c "open http://nl.archive.ubuntu.com/ubuntu/dists/xenial/main/installer-i386/current/images/netboot/ubuntu-installer/; mirror i386/"
echo Move the files to the correct position
rm -fr /var/lib/tftpboot/ubuntu-installer-1604/amd64
rm -fr /var/lib/tftpboot/ubuntu-installer-1604/i386
mv amd64 /var/lib/tftpboot/ubuntu-installer-1604/
mv i386 /var/lib/tftpboot/ubuntu-installer-1604/
ls -l /var/lib/tftpboot/ubuntu-installer-1604/ -r
echo Done

debian

Versie 8.0

De installatie bestanden staan in /var/lib/tftpboot/debian-installer-80

Versie 9.0

De installatie bestanden staan in /var/lib/tftpboot/debian-installer-90

Images ophalen van externe server

De boot images worden m.b.v. het script '/var/lib/tftpboot/debian-installer-90/tmp/update' van een externe server opgehaald.

cd /var/lib/tftpboot/debian-installer-90/tmp/
lftp -c "open ftp://ftp.nl.debian.org/debian/dists/stretch/main/installer-i386/current/images/; mirror netboot/"
lftp -c "open ftp://ftp.nl.debian.org/debian/dists/stretch/main/installer-amd64/current/images/; mirror netboot/"
rm -fr /var/lib/tftpboot/debian-installer-90/amd64
rm -fr /var/lib/tftpboot/debian-installer-90/i386
mv /var/lib/tftpboot/debian-installer-90/tmp/netboot/debian-installer/* /var/lib/tftpboot/debian-installer-90
rm -fr netboot

openSUSE versie

openSUSE versie 12.2

Bestandslocaties

De openSUSE 12.2 installatie bestanden staan in /var/lib/tftpboot/opensuse-installer-122

openSUSE versie 13.2

Bestandslocaties

De openSUSE 13.2 installatie bestanden staan in /var/lib/tftpboot/opensuse-installer-132

Images ophalen van externe server

De boot images worden m.b.v. het script '/var/lib/tftpboot/opensuse-installer-132/work/update' van een externe server opgehaald.

cd /var/lib/tftpboot/opensuse-installer-132/work/

mkdir i386
cd i386
wget http://download.opensuse.org/distribution/13.2/repo/oss/boot/i386/loader/initrd
wget http://download.opensuse.org/distribution/13.2/repo/oss/boot/i386/loader/linux
cd ..

mkdir amd64
cd amd64
wget http://download.opensuse.org/distribution/13.2/repo/oss/boot/x86_64/loader/initrd
wget http://download.opensuse.org/distribution/13.2/repo/oss/boot/x86_64/loader/linux
cd ..

rm -fr /var/lib/tftpboot/opensuse-installer-132/i386
rm -fr /var/lib/tftpboot/opensuse-installer-132/amd64

mv i386 ..
mv amd64 ..

fedora

Versie 17

Bestands locaties

De installatie bestanden staan in /var/lib/tftpboot/fedora-installer-17

Images ophalen van externe server

De boot images worden m.b.v. het script '/var/lib/tftpboot/fedora-installer-17/work/get_all' van een externe server opgehaald.

#! /bin/bash
cd /var/lib/tftpboot/fedora-installer-17/work/
lftp -c "open ftp://ftp.nluug.nl/pub/os/Linux/distr/fedora/linux/releases/17/Fedora/i386/os/images/; mirror pxeboot/"
rm -rf ../i386
mv pxeboot ../i386
lftp -c "open ftp://ftp.nluug.nl/pub/os/Linux/distr/fedora/linux/releases/17/Fedora/x86_64/os/images/; mirror pxeboot/"
rm -rf ../x86_64
mv pxeboot ../x86_64

Versie 22

Bestands locaties

De installatie bestanden staan in /var/lib/tftpboot/fedora-installer-22

Images ophalen van externe server

De boot images worden m.b.v. het script '/var/lib/tftpboot/fedora-installer-22/work/get_all' van een externe server opgehaald.

#! /bin/bash
cd /var/lib/tftpboot/fedora-installer-17/work/
lftp -c "open ftp://ftp.nluug.nl/pub/os/Linux/distr/fedora/linux/releases/22/Workstation/i386/os/images/; mirror pxeboot/"
rm -rf ../i386
mv pxeboot ../i386
lftp -c "open ftp://ftp.nluug.nl/pub/os/Linux/distr/fedora/linux/releases/22/Workstation/x86_64/os/images/; mirror pxeboot/"
rm -rf ../x86_64
mv pxeboot ../x86_64
Fedora configuratie scripts

??2014.04.22 Verouderde info??
In /var/www staan 2 configuratie scripts (kickstart) een voor 32 bit en 64 bit. In deze scripts staat de URL van de mirror, zodat de gebruiker vanaf daar kan installeren.
Hieronder een voorbeeld van zo'n bestand:

network --device eth0 --bootproto dhcp
#Use HTTP installation media
url --url=http://mirror.leaseweb.com/fedora/linux/releases/11/Fedora/x86_64/os

CentOS

Versie 6.0

Bestands locaties

De installatie bestanden staan in /var/lib/tftpboot/centos-installer-60

Images ophalen van externe server

De boot images worden m.b.v. het script '/var/lib/tftpboot/centos-installer-60/temp/update' van een externe server opgehaald.

cd /var/lib/tftpboot/centos-installer-60/temp/i386/
wget http://ftp.nluug.nl/ftp/pub/os/Linux/distr/CentOS/6/os/i386/isolinux/vmlinuz
wget http://ftp.nluug.nl/ftp/pub/os/Linux/distr/CentOS/6/os/i386/isolinux/initrd.img
mv * /var/lib/tftpboot/centos-installer-60/i386/
cd /var/lib/tftpboot/centos-installer-60/temp/amd64/
wget http://ftp.nluug.nl/ftp/pub/os/Linux/distr/CentOS/6/os/x86_64/isolinux/vmlinuz
wget http://ftp.nluug.nl/ftp/pub/os/Linux/distr/CentOS/6/os/x86_64/isolinux/initrd.img
mv * /var/lib/tftpboot/centos-installer-60/amd64/
Configuratie scripts

??2014.04.22 Verouderde info??
In /var/www staan 2 configuratie scripts (kickstart) een voor 32 bit en 64 bit. In deze scripts staat de URL van de mirror, zodat de gebruiker vanaf daar kan installeren.
Hieronder een voorbeeld van zo'n bestand:

network --device eth0 --bootproto dhcp
#Use HTTP installation media
url --url=ftp://ftp-stud.fht-esslingen.de/pub/Mirrors/centos/5.3/os/x86_64/

Clonezilla

AMD: Versie 1.2.12-67 i686: 2.2.2-37

Bestands locaties

De installatie bestanden staan in /var/lib/tftpboot/clonezilla/maverick

AMD: 2.2.2-37 / i686: 2.5.2-17

Bestands locaties

De installatie bestanden van staan in /var/lib/tftpboot/clonezilla/debian-amd64/ en ../debian-i686

Images ophalen van externe server

Haal een .zip bestand op vanaf de clonezilla server, en pak het lokaal uit. Verplaats dan de bestanden

filesystem.squashfs  initrd.img  vmlinuz

naar de juiste map, en gooi de andere bestanden weg.