At Crush + Lovely, we use Railsmachine's Moonshine to automate the configuration of our servers. When writing our deployment recipes, VMWare Fusion's ability to take snapshots and rollback to these snapshots is a huge timesaver because it takes just seconds to roll a server image to it's original state.
When you're just configuring a single server, having a static IP address for your server image isn't too important, but when you're configuring multi-server setups, it can be useful to duplicate a number of server images and give each a static IP address so you can consistently deploy to them. While not documented well at all, it turns out that this is relatively easy to accomplish in four simple steps.
Let's say you have a guest machine with the name ubuntu-lucid-lynx-base
and you keep your guest machine images in ~/Documents/Virtual\ Machines/
. To determine the MAC address for this VM, you can run:
cat ~/Documents/Virtual\ Machines/ubuntu-lucid-lynx-base/ubuntu-lucid-lynx-base.vmx
Get the Ethernet MAC address from ifconfig eth0 inside the guest machine, or from ~/Documents/Virtual Machines/GUESTMACHINENAME/GUESTMACHINENAME.vmx (it’s the line with ethernet0.generatedAddress).
Open /Library/Application\ Support/VMware\ Fusion/vmnet8/dhcpd.conf
. vmnet8
is the virtual interface for NAT networking in VMWare the guest machines. In this file, you'll see a subnet clause that looks something like this:
subnet 172.16.179.0 netmask 255.255.255.0 {
range 172.16.179.128 172.16.179.254;
option broadcast-address 172.16.179.255;
option domain-name-servers 172.16.179.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.179.2;
}
Take note of the line starting with range
. The IP addresses you will assign your guest machines will need to fall outside that range.
3. Update your /etc/hosts
file to assign your guest machine with a static IP address a fancy hostname.
- source: http://crshlv.ly/rjlXdS
- note: These instructions have been tested on Snow Leopard only.
On OS X 10.9.1 (Maverick) + VMware Fusion 6.0.2 I found the dhcp.conf there:
/Library/Preferences/VMware\ Fusion/vmnet8