Oct 27, 2011

Static IPs in VMware Fusion

I have had to look this shit up four times now. It’s a shame this isn’t a configurable thing in the Fusion UI. Reproduced in case source goes away:

Log into your VM, and type ifconfig -a | grep HWaddr | awk ‘{print $5}. That will spit out a string that looks something like “00:0c:29:f8:9d:61”. This string is your VM’s MAC address that uniquely identifies this VM when it requests an IP address. Write it down; you’ll need it shortly.

Back on your mac, open up VMWare’s DHCP server config. It sits in /Library/Application Support/VMware Fusion/vmnet8/dhcpd.conf, and is a simple text file that you can edit with something like TextMate or VIM.

mate /Library/Application\ Support/VMware\ Fusion/vmnet8/dhcpd.conf Add a block for each of your VMs in the form:

host [HOSTNAME] { hardware ethernet [MAC ADDRESS]; fixed-address [STATIC IP OF YOUR CHOICE]; option host-name [HOSTNAME];

} The address you choose needs to be in the same subnet as the previously assigned DHCP addresses. Mine, for example, was, so I can pick any address in 192.168.65.*. It’s best to pick a number between 3 and 127, as VMWare has reserved that range for static IPs.

Reboot VMWare’s DHCP server so that it picks up the new assignments you’ve made:

sudo /Library/Application\ Support/VMware\ Fusion/\boot.sh —restart Grab new addresses on your VMs. The simplest way to do this is simply to reboot the machines. If you’re not into rebooting, you can either bring the ethernet interface down and back up again (on linux) with:

sudo ifdown eth0 && sudo ifup eth0 Windows has a similar set of commands:

ipconfig /release ipconfig /renew Make sure you’re not trying to perform this switch if you’re SSHed into the machine. I suspect turning off the network would have some adverse effects on your connection… :)