Host Only Networking Setup With VMWare Fusion 4

 

I have used VMWare Workstation and Fusion for many years now on Linux, Windows and Mac OS X host operating systems. I have used the “host only” networking on Windows and Linux host operating systems, but never on OS X with VMWare Fusion until recently when I had the need to test some new firewall software setups.

On VMWare Workstation or Server, it is pretty easy to set network addresses for the virtual networks and hosts, but turns-out it is kind of a pain with VMWare Fusion (the Mac app.) For whatever reason, they didn’t include the configs in VM configuration GUI. This makes the whole setup more of a pain than it should be. I suppose they didn’t add this level of configuration because of the way the VMWare Tools may or may not integrate with the guest OS or something in OS X. Also, maybe Mac users just don’t really request the need to have this in a nice GUI due to lack of overall interest. Whatever the case, there are some great reasons to have it operational.

In testing the recently released IPCop 2, I needed to play around with settings and see how the configurations I use in production would and could work on the new build. VirtualBox, VMware and Parallels are great applications for these sorts of development testing situations. I have always had a preference for VMWare because of their commitment to have the vm images be able to move back and forth between host operating system applications versions of VMWare. It has come in handy many times when I have moved from Windows to Linux or back as I have changed my main operating system.

By default, a VMware Fusion guest OS will initial be setup with an initial network interface. You can set in the VMWare settings whether you want it to act as a NAT or Bridged. That is all standard, in the VMWare Fusion application host config settings. In my case, I need the VMWare guest to have at least two network adapters so I can test different network nodes as I try to mimic servers with multiple physical network cards running the Linux-based firewall. So, in my case, I added an additional network adapter in the guest settings interface.

VMWare Fusion 4 Guest OS Settings

At each of the network adapters, you can set the use setting. In my situation, I  wanted the first network adapter to be used to provide access to the real network my MacBook Pro is using to access the real network (wired or ethernet) on the machine.

It will want to make the first network adapter use NAT by default so nothing crazy here except, I did flip the “Advanced options” and generated a MAC address and kept generating addresses until I got an “A” in the final segment so when I am testing and looking and packets coming and going from device addresses, I can know that the host with the “A” is this first network adapter. You don’t need to do this, but if you can insert some sort of label to help troubleshoot or tag traffic/addresses/information in this sort of setup is useful to me. My VM is titled “ipcop2” but it could have been titled “Linux” or something else.

VMWare Fusion 4 Network Adapter 1 Settings

The second network adapter is when I dip into virtual / host only world. I create it and designate it as a private network only available to the host mac I am running VMware Fusion 4 on, then keep generating a MAC address until I get one that has a “B” in the final segment to continue the configuration pattern of tagging the network interfaces.

VMWare Fusion 4 Network Adapter 2 Settings

I also had to go into the guest OS and assign the virtual network interface to the correct address that matched the one I will put in the VMware config for the host only. Because it was IPCop 2, it looks like this. But, your setup will differ if you are running something else and want a fixed ip across the configs.

Assigning Virtual Host Only MAC To IPCop Green
Assigning the NAT MAC To IPCop RED
Assigning the fixed IP to the virtual network host only adapter in the guest OS (IPCop)

Then I went in a edited the networking file where VMWare maps the IP addresses to the virtual network interfaces. In VMWare Fusion 4, they moved it to /Library/Preferences/VMWare Fusion from the previous location under Application support. I gave my private network adapter a fixed IP in the reserved space since I will also be assigning the address to one of the settings in the guest host as a fixed address. You can hit this via an OS X terminal.

$ sudo vi /Library/Preferences/VMware\ Fusion/networking

and modify to assign the interface a IP. My example is changing it from the default setting or DHCP and setting it as 10.111.1.1

editing /Library/Preferences/VMWare Fusion/networking

Anytime you modify this config, you need to restart the the VMWare Fusion application to get it to use the new settings. I would also restart and confirm the settings in the guest host on network addresses on any testing or modifications. After all settings and restarts of guest OS (if they were in a suspended state) and the VMWare Fusion app, make sure the ping the address. You can also arp -a the network from the OS X terminal to see if you get a bite. You should see the MAC address you generated and the IP you set in the networking config.

arp -a in OS X terminal confirms vm network address

This process will at least get you a basic host only networking between the host and guest OS in a contained way. It is my hope that VMWare makes this easier in later updates of VMWare Fusion 4 and regardless of what host OS you are running (Windows, Linux, Ubuntu, etc.) At the time of this post, we were at VMWare Fusion 4.0.2.

6 Replies to “Host Only Networking Setup With VMWare Fusion 4”

  1. Hi
    I googled to this article when I was finding a way to make my Mac to use the the network of my vmware virtual machine.

    As I have to connect to the internet by a program on Win7, I have to use a vitual machine to do this job. I use a bridged ethernet network adapter on win7 to connect to the internet, but my OS X could not connect to the internet. It’s terrible and ridiculous for a Mac user who can only hug the internet by a virtual machine.

    I would be very appreciate if you could help me to share the win7 network to my Mac.

    With regards.
    Daniel

    1. The extra configs I covered in this post were more for creating dummy or internal (on the vmware host to vmware instance) type of connections. You probably want VMware just to be another address on the same network as your Mac (host computer you are running vmware on.) So, make sure you do have the network adapter in vmware for your win7 machine to “bridged” so it gets it’s own routable/networkable address from your network DHCP server or whatever. But, also make sure in Windows 7 network control panel you don’t have the connection be a “public” network. You probably want it to be a “private” type so Windows 7 will open-up on the network and you can connect/share between your two “computers” across the vmware structure.

      Hope that helps,

      Jonathan

  2. I’m trying to do something similar. I’d like to run Smoothwall in a VMWare Fusion VM to test both the caching proxy and the content filtering. I’ve configured two network cards to set up a Green and Red network. I’ve got the Red interface configured to share my host’s internet connection and the Green interface set to a private network (because the documentation suggests that this is how your host can communicate with the virtual machine). And that’s about as far as I’ve gotten…

    My biggest obstacle has been trying to figure out how to route my Mac’s traffic through the VM while allowing the VM to use my Mac’s Airport connection to connect to the Internet.

    I’m also at a loss about what IP addresses I should be assigning to each interface. I’ve done this installation on an actual machine with two network cards before and configuring the IPs was a snap, but in VMWare, it seems that you have inward facing and outward facing IPs, and they seem to be on different networks.

    Could you go into a little more detail on how you set up IPCop (what IP addresses you used on each interface and how you would configure a MacBook Pro so that all traffic goes through the VM)? If you could at least give me some pointers, I’d be happy to write up the whole How To (assuming I can actually get it to work) and would even publish the VM (assuming I have the legal right to do so).

    Thanks a lot for this post. It at least got me thinking in the right direction.

    Ted

    1. I haven’t managed to configure my machine as desired but I suspect it’s just not possible (without digging into iptables and other innards of OS X) since the Mac needs to have its network connection (IP address, gateway) configured properly in order for the virtual machine to use it, even though the virtual machine can have its own IP address.

      What I’ve done instead is to configure a second virtual machine and use that for testing. So, the smoothwall has two network interfaces: Red is bridged and on the same subnet as the Mac. Green is on a private network with an address of 172.16.1.1 and DHCP enabled. The second VM is a Lubuntu installation with the network interface configured as a private network as well. Since both VMs are on the private network, the second one sees the DHCP server and gets it’s appropriate IP address.

      Where this is failing is that the second machine is unable to reach the outside world (but I am able to reach the smoothwall admin interface on the first VM). I’ve double-checked all the settings on the smoothwall machine and can’t see what I’m doing wrong.

      Ted

Leave a comment or reply