Are you new to setting up virtual network connections? In this blog post, I will share my experience and guide you through the process of connecting virtual networks (VNets) in different regions. We will use a gateway device and peering connection to establish a secure connection between a VNet in India and another in the Central US region. Let's get started!
Step 1: Creating the VNet for India Region: First, we create a virtual network (VNet) in the India region. Think of it as a digital network where our servers and resources will reside.
Step 2: Configuring the Gateway for Central India: Next, we set up a gateway, which acts as the entry point for our VNet connection. This gateway will help us securely connect our VNet in India to the one in the Central US region.
Step 3: Creating the VNet for Central US: Now, we create a separate VNet in the Central US region. This VNet will be connected to our VNet in India.
Step 4: Configuring the Gateway for Central US: Similar to the previous step, we set up a gateway for the Central US region. This gateway will allow us to establish a secure connection with our VNet in India.
Step 5: Creating Virtual Machines (VMs) in Each VNet: Let's create virtual machines (VMs) within each VNet. We'll place one VM in the VNet for India and another in the VNet for the US. These VMs will be our test machines for checking the connection.
Step 6: Establishing the VNet Connection using Gateway: Now, we connect the two VNets by configuring the gateway connections. This will enable communication between the VMs in both VNets.
Step 7: Testing Connectivity through Private IP Addresses: To make sure our connection is working, we'll test it by accessing the private IP address of the US server from the India server. This test confirms that the VMs can communicate with each other.
Step 8: Setting Up the Peering Connection: In addition to the gateway connection, we'll establish a peering connection. This allows direct communication between the VNets without going through the gateway.
Step 9: Testing Connectivity with Peering Connection: After setting up the peering connection, we'll test it by pinging the VMs in each VNet. This test ensures that the peered VNets can directly communicate with each other.
In this blog post, I shared my experience of connecting virtual networks using a gateway device and peering connection. We went through the step-by-step process of creating VNets, configuring gateways, setting up VMs, establishing the connection, and testing its functionality. By following these easy steps, beginners like us can successfully connect VNets and enable seamless communication between different regions.
Creating 2 Vnet (India and Central US region)
Creating for India region first
Adding IPs and subnets
I have modified subnets name from A and B to 01 and 02
For Central India, it's ready now
Adding Gateway Subnet now
Just save this
Virtual Network Gateway (VPN - GW) for Central India
I have disabled the active-active mode because it will cost extra for 24/7 availability
This VPN process could easily take upto 30 minutes
Creating for Central US
Adding Gateway Subnet
Virtual Network Gateway (VPN - GW) for Central US
The same steps as the above one and this VPN process could easily take upto 30 minutes
Launching VMs
Creating VM by using Vnet_IND
Creating VM by using Vnet_US
Selecting the size for the Central US machine
My VMs are ready now
Connecting with the Central India server
sudo apt update
chmod 400 vnet-key.pem
ssh -i ~/Downloads/vnet-key.pem azureuser@20.204.119.3
Connecting with the Central US server
Vnet Connection
I have clicked on Ind Virtual Network Gateway then clicked to connections
I selected my Virtual Network and entered the password
The resource is ready now
Testing Connectivity
In India Server, I am accessing my private IP of the US Server
In US Server, I am accessing the private IP of the India Server
Our Vnet to Vnet Connection using Network Gateway is working properly - Done
Setupping Peering Connection now
I have clicked to Peering inside the Vnet_IND Virtual Network
It's connected now
India Server
I have tested by using the ping with the private IP of the US server
ping <Private IP>
US Server
Now I am testing this with US Server
ping <Private IP>
Thankyou for reading my blog.