How to ping virtualbox guest machine by hostname?

4

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.

Punit Soni

Posted 2013-10-30T01:01:22.403

Reputation:

See also http://superuser.com/questions/461323/543674

– Johann – 2014-07-03T22:42:03.430

Answers

2

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

ZVIK

Posted 2013-10-30T01:01:22.403

Reputation: 121

5I don't have static IP addr for the guest. I want this to work without adding entry in hosts file, As guest IP might change later. – Punit Soni – 2013-10-30T17:49:10.400