MacLochlainns Weblog

Michael McLaughlin's Technical Blog

Site Admin

Archive for March, 2010

VMWare Fusion NAT

with 32 comments

This is to correct an earlier omission and provide instructions for configuring static and dynamic IP addresses for Virtual Machines runing on VMWare Fusion on Mac OS X. The benefit of static IP address is important for those installing multiple development and test instances of Oracle Databases in virtual environments.

Back in September 2008, I blogged about how to configure the Oracle Client 10g on Mac OS X. It’s been used a lot but in hindsight it could have been organized more effectively. One thing that I noticed (through somebody bringing it to my attention) is that explaining the VMWare Fusion component by itself would have been more helpful then listing the IP ranges for releases through the date of my post. Hopefully, this corrects that omission.

VMWare NAT Configuration

There are only a few steps that you must do. These are they:

  1. Read the subnet value from the dhcpd.conf file.
  2. Dynamic IP address only require you to set the guest operating system to DHCP.
  3. Static IP addresses require you to set the IP address, subnet, default gateway, and preferred DNS server.
  4. Add assigned IP address and the guest operating system hostname to your Mac OS X /etc/hosts file.

The next sections gives the details of where to find all the things that you may want to experiment with. Remember if you make an error that damages these configuration files, you have to fix it or re-install VMWare Fusion.

VMWare NAT Files and Configurations

You can find the IP ranges for the Network Address Translation (NAT) here in VMWare 3:

/Library/Application Support/VMware Fusion/vmnet8/dhcpd.conf

VMWare 4 changes the location, qualified below.

You can find the IP ranges for the Network Address Translation (NAT) here in VMWare 3:

/Library/Preferences/VMware Fusion/vmnet8/dhcpd.conf

You can open the file for editing like this:

sudo vi "/Library/Application\ Support/VMware\ Fusion/vmnet8/dhcpd.conf"

The file contains the subnet, which I’ve found changes with release. You can configure this file and assign fixed addresses in it. However, you don’t need to install fixed addresses in this file unless you want to reserve addresses in the dynamic range.

The dynamic range is between xxx.xxx.xxx.128 and xxx.xxx.xxx.254. The range of xxx.xxx.xxx.3 to xxx.xxx.xxx.127 is available for static IP addresses. You can set a static IP address inside the native operating system of the VM.

The dhcpd.conf file with it’s instructions, looks like this:

# Configuration file for ISC 2.0 vmnet-dhcpd operating on vmnet8.
#
# This file was automatically generated by the VMware configuration program.
# See Instructions below if you want to modify it.
#
# We set domain-name-servers to make some DHCP clients happy
# (dhclient as configured in SuSE, TurboLinux, etc.).
# We also supply a domain name to make pump (Red Hat 6.x) happy.
#
 
###### VMNET DHCP Configuration. Start of "DO NOT MODIFY SECTION" #####
# Modification Instructions: This section of the configuration file contains
# information generated by the configuration program. Do not modify this
# section.
# You are free to modify everything else. Also, this section must start 
# on a new line 
# This file will get backed up with a different name in the same directory 
# if this section is edited and you try to configure DHCP again.
 
# Written at: 02/18/2010 23:30:54
allow unknown-clients;
default-lease-time 1800;                # default is 30 minutes
max-lease-time 7200;                    # default is 2 hours
 
subnet 172.16.123.0 netmask 255.255.255.0 {
	range 172.16.123.128 172.16.123.254;
	option broadcast-address 172.16.123.255;
	option domain-name-servers 172.16.123.2;
	option domain-name localdomain;
	default-lease-time 1800;                # default is 30 minutes
	max-lease-time 7200;                    # default is 2 hours
	option routers 172.16.123.2;
}
host vmnet8 {
	hardware ethernet 00:50:56:C0:00:08;
	fixed-address 172.16.123.1;
	option domain-name-servers 0.0.0.0;
	option domain-name "";
	option routers 0.0.0.0;
}
####### VMNET DHCP Configuration. End of "DO NOT MODIFY SECTION" #######

Unless you’ve changed the location of your VM repository on your Mac OS X, you can set a fixed-address for the virtual machine. You add the following lines at the bottom of the dhcpd.conf file:

host mclaughlinxp32 {
	hardware ethernet 00:0c:29:55:38:1b;
        fixed-address 172.16.123.21;
}

You pick whichever IP address you’d like to use. You also need to configure the guest opearting system in the VM with that same IP address. You can find the ethernet hardware value in the following file:

~/Documents/Virtual Machines/VMName/VMName.vmx

You can open the file and hunt for it, or simply run this command from the directory where the file exists:

grep ethernet0.generatedAddress *.vmx

As always, I hope this helps some folks.

Written by maclochlainn

March 1st, 2010 at 11:41 pm

Posted in Mac,Mac OS X,VMWare