DEV Community

Cover image for How to Create and Configure Virtual Networks in Azure
SUBAIR NURUDEEN ADEWALE
SUBAIR NURUDEEN ADEWALE

Posted on

How to Create and Configure Virtual Networks in Azure

Introduction

An Azure Virtual Network (VNet) enables many types of Azure resources to securely communicate with each other, the internet, and on-premises networks. All Azure resources in a virtual network are deployed into subnets within the virtual network.

In this project, you will learn how to:

  • Create a resource group.
  • Create a virtual network and subnets.
  • Configure another virtual network with a firewall subnet.
  • Establish a VNet peering connection between the two virtual networks.

Step 1: Create a Resource Group

  • Sign in to the Azure Portal

  • In the search bar, search for Resource groups.

  • Select + Create.

  • Enter the following properties:

Property Value
Resource group RG1
Region East US

  • Click Review + create and then Create.

  • Then Create.

Step 2 Create hub and spoke virtual networks and subnets

An Azure virtual network enables many types of Azure resources to securely communicate with each other, the internet, and on-premises networks. All Azure resources in a virtual network are deployed into subnets within the virtual network.

  • In the Azure portal, Search for and select Virtual Networks.

  • Create and complete the configuration of the app-vnet. This virtual network requires two subnets, frontend and backend.

  • Select + Create

  • In the Basics tab, enter the following information:
  • Select “Review + create"

Property Value
Subscription Select your subscription
Resource group RG1
Name app-vnet
Region East US

  • Then Create.

  • Click on go to resources button

Step 3: Configure IP Address Space

  • Under settings, Select Address Space
  • In the IP Addresses tab, set the following:
  • IPv4 address space: 10.1.0.0/16 and Click on save button. This address space will allow multiple subnets within the virtual network.

Step 4: Create Subnets

  • Still in the IP Addresses tab, add two subnets:
  • Subnet name Address range
  • frontend 10.1.0.0/24
  • backend 10.1.1.0/24
  • Leave other settings as defaults.

For Frontend subnet

  • Under settings, Select Subnet
  • Select + Subnet
  • Give subnet a name frontend, enter starting address 10.1.0.0, enter size /24 and Click on Add.

For backend subnet

  • Under settings, Select Subnet
  • Select + Subnet
  • Give subnet a name backend, enter starting address 10.1.1.0, enter size /24 and Click on Add.

  • Frontend and the Backend Subnet as been created successfully

Step 5: Create the Hub-VNet Virtual Network

  • Create another virtual network called hub-vnet.
  • In the Azure portal, Search for and select Virtual Networks.

  • Select + Create

  • Enter the following properties:
  • Property Value
  • Resource group RG1
  • Virtual network name hub-vnet
  • Region East US
  • Select Review + create

  • Then Create.

  • Click on go to resources button

Step 6 Configure IP Address Space for the firewall subnet

  • Under settings, Select Address Space
  • In the IP Addresses tab, set the following:
  • IPv4 address space: 10.0.0.0/16 and Click on save button. This address space will allow multiple subnets within the virtual network.

Step 7 Create firewall subnet

  • Under settings, Select Subnet
  • Select + Subnet
  • Select subnet purpose azure, enter starting address 10.0.0.0, enter size /26 and Click on Add.

  • The Firewall subnet as been created successfully

Step 8 Configure a peer relationship between the virtual networks

  • Search for and select the app-vnet virtual network.

  • In the Settings blade, select Peerings.
  • + Add a peering between the two virtual networks.

  • Complete the following Configurations.

  • Remote peering link name: app-vnet-to-hub

  • Virtual network: hub-vnet

  • Local virtual network peering link name: hub-to-app-vnet

  • Note: Leave all other settings as their defaults. Select “Add” to create the virtual network peering.

  • Once the deployment completes, verify the Peering status is Connected.

Conclusion

Completing this project equips you with the foundational skills to design and configure virtual networks in the cloud. You’ve learned how to create a VNet, subdivide it with subnets, and establish VNet peering for cross-network communication. These tasks not only build your technical expertise but also prepare you for more advanced configurations like network security groups, VPN gateways, and hybrid connectivity. Ultimately, mastering virtual networking is a crucial step toward becoming proficient in cloud infrastructure management.

Top comments (0)