Use Virtual Machine Names as DNS Names

When you start a virtual machine operating in the shared or host-only networking mode and it gets an IP address via DHCP, the virtual machine gets registered in the macOS etc/hosts file and you can use its name to connect from the host operating system or other virtual machine operating in the shared or host-only networking mode.

For example, after starting such a virtual machine, your etc/hosts file may look as follows:

You can use the virtual machine name (windows-8.1.shared) to connect to this virtual machine. For example, if you execute the following command in the macOS Terminal:

you will start pinging 10.211.55.3.

When such a virtual machine is shut down, its registration entry is removed from the etc/hosts file.

Was this topic helpful?