Virtual Network Peering: A Step-By-Step Guide
Step 1: Creating Virtual Networks and Subnets
- Login in to the Azure portal with your active subscription.
- Navigate to the Marketplace and search for Virtual Network service.
- Click on “create” to create a Virtual network.
- Enter the details like project details i.e. subscription type, Resource Group (either you can use existing resource group or create a new one) and Instance details i.e. Virtual network name and region(allocated by default).
- You may also enable Virtual network encryption to add an extra layer of security.
- click on “Review + create” to create and deploy your Virtual network.
- Similarly, create any number of Virtual networks as per your requirement.
- Now, your Virtual networks are ready, by default Virtual networks provide “default” subnet. You can use the default subnet to connect with resources or create new subnets as per your requirement.
- Make sure you have modified the default IP address for your VNet and subnets. Because, Virtual network peering cannot be done with two virtual networks with same IP addresses.
Step 2: Peer the Virtual Networks
- Navigate to your first Virtual network i.e. TestVnet1 and in the left menu, you can see the “Peerings”. Navigate to that section.
- Click on “Add ” to add a virtual network for peering.
- Enter current Virtual Network details:
- Enter the peering link name. Name it in a conventional manner(suggested).
- click on the given additional add-ons according to your requirement.
- Enter Remote Virtual Network details:
- Enter the peering link name. Name it in a conventional manner(suggested).
- Select a deployment model for your virtual network.
- Enter your resource ID(optional).
- Enter your subscription type. You may also connect the Virtual networks which are created in different subscriptions. Here you can choose your subscription in which the Remote virtual network is created.
- Also, You can choose the additional add-ons for managing the traffic.
- Click on “Add” to add the virtual network peering between the current virtual network and Remote virtual network.
- You can see the Peering status as “connected”.
- Similarly, navigate to the remote virtual network which you used in peering to check the peering status as well.
- So, now the resources can be inter communicated between these two virtual networks and this virtual network peering acts like a bridge between them.
What is Azure Virtual Network Peering ?
Imagine we have a virtual network named vnet1 which has address space assigned dynamically and subnets under that. so, the resources can be connected to subnets and they will be assigned with static Ip address. The resources which are connected to subnets can communicate with each other unless we restrict them. This is a default behavior. Similarly, we have another virtual network named vnet2. If we want the virtual networks to communicate with each other, it cannot happen dynamically. So we need Virtual network peering. In this article, let us understand Azure Virtual Network Peering.