For each customer I have a separate VMWare virtual development machine. This allows me to separate all environments, as for each of them I have other software and frameworks installed, and mixing these may cause compatibility issues. And if something happens with my laptop, I don’t loose my virtual machines and can simply use them on another laptop.
I was having one issue though: from within a virtual machine I could not access the internal network, for example, pinging a machine in the network resulted in an error:
VMWare Player’s network adapter was configured to use NAT; and internet connection was working fine. Then I looked up the IP address of the network machine, and tried to ping that one:
And this worked. So it meant that it could not resolve the machine name.
To solve this, I added the mapping between IP address and machine name in the hosts file:
After that, I could access the machine by its name without a problem:
I was not very happy with the first solution. But then I found that without these entries added to the hosts file, I could still access the machine if I used its name suffixed with the domain extension:
So, a better approach would be to somehow make the virtual machine automatically add the domain suffix with each call.
Indeed, if I did a ipconfig /all, it showed that DNS suffix Search List was localdomain:
To change this, go to ‘Control Panel\Network and Internet\Network and Sharing Center’, and click the connection. Then click properties, select the ‘Internet Protocol Version 4’, and click properties. Click the advanced button. In the DNS tab, add the required DNS suffix:
Now an ipconfig /all reveals that the DNS Suffix Search List now is the actual domain:
So now, if we ping the machine with just its name, it works:
And then it seems there is yet another way of solving this. Right click ‘Start/Computer’ and click properties. Click ‘Change settings’ next to the computer name, and then click the ‘Change’ button, then the ‘More’ button, and fill in the Primary DNS Suffic of this computer:
It has the same effect, but also changes your default domain.
…after a reboot, it stopped working again. With NAT mode I had internet connection but network did not function properly, with bridged mode network worked but I did not have internet connection. I tried every solution that I found on the net but none of them worked. So I decided to give VirtualBox a try… and there everything worked immediately, out of the box! See my post about that.