Azure VMs Virtual Network inter-communication

John picture John · Dec 21, 2012 · Viewed 23.7k times · Source

I'm new to Azure (strike 1) and totally suck at networking (strike 2).

Nevertheless, I've got two VMs up and running in the same virtual network; one will act as a web server and the other will act as a SQL database server.

While I can see that their internal IP addresses are both in the same network I'm unable to verify that the machines can communicate with each other and am sort of confused regarding the appropriate place to address this.

Microsoft's own documentation says

All virtual machines that you create in Windows Azure can automatically communicate using a private network channel with other virtual machines in the same cloud service or virtual network. However, you need to add an endpoint to a machine for other resources on the Internet or other virtual networks to communicate with it. You can associate specific ports and a protocol to endpoints. Resources can connect to an endpoint by using a protocol of TCP or UDP. The TCP protocol includes HTTP and HTTPS communication.

So why can't the machines at least ping each other via internal IPs? Is it Windows Firewall getting in the way? I'm starting to wonder if I've chose the wrong approach for a simple web server/database server setup. Please forgive my ignorance. Any help would be greatly appreciated.

Answer

astaykov picture astaykov · Dec 21, 2012

If both the machines are in the same Virtual Network, then just turn off Windows Firewall and they will be able to ping each other. Other way is to just allow all incoming ICMP traffic in Windows Firewall with Advanced Settings.

However there is a trick. Both the machines will see each other by IP Addresses, but there will be no name resolution in so defined Virtual Network. Meaning that you won't be able to ping by name, but only by direct IP address. So, if want your Website (on VM1) to connect to SQL Server (on VM2), you have to address it by full IP Address, not machine name.

The only way to make name resolution within a Virtual Network is to use a dedicated DNS server, which you maintain and configure on-premises.

This article describes in details name resolution scenarios in Windows Azure. Your particular case is this:

Name resolution between virtual machines and role instances located in the same virtual network, but different cloud services

You could potentially achieve name resolution, if you put your VMs is same cloud service. Thus you will not even require dedicated virtual network.