DEV Community

Cover image for CREATING MULTIPLE VIRTUAL MACHINES ON A SINGLE VIRTUAL NETWORK
Emmanuel Oluajo
Emmanuel Oluajo

Posted on

CREATING MULTIPLE VIRTUAL MACHINES ON A SINGLE VIRTUAL NETWORK

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

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

Image description

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

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

Image description

Click on the “Add IPv4 address space” button.

Image description

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

Image description

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

Image description

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

Image description

Image description

Image description

Image description

CREATE VIRTUAL MACHINES

After the deployment is complete, click on the “Go to resource” button.

Image description

Click on the menu and select “Virtual machines”.

Image description

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

Image description

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

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

Image description

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

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

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

Image description

Image description

Image description

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

Image description

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

Image description

Image description

Image description

TEST CONNECTION

Open the first VM.
On the resource page, click on “Connect”.

Image description

Click on the “Download RDP file”.

Image description

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

Image description

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

Image description

Image description

Image description

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

Image description

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

Image description

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

Image description

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

Image description

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

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

Image description

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

Image description

Top comments (0)