Overview
VMware Fusion’s networking configuration is a bit obscure and it is difficult to find information about it on the ‘net. I usually only need to achieve the following bits of config change, and they really only serve my need to tightly control all the things. I am posting this information here so that I never forget again.
Terminology
- host always refers to the Mac running Fusion. To run commands on the host, startup Terminal.app and start typing!
- guest always refers to the operating system running in a virtual machine within Fusion. To run commands on the guest, either log in via the VMware Fusion console or ssh your way into the guest.
NAT networking configuration
Changing the IP subnet for a VMware Fusion network
This is super-simple. Edit the following file:
$ sudo -e /Library/Preferences/VMware\ Fusion/networking
and make the obvious changes. For vmnet8, the NAT network, the config parameter is:
answer VNET_8_HOSTONLY_SUBNET 10.0.1.0
Then restart VMware Fusion networking:
sudo /Applications/VMware\\ Fusion.app/Contents/Library/vmnet-cli --stop sudo /Applications/VMware\\ Fusion.app/Contents/Library/vmnet-cli --start
Using vmnet8 dhcpd to assign static IPs
This is useful if you do not want to mess with the DHCP setup of your virtual machine. So if you copy the virtual machine and boot it up on another host, you will get network access without having to mess around with /etc/network/interfaces. The disadvantage is that you have to do a bit of manual configuration of VMware Fusion, the documentation for which can be a bit obtuse. Note that if you copy the virtual machine the NIC MAC address changes, so you will need to re-discover the MAC address and reconfigure VMware whenever you copy a virtual machine.
1. Find the MAC address of your virtual NIC in the guest machine
ex.
$ ifconfig eth0 eth0 Link encap:Ethernet HWaddr 00:0c:29:b3:31:a0 inet addr:10.0.1.130 Bcast:10.0.1.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:feb3:31a0/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:464 errors:0 dropped:0 overruns:0 frame:0 TX packets:261 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:466580 (466.5 KB) TX bytes:20814 (20.8 KB)
HWaddr is the MAC address for the virtual NIC; in this example, the value is 00:0c:29:b3:31:a0.
2. Edit your vmnet8 dhcpd.conf file
On your Mac host:
$ sudo -e /Library/Preferences/VMware\ Fusion/vmnet8/dhcpd.conf
Most of this file is automatically generated. AFTER this comment:
####### VMNET DHCP Configuration. End of "DO NOT MODIFY SECTION" #######
add the following stanza:
host ubuntu { hardware ethernet 00:0c:29:1b:5a:98; fixed-address 10.0.1.7; }
Note that you can choose whatever name you fancy to follow host. The fixed-address IP address must be in the IP range of the vmnet8 subnet, in this example the IP range is 10.0.1.0/255.255.255.0. The hardware ethernet setting is, predictably, the MAC address of the virtual NIC in the guest operating system.
3. Restart VMware Fusion services
In the host:
sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cli --stop sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cli --start
4. Restart the guest OS
Reboot the guest OS, or restart its networking layer. For example, in ubuntu, either of these will work:
sudo service networking restart
or
sudo reboot
5. Closing thoughts
Do not forget to add a convenience line to your host’s /etc/hosts file, now that you have a nice shiny predictable IP!
Any chance you could update this document for how to accomplish these changes using Fusion Pro version 6.02?
Thanks for the heads-up. If I get a chance I will see what is different with Fusion 6 and update.
Use the following command to modify the default Network Configurations for VMWare Fusion 4.x
sudo nano /Library/Preferences/VMware\ Fusion/networking
Is it any different on 6.0.2 Bryan? I’ve just updated my networking file and it’s fine (admittedly I did a ‘sudo vim …’ rather than -e, but otherwise the same.
Haven’t tried static IPs. Are you having a problem?
For those that are attempting to do this with host only networking, instructions are identical, but you need VNET_1 instead of VNET_8 in the networking file and you must modify vmnet1/dhcpd.conf instead of vmnet8/dhcpd.conf
Thanks for this article. The steps worked perfectly for my needs. However, VMWare Fusion 6 keeps overwriting vmnet8/dhcpd.conf at unpredictable times. The result is a loss of all of the “host” blocks added after the “DO NOT MODIFY SECTION”.
Has anyone found a way to persist these settings? Thanks!
I’ve seen the same issue with VMWare Fusion 6 overwriting vmnet8/dhcpd.conf I don’t have a solution, but wanted to chime in that Jack Gould isn’t the only person seeing this issue.
Just updated to Fusion 7 and it was always overriding vmnet8/dhcpd.conf.
I thought it might be somehow connected to my emacs which uses spaces instead of tabs, removes tailing spaces on the save, etc.
So I decided to edit the file in different editor….
And it stayed the way I have saved it.
Hopefully it will stay the same π
If it is a real reason – vmware does really naive comparison π
Thanks for sharing, the instructions worked without tweeks on VMware Fusion 7.1.0 (2314774).
I just want to mention, this article (https://medium.com/@tuweizhong/how-to-setup-port-forward-at-vmware-fusion-8-for-os-x-742ad6ca1344#.oua4nz2qc) mentions the config files being over-written on upgrades. I have had the same configs since Fusion 5 / 2012 when I wrote this, so I have no idea why some see this behavior and others do not. Very strange, I would take it up on VMware’s forums if it has not already been covered.