[gelöst] tftpd/nfs pxe server config

Einrichten des lokalen Netzes, Verbindung zu anderen Computern und Diensten.
Antworten
Benutzeravatar
florit
Beiträge: 61
Registriert: 10.01.2022 12:24:50
Lizenz eigener Beiträge: MIT Lizenz

[gelöst] tftpd/nfs pxe server config

Beitrag von florit » 16.11.2023 19:55:01

Hallo forum … und ebenfalls PXE booter

Ich wollte einen bzw mehrere raspberry’s per PXE booten
Nur finden die raspberry’s nur die standard config des dhcp servers nicht.
Benutzen tu ich dnsmasq und den nfs-kernel-server

Der nfs-kernel-server funktioniert prächtig mit dem habe ich keine Probleme
Aber dnsmasq mit dem includierten tftp-server gibt mir Rätsel auf …

Betriebssystem Server & Clients: Debian bookworm
https://raspi.debian.net/tested-images/

Ein teil stammt aus diesem tutorial: https://www.raspberrypi.com/tutorials/ ... tutorial/

Edit: habe die config angepasst und jetzt knallt es richtig 👍
Hint: der raspberry hatte eine defekte netzwerkkarte (habe ich ausgetauscht)*vom PXE server :facepalm:

Config wie folgt:

Code: Alles auswählen

 # Repeat the line for more than one interface.
interface=eth0
# Or you can specify which interface _not_ to listen on
except-interface=wlan0
# Or which to listen on by address (remember to include 127.0.0.1 if
# you use this.)
#listen-address=192.168.50.1
# If you want dnsmasq to provide only DNS service on an interface,
# configure it as shown above, and then use the following line to
# disable DHCP and TFTP on it.
no-dhcp-interface=wlan0

# Set a different domain for a particular subnet
domain=flips.org,192.168.50.0/24

# Uncomment this to enable the integrated DHCP server, you need
# to supply the range of addresses available for lease and optionally
# a lease time. If you have more than one network, you will need to
# repeat this for each network on which you want to supply DHCP
# service.
dhcp-range=192.168.50.1,192.168.50.250,255.255.255.0,12h

# Give the machine which says its name is "bert" IP address
# 192.168.0.70 and an infinite lease
#dhcp-host=bert,192.168.0.70,infinite
dhcp-option=1,255.255.255.0
dhcp-option=3,192.168.50.1
dhcp-option=6,192.168.50.1
dhcp-option=15,flips.org
dhcp-option=19,1
dhcp-option=66,192.168.50.1
dhcp-option=67,pxelinux.0
dhcp-option=128,d8:3a:dd:0b:10:6f
dhcp-option=128,d8:3a:dd:0b:05:6d
dhcp-option=128,d8:3a:dd:0b:6a:3b
dhcp-option=128,d8:3a:dd:0b:df:6a
dhcp-host=d8:3a:dd:0b:10:6f,0,192.168.50.11,infinite
dhcp-host=d8:3a:dd:0b:05:6d,0,192.168.50.12,infinite
dhcp-host=d8:3a:dd:0b:6a:3b,0,192.168.50.13,infinite
dhcp-host=d8:3a:dd:0b:df:6a,0,192.168.50.14,infinite
dhcp-option-force=210,/mnt/usb/tftpboot
dhcp-option-force=rpi1,17,192.168.50.1:/mnt/usb/rpi1
dhcp-option-force=rpi2,17,192.168.50.1:/mnt/usb/rpi2
dhcp-option-force=rpi3,17,192.168.50.1:/mnt/usb/rpi3
dhcp-option-force=rpi4,17,192.168.50.1:/mnt/usb/rpi4
dhcp-boot=pxelinux.0,d8:3a:dd:0b:10:6f,/5372979e/default
dhcp-boot=pxelinux.0,d8:3a:dd:0b:05:6d,/7819eecf/default
dhcp-boot=pxelinux.0,d8:3a:dd:0b:6a:3b,/68742c0c/default
dhcp-boot=pxelinux.0,d8:3a:dd:0b:df:6a,/ff0d449b/default
# Set the default time-to-live to 50
dhcp-option=23,50

# Set the "all subnets are local" flag
dhcp-option=27,1

# Send vendor-class specific options encapsulated in DHCP option 43.
# The meaning of the options is defined by the vendor-class so
# options are sent only when the client supplied vendor class
# matches the class given here. (A substring match is OK, so "MSFT"
# matches "MSFT" and "MSFT 5.0"). This example sets the
# mtftp address to 0.0.0.0 for PXEClients.
dhcp-option=vendor:PXEClient,1,192.168.50.1

# Set the boot filename for netboot/PXE. You will only need
# this if you want to boot machines over the network and you will need
# a TFTP server; either dnsmasq's built-in TFTP server or an
# external one. (See below for how to enable the TFTP server.)
dhcp-boot=pxelinux.0

# Boot for iPXE. The idea is to send two different
# filenames, the first loads iPXE, and the second tells iPXE what to
# load. The dhcp-match sets the ipxe tag for requests from iPXE.
#dhcp-boot=undionly.kpxe
dhcp-match=set:ipxe,175 # iPXE sends a 175 option.
#dhcp-boot=tag:ipxe,http://boot.ipxe.org/demo/boot.php

# Encapsulated options for iPXE. All the options are
# encapsulated within option 175
dhcp-option=encap:175, 1, 5b         # priority code
#dhcp-option=encap:175, 176, 1b       # no-proxydhcp
#dhcp-option=encap:175, 177, string   # bus-id
#dhcp-option=encap:175, 189, 1b       # BIOS drive code
#dhcp-option=encap:175, 190, user     # iSCSI username
#dhcp-option=encap:175, 191, pass     # iSCSI password

# Do real PXE, rather than just booting a single file, this is an
# alternative to dhcp-boot.
#pxe-prompt="What system shall I netboot?"
# or with timeout before first available action is taken:
pxe-prompt="Press F8 for menu.", 60

bind-dynamic
bogus-priv
domain-needed
no-resolv
no-poll
 
# Hier die IP-Adresse des Servers eintragen, auf dem Dnsmasq läuft. Es kann auch die Basisadresse eines Subnetzes
# angegeben werden. z.B. 192.168.0.0
dhcp-range=192.168.50.1,proxy
dhcp-no-override
 
# Falls der folgende Parameter pxe-prompt fehlt, funktioniert kein Netzwerkboot mehr.
pxe-prompt="pxelinux.0", 0
 
# Extra logging für DHCP: loggt alle Options die zu den DHCP clients gesendet wurde und auch die tags, die für die ermittlung verwendet wurden
# Beim Debugging von PXE-Problemen und dem Tagging extrem hilfreich!
log-dhcp
 
# Pfad zur Logdatei. Falls dieser nicht definiert ist, wird stattdessen im Syslog protokolliert.
log-facility=/var/log/dnsmasq.log
 
 
### Tagging und Tagabhängige operationen #####################################
dhcp-userclass=set:iPXE,iPXE
# iPXE: optional. Überträgt die Adresse des iSCSI Targets. In diesem Beispiel die von einem FreeNAS-Server.
#dhcp-option-force=203,iqn.2017-01.filer.ctl
 
# iPXE: IP-Adresse des TFTP-Servers und der Name der zu bootenden Datei. Kann z.B. auch pxelinux.0 sein.
dhcp-boot=tag:!iPXE,undionly.kpxe,,192.168.50.1
 
# iPXE: Wenn das iPXE ROM aktiv ist, dann hier den Namen der zu ladenden Konfigurationsdatei an den Client senden.
dhcp-boot=tag:iPXE,pxelinux.0,,192.168.50.1

# Available boot services. for PXE.
pxe-service=x86PC, "Boot from local disk"

# Loads <tftp-root>/pxelinux.0 from dnsmasq TFTP server.
pxe-service=x86PC, "Install Linux", pxelinux

# Loads <tftp-root>/pxelinux.0 from TFTP server at 1.2.3.4.
# Beware this fails on old PXE ROMS.
#pxe-service=x86PC, "Install Linux", pxelinux, 1.2.3.4

# Enable dnsmasq's built-in TFTP server
enable-tftp

# Set the root directory for files available via FTP.
tftp-root=/mnt/usb/tftpboot

# Do not abort if the tftp-root is unavailable
#tftp-no-fail

# Make the TFTP server more secure: with this set, only files owned by
# the user dnsmasq is running as will be send over the net.
tftp-secure

# This option stops dnsmasq from negotiating a larger blocksize for TFTP
# transfers. It will slow things down, but may rescue some broken TFTP
# clients.
tftp-no-blocksize

# Set the limit on DHCP leases, the default is 150
dhcp-lease-max=150

# The DHCP server needs somewhere on disk to keep its lease database.
# This defaults to a sane location, but if you want to change it, use
# the line below.
dhcp-leasefile=/var/lib/misc/dnsmasq.leases

# Set the DHCP server to authoritative mode. In this mode it will barge in
# and take over the lease for any client which broadcasts on the network,
# whether it has a record of the lease or not. This avoids long timeouts
# when a machine wakes up on a new network. DO NOT enable this if there's
# the slightest chance that you might end up accidentally configuring a DHCP
# server for your campus/company accidentally. The ISC server uses
# the same option, and this URL provides more information:
# http://www.isc.org/files/auth.html
dhcp-authoritative

# Set the DHCP server to enable DHCPv4 Rapid Commit Option per RFC 4039.
# In this mode it will respond to a DHCPDISCOVER message including a Rapid Commit
# option with a DHCPACK including a Rapid Commit option and fully committed address
# and configuration information. This must only be enabled if either the server is 
# the only server for the subnet, or multiple servers are present and they each
# commit a binding for all clients.
dhcp-rapid-commit

# Run an executable when a DHCP lease is created or destroyed.
# The arguments sent to the script are "add" or "del",
# then the MAC address, the IP address and finally the hostname
# if there is one.
dhcp-script=/bin/echo

# Set the cachesize here.
cache-size=150

# If you want to disable negative caching, uncomment this.
no-negcache

Antworten