AVS Routing Design Concern

Ali El Husseiny 60 Reputation points
2025-07-29T10:41:13.9733333+00:00

Hey AVS People,

I’d like to briefly explain my current setup and highlight a specific routing concern I have.

We have an AVS environment connected to an ExpressRoute gateway in a transit VNet, which also hosts a Route Server and a BGP NVA—both of which are peered with each other using BGP.

The transit VNet is peered with the hub VNet, with gateway transit disabled. In the hub, we have:

A Route Server (with an eBGP session established with the BGP NVA in the transit VNet)

A Perimeter Firewall

An ExpressRoute Gateway

A Core Firewall

Our on-premises connectivity is established via IPsec over ExpressRoute, terminating at the perimeter firewall in the hub.

My question: Traffic from AVS traverses through the transit VNet to the hub. In the hub, the Route Server and ExpressRoute Gateway establish an iBGP session by default (since they share the same ASN in Azure). However, since our on-prem traffic is actually reachable through the perimeter firewall via IPsec, how can I make sure that traffic from AVS destined for on-prem is routed to the perimeter firewall first or maybe core firewall first then perimeter not sure, rather than directly to the ER gateway?

Appreciate your help in clarifying this path.

Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
0 comments No comments
{count} votes

Accepted answer
  1. Thanmayi Godithi 230 Reputation points Microsoft External Staff Moderator
    2025-07-30T10:12:28.8566667+00:00

    Hi @Ali El Husseiny,

    Thanks for reaching out on Microsoft Q&A forum.

    I understand your AVS (Azure VMware Solution) environment is connected to your on-premises network via a transit virtual network (VNet), which peers with a hub VNet hosting critical network components such as a Route Server, perimeter firewalls, and an ExpressRoute Gateway. Your primary requirement is to ensure that traffic originating from AVS to on-premises flows through the designated perimeter firewall rather than taking the default path directly through the ExpressRoute Gateway, which may bypass your network inspection controls.

    Based on your topology, there are several supported approaches to help enforce this traffic flow behaviour:

    Option 1: User-Defined Routes (UDRs) on GatewaySubnet

    One straightforward approach is to create UDRs on the GatewaySubnet in the hub VNet. Although GatewaySubnet does not support a 0.0.0.0/0 UDR for ExpressRoute, you can define specific UDRs for your on-premises address ranges. For instance, if your on-premises range is 192.168.0.0/16, you can create a UDR with that prefix and set the next hop type to "Virtual Appliance" with the next hop IP as the firewall's private IP address. Ensure that route propagation is enabled on the subnet to allow coexistence of both system and custom routes.

    This will ensure that traffic from AVS is routed through the transit VNet and hub VNet to the firewall before reaching the on-premises network.

    For more information, refer to the documentation on User-defined routes in Azure.

    Option 2: BGP Route Advertisement with Custom Next Hop

    Since you are using BGP-capable network virtual appliances (NVAs) in the transit VNet, you can leverage Azure Route Server’s ability to honour custom next-hop IPs. This approach allows the NVA to advertise on-premises prefixes to the Route Server, while explicitly setting the firewall IP as the next hop. The Route Server will then propagate these routes to other peers, and Azure will honour the custom next hop during route selection.

    This dynamic routing approach ensures AVS traffic is routed via the firewall path instead of directly via ExpressRoute, while still maintaining flexibility and scalability.

    You can find further details in Injecting default routes via Azure Route Server.

    Option 3: Route Priority Manipulation

    Understanding Azure’s route selection behaviour is essential. The platform always prefers the longest prefix match (LPM). When multiple routes have the same prefix length, Azure prioritizes them as follows: User-defined routes take precedence over BGP routes, which in turn take precedence over system routes.

    You can use this to your advantage by either using more specific prefixes in UDRs or BGP advertisements, or by overriding broader ExpressRoute-learned routes through user-defined ones. This method is particularly effective when you need deterministic routing control.

    Refer to Azure routing overview for more guidance.

    Option 4: Configuring Route Server to Influence Routing Preference

    Given that you are using Azure Route Servers in both the hub and transit VNets, it is recommended to configure the route server to prefer VPN/NVA paths over ExpressRoute by adjusting the routing preference setting. Additionally, applying AS path prepending to the ExpressRoute Gateway route advertisements will make those paths less preferred compared to those learned from the firewall via the NVA.

    Ensure that the Route Server peers with distinct ASNs for the NVA and the ExpressRoute Gateway, and that the BGP sessions are configured correctly to support this preference behaviour.

    Recommended Architecture Flow

    For your specific setup, we recommend a combination of the above methods. In the transit VNet, configure your BGP NVA to advertise on-premises prefixes to the Route Server with the firewall’s IP as the next hop. In the hub VNet, allow the Route Server to propagate these routes to connected networks. As a fallback mechanism, apply UDRs on the GatewaySubnet for critical on-premises prefixes to statically enforce the firewall route in case dynamic advertisements are not available.

    This results in the following desired traffic flow: AVS → Transit VNet → Hub VNet → Route Server → Perimeter Firewall → (Optional Core Firewall) → On-premises.

     

    Additional Considerations

    • The iBGP session between the ExpressRoute Gateway and Route Server will still exist, but your custom routes will be preferred due to specificity or route type precedence.
    • Ensure that the "Use remote virtual network’s gateway or Route Server" setting is enabled on the VNet peering's between spoke, transit, and hub networks.
    • Use the “Effective Routes” view on test VMs to verify that routes are being resolved as expected.
    • ExpressRoute can still function as a backup route path if the primary firewall-inspected path is unavailable.

    Kindly let us know if the above helps or you need further assistance on this issue.

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

     


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.