Types of VNet peering

Key benefits and capabilities
What this demo covers
In this lesson we demonstrate VNet peering by:- Deploying two Linux VMs into separate VNets (one in East US, one in West US).
- Creating peering between those VNets.
- Verifying name resolution and connectivity (before and after peering).
Repository and deployment script
- Open the repository folder:
Administer Intersite Connectivity. - This folder contains
peering-pref-infra.ps1, a PowerShell script that deploys:- Two virtual networks with non-overlapping address spaces.
- Two Linux VMs (one in East US, one in West US) for testing.
Preparing and inspecting resources (DNS lookups)
The test environment includes DNS lookups from a workload VM to demonstrate name resolution across VNets and to external DNS records. Example nslookup outputs:Deploying the test environment
- Confirm your current Azure context:
- Run the deployment script:
- Creates two VNets with non-overlapping address ranges (this is required — do not overlap).
- Deploys one Linux VM in the East US VNet and one Linux VM in the West US VNet.
- Assigns private IPs for the demo (examples:
192.168.0.4and192.168.1.4).
Initial connectivity test (before peering)
SSH into the East US VM and confirm its IP configuration:Make sure VNets you plan to peer do not have overlapping IP address ranges. Overlapping address spaces prevent successful peering and cause routing conflicts.
Configuring VNet peering in the Azure portal
To add peering from the portal:- Open one of the virtual networks (either East US or West US) in the Azure portal.
- Select “Peerings” → “Add”.
- Provide a name for the local peering (for example,
WUS-EUS-Link). - Configure peering options:
- Allow virtual network access (enable to allow VM-to-VM traffic).
- Allow forwarded traffic (enable if you expect to route forwarded traffic).
- Allow gateway transit / Use remote gateways — enable only if you intend to route on-premises traffic through a remote gateway.
- Select the remote virtual network and create the peering. Repeat on the remote VNet if required — Azure will show peering status changes as the connection is established.
If you need to route on-premises traffic through peered VNets, enable gateway transit on the VNet with the gateway and enable “Use remote gateways” on the VNet that needs to use it. This requires a gateway in one VNet and proper permissions.

Testing connectivity after peering
Once peering is connected, retry the ping from the East US VM to the West US VM:Network Security Group (NSG) considerations
- Default NSG rules include
AllowVNetInboundwhich permits traffic from within the same VNet and from peered VNets. For many scenarios, no additional NSG changes are required. - To restrict peered traffic, add explicit NSG rules with higher priority to allow or deny traffic from specific IP ranges (include the peered VNet’s address ranges).
Best practices and summary
- Always plan and verify non-overlapping IP address spaces before peering.
- Use peering for high-performance, private connectivity across VNets and regions.
- Configure gateway transit only when necessary and ensure only the VNet with the gateway exposes transit to others.
- Both sides of the peering must reflect the connection; validate the peering status in the Azure portal or via CLI/PowerShell.
- Review NSG rules if you need to tighten or allow specific traffic flows across the peering.
Links and references
- Azure Virtual Network Peering overview
- Create a virtual network peering in the portal
- Azure networking documentation