This article provides steps for how to create an Azure-based hub virtual network (VNet) with subnets and address space from scratch, as well as how to configure a virtual network peering. This is to allow for the virtual networks to communicate with each other securely and privately.
A hypothetical Web Application requires network isolation and segmentation in a network for secure and private communication. The virtual networks and subnets will be created in the following steps.
Step 1: Create hub and spoke virtual networks and subnets
I. Creating the virtual networks
II. Create subnets for the first Virtual Network.
- At the dropdown menu displayed above the address space box on the displayed page, check that the dropdown is set to Add IPv4 address space
- In the address space box, change Subnet address range to 10.1.0.0/16 (This is usually the default IP address so you may not need to change it in this instance).
- locate a pen icon at the bottom corner, in the address space box (next to the garbage can icon). Click on this icon to edit the default Subnet name.
- Change Subnet name to frontend
- Also, change Subnet address range to 10.1.0.0/24 using the size label. Leave all other settings as their defaults.
Click Save to close the Edit Subnet pane. This
completes the creation of the first Subnet.The next step is to create the second subnet. As you can see, the
frontend subnet is listed in the box. We need to create another
subnet in this virtual network. Again, locate the pen
icon at the bottom (next to the garbage can icon). Click on this icon to
add another Subnet.Also, change the subnet name to backend, then change the
Subnet address range to 10.1.0.0/24.Again, leave all other settings as their defaults. Click Add to close the edit subnet pane.
Select Review + Create to validate the configurations and Create to create the first virtual network.
III. Creating the second virtual networks
- Creating the second virtual network is similar to creating the first virtual network.
- click the hamburger icon at the top left-hand side corner of the Azure portal.
- Again, in the displayed pane, select “Virtual Networks”.
- In the “Virtual Networks” portal pane, select “+ Create”.
- At the Resource group label select from the drop-down menu the first Resource group that was created.
- Also, give a name to the virtual network at the “virtual network name” label. Here the name I supplied was Hub-vnet.
- Select a similar Region from the dropdown like the first virtual network list at the Region label. In the previous virtual network, I selected East US.
- Next, Select the IP Addresses tab at the top of the page.
- set the IPv4 address space to 10.1.0.0/16
IV. Create a subnet for the second Virtual Network.
Step 2: Setup a peer relationship between the virtual networks
This article explains how to provide network isolation and segmentation for a web application, in an Azure virtual network with subnets with address space. It’s been great sharing my journey into cloud engineering and I hope to see you soon on the other articles.
Cover Image by Alina Grubnyak on Unsplash