Welcome to this Azure hands-on lab, where we connect multiple virtual networks and test connectivity. In many real world scenarios, it’s common to have multiple VNets. Using VNet Peering, we can provide secure, low-latency, high-bandwidth connectivity between VNets. The goal of this lesson is to gain knowledge and experience with the configuration of VNet peering as well as understand basic features and limitations.
VNet peering is important in many scenarios. One example is when our organization has resources in different regions or subscriptions. This is also used in many common Azure architecture patterns, such as Hub and Spoke. Good luck and enjoy the lab!
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- Configure VNet Peering
Architectural notes:
In the architecture of this hands-on-lab, we considerapp1-vnet
anddev1-vnet
to be "spoke VNets". Both of these VNets connect tocore1-vnet
which is considered the "hub VNet".Configure VNet Peering
Configure Peering Between
app1-vnet
andcore1-vnet
- In the Azure Portal, open the portal menu.
- Click on the all resources option.
- Click on the app1-vnet resource.
- Click Peerings and then Add.
- Set the following values:
- Name: "app1-to-core1"
- Deployment model: Resource manager
- Subscription: Leave the default subscription selected
- Virtual network: core1-vnet
- Name: "core1-to-app1"
- Configuration settings: Leave as the default value
- Click OK.
Configure Peering Between
dev1-vnet
andcore1-vnet
- In the Azure Portal, open the portal menu.
- Click on the all resources option.
- Click on the dev1-vnet resource.
- Click Peerings, and then Add.
- Set the following values:
- Name: "dev1-to-core1"
- Deployment model: Resource manager
- Subscription: Leave the default subscription selected
- Virtual network: core1-vnet
- Name: "core1-to-dev1"
- Configuration settings: Leave as the default value
- Click OK.
- Test Network Connectivity
Test the Peering Connectivity
Notes: See the instructions below for how to connect to each VM.
- From
app1vm
, perform a test ping using the private IP ofcore1vm
:- For example:
ping 10.1.1.4
- What does this tell us?
- Why does this work or not work?
- For example:
- Perform a test ping from
app1vm
todev1vm
:- For example:
ping 10.3.3.4
- What does this tell us?
- Why does this work or not work?
- For example:
Help Connecting to VMs and Pinging VMs
Navigate to All resources, and click on a VM (e.g.
app1vm
).Copy the public IP address (from the left-hand side, in the overview) and paste it into a text file, as we’ll need it to access the VM via SSH.
Copy its private IP and paste it into a text file, as we’ll need it to perform the ping tests.
Log in, replacing
PUBLIC_IP
with the one copied a minute ago:ssh [email protected]_IP
Perform ping tests using the following command, replacing
PRIVATE_IP
with the IP address of the VM we copied that we’d like to test.ping PRIVATE_IP
Note: Connecting to the Linux VMs will require SSH.
- Using macOS, we can run the provided
ssh
command after launchingterminal
. - Using Linux, we can run the provided
ssh
command from our bash/shell. - Using Windows, we can use one of two options:
- Download and use PuTTY for a graphical user interface.
- Use Linux on Windows with Windows Subsystem for Linux.
- From