PXE boot via Synology NAS

Tutorial PXE boot via Synology NAS

This tutorial will cover detail instructions on how to configure and setup your NAS to be a PXE boot server for your LAN. Keep in mind that this is a tutorial that I wrote back 5y now, but it still applies. We will see how to setup Syno as your PXE server as well as different methods of booting various OS from it (multiple Windows OS as well as Linux versions).

A. PXELINUX/SYSLINUX boot loader

In this example I have used Syslinux 4:06 (not most recent version but version 6.0 + has a problem, so I decided that this older version works just fine) for all MS installations (including WinXP <-> Win 10).

Syslinux download URL: Index of /pub/linux/utils/boot/syslinux/

After downloading and decompressing, it is necessary to do the following:

01. Create a TFTP/PXE folder on your NAS (exp PXE folder)​

02. Assign rights for a user who will execute the net use command with authorization (later in the process)​
03. Within the root of the new folder copy the following files from Syslinux installation: memdisk, menu.c32, pxelinux.0
04. Also within the PXE root folder, you should create another folder called pxelinux.cfg (yes a folder that has a name pxelinux.cfg)​
05. Within pxelinux.cfg folder you should create a file named 'default' (without extensions and apostrophe). So ultimately all together it should look like this:​
Code:
PXE
|--pxelinux.cfg
     |-- default
|-- memdisk
|-- menu.c32
|-- pxelinux.0

Now we need to make a modification of the 'default' file in pxelinux.cfg folder.

Open the file and put the following lines in:

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

LABEL Windows x86
MENU LABEL WinPE x86
KERNEL memdisk
append iso raw initrd=winpe_x86.iso

Now save the file.

Ofc this is a sample of my file that I use and now I will explain the structure.

The first four lines are something that is defined by default, and as it is evident menu.c32 file located in the root folder of PXE is called.

Next, the 'MENU TITLE' is the title of the PXE menu that appears after a successful network boot. Here, of course, you can put absolutely anything.

The following 4 lines define an item in the PXE menu. In this example, I chose WinPE x64 as my title (MENU LABEL) because I'm going to use a specific ISO file to launch the installation support for x64-bit OS. The kernel file that is located in the root of the PXE folder is memdisk. The last parameter is the actual name of the file you want to boot. As it can be seen in one line I call winpe_x64 while in the second x86 ISO.

WinPE - these are Preinstallation Environment ISO files that were built using a Win7 machine with Windows AIK - http://www.microsoft.com/en-us/download ... px?id=5753

NOTE
AIK is free. However, to create a WinPE ISO you will need a) Win (7) machine b) Win OS installation files. For this reason, I will not explain how to make a WinPE disc (there are many YT clips as well as Technet documentation), nor will I publicly publish ISO images. If anyone has a problem or question feel free to PM me on this matter.
ISO files that are used in this example are in the root folder of PXE. PXE folder situation now looks like this:

Code:
PXE
|--pxelinux.cfg
     |-- default
|-- memdisk
|-- menu.c32
|-- pxelinux.0
|-- winpe_x64.iso
|-- winpe_x86.iso

One note. PXE is the case SENSITIVE Therefore it is essential that whatever you write in the default file you write it correctly. If for example, the ISO file contains uppercase and lowercase letters, write literally.

B. CREATING PXE/TFTP environment

As you know a working DHCP service needs to be running in your network. For this, I have let Syno NAS sort that part considering I have a locked ISP router that doesn't allow me to make any modifications and point any network clients towards PXE server on the NAS.

I have decided to allow Syno to create a small pool of DHCP address within my current DHCP range that I know it's not being used, so there is no fear of conflict.

Within the DSM Control Panel it is necessary to open the category File Service and within it switch to TFTP/PXE tab.

Here you should activate the TFTP checkbox and select the TFTP root folder (PXE folder in this example). Changes in Advanced Settings are not necessary.

After that activate the checkbox in the PXE category and fill out all required fields:

Boot loader: pxelinux.0 (use the browse button to locate pxelinux.0 file in tftp root)

Network interface: probably there will be offered only one option and that is the name of Synology LAN interfaces (leave default values or change as needed)

DNS server: IP address of your router (or a dedicated DNS server - be sure to open ports if you use a dedicated one! Port 67 (DHCP) Port 69 (TFTP) Port 4011 (PXE) )

Start IP: starting IP address for the DHCP pool

End IP: end IP address for the DHCP pool

Netmask: depending on your IP class. exp: 255.255.255.0

Gateway: IP address of your GW

Press ‘Apply’ and that's it (for now). Everything is ready for PXE network boot. Now set your computer to boot from network interface and PXE menu should appear.

After the menu reads the state of 'default' file you will have a chance to boot of the corresponding ISO.

NOTE
To be able to do the installation over the network you must have a folder with installation files for the appropriate OS. Syno NAS offers the option to mount the ISO file (so you don't have to copy it to a separate folder) and I use that option for every OS I wanna PXE boot (later in the process this folder will be accessible via the net use command)

C. USE WINPE ENVIRONMENT FOR NETWORK INSTALLATION

C.a (WIN XP)


As I stated in the beginning, Win XP network installation, unlike Win Vista -> Win 10 requires a little more attention. As is well-known XP installation passes through two stages (non-GUI and GUI), and is necessary to accomplish the following steps to make it work and load.

01. After it finishes booting, WinPE environment will welcome with a command prompt showing as X: drive

02. Since XP will not see the available drive at this point it is necessary to use diskpart command to create partitions, assigning drive letter and format the drive.

Code:
x:\ diskpart [enter]
Code:
diskpart: list disk [enter]
(list of physical drives, it is necessary to note the drive number that we will use)
Code:
diskpart: select disk n [enter]
(n is the drive number that will be used if there is only one drive the number will be 0)
Code:
diskpart: create partition primary [enter]
Code:
diskpart: assign letter=C [enter]
Code:
diskpart: list partition [enter]
(note the partition number that you will use)
Code:
diskpart: select partition n [enter]
(number of partition is probably 1)
Code:
diskpart: active [enter]
Code:
diskpart: exit [enter]
You should now be back on the X: drive and have prepared the disk and partition as letter C:. It is necessary to perform the formatting:
Code:
x:\format c: [enter]
(this is a full NTFS format)

NEXT STEP IS VERY IMPORTANT

Code:
x:\ bootsect.exe /nt52 C: /force /mrb [enter]
XP uses NTLDR and with /nt52 switch we apply it on your C partition)
Code:
x:\ net use z: \\IP_ADR_SYNO_NAS\WINXP folder /user:username [enter]

(we are mapping our installation source folder (where all the installation files are located) to a network letter (z) and using /user switch in order to authenticate. Enter the password as well. Once again I remind you that the installation ISO should be mounted as a virtual drive (Virtual mount option inside DSM) so its content should now be visible via the mapped network drive.

Code:
x:\ z:\<winxp folder>\i386\winnt32.exe /syspart:C: /tempdrive:C: /makelocalsource [enter]
NOTE
(it is very important that there are NO SPACES while typing syspart and tempdrive commands and the drive letter. Also: after the drive letter is needed!)

After this step, you enter XP installation which will only copy the files to the drive. Upon completion of copying, Win XP GUI will close and return to the WinPE command prompt.
Code:
x:\exit [enter]

(we are done with our work in winpe and with exit command we intiate a reboot)

We now need to adjust the HDD/SSD as the primary boot device in BIOS and continue installing XP.

C.b (Win Vista -> Win10)

With 'modern' MS OS it is not required to do any preinstallation work (diskpart) but only start from the second stage (use the net use command). Of course when you map a network drive for let's say Win 7 or Win 10 just start setup.exe and follow further instructions.

Next set of steps is for booting linux (Ubuntu) installations.

01. In this case, this archive is to be unpacked and as a result, will be the accompanying ubuntu-installer folder.​
02. The folder from the previous step is copied to the root PXE folder (with all the remaining contents from the previous scenarios). The structure will now look like this:​
Code:
PXE

|--pxelinux.cfg (this is a folder)
     |-- default
|--ubuntu-installer (this is a folder)
|-- memdisk
|-- menu.c32
|-- pxelinux.0
|-- winpe_x64.iso
|-- winpe_x86.iso

03. Now you need to modify (in this case add the parameters) that will define the boot option within the PXE menu. Within the pxelinux.cfg folder there is a default file that specifies the following:​
Code:
LABEL Ubuntu Internet install
MENU LABEL Ubuntu Internet install
KERNEL ubuntu-installer/amd64/boot-screens/vesamenu.c32
APPEND ubuntu-installer/amd64/boot-screens/menu.cfg

So for the KERNEL paremtar we enter the path to the vesamenu.c32 file that is inside the specified structure. Additionally, the APPEND command lists the path to the menu.cfg menu.

04. Now, with all the previous options, just start the bootup, and select the item 'Ubuntu Internet Install' that will load the netboot and instantly allow download of the installation (or selection of distributions) as well as all the necessary configurations.​
Ubuntu DVD boot

For this scenario, I prepared a DVD Ubuntu 14.04 LTS version (ubuntu-14.04-desktop-amd64.iso) that I mounted using the Synology mount option

NOTE
it is not necessary, the entire install can also be copied to an additional folder within the PXE folder, but it must be ensured that .disk folder is also copied.

01. Once you have mounted the DVD/ISO the structure of the PXE folder looks like this:​

Code:
PXE

|--pxelinux.cfg (this is a folder)
     |-- default
|--ubuntu-installer (this is a folder)
|--ubuntu14dvd (this is a folder or Synology mount point)
|-- memdisk
|-- menu.c32
|-- pxelinux.0
|-- winpe_x64.iso
|-- winpe_x86.iso

02. Now we also need to configure NFS access so that the Ubunutu installer can retrieve boot files.​
NFS configuration

a) In the Control panel> File Service> Win / Mac / NFS (1 tab) there is an option to activate the NFS service:

114


b) Now it is necessary to configure NFS rights over the PXE folder. Control panel> Shared Folder> PXE (or how is the name of the folder in which the whole PXE is hosted) and then select the 'Edit' command. After that, the fourth tab is NFS Permissions. Here you need to create a client entry that will allow the computer (or more) certain rights over the NFS to the PXE folder.

115


Hostname or IP: one IP address or IP address range should be entered; IP addresses that PXE clients receive when contacting the PXE server over DHCP roles by Synology.

Privilege: Read-only (no need for write permissions)

Squash: no mapping (root privileges client)

Security: sys (other options are for Kerberos authentication)

DISABLE Enable asynchronous

NOTE
The option 'Allow users to access mounted subfolders' should be turned on if the mount option is used by Synology, as opposed to the copied installation within the PXE folder.

NOTE
If Permission denied form is encountered on the boot when the NFS mount command (explained later) appears, as a possible reason, it will be necessary to modify the NFS permissions within the etc/exports file.

Using SSH, log on to the NAS via root account and on the /etc/exports path modify the export file. Its original form will be similar to this:

Code:
/volume1/PXE 192.168.1.0/24(ro,sync,no_wdelay,crossmnt,no_root_squash,insecure_locks,sec=sys,anonuid=1025,anongid=100)

and should look like this:

Code:
/volume1/PXE 192.168.1.0/24(ro,sync,no_wdelay,crossmnt,no_root_squash,insecure,sec=sys,anonuid=1025,anongid=100)

So insecure_locks need only be written as insecure.

03. As with netboot, it is still necessary to set a parameter within the default file to display a menu item inside the PXE boot, and start the boot process:​
Code:
LABEL Ubuntu DVD install
MENU LABEL Ubuntu DVD install
kernel ubuntu14dvd/casper/vmlinuz.efi
append boot=casper netboot=nfs nfsroot=IP_ADDRESS_OF_YOUR_NAS:/volume1/PXE/ubuntu14dvd initrd=ubuntu14dvd/casper/initrd.lz

Therefore, the KERNEL parameter is also referred to the vmlinuz.efi file located inside the casper folder in the root of the DVD installation. The APPEND command has several parameters:

nfsroot (it is important to note that after the IP address of the NAS path must begin with the name / volume # / ... depending on the volume on which the PXE folder is located)

initrd (must point to initrd.lz or initrd.gz file, depending on the version of the installation)

If everything is configured as it should, the PXE boot should run and the installation via NFS.

Thats it!



Latest reviews

very good tutorial
Upvote 0

Similar resources

0.00 star(s) 0 ratings
Updated
NAS Remote Access for Newbies: Part 3 - Accessing Mobile Apps via Reverse Proxy NAS Newbie
A discussion of mobile app access via reverse proxy from a newbie perspective
0.00 star(s) 0 ratings
Updated
An easier method to obtain the results of your Memory Test without using Linux and PuTTY.......
0.00 star(s) 0 ratings
Updated
Back
Top