How to Configure FreeNAS for PXE or use it as a TFTP server to house the ISO images

Status
Not open for further replies.

Draconis

Cadet
Joined
Mar 21, 2012
Messages
8
Hi Everyone,

I'm a FreeNAS and PXE beginner. I was hoping if someone could help me with setting up a PXE server. I know that FreeNAS can become a TFTP server. This is my setup.

FreeNAS Setup:
1. 1 ZFS volume with all 4 disks named /mnt/Storage.
2. 1 ZFS Dataset named /mnt/Storage/tftproot shared through CIFS as TFTP_Root. I set up the CIFS share so it would be easier to copy files/ISOs over to FreeNAS.
3. Enabled TFTP and pointed it to the directory /mnt/Storage/tftproot with Allow New Files checkbox unchecked.

Is there anyway to make FreeNAS also a PXE server? If not, can I use CentOS 5.7 with pxelinux and point to the FreeNAS tftp? Does the image repository (ISOs) have to be local to the PXE server or can they be separated?

Thanks for any help.


Mark
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
Hi Mark,

Someone asked this question here before. I seem to recall that the TFTP server with FreeBSD has some file size limit like 32mb? Anyway, it prevented serving some of the larger files needed for PXE. I used a FOG PXE server in a virtual machine and had it serve files from FreeNAS. The FOG PXE server is quite nice, if you don't know about it it's also on Sourceforge. It's a small Linux image with a nice menu system for serving up PXE images. It would be nice to port/integrate it into FreeNAS.
 

Draconis

Cadet
Joined
Mar 21, 2012
Messages
8
Wow...FOG is awesome. Gotta play with it sometime this week. Great find...thank you!!! It's like PXE on crack. It even has Storage Replication. Crazy stuff for free. But of course FreeNAS has also saved me from buying some wickedly expensive NAS Solution.


Thank you DEV Team for providing such an awesome product!
 

peterh

Patron
Joined
Oct 19, 2011
Messages
315
pxeboot is included ( at /boot/pxeboot )

an example ( dhcpd.conf ) :
# pxeboot alix
host alix {
hardware ethernet 00:0d:b9:14:90:fc;
fixed-address 192.168.99.22;
next-server 192.168.99.5;
filename "pxeboot";
option root-path "/export/freebsd6.3";
}

inetd.conf should contain a line ( from memory) :
tftp dgram udp wait root /usr/libexec/tftpd tftpd -l -s /export/tftpboot

where /export/tftpboot has a copy of pxeboot.

Then pxeboot will be used and "freebsd6.3" will become rootfilesystem for booted system.
( freebsd6.3 is a verbatim copy of the iso image, you will of cource use a current distro)
 

Draconis

Cadet
Joined
Mar 21, 2012
Messages
8
From what I understand, I dont have to configure my dhcp for pxe so I can just leave dhcp unconfigured and not use DHCP on FreeNAS. I will continue to use my existing Adtran Netvanta router/switch/VLAN segmenter as my DHCP server. I am not sure if I have to provide the FreeNAS tftp ip address on my Adtran DHCP options since maybe the inetd.conf will take care of that for me by just specifying the tftpboot folder you noted? If I want another VLAN to have access to my pxe server/tftp, I will configure IP Helpers to do the UDP forwarding.

Are these all correct? But then I notice that in the dhcp config, you specifically list the filename "pxeboot" so the clients dont need to ask but are told to use the pxeboot file under the /boot folder. I would really like to keep my Adtran as my DHCP server since it is easier to configure. Can this be done?
 

peterh

Patron
Joined
Oct 19, 2011
Messages
315
The setup was something i did several years ago.
You need to adjust your dhcpd server in two respects : filename and next server. I'd use isc-dhcpd ( the freebsd )
and disable the adtran one. I cannot see anything more simple to configure then a textfile, but you might
have another opinion.
An alternative for ip helpers is to use vlan functionality in freebsd, where freebsd will become a trunk and
have several interfaces, one on each vlan. ( you never know if a "ip-helper" does what it should)

"pxeboot" resides not in /boot but in the tftp-servers "top directory", i'd advice to use a dedicated
directory for tftp-stuff.
 

peterh

Patron
Joined
Oct 19, 2011
Messages
315
the 32MB limit is solved by an option "blksize". ( rfc2348 )
This option is not recognized by stock freebsd tftpd, but there is a "ported" version in "ports" :
/usr/ports/ftp/tftp-hpa that has this option ( and more)

( it's also whats mentioned in the link mentioned above)
 

Draconis

Cadet
Joined
Mar 21, 2012
Messages
8
You need to adjust your dhcpd server in two respects : filename and next server. I'd use isc-dhcpd ( the freebsd )
and disable the adtran one.
I forgot to note the other reason why I would like to keep using the ADTRAN. This is a test environment and I would like to only keep the FreeNAS when necessary during builds and when testing out my ESX environments. I will just create a temporary pxeboot server in a VM to get a better understanding of pxeboot. I'm also gonna try FOG since it seems too good to ignore.

Draconis, here's a link to the thread I was telling you about with the 32MB limit. It doesn't look like it was ever resolved, the ticket was closed, but that doesn't mean it was fixed.
Thank you protosd because I was actually going to use the FreeNAS to have a consolidated deployment server. I was thinking of doing the Microsoft WDS since it can do both Windows and Linux but I was hesitant since it needed alot of infrastructure available plus the Windows Server CAL. I was actually looking for a possible alternative and it seems that if I can do WinPE that FreeNAS might be able to do it afterall. It's good to hear from peterh that the limitation has been resolved.




Thank you both so much. Awesome help.
 

Draconis

Cadet
Joined
Mar 21, 2012
Messages
8
the 32MB limit is solved by an option "blksize". ( rfc2348 )
This option is not recognized by stock freebsd tftpd, but there is a "ported" version in "ports" :
/usr/ports/ftp/tftp-hpa that has this option ( and more)

( it's also whats mentioned in the link mentioned above)

Hi Peter,

I dont see that directory in 8.0.4. Is there any other way to install tftp-hpa? I am having issues with PXE. I was able to keep DHCP on my ADTRAN router and was able to successfully PXE boot through my images on CentOS 6 but when trying to load large files on FreeNAS 8.0.4 like the Clonezilla LiveCD, I am having issues specifically filesystem.squashfs which is 90MB.
 

Draconis

Cadet
Joined
Mar 21, 2012
Messages
8
After digging around google, I found the command to install ports.

[root@FreeNAS02] /bin# pkg_add -r tftp-hpa
Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-8.2-release/Latest/tftp-hpa.tbz... Done.
bin/tftp: Could not unlink
libexec/in.tftpd: Could not unlink
man/man1/tftp.1.gz: Failed to create dir 'man'Can't create 'man/man1/tftp.1.gz'
man/man8/in.tftpd.8.gz: Failed to create dir 'man'Can't create 'man/man8/in.tftpd.8.gz'
man/man8/tftpd.8.gz: Failed to create dir 'man'Can't create 'man/man8/tftpd.8.gz'
share/doc/tftp-hpa/CHANGES: Failed to create dir 'share/doc'Can't create 'share/doc/tftp-hpa/CHANGES'
share/doc/tftp-hpa/README: Failed to create dir 'share/doc'Can't create 'share/doc/tftp-hpa/README'
share/doc/tftp-hpa/README.security: Failed to create dir 'share/doc'Can't create 'share/doc/tftp-hpa/README.security'
tar: Error exit delayed from previous errors.
pkg_add: leave_playpen: can't chdir back to ''

It looks like it downloads fine from the ftp site. However, I am getting an error after. I think it's because the filesystem is considered as readonly. Is there a way around this so I can install tftp-hpa?
 

Draconis

Cadet
Joined
Mar 21, 2012
Messages
8
I was able to mount / as writable using the command below:

mount -uw /

Then installed tftp-hpa. I then remounted / as read only using the command below:

mount -ur /

However it isnt working as expected. I dont even get my PXE menu anymore. Does anyone have the steps to successfully use tftp-hpa on FreeNAS 8.0.4? I might not even be configuring tftp-hpa properly. All I did was run pkg_add -r tftp-hpa.
 

peterh

Patron
Joined
Oct 19, 2011
Messages
315
You might have to build tftp-hpa on a 64-bit host, i built it from ports on a 32 bit and it did not work:
( ports in freebsd will build from source, pkg_add will install whatever is deposited )
This is a task that freenas developer might be of help.
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
The developers will tell you it's a VERY bad idea to install packages to FreeNAS like this and you're on your own..... You've probably clobbered some of the existing tftp files. There had to be a good reason they didn't install this package with FreeNAS, especially after the tickets/requests, the devs are really good about listening to suggestions like that. My suggestion is *wait* until 8.2 is ready and run it from a Plugin jail.
 

Draconis

Cadet
Joined
Mar 21, 2012
Messages
8
The developers will tell you it's a VERY bad idea to install packages to FreeNAS like this and you're on your own..... You've probably clobbered some of the existing tftp files. There had to be a good reason they didn't install this package with FreeNAS, especially after the tickets/requests, the devs are really good about listening to suggestions like that. My suggestion is *wait* until 8.2 is ready and run it from a Plugin jail.

I have just tried FreeNAS 8.2.0 Beta 2 with no luck. It doesnt appear to be on the Release Notes either so I doubt tftp-hpa will be on there when it becomes final. As you have suggested though, I might use it under the Plugins Jail. By the way, nice youtube vid on it...very straightforward and nice notes.

Thank you both so much. I might also give the build with tftp-hpa a shot since this is a test lab. Gotta love Virtual Machines. So helpful.


Mark
 

peterh

Patron
Joined
Oct 19, 2011
Messages
315
to be constructive :
install a amd64 freebsd system w/ ports. Then build and install tftp-hpa. This gives you a playground
to compile tftp-hpa statically linked ( or dynamically linked using only what already is
present in freenas)
Then move just the tftpd binsray OVER the existing tftpd binary-and you should be in postition to test.
 

kikotte

Explorer
Joined
Oct 1, 2017
Messages
75
I would need help if it's okay if I borrow this thread?
 
Status
Not open for further replies.
Top