Documentation by Dysphunkional
Jails on FreeNAS are how you add extra services like a database or a bittorrent client. They are based on FreeBSD Jails but there some FreeNAS specific features in their plugin jail type to integrate with the FreeNAS web interface. The other jail types work the same as a FreeBSD jail.
Create a Dataset for your Jails
If you are using ZFS for storage create a dataset to hold your jails. FreeNAS will automatically create subdatasets for each jail.
Before you can start creating jails you need to tell FreeNAS where you are going to store them and what IP address range they will be in.
Go to Jails -> Configuration.
For the Jail Root click the Browse button to find the location you want to store your jails.
Enter your the beginning IP address and subnet mask for your network in the IPv4 Network box. If you need help determining what the subnet should be you can use an online subnet calculator.
The IPv4 start and end address should be in a range that will not be given out by your DHCP server. All the jails you create need to have IP addresses in this range.
Click the Save button when you are done.
Creating a Jail
To create a new jail go to Jails -> Add Jails.
Enter a name for your jail and then click the Advanced Mode button.
You can change the IPv4 address of the jail if you like. Don’t use the same address as an existing jail.
Leave the rest of the IP settings empty.
Leave the MAC empty.
You should leave autostart on unless you don’t want the jail to start when the FreeNAS server boots.
See the FreeNAS documentation for the different types of jails you can choose.
VIMAGE should turned off. I’ve tried creating jails with it on but they don’t seem to be able to connect to the network properly.
NAT and 32 bit should be left off.
If you want to use the newer pkgng package manager uncheck the vanilla box.
Click OK to create the jail.
The first time you create a jail it will take a few minutes as FreeNAS downloads the required files and creates the base jail image that all other jails build on.
Jails can’t access files outside of the jail itself unless you tell FreeNAS to give the jail access to something.
To add a storage location log into the jail.
Create a directory in the jail to map the external directory to.
mkdir -p /mnt/shares/Video
Note: It is a good idea to keep all mount locations in the /mnt directory.
Go to Jails -> jailname -> Storage -> Add Storage.
Click the Browse button for the source and pick the location on the FreeNAS server that you want the jail to have access to.
Click the Browse button for the target and pick the directory you created in the jail.
Click the OK button.