Virtual Networks Different Azure Regions
in this article, I will explore how to connect virtual networks in different Azure regions. This connection is called VNet-to-VNet. VNet-to-VNet connectivity utilizes the Azure virtual network gateways to connect with different Azure regions called (Global VNet peering).
Virtual network peering – (Same Azure Region)
Global virtual network peering – (Different Azure Regions)
Virtual network connection with different Azure regions
Creating two virtual networks
Creating two virtual network gateway
Deploy a virtual machine (VM) into each vnet
Creating connection with two virtual network gateway
Communicate between VMs
Create Virtual Networks
1st first Virtual Network
Log in to the Azure Portal
1- On the Azure portal, select Azure menu bar and then select Virtual Network.
2- Click on create virtual network.
3- Subscriptions – Select your subscription
Resource group – click on create new.
4- Type a recourse group name (rg-vnet) and click OK.
5- Instance details type a virtual network name (vnet-east) select regions (east US) and then click Next : IP Address >.
6- IP Addresses tab
Enter 10.0.0.0/16 for the IPv4 Address Space field.
Click the + Add subnet button below.
7- Add subnet wizard; enter a Subnet Name (east-subnet) and type 10.0.0.0/24 for Subnet Address range and then click Add.
8- Click Next : Security >
9- Choose DDos Protection (Basic) Firewall (disable) and Select Review + Create.
10- Select Create.
11- To create a 2nd virtual network follow the above steps from 2 to 10 again with the following changes.
Setting | Value |
Resources Group | rg-vnet |
Name | vnet-west |
Region | (US) west US |
IPv4 address space | 192.168.0.0/16 |
Subnet name | west-subnet |
Subnet address range | 192.168.1.0/24 |
Security | DDos Protection Basic, Firewall disable |
Create |
2 Virtual Networks successfully created
Create Virtual Network Gateway
1- In Azure portal type virtual network gateway in the search bar to select.
2- Select create virtual network gateway
3- Select your subscriptions
4- Instance details;
Enter a name (vng-east)
Region (East US)
Gateway type (VPN)
VPN type (Route-based).
Virtual network (vnet-east)
5- Public IP address name enter (eastpublicip) and then click Review + Create
6- Click Create.
To create a 2nd virtual network gateway follow the above steps from 2 to 6 again with the following changes.
Settings | Valune |
Name | vng-west |
Region | West US |
Gateway type | VPN |
VPN type | Route-based |
Virtual network | vnet-west |
Public IP address name | westpublicip |
Create |
Now you can see two virtual network gateway successfully created.
Create Virtual Machines
Create a VM in each virtual network (VNet) so that we can communicate between them.
1st VM
1- On the Azure portal menu tab, then select Virtual machines
2- Select Create virtual machine.
3- Resource group select (rg-vnet)
4- Instance details
Enter a virtual machine name (vmeast)
Region select (East US)
Image select Windows Server 2019 Datacenter. You can use a different operating system, but the remaining steps assume you selected Windows Server 2019 Datacenter.
5- Administrator account
Enter a username (jamil), Password.
Public inbound ports choose to allow selected ports.
Choose inbound ports (HTTP, RDP) and then click Next : Disks >
6- Click Next : Networking >.
7- Under networking tab, network interface select virtual network (vnet-east)
Subnet (east-subnet) and then select the Review + Create button.
8- Click Create.
Create the second VM
Complete steps 2-8 again, with the following changes:
Name | Value |
Resource group | rg-vnet |
Virtual machine name | vmwest |
Region | (US) West US |
Image | Windows Server 2019 Datacenter |
Administrator account | username password |
Public inbound port | allow selected ports |
Select inbound ports | HTTP, RDP |
Virtual network | vnet-west |
Subnet | east-subnet (192.168.1.0/24) |
Create |
The VMs take a few minutes to create. Now the both VMs successfully created.
Azure Virtual Network Gateway Connection
1- Select Azure menu bar, search virtual network gateway and then click on vng-east.
2- Under Settings Select Connections, and then click + Add, as shown in the below picture.
3- Add Connection wizard, Type a name (east2west) under Name.
Under connection type choose VNet-to-VNet.
Select second virtual network gateway
4- Choose 2nd virtual network gateway (vng-west).
5- Under Shared key (PSK) type test1 and then click OK.
6- Click on the virtual network gateway to setup connection for 2nd virtual network gateway.
7- Select vng-west 2nd virtual network gateway.
8- Select Connection tab under settings and then click on + Add
9- Add Connection wizard, Type a name (west2east) under Name.
Under connection type choose VNet-to-VNet.
Select second virtual network gateway
10- Choose virtual network gateway (vng-east).
11- Under Shared key (PSK) type test1 and then click OK.
Note: shared key should be same for both connection.
12- Now you can see both virtual network gateway connections shows connected
If you didn’t see the status connected, click refresh. Note: it will take 15 to 20 minutes.
Communicate Between VMs
Please connect your both VMs (vmeast – vmwest) and then login using your credentials.
Now we need to disable Windows defender firewall on the both VMs.
Type Windows defender firewall in Windows Server search bar and then select it.
Select Turn Windows defender firewall on or off.
Turn off private – public network settings and then click OK.
Open command prompt, type ipconfig command to find the first VM (vmeast) IP Address.
You can see the IP address is 10.0.1.4
IP Address vmwest (192.168.1.4) pinging from vmeast
Open command prompt, type ipconfig command to find the 2nd VM (vmwest) IP Address.
You can see the IP address is 192.168.1.4
IP Address vmesst (10.0.1.4) pinging from vmwest