MacLochlainns Weblog

Michael McLaughlin's Technical Blog

Site Admin

VMWare Fusion NAT

with 28 comments

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:

  1. Read the subnet value from the dhcpd.conf file.
  2. Dynamic IP address only require you to set the guest operating system to DHCP.
  3. Static IP addresses require you to set the IP address, subnet, default gateway, and preferred DNS server.
  4. Add assigned IP address and the guest operating system hostname to your Mac OS X /etc/hosts file.

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.

Written by maclochlainn

March 1st, 2010 at 11:41 pm

Posted in Mac,Mac OS X,VMWare

28 Responses to 'VMWare Fusion NAT'

Subscribe to comments with RSS or TrackBack to 'VMWare Fusion NAT'.

  1. [...] 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 [...]

  2. 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

  3. 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

  4. Hi Mac,

    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

  5. [...] this post [...]

  6. [...] You can refer to this for the details on your VMWare NAT subnet [...]

  7. Thank you SO much Brother McLaughlin! I have been hunting everywhere for this so I can set up my MarkLogic dev machine for work. Awesome Possum!

    David Godfrey

    14 Mar 11 at 2:41 pm

  8. You can find instructions to install, configure, and setup MarkLogic 4.2 here.

    maclochlainn

    14 Mar 11 at 2:56 pm

  9. Please note that when you use this technique there is no need for installing the MS Loopback Adapter and assigning it a fixed IP.

    Everything here applies to the ‘regular’ network adapter. That is where VMWare is going to look for a connection.

    Signed, been at this all day and just figured this out…

    Donnachaidh

    22 Jun 11 at 5:16 pm

  10. I’d like to share another nugget regarding networking with a Windows XP guest OS.

    I’m building a ‘baseline’ VM that I can clone for installing various releases and combinations of Oracle products. So this VM has nothing from Oracle installed.

    To test the network visibility between my host OS (Mac OS 10.6) and the guest OS (XP Professional) I am using the ping utility.

    After configuring as described here, I could successfully ping FROM the guest to the host without any problem. I could not successfully ping in the other direction, from OS X to XP Pro.

    It turns out that the default Windows Firewall settings do not allow incoming ping requests.

    Here’s how to allow this:

    start menu / Control Panel / Windows Firewall

    Click the Advanced tab

    Click “Settings” in the first section “Network Connection Settings”

    Click the ICMP tab

    Click the checkbox in the first setting “Allow incoming echo request”

    Click OK twice

    I hope this will save someone the hours I’ve spent trying to find something wrong with the VMWare configuration when everything there in reality just fine!

    Jack

    Donnachaidh

    23 Jun 11 at 8:52 am

  11. There’s a link to an earlier article that covers all those configuration issues for Oracle client on Mac OS X and Oracle Server on Windows. It should answer most if not all the issues that you’re running into, but let me know if you need more information?

    maclochlainn

    23 Jun 11 at 10:30 am

  12. Thank you Mac.

    I had read that but hadn’t recalled the other Windows-side work that needed to be done. I understand that you’re not VMWare tech support, but if you don’t mind I’d like to ask another Fusion networking question. Is the VMWare gateway visible from the Mac OS and Virtualized Windows?

    I can ping this reliably from the guest OS, but only rarely and intermittently from the Mac OS host. Have you ever found any doc on this router on the VMware site? I have tried to access it from Firefox on the guest side and get a standard login dialog box, but I can’t find any mention whatsoever of how to provide the credentials.

    If there’s a short explanation I’d really appreciate you sharing. If it’s more involved I’m content to let it go. But come to think of it, I would appreciate any recommendation you could make on a intro to TCP/IP networking.

    Thanks, Jack

    Jack

    24 Jun 11 at 4:28 pm

  13. Actually, I’m not sure why you want to ping the gateway but the best thing to do is put your IP address in the /etc/hosts file on your Mac, like this:

    172.16.127.100   mclaughlin-7x64 mclaughlin-7x74.techtinker.com

    Then, you can ping your hostname like:

    ping mclaughlin-7x64

    As to a book reference on Networking, we use CCNA Guide to Cisco Networking Fundamentals in our first level networking course. It’s not for the faint of heart.

    maclochlainn

    24 Jun 11 at 8:16 pm

  14. Hi MacLochlain,

    Thanks for your post, i tried to configure the same but somehow the port forwarding didn’t work properly.

    i added this under /etc/hosts
    172.16.198.100 winxp

    and in dhcp.conf i added

    host winxp {
    	hardware ethernet 00:50:56:00:00:FF;
    	fixed-address 172.16.198.100;
    }

    and set it under guess os(windows xp) to use the ipaddres. it started correctly

    C:\Documents and Settings\Administrator>ipconfig -all
     
    Windows IP Configuration
     
            Host Name . . . . . . . . . . . . : winxp
            Primary Dns Suffix  . . . . . . . :
            Node Type . . . . . . . . . . . . : Unknown
            IP Routing Enabled. . . . . . . . : No
            WINS Proxy Enabled. . . . . . . . : No
     
    Ethernet adapter Local Area Connection:
     
            Connection-specific DNS Suffix  . :
            Description . . . . . . . . . . . : VMware Accelerated AMD PCNet Adapter
     
            Physical Address. . . . . . . . . : 00-50-56-00-00-FF
            Dhcp Enabled. . . . . . . . . . . : No
            IP Address. . . . . . . . . . . . : 172.16.198.100
            Subnet Mask . . . . . . . . . . . : 255.255.255.0
            Default Gateway . . . . . . . . . : 172.16.198.2
            DNS Servers . . . . . . . . . . . : 172.16.198.2

    I then defined the port forwarding for host OS to guest OS in nat.conf file.

    [incomingudp]
    5088 = 172.16.198.100:80
    [incomingtcp]
    5088 = 172.16.198.100:80

    I have a web server running in guest OS and would like this to be exposed to user under my local network. But it seems that http://localhost:5088 doesn’t go anywhere on my host OS(Mac)

    I can’t ping 172.16.198.100 from Mac host OS as well.

    PING winxp (172.16.198.100): 56 data bytes
    Request timeout for icmp_seq 0
    Request timeout for icmp_seq 1
    Request timeout for icmp_seq 2
    Request timeout for icmp_seq 3
    ...

    Any help would be greatly appreciated. Have been debugging this for like 3 hours.

    William

    26 Jun 11 at 2:05 am

  15. When you write “guest OS”, do you mean the Mac OS or Windows? If you mean Windows (my guess), you’re trying to get to it from the Mac OS, right? If so, I’d suggest the following:

    On Windows, open a firewall exception for Port: 5088. Then, you should be able to get to it with the following URL:

    http://winxp:5088

    If that doesn’t help, let me know.

    maclochlainn

    29 Jun 11 at 12:28 am

  16. Thanks for your reply. I’ve already disabled the firewall in the guest OS (Windows) and I can’t get it to work. Enabling firewall with the exception also didn’t help.

    I can’t ping the guest OS from host (MAC OS). Anything else i need to check?

    William

    29 Jun 11 at 9:56 am

  17. Hi Machlochalinn, any idea on what went wrong?

    William

    9 Jul 11 at 6:17 pm

  18. William,

    This is a typical configuration in the /etc/hosts file on the Mac OS X side:

    ##
    # Host Database
    #
    # localhost is used to configure the loopback interface
    # when the system is booting.  Do not change this entry.
    ##
    127.0.0.1	localhost
    127.0.0.1       MacPro
    255.255.255.255	broadcasthost
    ::1             localhost 
    fe80::1%lo0	localhost
    172.16.123.71   McLaughlin-7x64 McLaughlin-7x74.techtinker.com

    Are you pinging the machine name, like this:

    MacPro:~ maclaughlin$ ping McLaughlin-7x64
    PING McLaughlin-7x64 (172.16.123.71): 56 data bytes
    64 bytes from 172.16.123.71: icmp_seq=0 ttl=128 time=0.507 ms
    64 bytes from 172.16.123.71: icmp_seq=1 ttl=128 time=0.277 ms
    64 bytes from 172.16.123.71: icmp_seq=2 ttl=128 time=0.244 ms
     
    --- McLaughlin-7x64 ping statistics ---
    3 packets transmitted, 3 packets received, 0.0% packet loss
    round-trip min/avg/max/stddev = 0.244/0.343/0.507/0.117 ms

    maclochlainn

    13 Jul 11 at 10:41 pm

  19. Hi Maclochlainn,

    Mine looks like this, but i can’t ping the machine.

    ##
    # Host Database
    #
    # localhost is used to configure the loopback interface
    # when the system is booting.  Do not change this entry.
    ##
    127.0.0.1	localhost
    255.255.255.255	broadcasthost
    ::1             localhost 
    fe80::1%lo0	localhost
    172.16.198.100	winxp
     
    will14mong:~ will14m$ ping winxp
    PING winxp (172.16.198.100): 56 data bytes
    Request timeout for icmp_seq 0
    Request timeout for icmp_seq 1
    Request timeout for icmp_seq 2
    Request timeout for icmp_seq 3

    The firewall is off in my windows xp, so not sure what is wrong…

    William

    16 Jul 11 at 9:05 am

  20. I’m assuming that you’ve configured the Windows side correctly, and that you see the same IP address when you run ipconfig from the command-line. If that’s correct, did you open the ICMP Settings, which run before IP validation?

    maclochlainn

    16 Jul 11 at 11:26 am

  21. Hi Maclochalinn,

    Thanks for your help so far. THe ipconfig on the windows xp side is the same ip address:

            Connection-specific DNS Suffix  . :
            IP Address. . . . . . . . . . . . : 172.16.198.100
            Subnet Mask . . . . . . . . . . . : 255.255.255.0
            Default Gateway . . . . . . . . . : 172.16.198.2

    I’ve enabled the check mark for the ICMP settings and set the firewall to off, but still i can’t ping from mac os (host).

    William

    18 Jul 11 at 8:41 am

  22. Any clue on what is wrong with my setup?

    William

    21 Jul 11 at 8:08 am

  23. William,

    I’m wondering if the NIC ID is invalid. Can you look up your Mac IP address and then try this from your Windows environment:

    C:\> tracert 192.168.0.5
     
    Tracing route to MACPRO [192.168.0.5]
    over a maximum of 30 hops:
     
      1    >1 ms    >1 ms    >1 ms  172.16.123.2
      2    >1 ms    >1 ms    >1 ms  MACPRO [192.168.0.25]
     
    Trace complete.

    maclochlainn

    22 Jul 11 at 1:26 am

  24. Hi Maclochlainn,

    I can do a trace route to my mac from windows xp

    C:\Documents and Settings\Administrator>tracert 172.20.10.2
     
    Tracing route to 172.20.10.2 over a maximum of 30 hops
     
      1    >1 ms    >1 ms    >1 ms  172.16.198.2
      2    43 ms    >1 ms    ping 172.20.10.2
     
    Pinging 172.20.10.2 with 32 bytes of data:
     
    Reply from 172.20.10.2: bytes=32 time<1ms TTL=128
    Reply from 172.20.10.2: bytes=32 time<1ms TTL=128
    Reply from 172.20.10.2: bytes=32 time<1ms TTL=128
    Reply from 172.20.10.2: bytes=32 time<1ms TTL=128
     
    Ping statistics for 172.20.10.2:
        Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
    Approximate round trip times in milli-seconds:
        Minimum = 0ms, Maximum = 0ms, Average = 0ms

    Problem is to ping winxp from mac is not possible:

    will14mong:~ will14m$ ping winxp
    PING winxp (172.16.198.100): 56 data bytes
    Request timeout for icmp_seq 0
    Request timeout for icmp_seq 1
    Request timeout for icmp_seq 2
    Request timeout for icmp_seq 3

    William

    26 Jul 11 at 6:31 pm

  25. William,

    Try removing this from the dhcp.conf file:

    host winxp {
    	hardware ethernet 00:50:56:00:00:FF;
    	fixed-address 172.16.198.100;
    }

    It should connect.

    maclochlainn

    27 Jul 11 at 12:37 am

  26. I’m having the same issue even after removing that dhcp lines. :(

    bash-3.2# ping 172.16.198.100
    PING 172.16.198.100 (172.16.198.100): 56 data bytes
    Request timeout for icmp_seq 0
    Request timeout for icmp_seq 1
    Request timeout for icmp_seq 2
    Request timeout for icmp_seq 3
    Request timeout for icmp_seq 4
    Request timeout for icmp_seq 5

    It’s strange because i can connect to internet from windows xp (ip add 172.16.198.100).

    Mac internet also working fine.

    Communication from win xp to mac os is working fine:

    C:\Documents and Settings\Administrator>ping 192.168.1.103
     
    Pinging 192.168.1.103 with 32 bytes of data:
     
    Reply from 192.168.1.103: bytes=32 time<26ms TTL=128
    Reply from 192.168.1.103: bytes=32 time<1ms TTL=128
    Reply from 192.168.1.103: bytes=32 time<1ms TTL=128
    Reply from 192.168.1.103: bytes=32 time<1ms TTL=128
     
    Ping statistics for 192.168.1.103:
        Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
    Approximate round trip times in milli-seconds:
        Minimum = 0ms, Maximum = 26ms, Average = 6ms

    BUT, connection from mac os to winxp is having issue. I can't ping at all. I've disabled the firewall in winxp though

    William

    29 Jul 11 at 8:47 pm

  27. Just a hunch, but change to DHCP, release the IP license, and restart networking. Then, check the results of ipconfig /all.

    maclochlainn

    31 Jul 11 at 11:50 pm

  28. [...] VMWare Tools on Oracle Unbreakable Linux [...]

Leave a Reply