PXE: Difference between revisions
No edit summary |
|||
Line 204: | Line 204: | ||
* pas /etc/netplan/01-netcfg.yaml aan naar de netwerk configuratie (gebruik geen tabs maar spaties) hier onder een verbeeld van standaar netplan file | * pas /etc/netplan/01-netcfg.yaml aan naar de netwerk configuratie (gebruik geen tabs maar spaties) hier onder een verbeeld van standaar netplan file | ||
<pre> | <pre> | ||
# This file is generated from information provided by | # This file is generated from information provided by | ||
# the datasource. Changes to it will not persist across an instance. | # the datasource. Changes to it will not persist across an instance. |
Revision as of 08:40, 16 July 2018
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
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/
automatische installatie hobbynet
Voor hobbynet zijn volledig voorge configureerd instalatie script zo dat de hobbynet server's op de gewenste manier worden geinstalleerd
automatische installatie process
- Maak VM aan (Beschijf we niet spreekt voor zich anders lees vmware handleiding maar) Minimaal 2 cores en 2 gb geheugen is de standaard
- Boot van pxe ( bij 2 interface vaalt de 1e meestal en start van de 2e het interne netwerk)
- Kies in menu optie H hobbynet menu
- Bij 1 interface (alleen intern) kies je optie B en bij 2 interfaces of meer kies je optie A bij (interne interface is dan de 2e netwerk kaart)
- Vul de hostnaam in (zonder –int)
- Wacht tot de machine gaat rebooten
- Login met user a wachtwoord bas
- doe "sudo -i" weer wachtwoord bas
- geef het commando ./post-install.sh
- wacht op reboot
- Tijdens reboot krijg je de melding "A startup job is running for wait for Network to be Configured" hier op moet je wachten kan soms enkele min duren
- login met beheerders account
- wordt root (sudo -i)
- tip kijk met ifconfig wat ip is en login met ssh en ga veder als root
- pas /etc/netplan/01-netcfg.yaml aan naar de netwerk configuratie (gebruik geen tabs maar spaties) hier onder een verbeeld van standaar netplan file
# This file is generated from information provided by # the datasource. Changes to it will not persist across an instance. # To disable cloud-init's network configuration capabilities, write a file # /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following: # network: {config: disabled} network: version: 2 ethernets: ens160: addresses: - 212.72.224.111/24 - 2a02:968:1:2:212:72:224:111/64 gateway4: 212.72.224.1 gateway6: 2a02:968:1:2::1 nameservers: addresses: - 8.8.8.8 search: - hobby.nl optional: true ens192: addresses: - 172.31.1.111/24 nameservers: addresses: [] search: [] routes: - to: 172.31.2.0/24 via: 172.31.1.1 - to: 192.168.200.0/24 via: 172.31.1.1 optional: true
- controleer of de routes in de netplan file staan die nodig hebt minimaal de 2 routes uit het voorbeeld hier boven ivm vpn
- geef commando netplan apply
- Nu heeft de machine de de ip configuratie die jij hebt opgegeven (Als je met ssh zit ingelogd ben je uiteraard je verbinding kwijt)