Setting Up FreeNAS for a Central File Server: Part 1

Date: Aug 26, 2009 By Eric Geier. Article is provided courtesy of Cisco Press.
Sharing files using Windows is quick and simple at first, but it also has downsides. However, using network attached storage (NAS) drives has many advantages, such as centralized access, a network recycling bin, and multi-OS support. Eric Geier, author of Wi-Fi Hotspots: Setting Up Public Wireless Internet Access shows you how to set up a NAS or network drive for free by using the open source FreeNAS program.

If you regularly share files on your home or office network, you might want to look into network drives, which are called network attached storage (NAS) drives. Instead of sharing folders with Windows and hosting files from PCs, NAS devices connect directly to the network. They are mini-computers, so you can store files on them and access them from all the PCs.

And because they are specialized for network sharing, they support multiple operating systems and can include additional features.

If you have an old computer gathering dust and some free time, you can set up a FreeNAS machine. Pop the open source LiveCD into the computer and you'll have an advanced NAS device.

You can then host the hard drives of the old computer or plug in USB drives to share.

Of course, you can buy the prettier NAS enclosures for $100 or more and then also have to load it with a drive.

However, you can get a similar machine totally free if you use an old PC and an existing drive. This two-part tutorial will help set up and configure FreeNAS.

Now let's get started!

Benefits of Using NAS Devices

I already briefly mentioned a few benefits that NAS devices offer over setting up simple shares in Windows, however here's a full list:

  • Recycle bin support: This in itself can be a life saver and make switching to NAS devices well worth it. If you or other users delete files from Windows shares on other computers, they aren't moved to a recycle bin; they are permanently deleted.
  • This of course could be a huge problem if you later want to recover the file(s). Some NAS devices (such as FreeNAS), however, have a recycle bin feature that safeguards you from this situation.

  • PCs don't have to be on to access shares: Using Windows to share files means that particular computers must be on for others to access its shared files. NAS drives give you a central storage location, so you can always access the files you want, no matter which PCs are powered on.
  • Better and easier control over shares: You'll be able to manage the users and groups, and apply specific rights. Because the NAS drive provides the password authentication, your computers don't have to have matching accounts now.
  • When accessing password-protected shares on a remote Windows PC, you have to type in a user and password for a Windows account that's configured on the remote PC.

    Thus if you wanted to keep each user's credentials secret, you'd have to create an account for each person on every computer, or at least the ones that are sharing files. However, because a NAS drive controls the access, having matching Windows accounts on all the computers isn't necessary.

  • Supports native file sharing protocols of Windows, Linux, and Mac OS X: No more installing matching protocols among your different operating systems; NAS drives typically work with all default operating system protocols.

FreeNAS Protocols and Features

FreeNAS supports all the popular sharing protocols. For Windows PCs, it supports Common Internet File System (CIFS), also known as SMB or samba.

For Mac users, it supports the Apple Filing Protocol (AFP). It also supports Network File System (NFS) for those Unix-style machines. When you set up the disks, you can even enable encryption.

It also offers access via File Transfer Protocol (FTP), which you could even set up for incoming connections from the Internet.

You'd do this by entering a port forward into your router, for the FTP port and the IP address of the FreeNAS machine. FreeNAS also has a web server you could set up for a local intranet or similarly add a port forward to open it up to the Internet.

FreeNAS also does RSYNC for fast incremental file transfers, self-monitoring, and software-based RAID (0,1,5).

Additionally, it supports UPnP, TFTP, SSH, and Unison. It even has an iTunes/DAAP server, so you can share files among your iPods. Plus it has a built-in BitTorrent server.

Building Your FreeNAS Machine

First, you need to find a PC to use. Make sure that it has a network adapter, CD drive, and at least 128Mb of RAM.

You also need some type of drive for the file storage space: hard drive, USB drive, or flash drive. If you are going to use the LiveCD, you also need a floppy drive and a floppy disk to store the configuration.

If you don't have a CD or floppy drive, there are different configuration methods discussed in the FreeNAS Setup and User Guide.

Second, you need to download and burn the FreeNAS disc image to a CD or DVD. You could alternatively download and install the embedded version onto a drive.

Make sure that you plug the FreeNAS machine into the network by hooking an Ethernet cable between its wired network adapter and your router or switch. Then pop in the LiveCD disc, or install the embedded version, and boot the machine.

If you use the LiveCD method, make sure that a floppy disk is in before booting up. FreeNAS will search for and use any existing configuration on the floppy, or start a new one, during the boot.

If prompted about Invalid System Disk, don't pop in the floppy disc until you see the actual FreeNAS program booting.

Because you have to format the drives used for sharing/storage to the UFS filesystem, you might as well install FreeNAS onto a drive, instead of always using the LiveCD.

If you are working with just one drive, you can choose the option that will automatically format and partition the drive for everything: the FreeNAS files and configuration, storage space for data and sharing, and space for swap. To go this route, boot from the LiveCD, type 9 on the main console menu, and hit Enter.

Getting FreeNAS on the Network

Once FreeNAS boots up, you'll see the default IP, 192.128.1.250, displayed along with the Console Setup menu (see Figure 1). It automatically chooses an interface, so it might not be configured to the correct network adapter.

Figure 1 FreeNAS's main console menu

To check that you have the right interface, type 1 and hit Enter. You'll see a list of interfaces, in which ones with active connections are marked with UP.

Therefore, disconnect any other network cables and see which interface is the one hooked to your network. Then scroll to the interface and press Enter to select it.

For the optional interface, you can select the None option. Then on the confirmation dialog, choose Yes and hit Enter.

If your network is set in a subnet different from 192.168.1.x, you'll have to change the default static IP of FreeNAS[md]or simply enable DHCP to get it automatically. It's recommended to have a static, or permanent, IP because it's easier to remember.

To change the IP details, type 2 on the main menu of the FreeNAS Console and hit Enter.

To use DHCP, select Yes, or to set a static IP, select No, and then hit Enter.

When setting it manually, you'll probably want to use the default subnet mask of 24 (meaning 255.255.255.0) and enter your router's IP for the default gateway and DNS server. Because you're likely only using the popular IPv4, you can ignore IPv6.

Stay Tuned

In Part 2 of this series, we'll access the web GUI and perform some initial configuration. Then we'll set up the disks, so we can start sharing with the popular protocols.