Category: Setup your SAN using FreeNAS

How to setup your own cloud SAN storage at home using FreeNAS and a VM

How to setup your own Cloud SAN storage at home using FREENAS and a VM

So, I am writing this blog post for others who want to understand how SAN and NAS storage systems work. I had a colleague of mine suggest that I should setup my own NAS at home.  I decided that it was a great idea. This tutorial will teach you how to setup a NAS using virtual machines for the purposes of testing and learning.

It will help you understand the fundamentals of what is involved in setting up a NAS and how they work. There are commercial applications such as NETAPP that provide far more complexity in terms of functionality, however the principles are pretty much the same, and relatively easy to pick up on variations should you need to learn them on the fly in a job.

  • So one of the key benefits of setting up a NAS in VM is it allows you setup a sort of home based storage cloud solution
  • You may add multiple USB storage devices where you will be able to create volumes of various file systems types, essentially giving you the cloud type solution.
  • This will also allow various devices you have to mount the storage volumes
  • At the moment VirtualBox allows up to 2 terabytes ,  I’m sure this will increase as future revisions come to pass.

Phase 1

Create a new virtualbox VM for freeNAS

  1. Download  freeNAS FreeNAS-8.3.0-RELEASE-x86.iso
  1. Create a new VM in virtual box with the following configurations



  1. Ensure that you have over 10GB of HDspace and at least 512mb ram for you VM (otherwise your volume creations will fail)





  1. Network Configuration
    i.      Nic 1 (NAT)
    ii.      Nic 2 (Bridged Adapter, use wireless if its supported)



  1. On the settings tab you should enable USB Controller, you will need to install an additional packages for Virtualbox to enable this feature as it doesn’t come out of the box. The advantage of this is will allow you add multiple USB devices and use them as storage. Download and install the Oracle VM VirtualBox Extension Pack that matches your version of VirtualBox. The extension pack enables USB support.
  2. Next you want to click on the Storage tab under the IDE controller there should be a EMPTY and a icon of a CD, on the far right of that you should see Attributes “CD/DVD Drive” and the very far right of that a CD, click on that and find the FreeNAS iso you downloaded, click okay
  1. Now click the okay and go back to start the VM


Phase 2 Configuring FreeNAS

  1. Once freeNAS is installed you will get a configuration screen.  The primary interface you should leave alone, as this most like dhcp’d already.
  • You should be be able to ping externally from the freeNAS VM, if you need to look at your network configuration.
  • Typically the primary interface will use a  non-routable address which is being NAT’d externally
  1. So if your home network is like most people you’re probably using a dhcp pool in addresses. So you want to configure the second nic with within your home network pool (eg. address and a netmask.
    1.  You will not need to set a default gateway, since the primary interface is already using a gateway
    2. Once you have done this go to the command prompt on your host machine, so this is no longer in the VM, its on the physical machine that runs Virtualbox and see if you can ping the address you just assigned in FreeNAS. If you can’t ping the FreeNAS Ip you assigned try restarting the VM.
    3. Next you will want to ensure that your router of firewall allows port 80 on the ip address you assigned to freeNAS.


Phase 3 setting up ISCSI SAN with freeNAS

Note- any client Machine you want to connect to the iscsi SAN/NAS must have a iscsi controller, so if you are using a VM ensure that you have added the iscsi controller under the settings of your vm.

  1. So go to your browser and go to the webGUI


  1. Open a browser and login to FreeNAS 8.2.
  2. Navigate to Storage > Active Volumes:
  3.  Click Volume Manager.
  4. Enter a Volume Name, select disk(s), select Filesystem type (ZFS has some neat features), then click Add Volume:
  5. Click the Create ZFS Volume button:
  6. Enter a ZFS Volume Name, specify the volume size, then click Add ZFS Volume:
  7. Navigate to Services > Core, and turn on iSCSI:
  8. Click the wrench icon next to iSCSI.
  9. Navigate to iSCSI > Portals, click Add Portal. Select as the IP Address (this means it will listen on all IPs). Click OK:
  10.  Navigate to iSCSI > Initiators, click Add Initiator. Leave ALL in both fields to allow all client connections from any network:
  11. Navigate to iSCSI > Authorized Access, click Add iSCSI Authorized Access. Enter a User andSecret:

Note: If you dont want create a user for your home SAN, just because it makes life easier, then skip the user Access stuff and under the Target Global Configuration just select 

Discovery Auth method :Auto

Discovery Auth Group : None

  1. Navigate to iSCSI > Target, click Add Target. Enter a Target Name and Alias. Select thePortal and InitiatorGroup IDs, and Authentication Group number:
  2. Navigate to iSCSI > Device Extents, click Add Extent. Enter an Extent Name and select aVolume:
  3. Navigate to iSCSI > Associated Targets, click Add Extent to Target. Select a Target andExtent to map together:
  4. Navigate to iSCSI > Target Global Configuration. Customise your Base Name, select CHAPfor Discovery Auth Method and select your Discovery Auth Group. Leave other settings unless you know what you’re doing. Scroll to bottom of page to Save:
  5. All done. Now you need to connect to the iSCSI SAN using an iSCSI Initiator.
  6. If you get any connection problems, try restarting the iSCSI service here:
  7. If you don’t trust the GUI and want to confirm the service has definitely started, you can runservice -e at the shell prompt, and look for istgt:

Cheers Hope this helped you understand how it all works email if you have questions