Tutorial / Cram Notes

Virtual Network (VNet) Peering in Azure is a mechanism that connects two networks seamlessly, allowing resources in either network to communicate with each other as if they were in the same network. By using virtual network peering, administrators can establish low-latency, high-bandwidth connections between resources in different virtual networks. This feature is valuable for scenarios where you need to maintain segregated networks for management or security purposes, yet allow controlled access between them.

What is Virtual Network Peering?

Azure Virtual Network (VNet) peering is a non-transitive, one-to-one relationship between two VNets that allows them to communicate using the Azure backbone network. Once peered, resources in either VNet can communicate with each other using private IP addresses. There are two types of peering:

  • Regional VNet Peering: Connects VNets in the same Azure region.
  • Global VNet Peering: Connects VNets across different Azure regions.

Benefits of VNet Peering

  • Network Traffic Isolation: The traffic between peered VNets is entirely isolated from the public internet and stays on the Azure backbone network.
  • Low-latency, High-bandwidth Connections: Peered VNets benefit from Microsoft’s vast backbone infrastructure, leading to fast and reliable inter-network communications.
  • Subscription and Tenancy: VNets from different Azure subscriptions and Active Directory tenants can be peered if they adhere to the supported Azure account configurations.
  • No Downtime: VNet peering doesn’t require any downtime for existing resources, making it a seamless process.

Configuring Virtual Network Peering

When configuring VNet peering, there are several steps and considerations:

Step 1: Plan IP Address Spaces

Ensure that the IP address spaces for both VNets do not overlap. Peering cannot be established if the address spaces conflict.

Step 2: Create the Peering

You create a peering for each VNet and point it to the other VNet. Here’s an example using PowerShell:

<powershell>
# VNet1 Configuration
$VNet1 = Get-AzVirtualNetwork -Name VNet1 -ResourceGroupName ResourceGroup1
$VNet2 = Get-AzVirtualNetwork -Name VNet2 -ResourceGroupName ResourceGroup2

Add-AzVirtualNetworkPeering -Name LinkVNet1ToVNet2 -VirtualNetwork $VNet1 -RemoteVirtualNetworkId $VNet2.Id
Add-AzVirtualNetworkPeering -Name LinkVNet2ToVNet1 -VirtualNetwork $VNet2 -RemoteVirtualNetworkId $VNet1.Id
</powershell>

Step 3: Verify the Peering Status

After configuring peering, check the peering status to confirm that it’s connected. This can be done via the Azure Portal or PowerShell.

Considerations for VNet Peering

Consideration Description
Cost While VNet peering does not have a base cost, there is a charge for outbound data transfer across peering connections.
Service Limits Azure imposes limits on the number of peered connections a VNet can have. These are outlined in Azure’s documentation and can be increased by a support request.
Traffic Flow Traffic between peered VNets flows bi-directionally. However, if needed, you can modify Network Security Groups (NSGs) to control traffic flow.
Transitive Relationships VNet peering is not transitive. To connect multiple VNets, each VNet must be peered with each other VNet in the network topology.
Subscription and Management Peering can be done across subscriptions and between tenants, provided they’re associated with the same Active Directory tenant, or RBAC permissions are configured appropriately.

Managing VNet Peering

After creating a VNet peering, you can manage the peering settings to customize the network connectivity to suit your requirements:

  • Traffic Forwarding: You may enable or disable traffic forwarding to and from the connected VNets.
  • Gateway Transit: When one of the peered VNets has a virtual network gateway, other VNets can use this gateway for traffic routing. This is known as ‘UseRemoteGateways’ and ‘AllowGatewayTransit’ options in VNet peering settings.
  • Service Chaining: Service chaining allows you to direct traffic from one VNet to a virtual appliance in another VNet before it reaches its destination.

In conclusion, virtual network peering is a highly efficient and secure way to connect Azure networks. Azure administrators can leverage VNet peering to enhance connectivity and simplify network designs while maintaining proper security and isolation as needed. Whether you’re preparing for the AZ-104 Microsoft Azure Administrator exam or working with Azure VNets in a professional setting, understanding how to create, configure, and manage VNet peering is an essential skill.

Practice Test with Explanation

True or False: Virtual network peering allows resources to communicate across Azure regions without using gateways.

  • A) True
  • B) False

Answer: A) True

Explanation: Virtual network peering enables resources in different virtual networks to communicate with each other as if they were in the same network. This can be done across Azure regions without using gateways.

True or False: Once virtual network peering is set up, the peered networks must share their address space.

  • A) True
  • B) False

Answer: B) False

Explanation: The peered networks must have non-overlapping address spaces, as address space sharing is not allowed in virtual network peering.

Which of the following is required to configure virtual network peering in Azure?

  • A) Identical address spaces in both virtual networks
  • B) Non-overlapping address spaces in both virtual networks
  • C) At least one virtual network gateway
  • D) Subscription boundary

Answer: B) Non-overlapping address spaces in both virtual networks

Explanation: To establish virtual network peering, both virtual networks should have non-overlapping IP address spaces.

True or False: Peered virtual networks can have resources with duplicate IP addresses as long as they are in different subnets.

  • A) True
  • B) False

Answer: B) False

Explanation: Even after peering, virtual networks maintain their separate address spaces, and IP address conflicts are not allowed.

True or False: Virtual network peering connections are unidirectional and must be configured on both virtual networks separately.

  • A) True
  • B) False

Answer: B) False

Explanation: Virtual network peering connections are bi-directional; however, they must be initiated from one network and then accepted from the other network but do not need to be set up separately for each direction.

What type of traffic routing is supported by default when virtual networks are peered?

  • A) Internet-based routing
  • B) System routing
  • C) User-defined routing
  • D) Gateway transit

Answer: B) System routing

Explanation: System routing is used by default, enabling resources in peered virtual networks to communicate with each other directly, not through the internet or a gateway.

True or False: A peering relationship can be established between virtual networks in two different Azure subscriptions.

  • A) True
  • B) False

Answer: A) True

Explanation: Virtual network peering can be configured between virtual networks in the same Azure subscription or across different Azure subscriptions.

Can virtual network peering be set up between a virtual network in Azure and another one in an on-premises data center?

  • A) Yes
  • B) No

Answer: B) No

Explanation: Virtual network peering is specific to Azure virtual networks. Connectivity between an Azure VNet and an on-premises network requires a VPN or ExpressRoute, not peering.

True or False: Virtual network peering supports the transit of network traffic through a hub virtual network.

  • A) True
  • B) False

Answer: A) True

Explanation: Virtual network peering supports transit routing, where a peered virtual network can route traffic to a third virtual network through a hub virtual network.

When removing virtual network peering, what happens to the established connections between resources in peered networks?

  • A) They remain intact but new connections cannot be established.
  • B) They are immediately disconnected.
  • C) They remain active until the resources are restarted.
  • D) They are unaffected by peering changes.

Answer: B) They are immediately disconnected.

Explanation: Once the virtual network peering is removed, any established connections between resources in the previously peered networks are immediately disconnected.

To establish virtual network peering, which of the following Azure roles are sufficient?

  • A) Azure Network Contributor
  • B) Azure Reader
  • C) Azure Virtual Machine Contributor
  • D) Azure Contributor

Answer: A) Azure Network Contributor

Explanation: The Azure Network Contributor role allows users to manage virtual networks, including setting up peering connections.

True or False: Traffic between peered virtual networks is encrypted by default.

  • A) True
  • B) False

Answer: B) False

Explanation: Traffic between peered virtual networks is not encrypted by default. Encryption can be enabled by implementing encryption solutions at the application level or by using VPN or ExpressRoute with encryption options.

Interview Questions

What is virtual network peering in Azure?

Virtual network peering is a feature in Azure that allows you to connect virtual networks in different regions or subscriptions to create a single network infrastructure.

What are the benefits of using virtual network peering?

Using virtual network peering enables the sharing of resources across virtual networks, enables cross-region deployments, and simplifies network management.

How do you create virtual network peering in Azure?

To create virtual network peering in Azure, you must first create the virtual networks you want to peer, navigate to the virtual network peering section, create a new peering, and configure the peering settings.

Can virtual network peering be used across different Azure regions?

Yes, virtual network peering can be used to connect virtual networks across different regions.

Can virtual network peering be used across different Azure subscriptions?

Yes, virtual network peering can be used to connect virtual networks across different Azure subscriptions.

Is virtual network peering available in all Azure deployment models?

Yes, virtual network peering is available in all Azure deployment models, including the Azure Resource Manager, classic, and global models.

What are the configuration and management differences between virtual network peering in different deployment models?

Depending on the deployment model, the configuration and management process for virtual network peering may differ slightly. Refer to the Azure documentation for more information on configuring virtual network peering in different deployment models.

Can virtual network peering be modified or deleted after it is created?

Yes, virtual network peering can be modified or deleted after it is created.

What are the requirements and constraints for virtual network peering in Azure?

The requirements and constraints for virtual network peering in Azure include virtual network address space constraints, routing requirements, and security considerations.

Can you limit the traffic between peered virtual networks?

Yes, you can limit the traffic between peered virtual networks by configuring the peering settings to allow only specific traffic types.

How can you verify the connection between peered virtual networks?

You can verify the connection between peered virtual networks using the Azure Portal or the Azure CLI.

Can virtual network peering be used for connecting on-premises networks to Azure virtual networks?

No, virtual network peering is only used to connect virtual networks in Azure.

Can virtual network peering be used to connect two virtual networks with overlapping IP addresses?

No, virtual network peering cannot be used to connect two virtual networks with overlapping IP addresses.

What is the maximum number of peered virtual networks in Azure?

The maximum number of peered virtual networks in Azure is 500.

What is the purpose of a peering transit route in Azure?

A peering transit route in Azure allows you to route traffic between multiple peered virtual networks through a single transit virtual network.

0 0 votes
Article Rating
Subscribe
Notify of
guest
23 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Anthony Russell
1 year ago

Great post on virtual network peering! It really helped me understand the concept better.

Kikiliya Koval
1 year ago

I have successfully configured VNet peering, but I’m facing issues with the latency. Any tips?

Jérémy Brunet
2 years ago

Can we peer VNets across different subscriptions?

Ella Møller
2 years ago

Appreciate the step-by-step guide!

Peremisl Yuhimenko
7 months ago

Is there any downtime when enabling VNet peering?

Felix Harris
2 years ago

I followed the steps but I’m unable to communicate between VNets. What might be the issue?

Lasse Weber
1 year ago

Thanks for this insightful article!

بردیا کامروا

Can someone explain the cost implications of VNet peering?

23
0
Would love your thoughts, please comment.x
()
x