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, a few considerations must be put in place:
1. 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 18.104.22.168/16.
2. 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) and gateway transit is usefully 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 go ahead and ping one of my VMs in the docker-rg1-VNet that has 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.