How To Configure Virtual Network Peering in Azure
In this tutorial, I will be guiding you on how to set up a virtual network peering in Azure. Why do we need to set up the virtual network peering? When we have different virtual networks with resources in each network and we need the resources in those different networks to communicate with each other over a low-latency, high-bandwidth connection using the Microsoft backbone network. When we are done creating the virtual network peering it will enable us to connect two or more Virtual Networks in Azure and the resources in those networks will communicate with each other. What is Azure Virtual Network? Azure Virtual Network is the fundamental building block for your private network in Azure. A virtual network enables many types of Azure resources, such as Azure Virtual Machines (VM), to securely communicate with each other, the internet, and on-premises networks. A virtual network is similar to a traditional network that you’d operate in your own data center. An Azure Virtual Network brings with it extra benefits of Azure’s infrastructure such as scale, availability, and isolation. Virtual Network Peering? Virtual network peering links virtual networks, enabling you to route traffic between them using private IP addresses. Ingress and egress traffic is charged at both ends of the peered networks. Supported Peering in Azure; Virtual network peering: Connecting virtual networks within the same Azure region. Global virtual network peering: Connecting virtual networks across Azure regions. Build in the cloud with an Azure free account Are you ready to follow along with this tutorial? If your answer is Yes! Then click here to register for Azure Subscription. Virtual Network pricing Virtual Network in Azure is free of charge. Every subscription can create up to 50 Virtual Networks across all regions. Inbound and outbound traffic is charged at both ends of the peered networks. Network appliances such as VPN Gateway and Application Gateway that are run inside a virtual network are also charged. Click the link to read more: Virtual Network Pricing | Microsoft Azure Overview We will be creating two virtual networks and we will be naming them abcofcloudVNetHQ and abcofcloudVNetBranch, after creating the virtual networks, we will then create two virtual machines named VM1 and VM2. VM1 will be placed in a subnet in abcofcloudVNetHQ and VM2 will be placed in a subnet in abcofcloudVNetBranch. Creating a Virtual Network We will start with creating the abcofcloudVNetHQ. Step 1: Sign into the Azure Portal. Step 2: Search for virtual network in the Azure portal search box. Step 3: In the search results, select virtual network right under Marketplace. Step 5: Under the Basics tab, choose the Subscription you want to use for this virtual network. Step 6: A Resource group can be selected from the existing resource group, or a new resource group can be created by clicking on Create new. We will be using the abcofcloudRG for this tutorial. Step 7: Enter a preferred name for the virtual network, for this tutorial, we will be naming the virtual network abcofcloudVNetHQ. Step 8: Choose a preferred location for the virtual network, by clicking on the drop-down and selecting the region you prefer, and then clicking on Next at the bottom, we will be using the UK South for this tutorial. For this tutorial, we will leave the Security tab with the default settings and click on Next. We will be using the 172.20.0.0/16 for our address space and for the subnet, we will be using 172.20.0.0/24 for the Subnet Address range. Step 9: Click on the 3 dots beside the Add a subnet and then click on the Delete address space. Step 10: click on the Add an IP address space, and select the IPv4 with the Starting address as 172.20.0.0, the Address space size will be /16 (65536 addresses) then click on Add. Step 11: Select the + Add a subnet button and enter the HQSubnet1 for the Subnet Name and the Starting address as 172.20.0.0 with the Subnet size as /24 (256 addresses) and then click on Add. Once that is done click on Review + Create and select Create. What we need to do next is create the second Virtual Network which is abcofcloudVNetBranch using the same procedure from Step 1 to Step 11 but we just need to make a few changes. Resource group: abcofcloudRG Virtual network name: abcofcloudVNetBranch Region: UK South IP Address space: 172.22.0.0/16 Subnet name: BranchSubnet1 Starting Address: 172.22.0.0 Subnet size: /24 (256 addresses). Bonus: After creating both virtual networks, in the search box at the top type Network Watcher and on the Network Watcher page click on Topology. Select the Subscription and the Resource Group, you will see both virtual networks and their subnets, but once the peering is added you will see a line showing the peering has been added. Creating a Virtual Network Peer This is the point where we will peer the virtual networks, for us to do that we need to locate the virtual network we created. We can either do this by going to the Resource group “abcofcloudRG” or using the search box. Step 1: Search for abcofcloudVNetHQ in the Azure portal search box and select it. Step 2: On the abcofcloudVNetHQ virtual network page, click on Peerings Under the Settings area and then click on + Add. Once that is done, we need to add peering from this virtual network “abcofcloudVNetHQ” to the remote virtual network “abcofcloudVNetBranch”. Step 3: Now that we are on the Add peering page, we need to choose a preferred name for the peering link name for this virtual network, and for this tutorial, I will be using the abcofcloudVNetHQ-to-abcofcloudVNetBranch. Step 4: Since the goal is to allow resources in both virtual networks to communicate, for Traffic to remote virtual network, I will leave it on Allow(default), and for Traffic forwarded from a remote virtual network, I will leave it on Allow(default). The Virtual network gateway or Route Server will be None(default). Step 5: Now it is time to give
How To Configure Virtual Network Peering in Azure Read More »