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.
 
Just to let you know its very slow. SAMBA on the router sucks.
 

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

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