Tutorial: Connect virtual networks with VNet peering - Azure portal (2024)

  • Article

You can connect virtual networks to each other with virtual network peering. These virtual networks can be in the same region or different regions (also known as global virtual network peering). Once virtual networks are peered, resources in both virtual networks can communicate with each other over a low-latency, high-bandwidth connection using Microsoft backbone network.

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

  • An Azure account with an active subscription. You can create an account for free.

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.

    Tutorial: Connect virtual networks with VNet peering - Azure portal (2)

  4. Select Next to proceed to the Security tab.

  5. In the Azure Bastion section, select Enable Azure 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.

    Tutorial: Connect virtual networks with VNet peering - Azure portal (3)

  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).

  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:

Note

The second virtual network can be in the same region as the first virtual network or in a different region. You can skip the Security tab and the Bastion deployment for the second virtual network. After the network peer, you can connect to both virtual machines with the same Bastion deployment.

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.

    Tutorial: Connect virtual networks with VNet peering - Azure portal (5)

  6. Select Add.

Create virtual machines

Create a virtual machine in each virtual network to test the communication between them.

Create test virtual machine

The following procedure creates a test virtual machine (VM) named vm-1 in the virtual network.

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

  2. In Virtual machines, select + Create, then Azure virtual machine.

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

    SettingValue
    Project details
    SubscriptionSelect your subscription.
    Resource groupSelect test-rg.
    Instance details
    Virtual machine nameEnter vm-1.
    RegionSelect East US 2.
    Availability optionsSelect No infrastructure redundancy required.
    Security typeLeave the default of Standard.
    ImageSelect Ubuntu Server 22.04 LTS - x64 Gen2.
    VM architectureLeave the default of x64.
    SizeSelect a size.
    Administrator account
    Authentication typeSelect Password.
    UsernameEnter azureuser.
    PasswordEnter a password.
    Confirm passwordReenter the password.
    Inbound port rules
    Public inbound portsSelect None.
  4. Select the Networking tab at the top of the page.

  5. Enter or select the following information in the Networking tab:

    SettingValue
    Network interface
    Virtual networkSelect vnet-1.
    SubnetSelect subnet-1 (10.0.0.0/24).
    Public IPSelect None.
    NIC network security groupSelect Advanced.
    Configure network security groupSelect Create new.
    Enter nsg-1 for the name.
    Leave the rest at the defaults and select OK.
  6. Leave the rest of the settings at the defaults and select Review + create.

  7. Review the settings and select Create.

Note

Virtual machines in a virtual network with a bastion host don't need public IP addresses. Bastion provides the public IP, and the VMs use private IPs to communicate within the network. You can remove the public IPs from any VMs in bastion hosted virtual networks. For more information, see Dissociate a public IP address from an Azure VM.

Note

Azure provides a default outbound access IP for VMs that either aren't assigned a public IP address or are in the backend pool of an internal basic Azure load balancer. The default outbound access IP mechanism provides an outbound IP address that isn't configurable.

The default outbound access IP is disabled when one of the following events happens:

  • A public IP address is assigned to the VM.
  • The VM is placed in the backend pool of a standard load balancer, with or without outbound rules.
  • An Azure NAT Gateway resource is assigned to the subnet of the VM.

VMs that you create by using virtual machine scale sets in flexible orchestration mode don't have default outbound access.

For more information about outbound connections in Azure, see Default outbound access in Azure and Use Source Network Address Translation (SNAT) for outbound connections.

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

SettingValue
Virtual machine namevm-2
RegionEast US 2 or same region as vnet-2.
Virtual networkSelect vnet-2.
SubnetSelect subnet-1 (10.1.0.0/24).
Public IPNone
Network security group namensg-2

Wait for the virtual machines to be created before continuing with the next steps.

Connect to a virtual machine

Use ping to test the communication between the virtual machines.

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

  2. On the Virtual machines page, select vm-1.

  3. In the Overview of vm-1, select Connect.

  4. In the Connect to virtual machine page, select the Bastion tab.

  5. Select Use Bastion.

  6. Enter the username and password you created when you created the VM, and then select Connect.

Communicate between VMs

  1. At the bash prompt for vm-1, enter ping -c 4 vm-2.

    You get a reply similar to the following message:

    azureuser@vm-1:~$ ping -c 4 vm-2PING vm-2.3bnkevn3313ujpr5l1kqop4n4d.cx.internal.cloudapp.net (10.1.0.4) 56(84) bytes of data.64 bytes from vm-2.internal.cloudapp.net (10.1.0.4): icmp_seq=1 ttl=64 time=1.83 ms64 bytes from vm-2.internal.cloudapp.net (10.1.0.4): icmp_seq=2 ttl=64 time=0.987 ms64 bytes from vm-2.internal.cloudapp.net (10.1.0.4): icmp_seq=3 ttl=64 time=0.864 ms64 bytes from vm-2.internal.cloudapp.net (10.1.0.4): icmp_seq=4 ttl=64 time=0.890 ms
  2. Close the Bastion connection to vm-1.

  3. Repeat the steps in Connect to a virtual machine to connect to vm-2.

  4. At the bash prompt for vm-2, enter ping -c 4 vm-1.

    You get a reply similar to the following message:

    azureuser@vm-2:~$ ping -c 4 vm-1PING vm-1.3bnkevn3313ujpr5l1kqop4n4d.cx.internal.cloudapp.net (10.0.0.4) 56(84) bytes of data.64 bytes from vm-1.internal.cloudapp.net (10.0.0.4): icmp_seq=1 ttl=64 time=0.695 ms64 bytes from vm-1.internal.cloudapp.net (10.0.0.4): icmp_seq=2 ttl=64 time=0.896 ms64 bytes from vm-1.internal.cloudapp.net (10.0.0.4): icmp_seq=3 ttl=64 time=3.43 ms64 bytes from vm-1.internal.cloudapp.net (10.0.0.4): icmp_seq=4 ttl=64 time=0.780 ms
  5. Close the Bastion connection to vm-2.

Clean up resources

When you finish using the resources that you created, you can delete the resource group and all its resources:

  1. In the Azure portal, search for and select Resource groups.

  2. On the Resource groups page, select the test-rg resource group.

  3. On the test-rg page, select Delete resource group.

  4. Enter test-rg in Enter resource group name to confirm deletion, and then select Delete.

Next steps

In this tutorial, you:

  • Created virtual network peering between two virtual networks.

  • Tested the communication between two virtual machines over the virtual network peering with ping.

To learn more about a virtual network peering:

Virtual network peering

Tutorial: Connect virtual networks with VNet peering - Azure portal (2024)

FAQs

How to do virtual network peering in Azure? ›

  1. In the search box at the top of the Azure portal, enter Virtual network. ...
  2. Select the virtual network that you would like to view or change its peering settings in Virtual networks.
  3. Select Peerings in Settings and then select the peering you want to view or change settings for.
  4. Change the appropriate setting.
Jun 27, 2024

How many Azure virtual networks can be seamlessly connected via VNet peering? ›

Virtual network peering enables you to seamlessly connect two or more Virtual Networks in Azure.

Which two options can you use to connect Azure Virtual networks? ›

You can connect one virtual network to another virtual network by using either:
  • Virtual network peering. For details, see Virtual network peering.
  • An Azure VPN gateway. For details, see Configure a network-to-network VPN gateway connection.
Jul 22, 2024

How to communicate between two VNets in Azure? ›

Azure vNet-to-vNet Connections
  1. Create a Gateway Subnet.
  2. Create Virtual Network Gateway.
  3. Create and Configure vNet for the Other Side.
  4. Configure Gateway Connection.
  5. Configure RA/VA to CA Gateway Connection.
  6. Verify Connections.

What is the difference between global VNet peering and VNet peering? ›

VNet Peering: It empowers the connectivity between various VNets within the same Azure region. Global VNet Peering: It allows Virtual networks to connect across different Azure regions. It provides private peering with low latency and high bandwidth in Azure backbone infrastructure.

What is the benefit of peering Vnets together? ›

Global Vnet peering refers to peering of Vnets across regions. - Benefits of using Vnet Peering - 1) Resources can communicate to each other from different Vnets, 2) Low latency, High Bandwidth communication, 3) Private Connectivity.

What is the difference between a subnet and a virtual network? ›

Virtual network and subnets. A subnet is a range of IP addresses in the virtual network. You can divide a virtual network into multiple subnets for organization and security. Each NIC in a VM is connected to one subnet in one virtual network.

How do I connect to Azure VM through portal? ›

Connect to the virtual machine
  1. Go to the Azure portal to connect to a VM. ...
  2. Select the virtual machine from the list.
  3. At the beginning of the virtual machine page, select Connect.
  4. On the Connect to virtual machine page, select RDP, and then select the appropriate IP address and Port number.

What are the disadvantages of VNET peering? ›

Limitations: There are some limitations to VNet peering, such as the inability to peer VNets with overlapping IP address spaces and certain Azure services not supporting communication across peered VNets without additional configurations.

What is the limit of VNET peering in Azure? ›

Up to 500 virtual network peerings per virtual network (see Networking limits). One VPN gateway per virtual network. The maximum number of tunnels per gateway depends on the gateway SKU. Azure Virtual Network Encryption can be leveraged.

What is the difference between site to site and peering? ›

VPC Peering facilitates direct communication between VPCs within the same region while respecting security boundaries. Site-to-Site VPN establishes encrypted connections between on-premises, other cloud providers and AWS resources over the internet.

How to create virtual network peering in Azure? ›

Create peering connection - vnet-1 to vnet-2. You need the Resource ID for vnet-2 from the previous steps to set up the peering connection. Sign in to the Azure portal as user-1. If you're using one account for both subscriptions, change to subscription-1 in the portal.

How do I check VNET peering in Azure? ›

Sign in to the Azure portal with an account that has the necessary roles and permissions. Select the virtual network, select Peering, and then check the Status field.

Can subnets be deleted from a VNET? ›

You can delete a subnet only if there are no resources in the subnet. If resources are in the subnet, you must delete those resources before you can delete the subnet.

Can you peer with a virtual network in another account in Azure? ›

If you need to connect virtual networks that were both created through the classic deployment model, you can use an Azure VPN Gateway to connect the virtual networks. This tutorial peers virtual networks in the same region. You can also peer virtual networks in different supported regions.

How do I create a VPC peering network? ›

Create with VPCs in the same account and different Regions
  1. In the navigation pane, choose Peering connections.
  2. Choose Create peering connection.
  3. Configure the following information, and choose Create peering connection when you are done: ...
  4. In the Region selector, select the Region of the accepter VPC.

Can VNet1 be peered with VNet2? ›

VNet1 can be peered with VNet2.

This is valid because VNet1 has an IP address range of 192.168. 0.0/24, and VNet2 has an IP address range of 10.10. 0.0/24. Their IP address ranges do not overlap.

Top Articles
Is SEO Worth It in 2024? Analyzing the ROI of Organic Search Campaigns - HigherVisibility
How to Download Bank Statement Online- Step-by-Step Guide
123 Movies Black Adam
Junk Cars For Sale Craigslist
Missed Connections Inland Empire
Lighthouse Diner Taylorsville Menu
Craigslist Motorcycles Jacksonville Florida
Prosper TX Visitors Guide - Dallas Fort Worth Guide
Anki Fsrs
South Ms Farm Trader
Conduent Connect Feps Login
Caliber Collision Burnsville
Non Sequitur
Diesel Mechanic Jobs Near Me Hiring
[Birthday Column] Celebrating Sarada's Birthday on 3/31! Looking Back on the Successor to the Uchiha Legacy Who Dreams of Becoming Hokage! | NARUTO OFFICIAL SITE (NARUTO & BORUTO)
Spergo Net Worth 2022
Pekin Soccer Tournament
Air Force Chief Results
Allybearloves
Popular Chinese Restaurant in Rome Closing After 37 Years
Mc Donald's Bruck - Fast-Food-Restaurant
Drug Test 35765N
Reviews over Supersaver - Opiness - Spreekt uit ervaring
Gs Dental Associates
Impact-Messung für bessere Ergebnisse « impact investing magazin
Lacey Costco Gas Price
Truvy Back Office Login
8002905511
130Nm In Ft Lbs
Desales Field Hockey Schedule
Strange World Showtimes Near Regal Edwards West Covina
Worlds Hardest Game Tyrone
Serenity Of Lathrop - Manteca Photos
The Ride | Rotten Tomatoes
Tyler Sis 360 Boonville Mo
Giantess Feet Deviantart
Midsouthshooters Supply
Geology - Grand Canyon National Park (U.S. National Park Service)
Bella Thorne Bikini Uncensored
Culver's of Whitewater, WI - W Main St
Beaufort SC Mugshots
Alpha Labs Male Enhancement – Complete Reviews And Guide
Random Animal Hybrid Generator Wheel
Yale College Confidential 2027
Senior Houses For Sale Near Me
Mauston O'reilly's
Greg Steube Height
20 Mr. Miyagi Inspirational Quotes For Wisdom
Vci Classified Paducah
antelope valley for sale "lancaster ca" - craigslist
Ubg98.Github.io Unblocked
E. 81 St. Deli Menu
Latest Posts
Article information

Author: Rueben Jacobs

Last Updated:

Views: 6265

Rating: 4.7 / 5 (77 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Rueben Jacobs

Birthday: 1999-03-14

Address: 951 Caterina Walk, Schambergerside, CA 67667-0896

Phone: +6881806848632

Job: Internal Education Planner

Hobby: Candle making, Cabaret, Poi, Gambling, Rock climbing, Wood carving, Computer programming

Introduction: My name is Rueben Jacobs, I am a cooperative, beautiful, kind, comfortable, glamorous, open, magnificent person who loves writing and wants to share my knowledge and understanding with you.