I have a Ubuntu Server 9.04 image set up in VMWare Fusion 3.0.0, using the NAT option for the guest's network connection. From the Mac host, I can ssh to the linux guest just fine using it's IP address, but I would like to be able to refer to it by hostname for convenience. ie:

mac-host:~ ssh user@linux-guest.local

I had a similar setup using Parallels a couple years ago, but I don't remember how it was set up. It may have "just worked".

Any suggestion on how to make this work?

5 Answers 5


EDIT The first version of instructions I posted caused conflicts with the nameserver and gateway that VMware put on vmnet8. This version corrects the issue.

Software versions:

  • MAC OS X Version 10.6.3
  • VMware Fusion Version 3.1.0 (261058)
  • Ubuntu 10.04 LTS

What I have done:

  • During creation of the VM, set networking to NAT.

  • On Linux Guest: Run ifconfig to get the hardware address HWaddr, broadcast address Bcast, IPv4 internet address inet addr, and mask Mask being used.

    eth0      Link encap:Ethernet  HWaddr 00:0c:29:53:bf:e5  
              inet addr:  Bcast:  Mask:
  • On Linux Guest: Lookup the nameserver information

    UbuntuGuest$cat /etc/resolv.conf
    domain localdomain
    search localdomain
  • On Linux Guest: Lookup the gateway address: (Listed in the Gateway column of the line with as Destination.)

    UbuntuGuest$route -n
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface   U     0      0        0 eth0         UG    100    0        0 eth0
  • On OS X Host: Edit the dhcpd.conf file for vmnet8 (The NAT virtual switch) to assign a static IP address to the Linux Guest. (Use your editor of choice on the fourth line)

    OSXHost$cd /Library/Application\ Support/VMware\ Fusion/vmnet8/
    OSXHost$sudo chmod u+w dhcpd.conf
    OSXHost$sudo cp dhcpd.conf dhcpd.conf.bak.20100619
    OSXHost$sudo emacs dhcpd.conf
  • On OS X Host: The file will start out looking something like:

    # 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: 12/26/2009 10:35:10
    allow unknown-clients;
    default-lease-time 1800;                # default is 30 minutes
    max-lease-time 7200;                    # default is 2 hours
    subnet netmask {
          option broadcast-address;
          option domain-name-servers;
          option domain-name localdomain;
          default-lease-time 1800;         # default is 30 minutes
          max-lease-time 7200;             # default is 2 hours
      option routers;
    host vmnet8 {
        hardware ethernet 00:50:56:C0:00:08;
        option domain-name-servers;
        option domain-name "";
        option routers;
    ####### VMNET DHCP Configuration. End of "DO NOT MODIFY SECTION" #######

Things to note:

  • The subnet section should match the IP information gathered on the Linux Guest. The inet addr will be within range, netmask will match Mask, option broadcast-address will match Bcast, option domain-name-servers and option domain-name will match the information gathered with cat /etc/resolv.conf and option routers will match Gateway from the route -n command.

  • We want to assign a static IP address, so that we can add an entry to the OS X Host's hosts file. The address must be within the subnet defined. Addresses that are not available to assign are the ones within range in subnet section, the broadcast address, the fixed-address for host vmnet8, the DNS server and the gateway. And I think the address equal to subnet is not allowed. In this example, the subnet is So the available addressees are from to less to (range) less (broadcast) less (host vmnet8) less (gateway and DNS server). The net is that addresses to are available.

  • ON OS X Host: Create a new host entry below the DO NOT MODIFY SECTION. This entry will assign a static IP to the Linux Guest. hardware ethernet needs to match HWaddr from ifconfig on the Linux Guest. Pick an available static address for fixed-address. option broadcast-address, option domain-name-servers, option domain-name and option routers need to match the options given in the subnet section of dhcpd.conf. (Which we have already matched against information gathered on the Linux Guest.) In this example the host entry is:

    ####### VMNET DHCP Configuration. End of "DO NOT MODIFY SECTION" #######
    host serpents-hold {
        hardware ethernet 00:0c:29:53:bf:e5;
        option broadcast-address;
        option domain-name-servers;
        option domain-name localdomain;
        option routers;
  • On OS X Host Save dhcpd.conf and close your editor.

  • On OS X Host and all Guests: Shutdown all VMs and VMware.

  • On OS X Host: Restart the VMware services:

    OSXHost$cd /Library/Application\ Support/VMware\ Fusion/ 
    OSXHost$sudo ./boot.sh --restart 
  • On OS X Host: Look in Activity Monitor and make sure that two processes each named vmnet-dhcpd are running. (One is for the vmnet8, the NAT network, the other is for the host only network.) If you don't see both, there is probably a problem with the vmnet8/dhcpd.conf file on the OS X Host. Fix that and repeat the restart of VMware services.

  • On OS X Host: Start VMware and the Linux Guest VM.

  • On Linux Guest On the guest VM check that settings are as expected:

    eth0      Link encap:Ethernet  HWaddr 00:0c:29:53:bf:e5  
              inet addr:  Bcast:  Mask:
              inet6 addr: fe80::20c:29ff:fe53:bfe5/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:103 errors:0 dropped:0 overruns:0 frame:0
              TX packets:71 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:10961 (10.9 KB)  TX bytes:9637 (9.6 KB)
    lo <snip>    
    UbuntuGuest$cat /etc/resolv.conf
    domain localdomain
    search localdomain
    UbuntuGuest$route -n
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface   U     0      0        0 eth0         UG    100    0        0 eth0
  • On Linux Guest: Check that the outside world is reachable:

    UbuntuGuest$ping google.com
    PING google.com ( 56(84) bytes of data.
    64 bytes from pv-in-f104.1e100.net ( icmp_seq=1 ttl=128 time=47.6 ms
    64 bytes from 2.bp.blogspot.com ( icmp_seq=2 ttl=128 time=48.7 ms
    64 bytes from 2.bp.blogspot.com ( icmp_seq=3 ttl=128 time=48.2 ms
    --- google.com ping statistics ---
    4 packets transmitted, 3 received, 25% packet loss, time 3093ms
    rtt min/avg/max/mdev = 47.687/48.223/48.714/0.491 ms
  • On OS X Host: Add a mapping for the hostname to the hosts file:

    OSXHost$cd /etc
    OSXHost$sudo emacs hosts

    Add a line to the end of the hosts file using the Linux Guest's hostname and the IP address assigned above.   serpents-hold
  • On OS X Host: Save file and exit emacs.

  • On OS X Host: Test that the Linux Guest is reachable by hostname:

    OSXHost$ping serpents-hold
    PING serpents-hold ( 56 data bytes
    64 bytes from icmp_seq=0 ttl=64 time=0.169 ms
    64 bytes from icmp_seq=1 ttl=64 time=0.244 ms
    --- serpents-hold ping statistics ---
    2 packets transmitted, 2 packets received, 0.0% packet loss
    round-trip min/avg/max/stddev = 0.169/0.207/0.244/0.037 ms
  • This is great...if your on an OSX host. Wish I could find the windows equivalent somewhere.
    – TJ L
    Sep 15, 2010 at 14:19
  • 1
    Great info. Thanks. 2 updates for v4.x 1. Location of dhcpd.conf is now: "/Library/Preferences/VMware Fusion/" 2. In Fusion 4, the networking service does not run when Fusion is shut down. To restart the networking service, restart Fusion.
    – sym3tri
    Apr 30, 2012 at 18:33

The one step answer to the original question is to run this command:

$ sudo apt-get install libnss-mdns

Installing this package should enable the feature instantly. You will then be able to get to your VM at your-vm-hostname.local. This will only work within the local network of the VM, which depends on how you configured it in your virtualization software.

This feature is called Bonjour by Apple and Zeroconf by everyone else. It's built into OS X and iOS. The easiest way to get it on Windows is to install iTunes for Windows.

  • Using this, I need to append '.local' to the name of the guest machine, e.g. ubuntu-guest.local, when I refer to it from the host side. That aside, this works wonderfully! Aug 16, 2013 at 20:21
  • @NathanielWaisbrot That's true. That's what the original poster wanted.
    – hashemi
    Sep 5, 2013 at 20:49

You could configure zeroconf using Avahi, which should allow the client to identify itself on a network without DNS registration.


assuming you just want to login over a command line, why not create an ssh config file? i do something like this for my vm.

# ~/.ssh/config
Host linux-box    
Hostname localhost
Port 8822

then i can

mac-box:~ ssh linux-box

If you are using NAT, it may try to register with DNS servers, however to computers other than the host, it's IP will be the same as your machines and can cause a few problems.

I would recommend that you switch to bridged networking as this will give it its own IP address and to any machine, it will look and feel like any other machine on the network. If you set up all the IP settings correctly (or use DHCP), it should automatically register and you should not have a problem doing anything on any port via IP or hostname.

  • 1
    Yes I think that would work but I'd prefer a stable private network. The VM is on a laptop that moves around and sometimes doesn't have an internet connection. If I used bridged-mode, I wouldn't be able to contact it when the host was offline.
    – amrox
    Nov 18, 2009 at 16:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.