DEV Community

Cover image for Virtual network peering
Freddie HOLMES
Freddie HOLMES

Posted on • Edited on

Virtual network peering

*Create and configure Azure virtual networks*

First, let’s talk what Azure virtual network actually is.
An Azure Virtual Network (VNet) is a fundamental networking service in Microsoft Azure that allows you to create your own private network in the cloud.

Think of it like creating your own private data center network in Azure, with the flexibility and scalability of the cloud. You define the address space, create subnets, and control how traffic flows in and out.

Key aspects of virtual network.
It provides:
*Isolation and segmentation* - VNets provide a logically isolated section of the Azure cloud where you can launch Azure resources in a network you define. You have complete control over IP address ranges, subnets, route tables, and network gateways.

*Communication capabilities* - VNets enable Azure resources like virtual machines, web apps, and databases to communicate with each other, with on-premises networks, and with the internet. Resources within the same VNet can communicate by default.

*Connectivity* - You can connect VNets to on-premises networks using VPN connections or ExpressRoute for dedicated private connections. You can also connect multiple VNets together through VNet peering.

*Security* - VNets support network security groups (NSGs) to filter traffic, and you can segment your network into subnets for better organization and security. Resources in a VNet are isolated from other VNets by default unless you explicitly connect them.

In my exercise I will create and configure VNET peering.

In this exercise our organization is migrating a web-based application to Azure. My first task is to put in place virtual networks and subnets. I also need to securely peer the virtual networks.

Two virtual networks are required, app-vnet and hub-vnet This simulates a hub and spoke network architecture.

The *app-vnet* will host the application. This virtual network requires two subnets. The *frontend* subnet will host the web servers. The *backend* subnet will host the database servers.

The *hub-vnet* only requires a subnet for the *firewall*
The two virtual networks must be able to communicate with each other securely and privately through virtual network peering.
Both virtual networks should be in the same region.

For this exercise we need to create the following:

  1. *Create a virtual network*
  2. *Create a subnet*
  3. *Configure vnet peering*

This exercise requires Azure subscription. My subscription is *DevOps Lab*

Let’s get started
First I need to Create and complete the configuration of the *app-vnet* This virtual network requires two subnets, *frontend* and *backend*

from the below description.

*Property* *Value*

Resource Group RG1
Virtual network name app-vnet
Region East US
IPv4 address space 10.1.0.0/16
Subnet name frontend
Subnet address range 10.1.0.0/24
Subnet name backend
Subnet address range 10.1.1.0/24

  1. Login to Azure portal https://portal.azure.com/auth/login/

  2. Search for and select Virtual Networks.

  1. Click *+ Create* to create a new Virtual Network.

4 provide details, Resource Group is RG1 virtual network is app-vnet, region is East US

5 Click on default and select the *pencil icon*

6 I need to configure frontend IP 10.1.0.0/16 select default and click the *pencil icon*
Change the subnet name from default to *frontend* and click *Save*


I will click on Add to add additional subnet.
7 Add additional subnet for backend.


8 Change the subnet 10.1.0.0/24 name from default to backend and Save.


9 Review the changes made and click Review+Create

10 verify *validation* and click *Create*

11 Second I need to Create the *hub-vnet* virtual network configuration. This virtual network has the firewall subnet.
In this scenario I need to configure Azure firewall to secure my hub-vnet.

Property Value

Resource group RG1
Name hub-vnet
Region East US
IPv4 address space 10.0.0.0/16
Subnet name AzureFirewallSubnet
Subnet address range 10.0.0.0/26

12 From the Azure portal search Virtual Network

13 provide my details I am using the same RG1 resource group. Virtual network name is hub-vnet region is East US and click on the IP address Tab

14 Select default and click the *pencil icon*

15 Change the subnet purpose to Azure Firewall since we will be using firewall for this *hub-vnet* and click *Save*

16 Next view the changes made and click *Review+Create*

17 Verify *validation* and click *Create*

I have created both *app-vnet* and *hub-vnet* Now I need to create VNET peering

*Virtual network peering* enables you to seamlessly connect two or more Virtual Networks in Azure.

*Property* *Value*
Remote peering link name *app-vnet-to-hub*
Virtual network *hub-vnet*
Local virtual network peering link name hub-to-app-vnet

18 Search for Virtual network in Azure portal
and select the app-vnet virtual network.

19 In the *Settings blade* select *Peerings*

20 Click + Add and provide peering link name. Mine is *app-vnet-to-hub*

21 Peering link name is *hub-to-app-vnet*

22 verify and observe that my vnet peering is connect and fully synchronized.

Hope this resource was helpful.

Top comments (0)