Host-only network with fixed IP on Guest OS with VMware Fusion
If you find this, probably via Google, you have a Virtual Machine that you want to run on VMware Fusion 3.1. The VM has a (pre-configured?) fixed IP-address that you cannot change for whatever reason. If you struggle to get a connection to the Guest’s network, keep reading.
Unfortunately, Fusion does not expose a GUI (or even a virtual adapter in the System Preferences App) to edit the host side of the network configurations. It is simply assumed, that, no matter what network profile you select for your VM (shared, host-only etc.), the guest shall obtain its network settings from the host’s (virtual or actual) DHCP service.
There is a document floating around with the title VMWare Fusion Network Settings Part 1, which, in my case, was utterly useless and hopelessly outdated. The referenced vmware-config-net.pl is not part of the current distribution.
Another suggested solution was to create a custom setting in vmnet1/dhcpd.conf but that did not work for me either.
I assume that you have TextMate. If you don’t then you either are one of those vim-junkies or have no business in editing the kind of files mentioned here in the first place. Just replace mate with nano, if need be.
First though, make sure that your virtual machine is powered down (not suspended, really, shut down) and that the OS X VMware Fusion App is not running either.
Open Terminal and navigate to VMware’s Library folder:
$ cd /Library/Application\ Support/VMware\ Fusion/
Now turn off VMware’s networking interfaces:
$ sudo ./boot.sh --stop
Once the interfaces are shut down, we will edit the networking file to add another, custom interface. This way our changes will not affect any other VM that we have running.
$ sudo mate networking
Your networking file should be looking something like this:
You will find two network adapters described here, vmnet1 and vmnet8. We will leave those untouched and add a third interface that will be used by our special guest system with the peculiar settings. At the end of the file, append the following, then save and close:
answer VNET_2_DHCP yes answer VNET_2_HOSTONLY_NETMASK 255.255.255.0 answer VNET_2_HOSTONLY_SUBNET 192.168.182.0 answer VNET_2_VIRTUAL_ADAPTER yes
Note the line VNET_2_HOSTONLY_SUBNET. Replace this value with the IP of your Guest’s fixed IP, but make sure the last segment is 0. If your Guest has the IP 192.168.156.133, then fill in 192.168.156.0.
Back in the Terminal, restart the network:
$ sudo ./boot.sh --start
Now find your Guest’s .vmx file and open it in TextMate as well. Find the section that talks about ethernet0, and append the following:
ethernet0.connectionType = "custom" ethernet0.vnet = "vmnet2" ethernet0.bsdName = "vmnet2" ethernet0.displayName = "Custom Host Only VMnet2"
The first entry, ethernet0.connectionType will most likely be defined already, so you will have to delete the first declaration. Otherwise the VMware Browser will warn you that the Virtual Machine is broken. If this happens, just replace existing lines with those above. Save and close.
Start your virtual machine and you should now be able to ping your Guest system from your Mac’s Terminal.
$ ping 192.168.182.133 PING 192.168.182.133 (192.168.182.133): 56 data bytes 64 bytes from 192.168.182.133: icmp_seq=0 ttl=64 time=0.986 ms 64 bytes from 192.168.182.133: icmp_seq=1 ttl=64 time=0.467 ms 64 bytes from 192.168.182.133: icmp_seq=2 ttl=64 time=0.296 ms
The use of an additional networking interface has the advantage that other VMs are unaffected as they are dependent of vmnet1 or vmnet8.
In case you wish to disable the new interface, you will have to stop VMware’s networking service and change the following line in the networking file from yes to no:
answer VNET_2_VIRTUAL_ADAPTER yes
.

