Creating an Azure Virtual Network with Multiple Subnets
Tags: cloudcomputing, cloudpractitioner, cloudstorage, cloudlearning
Published: 2024-07-12 05:55:06

One of the key feature of networking is the ability to connect multiple machines together to share resources and, in some cases, to act as a way to even out the workload or traffic within a network infrastructure. Creating an Azure Virtual Network (VNet) with multiple subnets gives us the advantage of logically isolating different components of a defined network infrastructure, providing flexibility and security. 
Today In this blog post we will consider creating an Azure Virtual Network with four subnets using the address space 192.148.30.0/26.  
I’ll  be your guide as we take a step by step journey through this virtual walk. Come with me.

## Why Use Azure Virtual Networks?

Azure Virtual Networks offer several advantages:

1. Isolation: with Subnets within a Virtual Network you can decide to isolate different tiers of your application or infrastructure, such as front-end, back-end, and database tiers.
   
2. Security: Based on security needs within an organisation, you can decide to apply Network Security Groups (NSGs) to subnets to control inbound and outbound traffic, enhancing security.

3. Connectivity Options: When it comes to virtual networks, there is wide range of connectivity options open to an organisation. This is due to the fact that virtual networks support connectivity to on-premises networks, other virtual networks, and the internet, providing flexibility in network design.

4. Scalability: Virtual Networks permits either horizontal or vertical scaling, as such you can scale up as your application grows, accommodating additional resources and expanding to multiple regions if needed.


**Prerequisites**
Before we begin, ensure you have:
- An Azure subscription. If you don't have one, you can [create a free account](https://azure.microsoft.com/free/).
- Basic familiarity with Azure Portal and networking concepts.
- A plan for subnet allocation within the address space 192.148.30.0/26.

### Step 1 Sign in to Azure Portal:
   - Navigate to [portal.azure.com](https://portal.azure.com/) and log in with your Azure account.

### Step 2 Create a Virtual Network:
   - from the Azure portal home page Click on **Virtual network**.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ugg7m8vi6wrrj79nk2dq.png)

- in the virtual networks default page Click on **+Create**.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ifiz1cn9vxkf6l30kyvt.png)

- Fill in the required details:
     - **Subscription**: Choose your subscription.
     - **Resource group**: Create a new one or select an existing 
         resource group.
     - **Name**: Enter a name for your VNet, e.g., `MyVNet`.
     - **Region**: Choose the Azure region where you want to deploy the 
         VNet.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fudpvi84wm8azyyk0o45.png)

- Click on **Next** and **Next** again to get to the **IP Addresses Tab**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m7j96g7lr5tz4kop1qc1.png)
     
- **Address space**: Enter `192.148.30.0/26` as the address space.The image below shows that we can have 64 addresses within this network.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6iq4x9jh5jazb9pujjy9.png)

if you noticed our IP Address tab is showing signs of an error because we are yet to configure our subnets. so the next step for us now is to configure our subnet.

### Step 3 Configure Subnets:
 
   - Let us first of all delete the **Default subnet**.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mhv50a14m7f3570lv26k.png)
look at the bottom right hand corner of your screen, you should see a **Delete** icon. click on it ![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hiule0hb9kg9vfjzotlz.png)
to delete the default subnet.

Now that we have deleted the default subnet let us do one more thing and that is specifying the names that we will use for our four subnets. for the tutorial let us use 'frontend', 'backend', 'management', and then 'database'. Okay we can continue...
 
   - just immediately after the area where we added the address space 
     click on **+ Add Subnet**.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kyhcu1b5b7svhktzplc2.png)
   
- **Name**: Specify the name `FrontEnd` for the first subnet

- **Address range**: Assign a portion of the Virtual Network's address 
    space to each subnet. For our first subnet `FrontEnd`: 
    192.148.30.0/28 (16 IP addresses).  

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wpy8m8vlmkuu06b43dzo.png)

- Repeat this step three more times to create four subnets with the 
  following details:

        BackEnd: 192.148.30.16/28 (16 IP addresses)
        Management: 192.148.30.32/28 (16 IP addresses)
        Database: 192.148.30.48/28 (16 IP addresses)
   
   Ensure the subnet address ranges do not overlap and fit within the 
   VNet's address space.

### Step 4 Review and Create:
   - Review your configuration settings.
   - Click **Review + create** 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ukudj2owcet4hfsysbjh.png)

if all the settings are in order the way you have planned it, then Click on **Create** to provision the Virtual Network and subnets.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n2l064wmm6g0jk8fyqyr.png)

### Step 5 Verification:
Once the virtual network and its subnets have been provisioned the next step is to verify its creation.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rqz6ad3wz24cbtjy9ds3.png)

      - Click **go to Resources** it will take you to the home page of 
        the virtual network you created.

      - Click **settings** on your left pane of your screen, a list of of 
       menus will appear.
     
      - Click **subnets** to see a list of of the subnets you created on 
       the right side of the screen.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f2363a9y5g8n095fq3qv.png)

Bravo! we have successfully created and deployed an Azure Virtual Network with four subnets given the address space 192.148.30.0/26.

In conclusion, we can appreciate that creating an Azure Virtual Network with multiple subnets using the address space 192.148.30.0/26 provides a robust foundation for deploying and managing your Azure resources. By following the steps outlined in this guide, you can efficiently organize and secure your network infrastructure while leveraging Azure's scalability and connectivity options. Whether you're building a small-scale application or a complex enterprise solution, Azure Virtual Networks offer the flexibility and control needed to meet your networking requirements effectively.