Home > Editorial, Virtualization > Running FreeBSD 7.0 on ESX Server

Running FreeBSD 7.0 on ESX Server

I’m building new DNS servers for our corporate DNS due to our recent hardware problems with one of our old servers. We have had good success with publicly exposed BSD servers on the Internet, including OpenBSD and FreeBSD. My experience with FreeBSD is much more recent than with OpenBSD so for the new servers I am going with FreeBSD 7.0. We also have been building almost everything new as virtual machines on ESX server for the last year or so, so the DNS servers will be no exception.

FreeBSD is not officially supported by VMware on ESX server, but it runs on ESX 3.x without problems. My ESX server is configured with ESX 3.02. My first step was to build a template FreeBSD virtual machine. I’m going to use that as the basis for a master DNS server that we hide away and use to make changes on, and some slaves that are public-facing.

The first thing I didwas to get the FreeBSD iso files and put them somewhere where the ESX server can see them. I have an ISO library on my Sun x4500 that can be nfs mounted by my ESX servers, so that’s where I put the FreeBSD iso files (there are 3 iso files for FreeBSD 7.0 RC1).

Next, I set up a new virtual machine with 512 MB of RAM (probably overkill for a dedicated authoritative DNS server in charge of a few zones) and an LSI scsi adapter. For the guest OS, I chose Other/Other (not 64-bit). I pointed the VM’s CD-ROM drive at the FreeBSD disk1 iso file, and booted it. I’m not going to go over the partitioning and installation details of FreeBSD here. The install of FreeBSD is fairly straightforward if you have some UNIX/Linux experience. I chose to install the “Developer” package set, and to install the ports collection. I also added emacs and bash via the packages at the end of the installation because that’s how I roll. During the install it’s a good idea to add another user besides root, and to make them a member of the wheel group, so that they can run su to become root. In FreeBSD you have to be a member of the wheel group in order to be allowed to run su.

Once the install was completed, I rebooted, and logged in as root. To make the FreeBSD system a good virtual citizen on your ESX server, it’s a good idea to install the vmware tools. Unfortunately there is no vmware tools installer for FreeBSD on ESX 3.x. Luckily, the vmware tools for FreeBSD from VMware Server work in ESX Server. To install them on my virtual machine, I downloaded the tgz package for VMware Server 1.04, extracted it, and copied the file vmware-server-distrib/lib/isoimages/freebsd.iso to my ISO library. Then I connected that iso file as the CD-ROM of the virtual machine. Then from inside the VM, I used the ports collection to install the vmware tools. To do that, I logged as root (or become root with su) and then ran the following commands:

cd /usr/ports/emulators/vmware-tools6
make install clean distclean

Once the install completed, I rebooted to startup the vmware tools guest daemon. I logged in after the reboot and ran ps ax | grep vmware to verify that the vmware guest daemon was running, and I saw output like this:

570 ?? Ss 0:03.52 /usr/local/sbin/vmware-guestd --background /var/run/vmware_guestd.pid --h

The final thing to get the FreeBSD VM ready to go is to replace the default ethernet device, which is a lance virtual nic. There are many anecdotes about the lance ethernet driver in FreeBSD dropping packets under load. It’s a good idea to change to either the vmxnet device or the e1000 device instead of lance. The FreeBSD GENERIC kernel (the default kernel) in FreeBSD 7.0 does not have a driver for the vmxnet device, but it does have one for the e1000 device. Either can be used, but if you choose the vmxnet device, you have to build a new kernel (waaay beond the scope of this post).

To replace the default lance virtual nic with the e1000 one, I first shut down and powered off the vm. Then, I accessed my ESX server as root with a shell (via ssh or on the console) and used vi to edit the .vmx file of the FreeBSD virtual machine. I found a bunch of lines beginning with ethernet0 and inserted a line at the top of those lines like this:


Then, I saved the file and started up the virtual machine. When it came up, there was no IP address bound to the ethernet interface in the VM, and I had to login to it using the VMware ESX server Virtual Infrastructure Client console or Virtual Center. I logged in as root to the VM, and edited the /etc/rc.conf file. I found the line that said ipconfig_le0=... and changed it to ipconfig_em0=... and then rebooted. The new virtual nic was then started up with the same settings as the old one had before I replaced it.

That’s it. If you follow this procedure, you will have a VM that is ready to be configured for whatever workload you want to put on it.

Categories: Editorial, Virtualization
  1. George
    2008-01-23 at 16:00

    I was unaware that 7.0 RC2 was out? I had installed RC1 under ESX3 a few weeks ago, and did much the same thing as you did, with good success. It scaled well with four processors. Let me know if you have a spot to dl the rc2 iso1.

  2. 2008-01-23 at 16:54

    Umm, that’s a typo, which I will now fix in the body of the text. Thanks for pointing it out.


  3. f0bar
    2008-03-02 at 08:53

    If you don’t have access or don’t want to mess with the esx-server you could do the follwoing from inside the guest os:
    wget http://download3.vmware.com/software/vmserver/VMware-server-1.0.4-56528.tar.gz
    tar -xf VMware-server-1.0.4-56528.tar.gz
    mdconfig -a -t vnode -f vmware-server-distrib/lib/isoimages/freebsd.iso
    export MOUNT_DEV=”/dev/md0″

    Also i commented out the following in the Makefile, I don’t need X.

    cd /usr/ports/emulators/vmware-tools6; make install clean

    Changing from AMD Lance ethernet card to the other one was not possible for me so I rebuilt the kernel and exchange the if_lnc driver for if_le (lnc is deprecated in FreeBSD 7.0):
    #device lnc # NE2100, NE32-VL Lance Ethernet cards
    # lnc is replaced by le
    device le #

    Don’t forget to modify /etc/rc.conf replacing ifconfig_lnc0=.. with ifconfig_le0=..

  4. RobY
    2008-05-03 at 06:01

    This post saved my life. I’m trying to port a Tru64 box into ESX and FreeBSD seems to be the best alternative. Any tips or hints would be greatly appreciated!!

  5. RobY
    2008-05-03 at 16:27

    unfortunately while trying to run the vmware guest daemon FreeBSD dies with “Bad system call (core dumped)

    Any ideas? Also, what technically happens if I don’t install VMware tools?

  6. RobY
    2008-05-04 at 16:23

    figured it out, bad freebsd install!!

  7. Nikki
    2008-08-08 at 15:19

    I have been playing with FreeBSD-7-STABLE in a ESX server but have really bad disk performace. Anybody else noticed this? If so how did you fix it?

  8. Jim
    2008-09-25 at 12:39

    I have been trying to get FBSD 7 to run on ESX3i, and have had no luck with the 64bit version. It will not even boot. I know the ISO I am using is good as I have checked via MD5sum.

    When it boots, it immediately goes to a screen with a bunch of garbage, lots of colored blocks


    anyhelp would be appreciated.

  9. Brian
    2008-10-16 at 20:22


    Trying to do this part:

    “To replace the default lance virtual nic with the e1000 one, I first shut down and powered off the vm. Then, I accessed my ESX server as root with a shell (via ssh or on the console) and used vi to edit the .vmx file of the FreeBSD virtual machine. ”

    And I can’t seem to ssh into my esxi server.

    How do I actually go about “accessing the esx server as root with a shell” ?


  10. Chris
    2009-04-06 at 19:46

    I just tried to install freebsd 7.1 and the install process was VERY slow… anyone else experienced this? Anyone got any tweaks that may need to be done to speed things up ?



  11. Chris
    2009-04-26 at 00:06

    turns out there was a problem with our SAN at the time of install…

  12. 2009-05-06 at 19:46

    I’ve never bought a dude flowers… but you could be the first. Thanks a ton for posting this.

  13. 2009-05-07 at 09:21

    Jack, your comment made my wife look at me very strangely.

  14. Max
    2009-07-28 at 00:10

    Thanks for posting this. It helped me a lot. As i hate it to install X11 things on my Servers i tried if i could end up without it – and it works: just install emulators/vmware-guestd6 without -tools6. Just in case you don’t want/need X11 and the vmware-tools on a server.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

%d bloggers like this: