Ubuntu: How to access my virtual machine server via hostname?



Question:

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


Solution:1

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  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »