Resource icon

Tutorial How to PXE Boot Linux & Windows using Syslinux

This tutorial will walk you through the process of setting up a PXE boot server on your Synology NAS. By the end of this guide you should be able to boot any legacy PC from your NAS into Linux or Windows.

I might consider adding UEFI support to the guide once its finished however it has its caveats. Syslinux cannot boot Windows in UEFI boot mode due to the way Windows handles EFI boot security so a UEFI PXE server can only really boot Linux without chainloading custom PXE firmwares which is way beyond the scope of this guide.

I'm creating this because the process is not very well documented for Synology NAS systems. The intent is to create a guide which outlines the full procedure from start to finish so hopefully others can have success like I did. This process has taken me over a week of piecing together bits of information from various guides and, as needed, adjusting them to fit Synology DSM.

Its important to remember that DSM runs on Linux so all file and folder names are case sensitive. For example "Clonezilla.iso" is not the same as "clonezilla.iso" and confusing the two will result in errors.

00: Prerequisites


You'll need a PC running either Linux or Windows* (Windows is required if you want to boot Windows from PXE)
(*Note: I'm running Windows so the guide will be focused around instructions for that OS however nothing I do in the guide is so specific that it cannot easily be translated to Linux if that's what OS you are running.)
A Synology NAS (mines a 218+ but model shouldn't matter at all) running DSM 6.
A copy of the Syslinux download files (I used V6.04).
A copy of a Linux Distro of your choice. I will use Clonezilla as my example.
A WinPE bootable ISO (creating this is outside the scope of this guide however I will link to the MS tech net article on how its done).
Notepad++ (optional but highly recommended).
Software that can extract ISO files, I use WinRAR, you can use whatever (heck even Windows explorer).
A basic understanding of networking, IP addresses and DHCP. You'll need your Gateway IP and be able to understand how DHCP address reservation works.
Also a basic understanding of how your OS and DSM works. I'm not going to cover every fine detail otherwise we'd both be here for hours.

01: Setting up the NAS for booting Linux

We need to start on the NAS.

First we need to create a shared folder to act as our TFTP Root. Open DSM then go to Control Panel > Shared Folders > click Create > click Create again > enter "pxe" for the name and click Next 3 times leaving everything else default.

For permissions just make sure your main Synology user has read/write access since we will need to mount this share to add files to it. Permissions for PXE booting don't really matter here since the TFTP server will handle those for us.

Next you need to make some adjustments to your Router. This is a process I cannot help you with since every router is different but you need to access your routers firmware page, open the DHCP server settings and change the range of reserved values from xxx.xxx.xxx.2 - xxx.xxx.xxx.255 to xxx.xxx.xxx.2 - xxx.xxx.xxx.199. For example my routers Gateway IP is 192.1.68.1.1 so I set its DHCP server to reserve from 192.168.1.2 to 192.168.1.199. I believe this step is not strictly necessary since modern DHCP servers can co exist on the same subnet but I did it on mine anyway.

Now head back to DSM and lets set up DHCP. Open Control Panel > DHCP Server. Click Enable then select the DHCP server in the list and click Edit. Set the Primary DNS field to your routers Gateway IP then click Add, in the Start IP and Finish IP fields you want to add the addresses we unreserved earlier. In my case it was Start IP - 192.168.1.200 and Finish IP - 192.168.1.255 (note yours might not be the same as mine but will be the same as your gateway IP but with the last block of digits changed). Netmask is 255.255.255.0 and Gateway IP is your Gateway IP. Click OK twice.

The last thing to do on DSM (for now at least) is to configure TFTP. Open Control Panel > File Services > TFTP then tick Enable TFTP service. Click browse and point DSM to the "pxe" folder we created earlier and click Apply.

That's it for DSM for now. We cannot actually configure PXE until it has something to boot from.

02: Adding files to boot from

Start by mounting the "pxe" folder we created in part 1 into Explorer. I won't cover how to do that, you should know.

Download Syslinux from the link in prerequisites and extract it to a folder on your Desktop. Open the folder you just extracted and from here you need to copy the following 6 files onto the root of the "pxe" share.

1) bios\com32\elflink\ldlinux.c32
2) bios\com32\libutil\libutil.c32
3) bios\com32\modules\linux.c32
4) bios\memdisk\memdisk (that's not a typo, the file is called memdisk and has no extension)
5) bios\com32\menu\menu.c32
6) bios\core\pxelinux.0

Once those files are copied create a folder called "pxelinux.cfg" (again not a typo, that's a folder with a period in the name) and another folder called "clonezilla".

Now the "pxe" folder should contain those 6 files you copied, a folder called "pxelinux.cfg" and another folder called "clonezilla".

Next go and grab the Clonezilla ISO and extract its contents to a folder on your desktop. Open the folder and again you need to copy some files into your "pxe" share however this time you want to put them in the "clonezilla" folder you created.

1) live\vmlinuz
2) live\initrd.img
3) live\filesystem.squashfs

Now the "pxe\clonezilla" folder should contain the 3 files you copied over.

Open up Notepad++ and paste in the following
Code:
UI menu.c32
MENU TITLE Network Boot
TIMEOUT    50

LABEL CloneZilla
    MENU LABEL CloneZilla
    KERNEL clonezilla/vmlinuz
    APPEND initrd=clonezilla/initrd.img boot=live config noswap nolocales edd=on nomodeset ocs_live_run="ocs-live-general" ocs_live_extra_param="" ocs_live_keymap="" ocs_live_batch="no" ocs_lang="" vga=788 nosplash noprompt fetch=tftp://YOURNASIPHERE/clonezilla/filesystem.squashfs

You then need to edit the part that says "YOURNASIPHERE" to the IP Address of your NAS and then click File > Save As > change Save As Type to All Files > call the file "default" (again not a typo, that's default with no extension) > change the save location to your desktop and click Save. Finally copy the "default" file into the "pxelinux.cfg" folder you created.

Now the "pxelinux.cfg" folder should contain a file called "default".

Excellent, all that's left to do is configure PXE on the NAS to actually serve the boot files.

03: Configuring PXE

Head back into DSM and open Control Panel > DHCP Server > PXE. Tick Enable PXE Boot Server then click select and choose the file called "pxelinux.0". Click Apply and that's it for booting Linux.

04: Testing

Install any of the major VM applications (VMWare, VirtualBox, Hyper V), create a new machine, settings are mostly irrelevant since we only want to do a network boot test, just ensure the VM is set Bridged Networking (or whatever setting is direct connection to the physical network) and the firmware mode is set to BIOS. Fire the machine up and it should boot from PXE. Click "Clonezilla" in the boot menu and it should load up from the network.

05: Booting options and booting other distros

This is where things get complicated and unfortunately I cannot really help you. In the "default" file we created earlier you'll notice we set a huge string of boot options in the following line
Code:
APPEND initrd=clonezilla/initrd.img boot=live config noswap nolocales edd=on nomodeset ocs_live_run="ocs-live-general" ocs_live_extra_param="" ocs_live_keymap="" ocs_live_batch="no" ocs_lang="" vga=788 nosplash noprompt fetch=tftp://YOURNASIPHERE/clonezilla/filesystem.squashfs
These options that will vary depending on which Distro you want to boot and theres so many variations I couldn't possibly list them all. Just know that PXE booting Linux installers is pretty well documented and Google is your friend when it comes to determining these settings.

I should add that its only really possible to boot smaller files over PXE since everything is done in RAM. You couldn't for example directly boot a full Ubuntu Desktop DVD since the filesystem file would be to large however i have booted Ubuntu's Net Installed using this method with not much trouble. There are workarounds for booting full installers but they also fall outside the scope of this guide (plus if I'm honest I haven't looked into them at all yet).

We will cover the method of directly booting an ISO file in the Windows section of this guide.

06: Booting Windows PE over PXE

Before I begin I'd like to say this is the part that by far took me the longest to get working. I spent days trying to get UEFI booting working with Windows but I've since had confirmation that it's only possible using Microsoft's Deployment Services or a custom PXE firmware called IPXE. Unfortunately IPXE comes with its own huge set of issues if you're not flashing it directly to a NIC so I've given up on that, at least for now. There is also a third option called FOG but it's not possible to run a FOG server directly on a Synology NAS so that was a non starter.

Anyway, I digress. First you need to create a WinPE ISO file. As I said earlier I'm not covering that in this guide, there's no need since MS already did that. Just be sure to create an ISO.

See this - WinPE: Create bootable media

After you have created the ISO rename it to "winpe.iso" and copy it over to our "pxe" share in a folder called "windows".

Next open "pxelinux.cfg" and then open "default in Notepad++.

We want to add the following to the bottom of the file making sure to create a blank line between the existing last line and what you're going to paste in. Copy paste the following...

Code:
LABEL      winpe
MENU LABEL Windows PE
KERNEL     /memdisk
INITRD     windows/winpe.iso
APPEND     iso raw

Then save the file. Assuming you did everything correctly that should be it.

You can now fire up your VM, run the network boot test and you should see Windows listed.

Notice how we used the memdisk library to boot an ISO directly, this can be used in other circumstances too but as with doing a direct kernel boot, filesize is very much a limiting factor. Don't be expecting to boot a Windows 10 ISO in this way, its WAAAY to large .

Note that Windows PE doesn't really do anything useful on its own, it can be used to boot a Windows Installation from the network but that's also outside the scope of this guide. Google is again your friend. What I actually use it for is too PXE boot Macrium Reflect so I can restore images to my PC without the need to keep a USB drive handy.

07: Thanks

Thank you for reading my guide and I hope it helps others out in the future.

08: Can you guys help me?

If anybody knows of a way to PXE Boot Windows on a UEFI PC using a Synology please let me know.



  • Like
Reactions: jeyare

Similar resources

PXE boot via Synology NAS Rusty
Tutorial on booting up various OS and startup ISO images using PXE method on your Synology
5.00 star(s) 3 ratings
Updated
Back
Top