I've set up two virtual machines on one VMware Workstation. How to configure it to communicate with one another (two way).
For example, if VM #1 is running php web server and if it gets the IP address 192.168.1.12, the browser on VM #2 should be able to access http://192.168.1.12
.
I couldn't figure out the exact solution. I saw that it depends on the Network type. Please guide me how to set it up.
There are three basic types of networks supported in vmware player and virtualbox. 1) HOST ONLY 2) NAT 3) BRIDGE
and there are other variations of these.
Since your question in specific to vmware, the answer will go specific to it.
FOR ur problem NAT network will be fine. 1)NAT Using NAT the VMs will get 192.168.211.0/24 network. (At least this happens in my case) In this 192.168.211.1 will be the IP of the Host machine. 192.168.211.2 will be a dedicated IP. The vmware workstation internally uses this IP. The nameserver ,gateway and DHPC Server IP address will be 192.168.211.2. (All three same)
Now when u setup guests machines the DHCP Server will assign the ip addresses to these machines.
Next if you are running PHP server on 192.168.211.12(say) then go to this machine and change the interface file for this machine and assign static IP 192.168.211.12 to this machine. There are hundred of documents available on how to configure interface file. ex:-
DEVICE=eth0
BOOTPROTO=static //or set this as NONE
ONBOOT=yes
NETMASK=255.255.255.0
IPADDR=192.168.211.12
GATEWAY=192.168.211.2
NOTE:- IN vmware the NAT network allows inter VMs communication as well internet connectivity. Using NAT in case of virtualbox does not allow inter Vms communication, it only allows internet connectivity. NAT network works even in offline mode.
2) BRIDGE In bridge mode the VMs are assigned IP from the same network as your physical LAN. Don't use it if u are not administrator of the LAN. Bridge mode works in only in online mode.
3) HOST only allows inter VMs communication but creates local network between VMs and does not provides internet connectivity. You will have to configure one more interface in NAT mode for internet connectivity. (I used to do this when i use virtual box. i.e configure one interface in host only mode and another in NAT mode, since to make bridge mode work in virtual box is painful ).
These are some useful links
1) http://blog.pluralsight.com/vm-workstation-advanced-networking:- U can read this article if u want to understand how HOST machine adapters are configured.
2) http://pibytes.wordpress.com/2012/11/16/vmware-workstation-networking-basics/:- This blog is pretty good to understand how different modes work.