You are here: Home Blog VMWare Fusion guests with a static IP

VMWare Fusion guests with a static IP

by Dan Fairs last modified Apr 15, 2009 11:48 AM
The article that I followed to get a static IP for VMWare fusion guests seems to have been removed, so in the name of preserving this knowledge I'm reproducing the salient parts here.

It's not straightforward to assign static IP addresses to guests in VMWare Fusion, and the article from which I took my instructions has been removed, and lives on only in Google caches and the like. Since I don't want to lose this information, I'm reposting the technical content here. Thanks to the original author, Gary Day, for his research.

Gary, if you're reading this and want me to link to your canonical original version under a new URL, please contact me and I'll sort it out.

Gary's original content appears below. Apologies for the slight formatting issues, it's a kupu-n-paste job.


Guest Configuration Information

Open a Finder window and navigate to your Virtual Machines folder, probably /username/Documents/Virtual Machines. Locate the VM package for the guest you want to use for this procedure (Virtual Machines are represented by a single file which is a package containing multiple disk and configuration files).
CTRL-CLICK the Virtual Machine and select “Show Package Contents”, this displays the components of your Virtual Machine. Find Guest.vmx (in my case “UbuntuGnome.vmx”), CTRL-CLICK again and open with your text editor (in my case TextMate, can’t live without it). This action will show the default configuration of “UbuntuGnome”. Search this text file for “ethernet0.generatedAddress” and you fill find the following (similar) information:

ethernet0.generatedAddress = "00:0c:29:8b:a4:4f"

This is your Virtual Machine’s “MAC” or Ethernet Hardware Address.
Copy this information to a text file because I doubt most people can remember such things for more than a second or two.

Accessing VMWare Fusion’s DHCP Settings

VMware Fusion’s DHCP configuration file is located in “Application Support”.
Open a terminal and set a command to open this config file in your text editor of choice.

~ user$ mate "/Library/Application Support/VMware Fusion/vmnet8/dhcpd.conf"

This is what you should see:


# Configuration file for ISC 2.0b6pl1 vmnet-dhcpd operating on vmnet8.
#
# This file was automatically generated by the VMware configuration program.
# If you modify it, it will be backed up the next time you run the
# configuration program.
#
# We set domain-name-servers to make some DHCP clients happy
# (dhclient as configued in SuSE, TurboLinux, etc.).
# We also supply a domain name to make pump (Red Hat 6.x) happy.
#
allow unknown-clients;
default-lease-time 1800; # 30 minutes
max-lease-time 7200; # 2 hours
subnet 172.16.27.0 netmask 255.255.255.0 {
range 172.16.27.128 172.16.27.254;
option broadcast-address 172.16.27.255;
option domain-name-servers 172.16.27.2;
option netbios-name-servers 172.16.27.2;
option domain-name “localdomain”;
option routers 172.16.27.2;
}

Note the subnet range, we need to set a fixed address for our Virtual Machine outside of this range.
We do this like so:
Append the open file (dhcpd.conf) with the following, obviously using your own settings including the Ethernet Hardware Address you previously copied to a text file, the name of Guest.vmx and the IP address you wish to assign to this Virtual Machine.

host UbuntuGnome {
hardware ethernet 00:0c:29:8b:a4:4f;
fixed-address 172.16.27.20;
}

Save this file, you will prompted to enter your administrator password as we have opened dhcpd.conf as a read only file in TextMate.

We now need to restart networking for VMWare Fusion:

sudo "/Library/Application Support/VMware Fusion/boot.sh" --restart

Configuring Hosts In Linux Guest

That’s a confusing title I must admit.
Fire up your Virtual Machine..
NOTE:
I am using this Ubuntu Guest as it was a machine already on my system, the following configuration information will differ slightly between distros and interfaces. For my “Micro-Network” experiments I will be using minimal, command line installations of CentOS 5.02 and I will cover this in later posts.

If you are using the Gnome Desktop navigate to:

System> Administration> Network

Use your superuser password to unlock the network applet and select “Wired Connection (Properties)”.
Disable roaming mode (it’s set this way by default on a new Ubuntu installation) and enter the settings for Configuration (Static IP Address).

IP ADDRESS: (The Address You Set In The VMWare DHCP Settings)
SUBNET: (Usually 255.255.255.0)
GATEWAY: (The Address Of The VMware Fusion Server)*

* “option routers XXX.XX.XX.X” in dhcp.conf

Save these settings and restart networking (or your Virtual Machine).

This procedure can repeated for each Virtual Machine you want to add to your “Virtual Network” by adding a host entry for each guest machine in “/Library/Application Support/VMware Fusion/vmnet8/dhcpd.conf”.

Filed under: , ,
Richard Baxant
Richard Baxant says:
Sep 30, 2010 04:15 PM
Great article! I do have one issue with one of my guest VMs.

host Fedora 11 { <-- PROBLEM
hardware ethernet 00:0c:29:8b:a4:4f;
fixed-address 172.16.130.20;
}

PROBLEM: when issuing the sudo "/Library/Application Support/VMware Fusion/boot.sh" --restart command it does not like the space in the guest VM's name. I have tried single and double quotes but they still cause errors, any suggestions on how to fix?

Thanks,
ricbax
Gabriel Falkenberg
Gabriel Falkenberg says:
Oct 21, 2010 01:13 PM
I've read elsewhere that you should just remove spaces from the host name in the dhcpd.conf file so in your case it should be Fedora11 (without the space).
Filip
Filip says:
Dec 11, 2010 11:43 AM
Hi,
Great article.

My IP address has been changed correctly, but I can't access the internet anymore from my guest machine.

Is there something else I should do here?

Regards,

Filip
Gavin C
Gavin C says:
Dec 30, 2010 08:19 PM
Good info - but it seems that new installs of vmware fusion don't always follow this same 172 subnet range, instead, mine at least, featured a 192.168.14 subnet.

This means that my goal of distributing a vm image to developers that had a *fixed, known IP* are buggered, if I can't rely on the subnet or the gateway of vmnetworking, how can I specify a 'static' NAT IP that will be reachable in all cases?

And I was gonna be extra cheeky and use public dns servers to point browsers to a local ip address as well. Curses!

G
Gareth Foote
Gareth Foote says:
Feb 27, 2011 08:16 PM
Hi there,

I'm hoping this is a simple question to answer.

How do you determine the address of the VMware Fusion server to set as the Gateway within the guest? By this, do you mean the host IP address? I have tried this and it doesn't seem to like it.

Also I haven't installed a GUI for my Ubuntu Guest so am editing /etc/networking/interfaces to set my static IP.

I am setting mine within the 192.168.1.xxx range:
iface eth0 inet static
address 192.168.1.250
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1

Not sure if this is a problem or not?

I would gratefully appreciate your guidance here.

Thanks,
Gareth Foote
gareth.foote@gmail.com
jvh
jvh says:
Oct 14, 2011 02:57 AM
I've got my centos configured with a static ip from these instructions but do not have internet access. I can ping the vmware gateway but nothing outside of it. My router does not restrict by mac address and I have full internet and network access when the ip is assigned from dhcp. Any ideas?
Add comment

You can add a comment by filling out the form below. Plain text formatting.

Stereoplex is sponsored by Fez Consulting Ltd