Wednesday, December 29, 2010

Using FreeNAS 8.0 as a Bridge

I have installed and tested this on FreeNAS 8.0 Beta

My FreeNAS server and one workstation are in the same room and I needed a way to connect them to the LAN to allow for fast file transfers between all computers in my network.

Since I lacked a switch, I needed to convert FreeNAS into a bridging device. It was just a matter of installing a spare NIC into the FreeNAS server and doing the following:

Make my CF card readable (you might skip this step if you installed FreeNAS on a mechanical Hard drive).

mount -t ufs -w /dev/ufs/FreeNASs1a /

Insert a FreeBSD 8.0 disk into your cd-rom drive and copy the files as shown:

mkdir /mnt/cdrom
Mount cdrom: mount -t cd9660 /dev/acd0 /mnt/cdrom/

Copy files across:

cp /mnt/cdrom/boot/kernel/if_bridge.ko /boot/kernel/
cp /mnt/cdrom/boot/kernel/bridgestp.ko /boot/kernel/

ee /boot/loader.conf

Add the following line:


Save and exit

Restart the server with "reboot"

Create the bridge and add interfaces:

ifconfig bridge create
ifconfig bridge addm em0 addm em1
ifconfig em0 up
ifconfig em1 ip

dhclient bridge0 (or ifconfig bridge0 inet 192.168.xx.xx netmask

The name of your interfaces might vary. Check with ifconfig.

Note: You can start the bridge automatically at startup. Refer to the FreeBSD Handbook Chapter 31.5 to see how its done.

P.S. You may do this on FreeNAS 7.x as well. You just need to get FreeBSD 7.x's bridge modules for that kernel. They can obtained from or from a FreeBSD 7.x iso image.

1 comment:

Michael Adams said...

In version 8.1.3, you don't need to add the kernel option for bridging. What you do need to do is remount / as rw, and change the file under /conf/etc : /etc is replaced by that copy every reboot.