In a world where cloud technology is at the center of everything, having a secure, scalable, and well-structured network is essential. The hub-spoke topology in Azure is a great way to manage network traffic efficiently, connecting shared services in a central hub with various workload environments in separate spokes. This guide explores how to set up a hub-spoke virtual network architecture using Azure Virtual Network Gateway.
Let’s dive-in!
The hub-spoke model is a network design that helps organize and control traffic flow in a structured way. In this setup, a central hub connects to multiple separate networks, known as spokes. The hub typically hosts shared services like firewalls, VPN gateways, or domain controllers, while the spokes contain different workloads or applications. This approach improves security, reduces costs, and makes it easier to manage network communication across different environments.
Now the hub is ready.
Now, let’s create the spokes (additional virtual networks) that connect to the hub and establish a connection between them.
This is our Spoke1:
Now lets create a Spoke2 similar as Spoke1:
What is a Virtual Network Gateway (VNG) and Its Role in the Hub-Spoke Model?
A Virtual Network Gateway (VNG) is a networking service in Azure that enables secure communication between different virtual networks, on-premises networks, or external connections through VPN or ExpressRoute. It acts as a bridge, managing encrypted traffic flow and ensuring seamless connectivity across distributed environments.
To create Virtual Network Gateway follow the below steps:
Why Peering Needed in the Hub-Spoke Model?
Peering is required to establish communication between the hub virtual network (where the Virtual Network Gateway is deployed) and the spoke virtual networks. Since the spokes are isolated networks created for different workloads, they cannot communicate with the hub or other spokes directly unless peering is configured.
Steps to Create Peering:
Peerings
under the Settings section.+ Add
button to create a new peering.spoke1
→ Enable (Tick the box).spoke1
→ Enable (Tick the box).spoke1
→ Enable (Tick the box).In the “Local virtual network summary” section:
spoke1toHub
spoke1
to access the peered virtual network → Enable (Tick the box).spoke1
to forward traffic to the peered virtual network → Enable (Tick the box).spoke1
to use the peered virtual network’s remote gateway or route server → Enable (Tick the box).NOTE: Repeat the same steps for other spokes2, by changing the peering name accordingly (Example: spoke2toHub
).
In a Hub and Spoke network architecture in Azure, route tables are essential for managing and controlling the flow of traffic between the Hub and Spoke virtual networks (VNets). The Hub network usually contains shared services like VPN gateways, firewalls, and other security appliances, while the Spoke networks host workloads like applications and databases. Route tables are created to define custom routes that force the traffic between Spoke VNets to flow through the Hub VNet for centralized security, monitoring, and connectivity. This setup enables better traffic control, improved security, and optimized network management in the Hub and Spoke topology.
Steps to Create a Route Table in Azure:
Route tables
and select it from the search results.+ Create
to start creating a new route table.Spoke1RT
.Yes
to allow propagation of routes from the gateway.Review + Create
.NOTE: Repeat the same step to Create Route table for the Spoke2 Vnet.
Steps to Add a Route in Azure Route Table:
Spoke1RT.
Routes
under the Settings section.+ Add
to create a new route.Spoke2-Traffic-to-Hub
as the Route name.IP Addresses
.Virtual network gateway
from the dropdown.Add
to create the routeNOTE: Repeat the same steps for the Add the route in Spoke2RT. And in this route use the address space of Spoke1 Vnet.
Follow the below steps to confirm that the hub and spoke topology is working as expected:
Spoke1
VNet and another VM in Spoke2
VNet.Spoke1
VNet using Bastion or RDP/SSH.Spoke1
VM, try to ping the private IP of the VM in Spoke2
VNet.Spoke2
VM to Spoke1
VM to confirm bidirectional connectivity.This validates that the custom routes and hub-spoke network topology are configured correctly.
In conclusion, the Hub and Spoke architecture is a highly effective network topology that provides centralized management, improved security, and optimized resource sharing across multiple environments. It simplifies network design by allowing spokes to communicate with each other through the hub, enabling better control over traffic flow and easier implementation of shared services like firewalls, VPN gateways, and monitoring solutions
Subscribe Newsletter for more!