I was excited to see that Synology have recently integrated a PXE solution in their latest version of Diskstation Manager – DSM 4.2 beta. This makes their NAS devices even more ideal in a home virtualisation lab as they are both cheap to buy and to run (the DS212 unit that I own consumes less than 20W in use), but also easy to configure and they offer a wide range of storage and network services such as CIFS / AFP / NFS / iSCSI, LDAP, PXE, TFTP, VPN, DNS.
They also offer more powerful Enterprise versions of their NAS devices, which run the same operating system but with much faster hardware. I’ve yet to test them in a production environment, but given my experience in the lab, I am sure they would be a competitive solution.
In this post I will show you how to set up a PXE boot server that will let you perform a network installation of Centos 6.3 using your Synology NAS.
What is PXE?
PXE (pronounced pixie) stands for Preboot eXecution Environment. It’s a technology that can be used to boot a computer into an operating system from it’s network card without needing anything to be installed on the computer’s local storage devices in advance. Most modern servers come with PXE support as standard.
It’s incredibly useful if you wish to automate the deployment of many servers without having to attend each one with an installation CD / DVD / USB stick. With a little work, you can also configure custom kickstart files to be served to each server, to save having to enter all the installation options manually.
How to set up your Synology NAS as a PXE boot server
Step 1 – Install DSM 4.2
Upgrade your Synology device to DSM 4.2 beta if you haven’t already. Follow the download links for your region, download the appropriate firmware that for your model of device, then upload it in the DSM admin panel – control panel – DSM update screen.
Step 2 – Set up the DHCP Service on your NAS
I would recommend you set up the DHCP server on your Synology first and test it works. If you are running this on your main LAN, you will need to disable the DHCP server on your router so they don’t conflict. You can download the DHCP server package in Package Center.
You will need to configure the relevant primary and secondary DNS, start and end IP addresses, netmask and gateway settings.
Once you are happy this is working, you can move on to configure the TFTP and PXE servers.
Step 3 – Set up the TFTP and PXE Services.
Tick the Enable TFTP service box. You also need to specify a folder somewhere on your NAS that can be used as the TFTP root folder.
Tick the Enable PXE service box. In the boot loader box type ‘pxelinux.0’. Fill out the remaining fields using the same settings you used for DHCP in step 2. This will override the DHCP service settings.
This will set up a DHCP service which sets DHCP 67 (boot filename) in it’s DHCP offers to be PXELINUX.0. If the server making the DHCP request is performing a PXE boot, it will attempt to retrieve and load this file via TFTP from the DHCP server IP address. It is possible to tell the server to use a different server for TFTP using DHCP option 66 – but this is not necessary in our case because the Synology NAS is performing both functions.
Step 4 – Upload the PXELINUX scripts and PXE menu to your tftp folder.
In order to get PXE boot working, we now need to upload the PXELINUX.0 and a few associated files from the SYSLINUX project to the TFTP share. I’m sure you could use other boot loaders, but I have never tried any, so I’m going to stick to what I know!
According to the Centos wiki, the minimum required files to perform a PXE network installation of Centos 6.3 are:
- pxelinux.0
- menu.c32
- memdisk
- mboot.c32
- chain.c32
- pxelinux.cfg/default
- path/to/your_kernel_of_choice
- path/to/your_init_ramdisk_of_choice
You could download these yourself and edit pxelinux.cfg/default as necessary, but this is out of the scope of this blog, so to speed things up I have created a Github repository with all the files necessary for a Centos 6.3 install.
Simply download this repository as a ZIP file and copy the files inside your tftp folder.
This perfoms a network install using a kickstart I’ve created which will set up Centos 6.3 with a few KVM packages for use as a hypervisor. NB: The default password is changeme1122
Step 5 – Attempt to PXE boot a server.
All you need now is a server. Ensure the server is connected to the LAN with your Synology NAS on it, then power on the server and instruct it to perform a network boot. It should make a DHCP request to the NAS, and then perform a PXE boot using the files that we copied to the TFTP server.
If you want to load a different operating system, you need to copy across the relevant kernels / initial ramdisks for the distribution of your choice and then edit the PXE menu in pxelinux.cfg/default. You may also wish to either remove the kickstart parameter, or refer to a different kickstart of your own creation.
What can I do if I don’t have a server running? I did something similar with my Windows 7 box and it PXE fine using Ghostcast.
I have both a Synology and Qnap and be great to setup standalone PXE boot.
Hello Paul, thank you for this tuto.
I am searching to implement your solution for Microsoft Windows with WinPE.
Do you have any idea how to implement ?
Thanks for reply
ds212 with dsm 4.2-3208, dont work pxe… hopeful yet
Nice thanks this was missing in Synology documentation.
Simple, direct, “working”.
Moreover, i had issue having 2 DHCP ranges (don’t know why)
Found root cause within WireShark detect boot file name not given on DHCP offer.
CentOS 6.3 Password is nice but login?
Best,
hi
thanks for this article very interessant. i am searching to realize a diskless pc with windows 7.have you tried it?
which files have to be added?
i have another question
if i use my router as dhcp server and reply the same ip and mac adress in dhcp server in synology… are there conflicts?
thanks
AWESOME!! Just got this working with my Synology and wow impressive well done sir!! You saved me a ton of $$ and time thanks so much for putting that repository together!!
Jon
Sounds good. Very detailed information. Trying to install it tonight.
Hi Paul,
Thanx for this good tutorial.. i will try as soon as possible!!
@lla4u The password I specified is for the root user.
@mario Yes, I think there will be conflicts if you use 2 DHCP servers on the same LAN. You should consider turning off the main DHCP server on your router, and just using the Synology. You don’t have to use the Synology as the DHCP server, but if you don’t you need to find a DHCP server that supports DHCP options 66 (next-server) and 67 (boot-filename).
Thinks a lot.
It works on ds411j
I will try installing windows.
You ever try nclone? I can’t seem to get either method working – yours or nclone.
I have a DS112j on latest FW.
When you write instructions please explain everything so that people that need the information who aren’t as tech savvy as you can use them. After all they’re the people that will need help in the fist place. I’m frustrated because your info is the only bit out there and now I’m fustraded.
I’ve tried to give a good amount of detail, but I’m also assuming anyone who wants to set up a PXE server has a reasonable level of technical knowledge. If you tell me which bit your stuck on, I’ll try to help.
You’re welcome 🙂
Guess what, it’s tottaly my fault. I went into my router in dispare and noticed that when I setup port forwarding for TFTP that the router had the NetBIOS name and not the address of the TFTP server. I deleted the entery and found a way to enter it in manually. Attention to detail saved the day. Sorry.
Actually I have an update. It turns out it was the router that Verizon provided with FIOS. currently they don’t complete the installation with an ethernet cable from the fiber optic box, and connect it with coax. This locks you into the horrible actiontec router – which might I add has a port in the 4000 range forwarding to every device on your network, that you can’t remove. I found a tutorial on line that shows how to convert the Actiontec router into a bridge. Once I did that an put my awesome Netgear N router in it’s place I had ZERO issues.
Hello! Awesome tool. Have this setup with my synology NAS. Trying to add a windows 7 meny item and install source but don’t seem to get it to work. Could you post a short tutorial on how to add other OS inställs as menu items in the boot loader?
First PXE tutorial I found that actually was worth reading and allowed me to get it working on my synology NAS (DSM 5.1). Kudos!!! I’ve got you bookmarked in case you do post more information on synology or PXE.
Thanks your kind words 🙂 I’m glad you have found it useful! I think the Synology NAS is a great little box for small home or office labs, where you want to auto deploy servers via PXE.
Hi,
Followed the tutorial and it worked out great, except for the last part. When I want to boot a VM, it gets the DHCP IP address and it just sits there without doing anything else, no errors, no information. Could you possibly update this tutorial to match the current release version of DSM?
Hello Paul,
This tutor rocks. I have been searching for as PXE solution for nearly eight hours, when I found your blog and implemented it everything was solved.
I have Synology NAS DS414j and DSM 6.1. I have DHCP and TFTP in this NAS. My server is Fujitsu with ESXi and VM there on.
I have already installed Ubuntu – it finished well.
But when I tried CentOS 7 the installation process hanged. I have noticed the following error messages:
1. curl (22): The requested URL returned error: 404 Not found
Warning: Downloading ‘http://centos.serverspace.co.uk/centos/7/os/x86_64/images/product.img’ failed!
followed by Anaconda message
2. new value non-existant xfs filesystem is not valid as a default fs type
and finally
3. Pane is dead.
I believe, the inability to download from repository is the root problem.
I have tried with other repository mirror and got the same error. I have browsed to repository and saw that requested file is really not there.
Should
http://centos.serverspace.co.uk/centos/7/os/x86_64
be something different?
Does this works for you?
Thanks.
Update:
Just let anyone know – it works now. Here is what I did:
1. I changed
http://centos.serverspace.co.uk/centos/7/os/x86_64
to
http://centos.serverspace.co.uk/centos/7.3.1611/os/x86_64
7.3.1611 is curnetly the latest version.
2. Downloaded CentOS 7.3.1611 Minimal
3. Replaced files in tftpRootDirecory\images\centos\7.0\x86_64\ with files from CentOS-7-x86_64-Minimal-1611.iso file from \images\pxeboot\
4. Restarted server machine which need new CentOS.
followed your instructions to the letter and copied the files across
but getting a tftp: prefix
unable to locate config file
i can see from the synology logs it pulled the pxelinux.0
from the server
but then does not go any further
Hi Paul, have you a solution for UEFI Boot?