Virtual Networks Different Azure Regions Step by Step

Virtual Networks Different Azure Regions

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.

azure menu

2- Click on create virtual network.

azure create virtual network

3- Subscriptions – Select your subscription
Resource group – click on create new.

azure create virtual network

4- Type a recourse group name (rg-vnet) and click OK.

azure create new resource group

5- Instance details type a virtual network name (vnet-east) select regions (east US) and then click Next : IP Address >.

azure create virtual network

6- IP Addresses tab
Enter 10.0.0.0/16 for the IPv4 Address Space field.
Click the + Add subnet button below.

azure create virtual network ip address

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.

azure vnet add subnet

8- Click Next : Security >

azure create virtual network ip address

9- Choose DDos Protection (Basic) Firewall (disable) and Select Review + Create.

azure create virtual network security

10- Select Create.

azure create virtual network validation

11- To create a 2nd virtual network follow the above steps from 2 to 10 again with the following changes.

SettingValue
Resources Grouprg-vnet
Namevnet-west
Region(US) west US
IPv4 address space192.168.0.0/16
Subnet namewest-subnet
Subnet address range192.168.1.0/24
SecurityDDos Protection Basic, Firewall disable
Create 

2 Virtual Networks successfully created

azure create network virtual

Create Virtual Network Gateway

1- In Azure portal type virtual network gateway in the search bar to select.

microsoft azure search bar

2- Select create virtual network gateway

azure create virtual network gateway

3- Select your subscriptions

create virtual network gateway

4- Instance details;

Enter a name (vng-east)
Region (East US)
Gateway type (VPN)
VPN type (Route-based).
Virtual network (vnet-east)

create virtual network gateway

5- Public IP address name enter (eastpublicip) and then click Review + Create

create virtual network gateway

6- Click Create.

create virtual network gateway

To create a 2nd virtual network gateway follow the above steps from 2 to 6 again with the following changes.

SettingsValune
Namevng-west
RegionWest US
Gateway typeVPN
VPN typeRoute-based
Virtual networkvnet-west
Public IP address namewestpublicip
Create 

Now you can see two virtual network gateway successfully created.

azure virtual network gateway

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

microsoft azure menu

2- Select Create virtual machine.

azure virtual machine

3- Resource group select (rg-vnet)

azure new vm wizard

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.

azure instance details

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 >

azure new vm wizard

6- Click Next : Networking >.

azure create a new vm disks

7- Under networking tab, network interface select virtual network (vnet-east)
Subnet (east-subnet) and then select the Review + Create button.

azure create vm networking

8- Click Create.

azure create vm review + create

Create the second VM

Complete steps 2-8 again, with the following changes:

NameValue
Resource grouprg-vnet
Virtual machine namevmwest
Region(US) West US
ImageWindows Server 2019 Datacenter
Administrator accountusername password
Public inbound portallow selected ports
Select inbound portsHTTP, RDP
Virtual networkvnet-west
Subneteast-subnet (192.168.1.0/24)
Create 

The VMs take a few minutes to create. Now the both VMs successfully created.

azure virtual machine

Azure Virtual Network Gateway Connection

1- Select Azure menu bar, search virtual network gateway and then click on vng-east.

create virtual network gateway

2- Under Settings Select Connections, and then click + Add, as shown in the below picture.

virtual network gateway connection

3- Add Connection wizard, Type a name (east2west) under Name.
Under connection type choose VNet-to-VNet.
Select second virtual network gateway

add virtual network gateway connection

4- Choose 2nd virtual network gateway (vng-west).

choose virtual network gateway

5- Under Shared key (PSK) type test1 and then click OK.

add virtual network gateway connection

6- Click on the virtual network gateway to setup connection for 2nd virtual network gateway.

virtual network gateway connection

7- Select vng-west 2nd virtual network gateway.

azure virtual network gateway

8- Select Connection tab under settings and then click on + Add

virtual network gateway connection

9- Add Connection wizard, Type a name (west2east) under Name.
Under connection type choose VNet-to-VNet.
Select second virtual network gateway

add virtual network gateway

10- Choose virtual network gateway (vng-east).

choose virtual network gateway

11- Under Shared key (PSK) type test1 and then click OK.

Note: shared key should be same for both connection.

add virtual network gateway

12- Now you can see both virtual network gateway connections shows connected

virtual network gateway connection

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.

windows defender firewall

Turn off private – public network settings and then click OK.

customize settings for each type of network

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

Comments

Leave a Reply