Ubuntu – How to ping virtualbox guest machine by hostname

networkingUbuntuvirtualbox

Here is the summary.

VirtualBox 4.2.18

Host OS: Windows 7

Guest OS: Ubuntu 12.04

Networking: Bridged Adaptor

I can ping Host and other machines in host's network from ubuntu guest using hostnames. But, I can only ping the guest machine using IP address from host and network machines.
I have avahi-daemon running on Guest OS.

I want to be able to ping/ssh the guest machine from host and other machines on network using hostname of the guest machine. Please help.

Best Answer

The new guest VM that you created is not resolved by the other host machines in the network. You can try below solution.

Case 1:

Trying to connect to guest machine from a different host machine [say windows] in the network

open the file

C:\Windows\System32\drivers\etc\hosts

Add the following Entry

ipaddressofguest  hostname

Save the entry

From the windows host ping hostname [You will be able to connect to guest OS]

Case 2:

Trying to connect to guest machine from a different host machine [say Linux] in the network

open the file

/etc/hosts

ipaddressofguest  hostname

Save the entry

From the Linux host ping/ssh using hostname [You will be able to connect to guest OS]

Sandeep

Related Question