This content originally appeared on DEV Community and was authored by Shish Singh
Before we move ahead and start connecting two virtual machines present in the same virtual networks. Let's first understand what virtual network is..?
Virtual Network
A virtual network in azure is a logical separation of the azure cloud dedicated for your subscription. You can treat it as your own personalised network present in the cloud.
Each virtual network just like any other physical network can further be divided into multiple sub networks. It won't be wrong to simply state a subnet is a range of IP addresses in the virtual network.
Coming back to our topic if we wish to connect two virtual machines present in the same virtual network we need to move ahead and first create the required resources.
Steps to follow
*** Create the resource group(RG)
First we will have a create a resource group. This resource group will hold all our resources and will help us in logically handling all the resources at one place and in one go.
e.g.; VM_CON_RG
*** Create two virtual machines
select the resource group created in point 1 (You may also create a resource group while creating the first virtual machine).
You may select a higher end machine but for understanding the topic let's consider windows server 2019 image as an example.
e.g.; VM1
Public inbound ports are allowed and inbound ports is RDP(3389).
Keeping all the settings as default for VM1. The final step is to review and create the VM. Meanwhile, remember the virtual network(vnet) of the first machine.
While creating the second virtual machine we will have to use the same virtual network. Also, Copy the public ip address of the virtual machine.
If not created please create one. e.g.;10.0.0.0/16
- Now move ahead and create the second virtual machine keeping all the settings and configuration as it is.
e.g.; VM2
- Make sure you check the virtual network while creating the second virtual machine. Select the same VNet as of virtual machine 1. Copy the public ip address of the virtual machine.
If not created please create one. e.g.;10.1.0.0/24
- Once all the configurations and settings are verified please move ahead and create the virtual machine.
*** Once done connect to the virtual machine 1 using RDP. Open the windows setting dashboard. Here, select Network & Settings. Click on windows firewall sub option in the change your network settings sub-section.
*** Disable both public and private windows defenders.
*** Also, If created try and connect to the virtual machine 2 using RDP.
*** Please repeat step 3 & 4 for virtual machine 2.
*** Now open the Windows PowerShell in virtual machine 1 and try to ping virtual machine 2 with its ip address.
Voila...It's done.
Note: In the next blog we will try and understand VNet Peering with an example.
This content originally appeared on DEV Community and was authored by Shish Singh
Shish Singh | Sciencx (2023-03-24T21:43:28+00:00) How to communicate with two VMs in the same VNet. Retrieved from https://www.scien.cx/2023/03/24/how-to-communicate-with-two-vms-in-the-same-vnet/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.