VNet Peering is used to create connectivity between two or more Azure virtual networks hosting different resources, and these can be VNets in different resource groups residing in different locations. This communication happens over the Microsoft backbone network and hence doesn’t traverse over the Internet.
To create VNet-to-VNet connectivity, these are some of the considerations.
- The address space of both VNets should not be overlapping. In my example am using two VNets, one of the private IP range of 10.0.0.0/16 and the other of 126.96.36.199/16.
- Each VNet can have up to a maximum of VNet-to-VNet 100 Connections.
To get started creating VNet connectivity, we access our first VNet and click on the peerings section.
And then, we create our VNet peerings for both VNets in one place.
We leave the options for forwarded traffic disabled and Gateway transit settings un-checked. Forwarded traffic is suited for hub and spoke VNet networks (shared services between VNets, e.g., domain controller). Gateway transit is useful, especially when working with Site-to-Site VPN in a scenario that we want more than one VNet to share the gateway. More on this will be covered in a future article.
To confirm that our VNet peering has worked. I will ping one of my VMs in the docker-rg1-VNet with a private IP address of 10.0.0.4. My ping origin is from a Virtual Machine in myVNetB and has a private IP address of 172.16.0.4.