How to access my virtual machine server via hostname?

10,030

I think you need Apple's 'Bonjour' for this, and it needs to be installed on the Host OS. as well as the Guest OS. It should be installed by default in Ubuntu. If it is already installed, accessing:

http://hostname.local/

should work, where the hostname is the name you get at a CLI on the Guest OS, e.g.:

username@hostname:~$

If you don't have 'Bonjour' installed on either then just install the packages avahi-daemon and libnss-mdns with:

sudo apt-get install avahi-daemon libnss-mdns
Share:
10,030

Related videos on Youtube

Alexis
Author by

Alexis

Senior #iOS Developer, #Swift lover, owner at firstsecond.eu, Android, software, geek, tech enthusiast, Star Wars, cashew nuts & dinosaurus cookies

Updated on September 18, 2022

Comments

  • Alexis
    Alexis over 1 year

    I created a Ubuntu 12.10 virtual machine in VMware which runs an Apache server. The VMware machine is on a bridged network adapter, so it's using the physical network connected on my host.

    For now I can access the web server in the VM using its dynamically assigned IP address, e.g.:

    http://192.168.1.8/...
    

    However, its IP address is likely to change everytime I restart the VM (because of DHCP). In order not to have to determine the IP address of the machine over and over again, I'd like to access it using a domain/host name, e.g.:

    http://name.local/...
    

    How can I accomplish this?

    EDIT:

    It's a VMware vm with bridged networking.

    My host OS is Ubuntu 12.10 too.

    My local network uses DHCP and I'd rather not using static IP address.

    The DHCP server is the one built-in my router. And I don't know about the DNS sever (Do I have a local one by default?)

    • gertvdijk
      gertvdijk over 11 years
      What kind of virtualization are you using? Libvirt/KVM, VirtualBox, VMware, etc. Is this DHCP server managed by the hypervisor or external (e.g. bridged networking)? And is your host using the same DNS server as the guests? The 'default' virtualization Libvirt/KVM allows you to specify a fixed MAC address and IP-address for the guests in the virtual network configuration file for example.
    • Alexis
      Alexis over 11 years
      it's a VMware vm with bridged networking
    • gertvdijk
      gertvdijk over 11 years
      Your answer is still incomplete. Do you have access to your DNS/DHCP server? If so, what kind of server is this? (Ubuntu based?) What host operating system are you on? Do you need to use DHCP on your network or could you assign a static address?