VNet Peering

Virtual Network (VNet) Peering consistently stands out as one of the most efficient ways to connect Azure networks. In this article, I’ll cover everything you need to know about VNet Peering, from basic concepts to advanced implementation strategies.

VNet Peering

  • Virtual network peering in Azure is an excellent concept that helps you to connect multiple virtual networks in Azure seamlessly.
  • VNet peering helps you to route traffic between the virtual networks privately.

What is Azure VNet Peering

Virtual network peering enables you to connect two or more virtual networks seamlessly in Azure. Once peered, these networks appear as one for connectivity purposes, allowing resources in different VNets to communicate as if they were in the same network.

This results in:

  • Low-latency, high-bandwidth connections
  • Private IP communication between resources
  • Seamless integration between services

Why Should You Use VNet Peering?

Below are the reasons to implement VNet peering:

  1. Isolation with Communication: Maintain separate VNets for different departments (like Finance and Marketing) while still allowing necessary communication between them
  2. Cross-Region Connectivity: Connect resources deployed in different geographic regions
  3. Simplified Multi-Team Environments: Allow DevOps and Production teams to manage separate networks while maintaining connectivity
  4. Enhanced Security: Keep traffic on Microsoft’s private network rather than traversing the public internet

Types of VNet Peering

There are two primary types of VNet peering:

TypeDescription
Regional VNet PeeringConnects VNets within the same Azure region
Global VNet PeeringConnects VNets across different Azure regions

How VNet Peering Works

When you establish a VNet peering connection, Azure creates two connections – one from VNet A to VNet B and another from VNet B to VNet A. This connection enables traffic to flow using private IP addresses through Microsoft’s backbone network.

The key technical aspects of VNet peering include:

  • Traffic routing through Microsoft’s backbone infrastructure
  • Support for both IPv4 and IPv6 addresses
  • No encryption of traffic between the virtual networks
  • No transitive relationships (more on this later)

How to configure VNet peering in Azure

Let me guide you to create VNet peering in your Azure environment. I’ll assume you already have two VNets created that you want to connect. If not, you can create the VNet now.

Prerequisites

Before we begin, ensure you have:

  • Two or more Azure Virtual Networks
  • Non-overlapping IP address spaces in the VNets
  • Appropriate permissions (Network Contributor or Administrator)

Setting Up Regional VNet Peering

Here’s how to configure VNet to VNet peering:

  1. Navigate to your Virtual Network:
    • Log in to the Azure portal
    • Search for “Virtual Networks” and select the service
what is vnet peering
  • Select the first VNet you want to peer

2. Access Peering Configuration:

  • In the left navigation panel, select “Peerings” under the Settings node as shown in the screenshot below.
vnet peering
  • Click “+ Add” to create a new peering connection
azure vnet peering

3. Configure Peering from First VNet:

  • Name your peering connection (e.g., “Peer-VNet1-to-VNet2”)
  • Choose “Virtual network” for the connection type
  • Select the subscription and virtual network to peer with
  • Name the reverse peering connection (e.g., “Peer-VNet2-to-VNet1”)
  • Configure optional settings (more on these below)
  • Click “Add” as shown in the screenshot below.
global vnet peering
vnet to vnet peering

The screenshot below shows that the virtual network peering has been added successfully.

vnet peering in azure

Verify Peering Status:

  • Check that the peering status shows “Connected” for both VNets as shown below.
how to create vnet peering in azure
how to configure vnet peering in azure

Important Configuration Options

When setting up peering, you can also use these as the optional settings:

  • Allow virtual network access: Enable direct connectivity between VMs in the peered networks
  • Allow forwarded traffic: Allow traffic forwarded by a network virtual appliance
  • Allow gateway transit: Allow the peer VNet to use your VNet’s gateway
  • Use remote gateways: Use the peer network’s gateway for outbound connectivity

Best Practices for VNet Peering Implementation

The following are the best practices

Planning Your Network Architecture

  1. Consider using a hub-and-spoke topology for complex environments

Security Considerations

  1. Use Network Security Groups (NSGs) to control traffic between peered VNets
  2. Implement least-privilege access between networks
  3. Monitor network traffic using Network Watcher or Azure Monitor

Performance Optimization

  1. Keep latency-sensitive applications in the same region when possible
  2. Understand bandwidth limits based on VM sizes
  3. Monitor peering connections for potential bottlenecks

Common VNet Peering Issues and their Solutions

You may encounter issues with VNet peering. Here are some common problems I’ve faced and how to resolve them:

Problem: Peering Shows “Initiated” Status

Solution: Ensure both sides of the peering are properly configured. Check permissions and validate that the VNet names are correct.

Problem: Resources Cannot Communicate Despite Connected Peering

Solution: Verify Network Security Groups (NSGs) aren’t blocking traffic. Confirm that the VM network interfaces are configured correctly.

Problem: Cannot Establish Peering Between VNets

Solution: Check for IP address space overlaps. Ensure you have the proper permissions in both VNets.

Azure VNet peering limitations.

  1. Transitive peering is not supported here. To clarify, let’s consider a scenario: Suppose X has peered with Y, Y has peered with X but not with Z.
  2. If your virtual networks have matching CIDR blocks, you cannot create virtual network peering in this scenario.

Azure VNet peering pricing.

Below is the pricing structure you need to consider if you want to use the Azure virtual network peering.

For the same region

If the Azure virtual networks belong to the same region, you must pay $0.01/GB for inbound data transfer and $0.01/GB for outbound data transfer.

You can now check out the Azure Virtual Network Peering Pricing for more information.

Conclusion

VNet peering provides a powerful way to connect these networks with low latency, high bandwidth, and simplified configuration.

Implementing the best practices in this article will create a robust, scalable network infrastructure for your Azure workloads.

You may also like the following articles below

Azure Virtual Machine

DOWNLOAD FREE AZURE VIRTUAL MACHINE PDF

Download our free 25+ page Azure Virtual Machine guide and master cloud deployment today!