Register for the iXsystems Community to get an ad-free experience and exclusive discounts in our eBay Store.

PXE Server

Joined
Oct 25, 2018
Messages
12
Thanks
0
#1
I have read a number of posts on here asking how to set-up a PXE Server on FreeNAS. The posts always seem to get responses saying that PXE Server is not a FreeNAS issue and I understand that. I know that I need to configure my DHCP server to point to a dataset on FreeNAS. I haven't yet figured out how to do that using a Ubiquiti Edgemax router as I understand that it has to be done via the command line and I can't find a command line reference guide for the Edgemax. I know I would be better off with a pfSense box but I already have the Edgemax.

But my question relates to the files that I then need to place on the FreeNAS dataset. I already have all my ISO files on a FreeNAS dataset, but I understand that I need to put some PXE configuration files there too. What I can't find out is what those files are. If I understand it, I have to create some sort of boot menu and I have to have some "syslinux" files. What are these files and where do I get them from?

I have also read replies that say people don't need to do this at all, but I have a very old machine that will not boot any other way since the CD rom that went with the machine died and it will not boot from USB. Yes it is that old but I quite like it!

Even though I haven't configured DHCP to point to the dataset on the FreeNAS box, when I tried booting a virtual machine over the network it said it couldb't find the configuration files. But it indicated that it was looking at an AMD box and the only AMD box I have is the FreeNAS box. So, it seems as if DHCP is somehow already pointing at the correct location or something very strange is happening.

I'm sure this is very basic to most people but every time I search Google I get loads of hits of people trying to do it, but I find no actual answers. Any help much appreciated.
 

Fredda

FreeNAS Experienced
Joined
Jul 9, 2019
Messages
114
Thanks
22
#2
Yes, you're right. This is not really a FreeNAS issue, but to point you in the right direction:

The easiest way is probably to do this probably with a jail. syslinux is available as a bsd package.
Install dnsmasq and syslinux in a jail. There are several tutorials for that online, just google
for "pxe boot dnsmasq".

If you do this to just ressurect an old computer, it might also be an option to simply replace the
defect CD ROM? A new drive is about 10-15€....
 
Joined
Oct 25, 2018
Messages
12
Thanks
0
#3
Thank you. I had hoped I didn't need to install anything in a jail so maybe I'll find another way of doing it that doesn't involve FreeNAS. I'm relatively new to FreeNAS and I don't feel confident enough to play with jails yet.

One question though. I see there is a file in FreeNAS called pxeboot. Is that so that FreeNAS can boot from a PXE server or is that to support booting of clients from FreeNAS?

Replacing the CD ROM is not an option. The machine was in two parts, a thin and light top part and a separate "dock" part that fitted under it like a docking station. It was a nice design until the docking part failed. That is why I like the machine as the light part still had things like network ports that you don't get on most light machines these days.
 

Fredda

FreeNAS Experienced
Joined
Jul 9, 2019
Messages
114
Thanks
22
#4
Thank you. I had hoped I didn't need to install anything in a jail so maybe I'll find another way of doing it that doesn't involve FreeNAS. I'm relatively new to FreeNAS and I don't feel confident enough to play with jails yet..
As you asked for syslinux, you intend to install Linux? In that case the easiest option might be to take out the
harddisc of your computer, plug it into another computer which is able to boot from USB or CDROM, install linux
and plug it back to your old computer.
 
Joined
Oct 25, 2018
Messages
12
Thanks
0
#5
My question about syslinux was actually because I couldn't work out whether I could just copy some syslinux files to FreeNAS to get a pxe server running. I didn't know if I needed a full syslinux installation or just some boot/configuration files.

I've never built a linux machine by installing the files on a hard drive installed in a caddie on another machine. I've created bootable USB sticks but never done it for a hard disk. How do you make it bootable? When I do it for USB I use Rufus. Will this work on a hard disk too?
 

Fredda

FreeNAS Experienced
Joined
Jul 9, 2019
Messages
114
Thanks
22
#6
My question about syslinux was actually because I couldn't work out whether I could just copy some syslinux files to FreeNAS to get a pxe server running. I didn't know if I needed a full syslinux installation or just some boot/configuration files.
You need pxelinux, which is the part of syslinux for pxe booting. Check out the syslinux homepage, there are good examples how to do it.
I've never built a linux machine by installing the files on a hard drive installed in a caddie on another machine. I've created bootable USB sticks but never done it for a hard disk. How do you make it bootable? When I do it for USB I use Rufus. Will this work on a hard disk too?
You still haven't explained, what you try achieve. Take the HD out of your problem computer, plug it into another computer. Install linux on it
plug it back and you'll have a running linux.
 
Joined
Oct 25, 2018
Messages
12
Thanks
0
#7
You need pxelinux, which is the part of syslinux for pxe booting. Check out the syslinux homepage, there are good examples how to do it.
I already read that before I posted and couldn't work out what to do.
 

Fredda

FreeNAS Experienced
Joined
Jul 9, 2019
Messages
114
Thanks
22
#8
I already read that before I posted and couldn't work out what to do.
As you still have not written, what you are trying to achieve, it is hard to help.
For several different use cases you'll find detailed step by step tutorials all over the web.
 

jgreco

Resident Grinch
Moderator
Joined
May 29, 2011
Messages
11,799
Thanks
3,053
#9
As you asked for syslinux, you intend to install Linux? In that case the easiest option might be to take out the
harddisc of your computer, plug it into another computer which is able to boot from USB or CDROM, install linux
and plug it back to your old computer.
No, syslinux is a package that would be needed to build a PXE boot server supporting pxelinux. You would install syslinux on FreeBSD (or just snag the necessary files out of a syslinux package).

If you're unsure what a discussion is about, which is how I interpret your response, it might be better to avoid answering with a confusing and unhelpful post.

A better answer is this:

I build PXE servers on FreeBSD (not FreeNAS) all the time. I generally use pxelinux with good success, it depends on what the target being booted is. Much stuff works fine with modern pxelinux. Some stuff like ESXi doesn't work with the modern pxelinux and needs older pxelinux. The *BSD's generally don't work well as a pxelinux target and probably need some other toolchain, which is also something I've done.

The fileservice side of PXE booting is something I'd expect FreeNAS to be completely capable of. Basic PXE setups generally involve TFTP, certainly as an initial bootstrap, and can also be used for the remainder of files served as well.

Here's the deal.

You need a DHCP server somewhere that you can configure to hand out boot information. For ISC DHCP, you need to be able to provide the nextboot server and path, as follows:

Code:
subnet 10.91.62.0 netmask 255.255.255.0 {
        option routers 10.91.62.5;
        option domain-name-servers rns1.sol.net, rns2.sol.net, rns3.sol.net, rns4.sol.net;
        range dynamic-bootp 10.91.62.50 10.91.62.99;
        default-lease-time 86400;
        option subnet-mask 255.255.255.0;
        next-server 10.91.62.47;
        filename "/bench/gpxelinux.0";
}


So this configures DHCP on 10.91.62.0/24 to assign addresses in the range .50-.99, and to tell the PXE clients that the fileserver is at 10.91.62.47, and that the pathname to be requested should be "/bench/gpxelinux.0". In our case this is what's used on the shop bench to serve up some basic diagnostic tools via PXE. You do not need the subdirectory if you are not supporting multiple PXE environments.

The DHCP stuff is the only part of this that I think FreeNAS probably can't handle out of the box. Your typical consumer home "router" probably won't handle this either. You need a real DHCP server. This is how PXE works. It broadcasts for DHCP and then interprets options in the DHCP response to get itself pointed to a fileserver and path.

The rest of this is literally just files being served by a fileserver. gpxelinux.0 is a variant on pxelinux. You need to set up pxelinux in the TFTP directory specified and test using a TFTP client that when you connect to (in my example) 10.91.62.47 and ask for /bench/gpxelinux.0 that you receive the file. If that doesn't work with a generic TFTP client, it also won't work for PXE.

Our TFTP /bench/ directory looks like

Code:
total 1012
drwxr-xr-x  11 root  wheel    1024 Sep  5 08:33 .
drwxr-xr-x   4 root  wheel     512 Oct 29  2018 ..
drwxr-xr-x   3 root  wheel     512 Nov  7  2018 biosutil
drwxr-xr-x   3 root  wheel     512 Nov  7  2018 burnutils
-rwxrwxr-x   1 1026  1026    24560 Oct  6  2014 chain.c32
drwxr-xr-x   5 root  wheel     512 Nov  7  2018 diskutil
drwxr-xr-x   2 root  wheel     512 Sep  5 08:29 firmutil
-rw-rw-r--   1 1026  1026   111334 Oct  6  2014 gpxelinux.0
-rwxrwxr-x   1 1026  1026   173108 Oct  6  2014 hdt.c32
-rwxrwxr-x   1 1026  1026   122308 Oct  6  2014 ldlinux.c32
-rwxrwxr-x   1 1026  1026   186500 Oct  6  2014 libcom32.c32
-rwxrwxr-x   1 1026  1026    66524 Oct  6  2014 libgpl.c32
-rwxrwxr-x   1 1026  1026    24132 Oct  6  2014 libmenu.c32
-rwxrwxr-x   1 1026  1026    24148 Oct  6  2014 libutil.c32
-rwxrwxr-x   1 1026  1026     4660 Oct  6  2014 linux.c32
drwxr-xr-x   5 root  wheel     512 Nov  7  2018 linuxinst
-rw-rw-r--   1 1026  1026    91550 Oct  6  2014 lpxelinux.0
-rw-rw-r--   1 1026  1026    26140 Oct  6  2014 memdisk
-rwxrwxr-x   1 1026  1026    26596 Oct  6  2014 menu.c32
drwxr-xr-x   2 root  wheel     512 Nov  7  2018 pxelinux.cfg
-rwxrwxr-x   1 1026  1026     1376 Oct  6  2014 reboot.c32
drwxr-xr-x   5 root  wheel     512 Nov  7  2018 sysrescue
drwxr-xr-x   3 root  wheel     512 Sep  5 08:32 sysutils
-rwxrwxr-x   1 1026  1026    27104 Oct  6  2014 vesamenu.c32
-rwxr-xr-x   1 root  wheel   51392 Sep  5 08:32 wimboot
drwxr-xr-x   3 root  wheel     512 Nov  7  2018 wininst


where most of the 2014-dated files are files from the pxelinux download tarball. No need to use "packages", no need to do any complicated install, these simply need to be in the fileserver in the correct directory. Our pxelinux.cfg/default includes menus and submenus for a bunch of tools to do stuff like BIOS flashing, burn-in, disk utils, card firmware updates, etc. There is nothing that actually "runs" on the fileserver other than the TFTP server daemon. You need to get the TFTP bit working 100% but FreeNAS should be able to do that just fine and dandy.

The rest of this is really pxelinux garbage and is out-of-scope for this forum, so don't expect a lot of help building a PXE environment here on these forums, but to give you some more of a push in the right direction, here's an example of what the stuff within a PXE environment might look like. This particular stuff is the stuff out of diskutil/ because that covered several different things including a .ISO, a USB image, and an vmlinuz/initrd setup. This is a small snippet of the pxelinux.cfg/default file covering the "Disk Utilities" submenu

Code:
MENU BEGIN
 MENU TITLE Disk Utilities

LABEL reboot
 MENU LABEL Reboot System
 KERNEL reboot.c32

LABEL dbanz
 MENU LABEL DBAN Auto Zero - Erase Disks
 MENU PASSWD avadakedavra
 MENU PASSPROMPT Enter 'avadakedavra' to erase disk(s)
 KERNEL diskutil/dban.bzi
 APPEND nuke="dwipe --autonuke --method zero" silent vga=785

LABEL dbanq
 MENU LABEL DBAN Auto Quick - Erase Disks
 MENU PASSWD avadakedavra
 MENU PASSPROMPT Enter 'avadakedavra' to erase disk(s)
 KERNEL diskutil/dban.bzi
 APPEND nuke="dwipe --autonuke --method quick" silent vga=785

LABEL dbanp
 MENU LABEL DBAN Auto Paranoid - Erase Disks
 MENU PASSWD avadakedavra
 MENU PASSPROMPT Enter 'avadakedavra' to erase disk(s)
 KERNEL diskutil/dban.bzi
 APPEND nuke="dwipe --autonuke --method prng --rounds 8 --verify all" silent vga=785

LABEL dban
 MENU LABEL DBAN Manual Mode
 KERNEL diskutil/dban.bzi
 APPEND nuke="dwipe" silent vga=785

LABEL clonezilla
 MENU LABEL Clonezilla
 KERNEL diskutil/clonezilla/vmlinuz
 APPEND initrd=diskutil/clonezilla/initrd.img boot=live username=user union=overlay config components quiet noswap edd=on nomodeset nodmraid locales= keyboard-layouts= ocs_live_run="ocs-live-general" ocs_live_extra_param="" ocs_live_batch=no net.ifnames=0 nosplash noprompt fetch=http://10.64.62.47/bench/diskutil/clonezilla/filesystem.squashfs

LABEL hdclone
 MENU LABEL HDClone (Free Edition)
 KERNEL memdisk
 APPEND initrd=diskutil/hdclone/hdclone.iso iso raw

LABEL atapwd
 MENU LABEL ATA Password Tool
 KERNEL memdisk
 APPEND initrd=diskutil/fdubcd/fdubcd.img.gz floppy raw c=7 h=255 s=63 ubcdcmd=atapwd

LABEL wdidle3
 MENU LABEL Western Digital WDIDLE3
 KERNEL memdisk
 APPEND initrd=diskutil/fdubcd/fdubcd.img.gz floppy raw c=7 h=255 s=63 ubcdcmd=wdidle3

MENU END


The directory diskutil/ looks like

Code:
diskutil:
-r--r--r--  1 root  wheel  16318688 Jun  4  2015 dban.bzi

diskutil/clonezilla:
total 227432
drwxr-xr-x  2 root  wheel        512 Nov  7  2018 .
drwxr-xr-x  5 root  wheel        512 Nov  7  2018 ..
-r--r--r--  1 root  wheel  207446016 Aug 16  2018 filesystem.squashfs
-r--r--r--  1 root  wheel   21208264 Aug 16  2018 initrd.img
-r--r--r--  1 root  wheel    4016352 Aug 16  2018 vmlinuz

diskutil/fdubcd:
total 18216
drwxr-xr-x  2 root  wheel       512 Nov  7  2018 .
drwxr-xr-x  5 root  wheel       512 Nov  7  2018 ..
-r--r--r--  1 root  wheel  18589633 Nov  3  2018 fdubcd.img.gz

diskutil/hdclone:
total 27048
drwxr-xr-x  2 root  wheel       512 Nov  7  2018 .
drwxr-xr-x  5 root  wheel       512 Nov  7  2018 ..
-r--r--r--  1 root  wheel  27656192 Mar 18  2018 hdclone.iso



So you can see a variety of examples of how arguments can be passed into things like DBAN, or how I am exceedingly lazy and borrowed someone else's prepackaged tools (FBUBCD) to handle ATA Password and WDIDLE3.
 

jgreco

Resident Grinch
Moderator
Joined
May 29, 2011
Messages
11,799
Thanks
3,053
#10
Sorry, on re-reading my post I realize it's a little disjointed because I kept restructuring it to provide "a little more info" here and there, so there is less of a coherent train of thought than I'd prefer. I promise I'm not actually on drugs. Except caffeine. I am on *lots* of caffeine. ;-)
 

jgreco

Resident Grinch
Moderator
Joined
May 29, 2011
Messages
11,799
Thanks
3,053
#11
I already read that before I posted and couldn't work out what to do.
Yeah, don't feel bad. The normal UNIX style of thought about how things install and how they work can be jarring when it comes to setting stuff up on a fileserver. It's so obvious in hindsight that you'll hopefully be going "D'oh!" but it is totally opaque when you are at the start line, since most "how-to" documents just say "install x y and z" and aren't really explaining how the things work or where they go. I know lots of Really Smart People who have been a bit befuddled about how to get started.

Anyone remember when netbooting required you to burn an EPROM and install it on your WD8013?

How about 1980's netbooting of workstations?

It helps to have a history doing this. So, again, don't feel bad.
 

Fredda

FreeNAS Experienced
Joined
Jul 9, 2019
Messages
114
Thanks
22
#12
If you're unsure what a discussion is about, which is how I interpret your response, it might be better to avoid answering with a confusing and unhelpful post.
No, I've built some pxe boot servers for different stuff (Installation of OS or booting linux rescue systems).
I got the impression the OP was not sure what he was doing 'I think I need some "syslinux"' files' so I
tried to figure out what he wanted to do and point to easier alternatives.

Installing a pxe boot server is not a very easy thing. And to do this for just an installation of an old computer
with a broken CD ROM and no USB boot capability is pure overkill (IMHO)
 
Last edited:

jgreco

Resident Grinch
Moderator
Joined
May 29, 2011
Messages
11,799
Thanks
3,053
#13
One question though. I see there is a file in FreeNAS called pxeboot. Is that so that FreeNAS can boot from a PXE server or is that to support booting of clients from FreeNAS?
Neither. It's a holdover from the default FreeBSD distribution used to build FreeNAS. FreeBSD can be pxebooted using this file on your TFTP server and a root path specification, plus lots of tweaks and some hacks. FreeNAS does not support being pxebooted though. It'd be a lot of work to strain all the superfluous unnecessary fluff out of FreeNAS though, so the file is just included but unused.
 

jgreco

Resident Grinch
Moderator
Joined
May 29, 2011
Messages
11,799
Thanks
3,053
#14
No, I've built some pxe boot servers for different stuff (Installation of OS or booting linux rescue systems).
I got the impression the OP was not sure what he was doing 'I think I need some "syslinux"' files' so I
tried to figure out what he wanted to do and point to alternatives.
Having built numerous PXE environments, the question in #1 seemed straightforward enough, and an obvious stumbling block to someone unfamiliar with actually building this from scratch. Since the question involved figuring out how and where to install syslinux for a PXE environment, an answer of "just install linux directly to your HDD" in #4 seemed out of scope, and seemed to be inducing confusion as the discussion evolved in #5-#6, so I felt your answer was confusing and derailing the topic. Even the answer in #2 that discussed installing a jail and packages was unnecessarily complicated to the question being asked in #1.

The questions as I saw them were:

I know that I need to configure my DHCP server to point to a dataset on FreeNAS.
Not exactly a question but I provided a working example off a production DHCP server anyways.

But my question relates to the files that I then need to place on the FreeNAS dataset. I already have all my ISO files on a FreeNAS dataset, but I understand that I need to put some PXE configuration files there too. What I can't find out is what those files are. If I understand it, I have to create some sort of boot menu and I have to have some "syslinux" files. What are these files and where do I get them from?
So I said to get them from the pxelinux download tarball and gave an example of what it looked like on a production fileserver.

Certainly there are numerous "alternative solutions" such as "remove the hard drive and install elsewhere" or "just buy a new computer" but none of these involve FreeNAS and aren't really in scope on the forum. The issue of "how to set up PXE" has the virtue of at least being a related topic to FreeNAS as it involves serving files.
 

Fredda

FreeNAS Experienced
Joined
Jul 9, 2019
Messages
114
Thanks
22
#15
Even the answer in #2 that discussed installing a jail and packages was unnecessarily complicated to the question being asked in #1.
Yes, sorry, the issue with the jail was misleading. I did not see that FreeNAS directly includes a TFTP-Server, which still was missing from his described setup. So I was pointing to dnsmasq, as it is an ideal starting point for a PXE bootserver being able to serve DHCP and TFPT.
Certainly there are numerous "alternative solutions" such as "remove the hard drive and install elsewhere" or "just buy a new computer" but none of these involve FreeNAS and aren't really in scope on the forum. The issue of "how to set up PXE" has the virtue of at least being a related topic to FreeNAS as it involves serving files.
I think I focused too much on this part:
but I have a very old machine that will not boot any other way since the CD rom that went with the machine died and it will not boot from USB. Yes it is that old but I quite like it!
I agree that "buy a new CD ROM" or "directly install the HD in another PC and put it back" is off topic, but I think if the FreeNAS related solution is a not so easy solution it should be OK to point out alternatives, which do not involve FreeNAS.
 
Top