CREATING MULTIPLE VIRTUAL MACHINES ON A SINGLE VIRTUAL NETWORK
Tags: tutorial, cloud, virtualmachine, network
Published: 2024-07-12 23:29:38

In this tutorial, we’re going to deploy two virtual machines on a single virtual network and configure them to allow one virtual machine to ping the other within the network—we will be testing to confirm their connection.

## **PREREQUISITE**
- Working computer
- Internet connection
- Microsoft Azure account + active subscription

## **PROCEDURE**

### **CREATE A VIRTUAL NETWORK**
Open the Azure portal and type “Virtual network” in the search bar at the top. Click on “Virtual networks” under services as seen in the image below.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ai4rb84frjms9pccg7hs.png)

On the Virtual networks service webpage that loads, click on the “Create” or “Create virtual network” button as you deem fit.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oe6cq52mh0kvd3cv4cfp.png)

You will be directed to the “Basics” page.
The first part of the “Basics” page is the “Project details” section where you are asked to select the subscription and resource group under which you want to create the virtual network. 
Create a new resource group by clicking on “Create new” and entering a suitable name for the new resource group.
The next section is “Instance details” where you can input a virtual network name of choice and select a region.
Afterwards, click on “IP addresses”.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xbyezqdk4nj4q62e81u6.png)

On that page, click on “Delete address space” to delete the current IPv4 address space.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/egljt3w73dh6t42pglqk.png)

Click on the “Add IPv4 address space” button.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hoyw221y1siujkvxnu3y.png)

Change the new address space to 10.1.0.0/16.
Click on “Add a subnet”

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oiplc0aobjn8qkwoura1.png)

Leave everything as default and click on the “Add” button.
Click “Review + create”.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/knyi12gfm3rw6nexvz3x.png)

When a notification depicting Validation passed is displayed, click on the “Create” button to deploy the virtual network.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zrc5vnm3elrkhjnp49su.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t6nh9z0r3bz3vz26vf6i.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2sx1dy9o1a6p5naoorjo.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/665fe8dyr3hro227hlo1.png)


### **CREATE VIRTUAL MACHINES**
After the deployment is complete, click on the “Go to resource” button.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b9baxwbxhuoy6uloakuw.png)

Click on the menu and select “Virtual machines”.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/343vm86jkz4dxz5fg0qv.png)

Click on the “Create” button and then click on “Azure virtual machine” on the pop-up menu.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wa64wqhxtkpewi2hu52i.png)

You will be directed to the “Basics” page.
The first part of the “Basics” page is the “Project details” section. 
Select your subscription and the resource group created earlier.
The next section is “Instance details” where you are to input a VM name of choice.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7wssnbgzxomha0hk65gt.png)

Under “Image”, select “Windows Server 2019 Datacenter - ×64 Gen2”.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qduc6cmfuzd85k9b6dr6.png)

Scrolling down, we get to “Administrator account” section where you are required to provide a username and password. 
This will be used to log in to the account so, keep a record or use a password you won’t forget.
At the “Inbound port rules” section, select “Allow selected ports” under “Public inbound ports” and select “RDP (3389)” from the drop-down list provided when you click on the box for “Select inbound ports”.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5yelv74me9maf230qvud.png)

Since this is just a trial, we would be leaving most of the settings as default and skip to only those that need to be attended to personally.

Scroll back to the top and click on “Networking”.
Make sure that the VM is placed on the previously created vNet and subnet.
Click on “Review + create.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bnjcdmk2dfvx85fmkmpu.png)

After successful validation, click on the “Create” button. There will be a pop-up at the top right showing the status of the deployment.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/07she3i9w0jzrgb501iv.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rf0i4hlr8w25g96nu89f.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l08b6aocwqzes1ikb9hx.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5h9xuu8ggpwsbal1aw7g.png)

You will be directed to a “CreateVm” page which goes through several phases that you might need to be patient for.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9v41hb151fxmfo2f2q1p.png)

After successful deployment, repeat the process to create a second VM with a different name and public IP address.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q3f74d1b5qcu1uxpatgy.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i0l6az9utvc688l930ph.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oq8qnq24281d4cpcgdy6.png)

### **TEST CONNECTION**
Open the first VM.
On the resource page, click on “Connect”.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f9jsj35tiqwi1pz97qdd.png)

Click on the “Download RDP file”.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zwu68k67wj89zzkto4jd.png)

Load the downloaded file and click on “Connect” on the window that pops up.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mm7v8cynltv6pqc8imoy.png)

Input your username and password in the next window and affirm.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ign5yjw6cp17pjfofcvb.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/10s6t7uli66a2j0a78ie.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sbangro4pouqtefdxhza.png)

You should have a Windows VM running on your computer right about now.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x4f73mhboa7tklkf7exn.png)

Click on the start menu and type “Firewall” in the search bar.
Open “Windows Defender Firewall”.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f9smqs83110cd72m2z7q.png)

Click on “Turn Windows Defender Firewall on or off”.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1wysqyibd6gw58zkh9cf.png)

Turn off Windows Defender Firewall under both private and public network settings.
Click “OK”.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kv2tm8ddps2qys15pkpq.png)

Repeat these steps for the second VM.

Head back to the first VM.
Click on the start menu and type “PowerShell” in the search bar.
Open “Windows PowerShell”.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i13bvljfh59gf401n7dl.png)

Type in a command in this format:
`ping nameofsecondvm`. That is, “`ping vMdemo2`” in this case.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/brmtif7ynzxriabymxn1.png)

As can be seen, the second VM was successfully pinged from the first VM indicating a connection between them.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dklwdrfqdg9el92hyb5b.png)