In last few posts, I have been trying to publish the things I learned about Azure Virtual Networks. If you want to have a look at them, below is the list:
- Getting started with Azure Virtual Networks
- Azure Virtual Networks – Public and Private IPs
- Azure Virtual Networks – Network Security Groups
- Azure Virtual Networks – Application Security Groups
- Creating Azure virtual network using Azure Portal
- Azure Virtual Networks – Filtering traffic using NSG
- Azure Virtual Networks – Security Rules using ASG
In this short post, let’s see how to enable peering among the virtual networks.
Global VNet Peering
You can connect multiple networks using virtual network peering. Both of the virtual networks can either be in same region, or they can be in different region. If both virtual networks are in different regions, then it is called as Global VNet Peering
.
We already have created the virtual network in previous article. Now, we will create a virtual network and add a peering between these two networks.
You would need to have an Azure account with an active subscription. If you do not have it yet, you can create one for free. And then sign in to the Azure portal.
Create new virtual network
From the Azure portal menu, select Create a resource. From the Azure Marketplace, select Networking > Virtual network.
In first screen of Create Virtual Network wizard, provide below details:
- Subscription: select appropriate subscription,
- Resource Group: create a new resource group with name
blog-samples
. - Name: the name for virtual network, e.g.
blog-demo-vnet-2
- Region: the region where the resource should be created
On next screen of IP Addresses,
- IPv4 Address Space, For this demo, select the default IPv4 Address space and select the default addresses 10.2.0.0/16.
- Subnet, keep the default subnet (10.2.0.0/24), make sure you check both the checkboxes
Then click on Review + Create button and then click on Create button. It would take couple of seconds to create the virtual network.
Enable Peering
The virtual network would be created instantly. Open the newly created virtual network and select Peering option from left side navigation. Then click on Add to create the new peering.
The new panel takes two set of inputs. It will create two links and both peering links are created from the same panel.
For each peering link below details are required to be provided:
- Peering link name, the name of this link
- Traffic to remote virtual network, allow connectivity between two networks
- Traffic forwarded from remote virtual network, whether to allow traffic forwarded from the remote virtual network.
- Virtual Network Gateway
This set of inputs are first asked for the currently opened virtual network.
Once these are provided for current virtual network, same set of inputs should be provided for the remote virtual network with which the peering is required to be done.
Verifying
You can verify the connectivity easily. Create a new virtual machine in the newly created virtual network. Then try to ping from this new VM to the demo-vm1
which is in the remote virtual network. If the connectivity is setup, then the ping should be successful. Please refer the detailed steps from one of my previous blog post.
I hope you found this helpful. Let me know your thoughts.