To set up a TFTP server on your Debian system for PXE booting Windows 11 installations, follow this comprehensive guide. Since DHCP is managed externally, ensure your DHCP server is configured to point to your TFTP server (option next-server and filename). Let's proceed:
1. Install TFTP and Related Tools
sudo apt update
sudo apt install tftpd-hpa syslinux-common pxelinux -y
2. Configure TFTP Server
Edit the configuration file:
sudo nano /etc/default/tftpd-hpa
Modify it to match:
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/srv/tftp"
TFTP_ADDRESS=":69"
TFTP_OPTIONS="--secure --create"
Create the TFTP directory and set permissions:
sudo mkdir -p /srv/tftp
sudo chown -R tftp:tftp /srv/tftp
sudo chmod -R 777 /srv/tftp # TFTP requires write access for file uploads
Restart the service:
sudo systemctl restart tftpd-hpa
3. Set Up PXE Boot Files
Copy essential SYSLINUX bootloaders:
sudo cp /usr/lib/PXELINUX/pxelinux.0 /srv/tftp/
sudo cp /usr/lib/syslinux/modules/bios/{ldlinux.c32,libcom32.c32,libutil.c32,vesamenu.c32} /srv/tftp/
Create the PXE menu structure:
sudo mkdir -p /srv/tftp/pxelinux.cfg
sudo nano /srv/tftp/pxelinux.cfg/default
Add this menu configuration:
DEFAULT vesamenu.c32
PROMPT 0
TIMEOUT 50
ONTIMEOUT Win11
LABEL Win11
MENU LABEL Install Windows 11
KERNEL memdisk
INITRD boot/win11/boot.sdi
APPEND raw
4. Prepare Windows 11 Boot Files
Obtain Required Files
- Mount your Windows 11 ISO:
sudo mkdir /mnt/win11
sudo mount -o loop Win11_22H2_English_x64.iso /mnt/win11
- Copy critical boot files to TFTP directory:
sudo mkdir -p /srv/tftp/boot/win11
sudo cp /mnt/win11/boot/boot.sdi /srv/tftp/boot/win11/
sudo cp /mnt/win11/efi/microsoft/boot/bcd /srv/tftp/boot/win11/
sudo cp /mnt/win11/efi/microsoft/boot/bootmgfw.efi /srv/tftp/boot/win11/
sudo umount /mnt/win11
Create a Custom BCD File
Use a Windows machine with the Windows ADK to generate a custom BCD that points to your SMB share. Example steps:
- Install ADK and open Deployment and Imaging Tools as admin.
- Create a new BCD store:
bcdedit /createstore BCD
- Import Windows PE (
boot.wim from your ISO):
bcdedit /store BCD /set {default} device ramdisk=[boot]\boot\win11\boot.wim,{ramdiskoptions}
bcdedit /store BCD /set {ramdiskoptions} ramdisksdidevice boot
bcdedit /store BCD /set {ramdiskoptions} ramdisksdipath \boot\win11\boot.sdi
- Replace
/srv/tftp/boot/win11/BCD with this custom file.
5. Set Up Samba Share for Windows Installation
Install Samba:
sudo apt install samba -y
Configure the share:
sudo nano /etc/samba/smb.conf
Add at the end:
[Win11_Install]
path = /srv/samba/win11
browsable = yes
writable = no
guest ok = yes
read only = yes
Create the directory and copy Windows 11 files:
sudo mkdir -p /srv/samba/win11
sudo cp -r /path/to/mounted/win11_iso/* /srv/samba/win11/ # Copy entire ISO contents
sudo chmod -R 755 /srv/samba/win11
Restart Samba:
sudo systemctl restart smbd
6. Configure External DHCP Server
On your DHCP switch/router, set these options:
- Option 66 (TFTP Server Name): IP of your Debian server.
- Option 67 (Bootfile Name):
pxelinux.0 for BIOS clients or boot/win11/bootmgfw.efi for UEFI.
7. Test Your Setup
- Boot a client PC via PXE.
- Select Install Windows 11 from the PXE menu.
- The client should load WinPE and start the Windows Setup, pulling files from your Samba share.
Troubleshooting Tips
This setup provides a scalable solution for deploying Windows 11 across your organization. Customize paths and IPs according to your environment!