Connecting Virtual machines in Vnet

Shruti Pal
3 min readJul 2, 2022

--

This article is about the connection of instances under different subnets of a Vnet. A Vnet is simply a private network in Azure that hosts various resources and ensures secure and secret connections between them.

While creating a virtual network, Azure provides a range of IP addresses that contain a maximum of about 65k sub addresses able to be distributed among subnetworks and other resources.

Today we will create a Vnet with two subnets. Connect the virtual machine to each subnet and ping it.

Step 1: Create a Virtual Network and subnets

Creating a Virtual Network in Azure is simple. You only have to make sure all your resources and Vnet are in the same region. Create 2 subnets with different IP ranges. [I have taken 10.3.0.0/24 for one and 10.3.1.0/24 for other]. Take a look at the following subnets for reference.

Step 2: Building the machines

I have created the first instance named “green” under subnet 1. Notice in the Networking section, the machine has 2 different IP addresses. One is a public IP address, this IP is available to connect the machine to the outside world. Another is a Private IP address which of course allows only internal connections under Vnet. This IP is as expected within the range of subnet 1.

Similarly, I have also created the next VM called “blue” under subnet 2. This instance also has the private IP address confined in the IP range of subnet 2.

Next, connect to both these VM via Secured Shell (SSH).

Step 3: Ping and verify the connection

Ping is a method of determining latency or the amount of time it takes for data to travel between two devices or across a network.

Ping is short for Packet internet groper.

In the SSH of green, to ping blue :

ping <Private IP address of blue>

and vice-versa.

Private IP address of blue is 10.3.0.4
Private IP of green is 10.3.1.4

Great!! our machines are well connected and our network is ready.

That’s all,

Thanks.

--

--