DEV Community

1suleyman
1suleyman

Posted on

Exercise 01: Create and Configure Virtual Networks

Scenario

In this exercise, I worked on migrating a web-based application to Azure. My first task was to establish the virtual networks and subnets required for the project. I also needed to securely peer the virtual networks. Below are the key requirements for this exercise:

  • Two Virtual Networks: The first virtual network, app-vnet, will host the application and is divided into two subnets: a frontend subnet for web servers and a backend subnet for database servers. The second virtual network, hub-vnet, will only require a subnet for the firewall.
  • Virtual Network Peering: The two virtual networks must be able to communicate with each other securely and privately through virtual network peering.
  • Region: Both virtual networks should be located in the same region.

Skilling Tasks

  • ✅ Create a virtual network
  • ✅ Create a subnet
  • ✅ Configure VNet Peering

Exercise Instructions

To complete this exercise, I signed in to the Azure portal and began by creating the required virtual networks and configuring their subnets.


Step 1: Create Hub and Spoke Virtual Networks and Subnets

I started by creating the app-vnet, which required two subnets: a frontend subnet and a backend subnet. Here's the process I followed:

1️⃣ Sign in to the Azure Portal: I navigated to Azure Portal and searched for Virtual Networks.

2️⃣ Create the app-vnet:

  • I clicked on + Create to start creating a new virtual network.
  • I filled out the following information for the app-vnet:
Property Value
Resource Group RG1
Virtual Network Name app-vnet
Region Uk South
IPv4 Address Space 10.1.0.0/16
Subnet Name (Frontend) frontend
Subnet Address Range (Frontend) 10.1.0.0/24
Subnet Name (Backend) backend
Subnet Address Range (Backend) 10.1.1.0/24

I left all other settings as their defaults and clicked Review + Create, then Create.

3️⃣ Create the hub-vnet: This network only needed one subnet for the firewall.

  • I followed similar steps as the app-vnet creation, but for the hub-vnet:
Property Value
Resource Group RG1
Name hub-vnet
Region Uk South
IPv4 Address Space 10.0.0.0/16
Subnet Name AzureFirewallSubnet
Subnet Address Range 10.0.0.0/26

After filling in the details, I clicked Review + Create and then Create.

4️⃣ Verify Virtual Networks and Subnets:

  • Once both virtual networks were deployed, I searched for and selected Virtual Networks in the Azure portal.
  • I confirmed that both app-vnet and hub-vnet were created with their respective subnets.

Step 2: Configure VNet Peering

Now that I had both virtual networks set up, I moved on to configure VNet Peering to ensure they could communicate securely.

1️⃣ Search for and select app-vnet:

  • In the Settings blade of app-vnet, I selected Peerings.

2️⃣ Add Peering:

  • I clicked + Add to set up the peering between app-vnet and hub-vnet.
Property Value
Remote Peering Link Name app-vnet-to-hub
Virtual Network hub-vnet
Local Virtual Network Peering Link Name hub-to-app-vnet

I left all other settings as defaults and clicked Add to create the virtual network peering.

3️⃣ Verify Peering Status:

  • After the deployment completed, I verified that the Peering Status for both networks showed Connected.

Key Learnings

Here are the key takeaways from this exercise:

1️⃣ Azure Virtual Networks (VNets)

Azure virtual networks provide a secure and isolated network environment for Azure resources. Each VNet can have multiple subnets that segment IP address ranges, providing organization and security.

2️⃣ Subnets

A subnet is a range of IP addresses within a VNet. You can create multiple subnets within a VNet, each serving different purposes (e.g., frontend, backend, firewall).

3️⃣ Virtual Network Peering

Virtual network peering connects two virtual networks and allows them to communicate as though they are part of the same network. In my case, I created a hub-and-spoke architecture, where app-vnet (the spoke) communicates with hub-vnet (the hub) via peering.


Conclusion

In this exercise, I successfully created two virtual networks (app-vnet and hub-vnet) in Azure, configured subnets within these networks, and established VNet peering to enable secure communication between the networks. Through these steps, I gained hands-on experience with creating and managing virtual networks in Azure, which is fundamental for building secure cloud infrastructures.

🌐 Stay tuned for more as I continue my learning journey with Azure networking and other Azure services!

Heroku

Built for developers, by developers.

Whether you're building a simple prototype or a business-critical product, Heroku's fully-managed platform gives you the simplest path to delivering apps quickly — using the tools and languages you already love!

Learn More

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Explore a trove of insights in this engaging article, celebrated within our welcoming DEV Community. Developers from every background are invited to join and enhance our shared wisdom.

A genuine "thank you" can truly uplift someone’s day. Feel free to express your gratitude in the comments below!

On DEV, our collective exchange of knowledge lightens the road ahead and strengthens our community bonds. Found something valuable here? A small thank you to the author can make a big difference.

Okay