Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?)

share|improve this question
    
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. –  gertvdijk Dec 30 '12 at 15:19
    
it's a VMware vm with bridged networking –  jafar Dec 30 '12 at 15:53
    
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? –  gertvdijk Dec 30 '12 at 16:14
add comment

1 Answer 1

up vote 4 down vote accepted

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|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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