From 0f6de50a6699d502be4bab5127e3209f46e61215 Mon Sep 17 00:00:00 2001 From: Jarod Pauchet Date: Mon, 16 Sep 2024 17:53:29 +0200 Subject: [PATCH] =?UTF-8?q?=09nouveau=20fichier=C2=A0:=20sio2/sisr/PXE/REA?= =?UTF-8?q?DME.me=20=09nouveau=20fichier=C2=A0:=20sio2/sisr/PXE/dhcpd.conf?= =?UTF-8?q?=20=09nouveau=20fichier=C2=A0:=20sio2/sisr/PXE/enp0s3=20=09nouv?= =?UTF-8?q?eau=20fichier=C2=A0:=20sio2/sisr/PXE/enp0s8=20=09nouveau=20fich?= =?UTF-8?q?ier=C2=A0:=20sio2/sisr/PXE/isc-dhcp-server=20=09nouveau=20fichi?= =?UTF-8?q?er=C2=A0:=20sio2/sisr/PXE/nftables.conf?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sio2/sisr/PXE/README.me | 38 +++++++++++++++++++++++++++++++++++ sio2/sisr/PXE/dhcpd.conf | 15 ++++++++++++++ sio2/sisr/PXE/enp0s3 | 3 +++ sio2/sisr/PXE/enp0s8 | 4 ++++ sio2/sisr/PXE/isc-dhcp-server | 18 +++++++++++++++++ sio2/sisr/PXE/nftables.conf | 14 +++++++++++++ 6 files changed, 92 insertions(+) create mode 100644 sio2/sisr/PXE/README.me create mode 100644 sio2/sisr/PXE/dhcpd.conf create mode 100644 sio2/sisr/PXE/enp0s3 create mode 100644 sio2/sisr/PXE/enp0s8 create mode 100644 sio2/sisr/PXE/isc-dhcp-server create mode 100644 sio2/sisr/PXE/nftables.conf diff --git a/sio2/sisr/PXE/README.me b/sio2/sisr/PXE/README.me new file mode 100644 index 0000000..a26a58e --- /dev/null +++ b/sio2/sisr/PXE/README.me @@ -0,0 +1,38 @@ +# TP Déploiement PXE + +## Description +Ce projet décrit comment installer et configurer un serveur PXE (Preboot Execution Environment) pour permettre le démarrage de machines via le réseau. + +## Prérequis +- Un serveur avec une distribution Linux (par exemple, Ubuntu ou Debian) +- Accès root ou sudo +- Une connexion réseau fonctionnelle + +## Installation + +### Étape 1 : Installer les paquets nécessaires +``` +sudo apt update +sudo apt install -y isc-dhcp-server tftpd-hpa + +### Étape 2 : Modifier le fichier isc-dhcp-server +``` +--> Voir fichier dhcpd.conf + +### Étape 3 : Configurer nftables +``` +--> Voir /etc/nftables.conf + +### Étape 4 : Configurer TFTP +``` +YOURMIRROR=deb.debian.org +Utiliser le script ci-dessous afin de récupérer l'image de netboot +DIST=bookworm +ARCH=amd64 +wget http://"$YOURMIRROR"/debian/dists/"$DIST"/main/installer-"$ARCH"/current/images/netboot/netboot.tar.gz + +L'extraire dans /srv/tftp + + + + diff --git a/sio2/sisr/PXE/dhcpd.conf b/sio2/sisr/PXE/dhcpd.conf new file mode 100644 index 0000000..05fa16c --- /dev/null +++ b/sio2/sisr/PXE/dhcpd.conf @@ -0,0 +1,15 @@ +default-lease-time 600; +max-lease-time 7200; + +allow booting; + +# in this example, we serve DHCP requests from 192.168.0.(3 to 253) +# and we have a router at 192.168.0.1 +subnet 192.168.1.0 netmask 255.255.255.0 { + range 192.168.1.3 192.168.1.253; + option broadcast-address 192.168.1.255; + option routers 192.168.1.100; # our router + option domain-name-servers 10.121.38.7; # our router has DNS functionality + next-server 192.168.1.100; # our Server + filename "pxelinux.0"; # setting a default, might be wrong for "non defaults" +} \ No newline at end of file diff --git a/sio2/sisr/PXE/enp0s3 b/sio2/sisr/PXE/enp0s3 new file mode 100644 index 0000000..356191f --- /dev/null +++ b/sio2/sisr/PXE/enp0s3 @@ -0,0 +1,3 @@ +# generated by FAI +auto enp0s3 +iface enp0s3 inet dhcp \ No newline at end of file diff --git a/sio2/sisr/PXE/enp0s8 b/sio2/sisr/PXE/enp0s8 new file mode 100644 index 0000000..fe0b574 --- /dev/null +++ b/sio2/sisr/PXE/enp0s8 @@ -0,0 +1,4 @@ +# generated by FAI +auto enp0s8 +iface enp0s8 inet static +address 192.168.1.100/24 \ No newline at end of file diff --git a/sio2/sisr/PXE/isc-dhcp-server b/sio2/sisr/PXE/isc-dhcp-server new file mode 100644 index 0000000..92f9a5d --- /dev/null +++ b/sio2/sisr/PXE/isc-dhcp-server @@ -0,0 +1,18 @@ +# Defaults for isc-dhcp-server (sourced by /etc/init.d/isc-dhcp-server) + +# Path to dhcpd's config file (default: /etc/dhcp/dhcpd.conf). +DHCPDv4_CONF=/etc/dhcp/dhcpd.conf +#DHCPDv6_CONF=/etc/dhcp/dhcpd6.conf + +# Path to dhcpd's PID file (default: /var/run/dhcpd.pid). +DHCPDv4_PID=/var/run/dhcpd.pid +#DHCPDv6_PID=/var/run/dhcpd6.pid + +# Additional options to start dhcpd with. +# Don't use options -cf or -pf here; use DHCPD_CONF/ DHCPD_PID instead +#OPTIONS="" + +# On what interfaces should the DHCP server (dhcpd) serve DHCP requests? +# Separate multiple interfaces with spaces, e.g. "eth0 eth1". +INTERFACESv4="enp0s8" +#INTERFACESv6="" \ No newline at end of file diff --git a/sio2/sisr/PXE/nftables.conf b/sio2/sisr/PXE/nftables.conf new file mode 100644 index 0000000..2ffb815 --- /dev/null +++ b/sio2/sisr/PXE/nftables.conf @@ -0,0 +1,14 @@ +#!/usr/sbin/nft -f + +flush ruleset + +table inet nat { + chain prerouting { + type nat hook prerouting priority 0; + } + chain postrouting { + type nat hook postrouting priority 100; + oifname "enp0s3" masquerade + } +} +