Wednesday 24 July 2024

Connect virtual networks with virtual network peering using the Azure portal

 

Connect virtual networks with virtual network peering using the Azure portal

Diagram of Azure resources created in tutorial.

In this tutorial, you learn how to:

  • Create virtual networks
  • Connect two virtual networks with a virtual network peering
  • Deploy a virtual machine (VM) into each virtual network
  • Communicate between VMs

Prerequisites

Sign in to Azure

Sign in to the Azure portal.

Create a virtual network and an Azure Bastion host

The following procedure creates a virtual network with a resource subnet, an Azure Bastion subnet, and a Bastion host:

  1. In the portal, search for and select Virtual networks.

  2. On the Virtual networks page, select + Create.

  3. On the Basics tab of Create virtual network, enter, or select the following information:

    SettingValue
    Project details
    SubscriptionSelect your subscription.
    Resource groupSelect Create new.
    Enter test-rg for the name.
    Select OK.
    Instance details
    NameEnter vnet-1.
    RegionSelect East US 2.

    Screenshot of the Basics tab for creating a virtual network in the Azure portal.

  4. Select Next to proceed to the Security tab.

  5. In the Azure Bastion section, select Enable Bastion.

    Bastion uses your browser to connect to VMs in your virtual network over Secure Shell (SSH) or Remote Desktop Protocol (RDP) by using their private IP addresses. The VMs don't need public IP addresses, client software, or special configuration. For more information, see What is Azure Bastion?.

     Note

    Hourly pricing starts from the moment that Bastion is deployed, regardless of outbound data usage. For more information, see Pricing and SKUs. If you're deploying Bastion as part of a tutorial or test, we recommend that you delete this resource after you finish using it.

  6. In Azure Bastion, enter or select the following information:

    SettingValue
    Azure Bastion host nameEnter bastion.
    Azure Bastion public IP addressSelect Create a public IP address.
    Enter public-ip-bastion in Name.
    Select OK.

    Screenshot of options for enabling an Azure Bastion host as part of creating a virtual network in the Azure portal.

  7. Select Next to proceed to the IP Addresses tab.

  8. In the address space box in Subnets, select the default subnet.

  9. In Edit subnet, enter or select the following information:

    SettingValue
    Subnet purposeLeave the default of Default.
    NameEnter subnet-1.
    IPv4
    IPv4 address rangeLeave the default of 10.0.0.0/16.
    Starting addressLeave the default of 10.0.0.0.
    SizeLeave the default of /24 (256 addresses).

    Screenshot of configuration details for a subnet.

  10. Select Save.

  11. Select Review + create at the bottom of the window. When validation passes, select Create.

Repeat the previous steps to create a second virtual network with the following values:

SettingValue
Namevnet-2
Address space10.1.0.0/16
Resource grouptest-rg
Subnet namesubnet-1
Subnet address range10.1.0.0/24

Create virtual network peer

Use the following steps to create a two way network peer between vnet1 and vnet2.

  1. In the search box at the top of the portal, enter Virtual network. Select Virtual networks in the search results.

  2. Select vnet-1.

  3. In Settings select Peerings.

  4. Select + Add.

  5. Enter or select the following information in Add peering:

    SettingValue
    Remote virtual network summary
    Peering link nameEnter vnet-2-to-vnet-1.
    Virtual network deployment modelLeave the default of Resource Manager.
    SubscriptionSelect your subscription.
    Virtual networkSelect vnet-2.
    Remote virtual network peering settings
    Allow 'vnet-2' to access 'vnet-1'Leave the default of selected.
    Allow 'vnet-2' to receive forwarded traffic from 'vnet-1'Select the checkbox.
    Allow gateway or route server in 'vnet-2' to forward traffic to 'vnet-1'Leave the default of cleared.
    Enable 'vnet-2' to use 'vnet-1's' remote gateway or route serverLeave the default of cleared.
    Local virtual network peering summary
    Peering link nameEnter vnet-1-to-vnet-2.
    Local virtual network peering settings
    Allow 'vnet-1' to access 'vnet-2'Leave the default of selected.
    Allow 'vnet-1' to receive forwarded traffic from 'vnet-2'Select the checkbox.
    Allow gateway or route server in 'vnet-1' to forward traffic to 'vnet-2'Leave the default of cleared.
    Enable 'vnet-1' to use 'vnet-2's' remote gateway or route serverLeave the default of cleared.

    Screenshot of Add peering in the Azure portal.

No comments:

Post a Comment