VMWare Fusion NAT
This is to correct an earlier omission and provide instructions for configuring static and dynamic IP addresses for Virtual Machines runing on VMWare Fusion on Mac OS X. The benefit of static IP address is important for those installing multiple development and test instances of Oracle Databases in virtual environments.
Back in September 2008, I blogged about how to configure the Oracle Client 10g on Mac OS X. It’s been used a lot but in hindsight it could have been organized more effectively. One thing that I noticed (through somebody bringing it to my attention) is that explaining the VMWare Fusion component by itself would have been more helpful then listing the IP ranges for releases through the date of my post. Hopefully, this corrects that omission.
VMWare NAT Configuration
There are only a few steps that you must do. These are they:
- Read the subnet value from the
dhcpd.conffile. - Dynamic IP address only require you to set the guest operating system to DHCP.
- Static IP addresses require you to set the IP address, subnet, default gateway, and preferred DNS server.
- Add assigned IP address and the guest operating system
hostnameto your Mac OS X/etc/hostsfile.
The next sections gives the details of where to find all the things that you may want to experiment with. Remember if you make an error that damages these configuration files, you have to fix it or re-install VMWare Fusion.
VMWare NAT Files and Configurations
You can find the IP ranges for the Network Address Translation (NAT) here:
/Library/Application Support/VMware Fusion/vmnet8/dhcpd.conf
You can open the file for editing like this:
sudo vi "/Library/Application Support/VMware Fusion/vmnet8/dhcpd.conf"
The file contains the subnet, which I’ve found changes with release. You can configure this file and assign fixed addresses in it. However, you don’t need to install fixed addresses in this file unless you want to reserve addresses in the dynamic range.
The dynamic range is between xxx.xxx.xxx.128 and xxx.xxx.xxx.254. The range of xxx.xxx.xxx.3 to xxx.xxx.xxx.127 is available for static IP addresses. You can set a static IP address inside the native operating system of the VM.
The dhcpd.conf file with it’s instructions, looks like this:
# Configuration file for ISC 2.0 vmnet-dhcpd operating on vmnet8. # # This file was automatically generated by the VMware configuration program. # See Instructions below if you want to modify it. # # We set domain-name-servers to make some DHCP clients happy # (dhclient as configured in SuSE, TurboLinux, etc.). # We also supply a domain name to make pump (Red Hat 6.x) happy. # ###### VMNET DHCP Configuration. Start of "DO NOT MODIFY SECTION" ##### # Modification Instructions: This section of the configuration file contains # information generated by the configuration program. Do not modify this # section. # You are free to modify everything else. Also, this section must start # on a new line # This file will get backed up with a different name in the same directory # if this section is edited and you try to configure DHCP again. # Written at: 02/18/2010 23:30:54 allow unknown-clients; default-lease-time 1800; # default is 30 minutes max-lease-time 7200; # default is 2 hours subnet 172.16.123.0 netmask 255.255.255.0 { range 172.16.123.128 172.16.123.254; option broadcast-address 172.16.123.255; option domain-name-servers 172.16.123.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.123.2; } host vmnet8 { hardware ethernet 00:50:56:C0:00:08; fixed-address 172.16.123.1; option domain-name-servers 0.0.0.0; option domain-name ""; option routers 0.0.0.0; } ####### VMNET DHCP Configuration. End of "DO NOT MODIFY SECTION" #######
Unless you’ve changed the location of your VM repository on your Mac OS X, you can set a fixed-address for the virtual machine. You add the following lines at the bottom of the dhcpd.conf file:
host mclaughlinxp32 { hardware ethernet 00:0c:29:55:38:1b; fixed-address 172.16.123.21; }
You pick whichever IP address you’d like to use. You also need to configure the guest opearting system in the VM with that same IP address. You can find the ethernet hardware value in the following file:
~/Documents/Virtual Machines/VMName/VMName.vmx
You can open the file and hunt for it, or simply run this command from the directory where the file exists:
grep ethernet0.generatedAddress *.vmx
As always, I hope this helps some folks.
[...] This is the NAT network for Fusion. IP addresses .3-.127 are statically assignable. Thanks to Michael McLaughlin for this information. Note that if you do not setup the network correctly, the system will not [...]
Cisco Unified Communication Manager 7 (CUCM7) on VMWare Fusion 3.0 for Mac » Jim Shank's Good Info
7 Mar 10 at 12:44 pm
Hi Michael,
I have 3 development environments running under vmware fusion (2.0.7).
I’ve only just came across your article so I decided to try it out.
After making the required changes and restarting the vm services, the vm’s each come up with the correct ip, the ports are forwarded correctly, I can ssh into them from the host (i.e. host can see ubuntu guest) but for whatever reason I no longer have external network connectivity. i.e. I can no longer ping the gateway (i.e. the host) from within the guest. dns resolution fails also. I’m pretty stumped at this point. If i revert my changes, restart vmware services, reboot host and restart networking things are back to normal (i.e. ip from vmware dhcpd, can see gateway and can ping google). I’ve tried this dance a number of times and I’m seeing the same behaviour every time…
my nat.conf :http://pastebin.com/UDaLQDYR
my dhcpd.conf: http://pastebin.com/58KQb2hS
What I’ve just noticed is that by default my dhcpd.conf doesn’t have the vmnet8 entry???
Do you have clue as to why I’m seeing this behaviour or how I can go about debugging this?
Very sorry to bother you like this but I’m desperate at this point (tried google, irc, vmware support forums)..
Thanks for reading,
Saimon
Saimon Moore
11 Jun 10 at 7:50 pm
Have you tried shutting down your instances, and rebooting VMWare. Here’s another post that shows you how to do that without shutting down your native hosting OS.
If that doesn’t work, let me know.
maclochlainn
11 Jun 10 at 9:26 pm
Hi Max,
Many thanks for your response…Yes I had tried that and I also tried the procedure in your other post. In fact since I wrote the comment I’ve solved the problem.
I tracked back and started to make incremental changes for each vm. I first made a single change to dhcpd.conf for one vm, rebooted vmare services and was suprized to find I still had connectivity. I then incrementally made changes until I discovered that was causing the initial issue was having setup multiple entries for portforwrding using the same destination port.
e.g. this won’t work:
2222 = 172.16.151.100:22
2222 = 172.16.151.101:22
2222 = 172.16.151.102:22
even though the vms are never running at the same time.
but this will:
2224 = 172.16.151.100:22
2223 = 172.16.151.101:22
2222 = 172.16.151.102:22
So thanks again for your help,
Signed
A happy virtual camper
Saimon Moore
15 Jun 10 at 5:01 am
[...] http://blog.mclaughlinsoftware.com/2010/03/01/vmware-fusion-nat/ [...]
Configuring VMWare Fusion NAT on Mac OS X « More Soma Please…
25 Aug 10 at 3:56 am