Create Local Area Network in Azure

Problem

When you want to learn how to add computers to LAN (Local Area Network), you must face a problem in which environment you want to apply. Ideally you implement it in on-premise environment such as in your office.

However, it’s almost impossible to test your office infrastructure for learning purpose. Therefore, throughout this tutorial we want to simulate how you can create LAN (Local Area Network) and then add computers to this network. We will simulate it using Azure Virtual Network that will represent the LAN as well as using Azure Virtual Machines to represent the computers.

This knowledge later can be applied to your on-premise environment.

Prerequisites

To follow this tutorial, you need Azure account with active subscription.

Sign in to Azure

You must sign in to Azure portal.

Create Virtual Network

  1. Search for Virtual networks in Azure portal search bar, then select.

    Please not to choose Virtual networks (classic) because there will be an issue when you want to attach virtual machine to the network later.

search virtual network resource
  1. Select Create that will navigate you to Create virtual network page.

    Fill all required details as follows:

    • Subscription: Enter your active subscription
    • Resource Group: You can use existing resource group or Create a new one if not exists
    • Virtual network name: Give the name of your network
    • Region: Choose your closest region to reduce latency
    create virtual network page - basics tab

    In IP addresses tab, delete existing IP address space then create a new one because we want to create a small network consists of only two subnetworks.

    IP address space is a range of possible IP addresses that can be assigned to the devices in the network. We will use 10.0.0.0/28 which means IP addresses will range from 10.0.0.0 to 10.0.0.15.

    Add IP address space

    Next, select Add a subnet to create the first subnetwork where the address spacee is 10.0.0.0/29 (10.0.0.0 - 10.0.0.7).

    first subnetwork

    Repeat the same step to create the second subnetwork where the address space is 10.0.0.8/29 (10.0.0.8 - 10.0.0.15).

    second subnetwork

    The final network will look as follows:

    final network settings
  2. Select Review + create. If all validations are passed, then select Create to create your virtual network

  3. Wait until deployment is completed

a complete virtual network deployment

Create Virtual Machines

  1. Search for Virtual machines in Azure portal, then select.
search virtual machines in azure portal
  1. Select Create. In dropdown list, choose Azure virtual machine that will navigate you to Create a virtual machine page.

  2. In this page, there are some tabs you need to fill to align with this tutorial. The rest can be left as it is.

    One mandatory requirement is to put our virtual machines in the same subscription and region of virtual networks.

    In Basics tab, fill some required details as follows:

    • Subscription: It must be the same with our virtual network’s subscription
    • Resource Group: Use the same resource group we use in creating virtual network
    • Virtual machine name: Give the name for our first virtual machine
    • Region: It must be the same with our virtual network’s region
    • Image: Use Windows image. In this case, Windows 10 image is enough
    • Size: Use at least 4 GiB memory
    • Username, Password, Confirm password: Create account (username and password) for administrator
    create virtual machines - basics tab create virtual machines - basics tab 2

    Do not forget to tick Licensing checkbox at the bottom of Basics tab.

  3. Next, go to Networking tab.

    Choose virtual network we create in previous section and put this virtual machine to the first subnet.

create virtual machines - networking tab
  1. Select Review + create. If all validations are passed, then select Create to create your first VM. Wait until deployment is completed.
a complete virtual machine deployment
  1. Repeat the same steps to create the second VM. You could name it as vm-2, Username as admin-vm2. Put this VM to the same virtual network but different subnet which is subnet-2. The rest could be left as is.

Automation

To automate deployment of above resources, you could use Azure portal to export the template that can be reused later.

  1. Select Resource Group used in this tutorial, i.e., Demo, then select Export template
Select export template in resource groups
  1. In Export template page, select Download to get the exported template. The template is in JSON format which is also called ARM template, one of many methods to perform automation in Azure.

    download template
  2. The template cannot be used as is, so you have to customize it. The following attachments are the original and custom template respectively.

    The original template is only a sample while you should apply the custom one.

  • ExportedTemplate-Demo-Original.zip (3 KB)

  • ExportedTemplate-Demo-Custom.zip (2 KB)
  • Conclusion

    In this case, we show you how to create virtual network that represent a LAN and add virtual machines that represent computers. The network consists of two subnetworks. The first VM is attached to the first subnet and the second one is attached to the second subnet.

    Don’t forget to delete all the resources if you don’t use them anymore because the bill will still be running even though the resources are idle.

    To automate resources deployment, you can export ARM template from the portal then customize it because it can’t be used as is.