What's new

PXE boot for installing Windows via router USB

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Rob Q

Senior Member
Hello,
I would like to store my Windows ISO's on the USB stick of my router and when it comes time for a reinstallation of Windows on my desktop PC, I'd like to have my BIOS boot from the network, access the installation source, and install Windows to my computer. How can I do this?

My USB stick is located at /tmp/mnt/Kingston
 
Just wondering, if the router has an USB3 port and I'm using an USB3 flash drive on the USB2 port, shouldn't I be using the USB3 port if I will be remote booting ISO images?
 
Obviously using a USB3 device in a USB3 port will potentially be faster than using the USB2 port (depending on the performance of the flash drive). USB2 has a maximum rate of 480 Mbps (60 MB/s) which is less than that of a Gigabit LAN port.
 
Hi @ColinTaylor , thank you for your response. I've switched it over to the USB3 port and I placed the ipxe.efi and undionly.kpxe files in the /tmp/mnt/USB/tftproot directory.
As for the /jffs/configs/dnsmasq.conf.add file, I've copied yours from here... https://www.snbforums.com/threads/dhcp-uefi-and-pxe-support.41968/#post-356288

The end result is that it keeps looping.

I have Diversion installed, the routers built-in firewall, and AiProtection enabled.

As for the router log...
Code:
Mar 16 16:59:39 dnsmasq-tftp[1762]: sent /tmp/mnt/USB/tftproot/undionly.kpxe to 192.168.1.123
and DHCPDiscover and DHCPOffer, then it loops to the tftp line.
1679000415842.png
 
I have changed over to PXELinux but I don't know why I'm getting those file not found messages.
Code:
Mar 16 18:21:21 dnsmasq-tftp[11663]: file /tmp/mnt/USB/tftproot/pxelinux.cfg/C0A801 not found for 192.168.1.123
Mar 16 18:21:21 dnsmasq-tftp[11663]: file /tmp/mnt/USB/tftproot/pxelinux.cfg/C0A80 not found for 192.168.1.123
Mar 16 18:21:21 dnsmasq-tftp[11663]: file /tmp/mnt/USB/tftproot/pxelinux.cfg/C0A8 not found for 192.168.1.123
Mar 16 18:21:21 dnsmasq-tftp[11663]: file /tmp/mnt/USB/tftproot/pxelinux.cfg/C0A not found for 192.168.1.123
Mar 16 18:21:21 dnsmasq-tftp[11663]: file /tmp/mnt/USB/tftproot/pxelinux.cfg/C0 not found for 192.168.1.123
Mar 16 18:21:21 dnsmasq-tftp[11663]: file /tmp/mnt/USB/tftproot/pxelinux.cfg/C not found for 192.168.1.123
Mar 16 18:21:21 dnsmasq-tftp[11663]: sent /tmp/mnt/USB/tftproot/pxelinux.cfg/default to 192.168.1.123
Mar 16 18:21:22 dnsmasq-tftp[11663]: sent /tmp/mnt/USB/tftproot/menu.c32 to 192.168.1.123
Mar 16 18:21:22 dnsmasq-tftp[11663]: sent /tmp/mnt/USB/tftproot/pxelinux.cfg/default to 192.168.1.123
Mar 16 18:21:50 dnsmasq-tftp[11663]: sent /tmp/mnt/USB/tftproot/memdisk to 192.168.1.123
Mar 16 18:22:18 dnsmasq-tftp[11663]: sent /tmp/mnt/USB/tftproot/memdisk to 192.168.1.123
Mar 16 18:23:49 dnsmasq-tftp[11663]: sent /tmp/mnt/USB/tftproot/winpe_x64.iso to 192.168.1.123
1679005633973.png


Contents of "pxelinux.cfg/default"
Code:
DEFAULT menu.c32
TIMEOUT 300
ALLOWOPTIONS 0
PROMPT 0

MENU TITLE PXE Boot Menu

LABEL Windows x64
MENU LABEL WinPE x64
KERNEL memdisk
append iso raw initrd=winpe_x64.iso

I was able to get this far, haven't tested it on a real EFI PC. Legacy BIOS seems to work.

1679005738897.png
 
Well, got to do more reading. EFI won't work. I might be missing some files here.
 
I have changed over to PXELinux but I don't know why I'm getting those file not found messages.
I was just about to post that I don't know why you were having problems as it looked like it was trying to work. I was reviewing my old files from 5 years ago and it looks like I switched over to pxelinux.0 and syslinux.efi.

IIRC the "not found" messages are normal, it's just to order in which it hunts for the config file.

FWIW here's the last config file I had:
Code:
log-dhcp
enable-tftp
tftp-root=/tmp/mnt/VERBATIM/ASUS/pxe

dhcp-vendorclass=BIOS,PXEClient:Arch:00000
dhcp-vendorclass=UEFI32,PXEClient:Arch:00006
dhcp-vendorclass=UEFI,PXEClient:Arch:00007
dhcp-vendorclass=UEFI64,PXEClient:Arch:00009

dhcp-boot=net:BIOS,bios/pxelinux.0
dhcp-boot=net:UEFI32,efi32/syslinux.efi
dhcp-boot=net:UEFI,efi64/syslinux.efi
dhcp-boot=net:UEFI64,efi64/syslinux.efi

# Or...
#enable-tftp
#tftp-root=/tmp/mnt/VERBATIM/ASUS/pxe/bios
#dhcp-boot=pxelinux.0
Notice that I'm using three separate subdirectories, bios, efi32 and efi64.
 
I was just about to post that I don't know why you were having problems as it looked like it was trying to work. I was reviewing my old files from 5 years ago and it looks like I switched over to pxelinux.0 and syslinux.efi.

IIRC the "not found" messages are normal, it's just to order in which it hunts for the config file.

FWIW here's the last config file I had:
Code:
log-dhcp
enable-tftp
tftp-root=/tmp/mnt/VERBATIM/ASUS/pxe

dhcp-vendorclass=BIOS,PXEClient:Arch:00000
dhcp-vendorclass=UEFI32,PXEClient:Arch:00006
dhcp-vendorclass=UEFI,PXEClient:Arch:00007
dhcp-vendorclass=UEFI64,PXEClient:Arch:00009

dhcp-boot=net:BIOS,bios/pxelinux.0
dhcp-boot=net:UEFI32,efi32/syslinux.efi
dhcp-boot=net:UEFI,efi64/syslinux.efi
dhcp-boot=net:UEFI64,efi64/syslinux.efi

# Or...
#enable-tftp
#tftp-root=/tmp/mnt/VERBATIM/ASUS/pxe/bios
#dhcp-boot=pxelinux.0
Notice that I'm using three separate subdirectories, bios, efi32 and efi64.
Thanks. Where did you get the syslinux.efi and pxelinux.0 files from? I've decided to start from square one as it was becoming a mess and I lost the source.

Also, what does the file called /pxe.config/default look like? Just wondering how you added entries to your menu and lastly, could I please see a directory listing of the folder and subfolders of pxe?
If you could map your PXE folder to drive Z for example (just temporary), go to the command prompt, and type this...
Z:
DIR /S >C:\PXE.txt
That should create a text file on your C:\ drive (root folder). Not sure what the Linux equivalent would be.

Which version of syslinux are you using? How about pxelinux?
 
Last edited:
I'm sorry but I really can't remember anything about this, it was too long ago. Maybe I got those files pre-packaged from somewhere. I can't even remember whether I got UEFI to work or not.

It looks like you're expected to extract the files from the syslinux archive. See the notes here: https://wiki.syslinux.org/wiki/index.php?title=Install#UEFI

This is what I ended up having:
Code:
# find pxe -ls
   263777      4 drwxrwxrwx   5 Colin    Colin        4096 Mar  9  2022 pxe
   263779      4 drwxrwxrwx   3 Colin    Colin        4096 Mar  9  2022 pxe/bios
   263780     48 -rwxrwxrwx   1 Colin    Colin       46909 Oct  6  2014 pxe/bios/pxelinux.0
   263786     24 -rwxrwxrwx   1 Colin    Colin       24148 Oct  6  2014 pxe/bios/libutil.c32
   263782    120 -rwxrwxrwx   1 Colin    Colin      122308 Oct  6  2014 pxe/bios/ldlinux.c32
   263781     28 -rwxrwxrwx   1 Colin    Colin       26596 Oct  6  2014 pxe/bios/menu.c32
   263783      4 drwxrwxrwx   2 Colin    Colin        4096 Mar  9  2022 pxe/bios/pxelinux.cfg
   263784      4 -rwxrwxrwx   1 admin    root          483 Nov  3  2017 pxe/bios/pxelinux.cfg/default
   263785     92 -rwxrwxrwx   1 Colin    Colin       91550 Oct  6  2014 pxe/bios/lpxelinux.0
   263794      4 -rwxrwxrwx   1 admin    root          475 Apr  3  2018 pxe/dnsmasq-config
   263795    948 -rwxrwxrwx   1 Colin    Colin      968736 Nov  3  2017 pxe/ipxe.efi
   263787      4 drwxrwxrwx   2 Colin    Colin        4096 Mar  9  2022 pxe/efi32
   263789    124 -rwxrwxrwx   1 Colin    Colin      124292 Oct  6  2014 pxe/efi32/ldlinux.e32
   263788    192 -rwxrwxrwx   1 Colin    Colin      193230 Oct  6  2014 pxe/efi32/syslinux.efi
   263790      4 drwxrwxrwx   3 Colin    Colin        4096 Mar  9  2022 pxe/efi64
   263793    140 -rwxrwxrwx   1 Colin    Colin      139968 Oct  6  2014 pxe/efi64/ldlinux.e64
   263791    196 -rwxrwxrwx   1 Colin    Colin      199952 Oct  6  2014 pxe/efi64/syslinux.efi
   263792      4 drwxrwxrwx   2 Colin    Colin        4096 Nov  3  2017 pxe/efi64/pxelinux.cfg
   263778     68 -rwxrwxrwx   1 Colin    Colin       67227 Nov  3  2017 pxe/undionly.kpxe
Code:
# cat pxe/bios/pxelinux.cfg/default
default menu.c32
prompt 0
timeout 300
ONTIMEOUT local

MENU TITLE Main Menu

LABEL local
        MENU LABEL Boot local hard drive
        LOCALBOOT 0

LABEL x86 Servers
        MENU LABEL x86 Servers
        KERNEL menu.c32
        APPEND pxelinux.cfg/x86_Servers

LABEL x86_64 Servers
        MENU LABEL x86_64 Servers
        KERNEL menu.c32
        APPEND pxelinux.cfg/x86_64_Servers

LABEL Tools
        MENU LABEL Tools
        KERNEL menu.c32
        APPEND pxelinux.cfg/tools
 
Thanks. I'll be able to find the files again. Too bad Merlin doesn't include them in the firmware image, then all we would have to do is enable the TFTP service and configure dnsmasq.conf.add (or maybe he could include an example file as a template).
I thought of doing this on my Synology NAS but that would require me to enable the DHCP server but since I don't know anything about that kind of stuff, I'm afraid of messing up the router and all the connected devices. Heck, my modem on the WAN port was even logging strange DHCP events. Didn't think that was possible.
I wonder, once this is all completed and the LAN devices are booting (UEFI/BIOS), could the WiFi devices do this also? I never seen an option in the BIOS for the WiFi cards, only the LAN boot ROM.

For a Windows user that knows nothing about networking and Linux, this is a ..... challenge. :)
 
I'm sorry but I really can't remember anything about this, it was too long ago. Maybe I got those files pre-packaged from somewhere. I can't even remember whether I got UEFI to work or not.

It looks like you're expected to extract the files from the syslinux archive. See the notes here: https://wiki.syslinux.org/wiki/index.php?title=Install#UEFI

This is what I ended up having:

Code:
# cat pxe/bios/pxelinux.cfg/default
default menu.c32
prompt 0
timeout 300
ONTIMEOUT local

MENU TITLE Main Menu

LABEL local
        MENU LABEL Boot local hard drive
        LOCALBOOT 0

LABEL x86 Servers
        MENU LABEL x86 Servers
        KERNEL menu.c32
        APPEND pxelinux.cfg/x86_Servers

LABEL x86_64 Servers
        MENU LABEL x86_64 Servers
        KERNEL menu.c32
        APPEND pxelinux.cfg/x86_64_Servers

LABEL Tools
        MENU LABEL Tools
        KERNEL menu.c32
        APPEND pxelinux.cfg/tools
I don't understand the APPEND section of each line. What does that line of each listing do? Only thing I understand is LOCALBOOT 0.
I'm assuming this is the boot order of your BIOS?
FLOPPY (Yeah, I'm old school. haha!) *If you have a floppy controller on your motherboard*
CD-ROM
NETWORK
HARD DRIVE (C, D)
 
Last edited:
I thought of doing this on my Synology NAS but that would require me to enable the DHCP server but since I don't know anything about that kind of stuff, I'm afraid of messing up the router and all the connected devices.
How much control does the Synology give you over the dhcp setup? Is it using dnsmasq?

If so on the latter it should be fairly simple - I've got dnsmasq running on a Pi comfortably for nothing more than serving boot requests. DHCP is still running on the router.
 
I have successfully implemented network booting through iPXE for both UEFI and BIOS, drawing inspiration from discussions among my predecessors. This is primarily aimed at facilitating diskless rescue boot and data restoration, leveraging tools such as netboot.xyz or Synology Active Backup for Business Recovery Wizard.

UEFI mode
1709089778539.png


1709090140755.png




BIOS mode
1709089843321.png

1709090240407.png

1709090292322.png



dnsmasq add-on
admins@GT-AX6000-0FC8:/jffs/configs# cat dnsmasq.conf.add
# Tag dhcp request from iPXE
dhcp-match=set:ipxe,175

# inspect the vendor class string and tag BIOS client
dhcp-vendorclass=BIOS,PXEClient:Arch:00000
#dhcp-match=set:bios,option:client-arch,0

enable-tftp
tftp-root=/mnt/usbkey/tftboot/

# BIOS iPXE
dhcp-boot=tag:!ipxe,tag:BIOS,undionly.kpxe

# UEFI iPXE
dhcp-boot=tag:!ipxe,tag:!BIOS,ipxe.efi
#dhcp-boot=tag:!ipxe,tag:!BIOS,images/netboot.xyz.efi

# iPXE BOOT MENU
dhcp-boot=tag:ipxe,menu.ipxe

ipxe menu
admins@GT-AX6000-0FC8:/tmp/mnt/usbkey/tftboot# cat menu.ipxe
#!ipxe

iseq ${platform} efi && goto esxi_efi || goto esxi_bios

######## UEFI MAIN MENU BEGIN ###################
:esxi_efi
menu Welcome to iPXE's Boot Menu for UEFI
item
item --gap -- ------------------------------ Utilities -------------------------
item netboot Goto netboot.xyz (lets you PXE boot various OS from the network.)
item synology Active Backup for Business (Synology Restore)
item debian Debian Netboot (Linux system)
item ubuntu Ubuntu Netboot (Linux system)
item --gap -- ------------------------------ Advanced --------------------------
item config Configure settings
item shell Enter iPXE shell
item reboot Reboot
item exit Exit (boot local disk)
choose --default exit --timeout 60000 target && goto ${target}

########## UTILITY ITEMS ##############
:netboot
#open iso with iso editor and remove pmagic to make it ligther
#chain --autofree http://netboot.cz/index.ipxe || goto failed
chain --autofree https://boot.netboot.xyz || goto failed
#chain http://boot.ipxe.org/demo/boot.php || goto failed
goto esxi_efi


:synology
kernel http://192.168.168.254:8000/uefi/wimboot
initrd http://192.168.168.254:8000/uefi/SynologyRestoreMedia/Boot/BCD
initrd http://192.168.168.254:8000/uefi/SynologyRestoreMedia/Boot/boot.sdi
initrd http://192.168.168.254:8000/uefi/SynologyRestoreMedia/sources/boot.wim
boot || goto failed
goto esxi_efi


:debian
echo Booting Debian netboot
set url https://mirrors.aliyun.com/debian/d...urrent/images/netboot/debian-installer/amd64/
kernel ${url}linux initrd=initrd.gz
initrd ${url}initrd.gz
boot || goto start
goto esxi_efi

:ubuntu
echo Booting Ubuntu netboot
set base-url http://archive.ubuntu.com/ubuntu/di...legacy-images/netboot/ubuntu-installer/amd64/
kernel ${base-url}/linux initrd=initrd.gz
initrd ${base-url}/initrd.gz
boot || goto start
goto esxi_efi


:shell
echo Type exit to get the back to the menu
shell
set menu-timeout 0
goto esxi_efi

:failed
echo Booting failed, dropping to shell
goto shell

:reboot
reboot

:exit
exit

:cancel
echo You cancelled the menu, dropping you to a shell

:config
config
goto esxi_efi

:back
set submenu-timeout 0
clear submenu-default
goto esxi_efi

######## UEFI MAIN MENU END ###################


######## BIOS MAIN MENU BEGIN ###################
:esxi_bios
menu Welcome to iPXE's Boot Menu for Legacy BIOS
item
item --gap -- ------------------------------ Utilities -------------------------
item netboot1 Goto netboot.xyz (lets you PXE boot various OS from the network.)
item acronis1 Boot Acronis True Image 2021 (Rescute system)
item synology1 Active Backup for Business (Synology Restore)
item systemrescue1 systemrescue-9.06-amd64.iso (SystemRescue)
item --gap -- ------------------------------ Advanced --------------------------
item config Configure settings
item shell Enter iPXE shell
item reboot Reboot
item exit Exit (boot local disk)
choose --default exit --timeout 60000 target && goto ${target}

########## UTILITY ITEMS ##############
:netboot1
#open iso with iso editor and remove pmagic to make it ligther
chain --autofree http://boot.netboot.xyz || goto failed
goto esxi_bios


:acronis1
#open iso with iso editor and remove pmagic to make it ligther
initrd http://192.168.168.254:8000/images/AcronisTrueImage2021.iso
kernel http://192.168.168.254:8000/memdisk iso raw
boot || goto failed
goto esxi_bios


:synology1
#open iso with iso editor and remove pmagic to make it ligther
initrd http://192.168.168.254:8000/images/SynologyRestoreMedia.iso
kernel http://192.168.168.254:8000/memdisk iso raw
boot || goto failed
goto esxi_bios

:systemrescue1
#open iso with iso editor and remove pmagic to make it ligther
initrd http://192.168.168.254:8000/images/systemrescue-9.06-amd64.iso
kernel http://192.168.168.254:8000/memdisk iso raw
boot || goto failed
goto esxi_bios

:shell
echo Type exit to get the back to the menu
shell
set menu-timeout 0
goto esxi_bios

:failed
echo Booting failed, dropping to shell
goto shell

:reboot
reboot

:exit
exit

:cancel
echo You cancelled the menu, dropping you to a shell

:config
config
goto esxi_bios

:back
set submenu-timeout 0
clear submenu-default
goto esxi_bios

######## BIOS MAIN MENU END ###################
 
Last edited:

Similar threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top