Skip to content

Latest commit

 

History

History
112 lines (83 loc) · 4.79 KB

how-to-configure-custom-bgp-communities.md

File metadata and controls

112 lines (83 loc) · 4.79 KB
title description services author ms.service ms.custom ms.topic ms.date ms.author
Configure custom BGP communities for Azure ExpressRoute private peering
Learn how to apply or update BGP community value for a new or an existing virtual network.
expressroute
duongau
expressroute
devx-track-azurepowershell
how-to
09/05/2023
duau

Configure custom BGP communities for Azure ExpressRoute private peering

BGP communities are groupings of IP prefixes tagged with a community value. This value can be used to make routing decisions on the router's infrastructure. You can apply filters or specify routing preferences for traffic sent to your on-premises from Azure with BGP community tags. This article explains how to apply a custom BGP community value for your virtual networks using Azure PowerShell. Once configured, you can view the regional BGP community value and the custom community value of your virtual network. This value will be used for outbound traffic sent over ExpressRoute when originating from that virtual network.

Prerequisites

  • Review the prerequisites, routing requirements, and workflows before you begin configuration.

  • You must have an active ExpressRoute circuit.

    • Follow the instructions to create an ExpressRoute circuit and have the circuit enabled by your connectivity provider.
    • Ensure that you have Azure private peering configured for your circuit. See the configure routing article for routing instructions.
    • Ensure that Azure private peering gets configured and establishes BGP peering between your network and Microsoft for end-to-end connectivity.

Working with Azure PowerShell

[!INCLUDE updated-for-az]

[!INCLUDE expressroute-cloudshell]

Apply a custom BGP community value for a new virtual network

  1. To start the configuration, sign in to your Azure account and select the subscription that you want to use.

    [!INCLUDE sign in]

  2. Create a resource group to store the new virtual network.

    $rg = @{
        Name = 'myERRG'
        Location = 'WestUS'
    }
    New-AzResourceGroup @rg
    
  3. Create a new virtual network with the -BgpCommunity flag to apply a BGP community value.

    $vnet = @{
        Name = 'myVirtualNetwork'
        ResourceGroupName = 'myERRG'
        Location = 'WestUS'
        AddressPrefix = '10.0.0.0/16'
        BgpCommunity = '12076:20001'    
    }
    New-AzVirtualNetwork @vnet
    

    [!NOTE] The 12076: is required before your custom community value.

  4. Retrieve your virtual network and review its properties. You'll notice a BgpCommunities section that contains a RegionalCommunity value and a VirtualNetworkCommunity value. The RegionalCommunity value is predefined based on the Azure region of the virtual network. The VirtualNetworkCommunity value should match your custom definition.

    $virtualnetwork = @{
        Name = 'myVirtualNetwork'
        ResourceGroupName = 'myERRG'
    } 
    Get-AzVirtualNetwork @virtualnetwork
    

Applying or updating the custom BGP value for an existing virtual network

  1. Get the virtual network you want to apply or update the BGP community value and store it to a variable.

    $virtualnetwork = @{
        Name = 'myVirtualNetwork'
        ResourceGroupName = 'myERRG'
    } 
    $vnet = Get-AzVirtualNetwork @virtualnetwork
    
  2. Update the VirtualNetworkCommunity value for your virtual network.

    $vnet.BgpCommunities = @{VirtualNetworkCommunity = '12076:20002'}
    $vnet | Set-AzVirtualNetwork
    

    [!NOTE] The 12076: is required before your custom community value.

  3. Retrieve your virtual network and review its updated properties. The RegionalCommunity value is predefined based on the Azure region of the virtual network; to view the regional BGP community values for private peering, see ExpressRoute routing requirements. The VirtualNetworkCommunity value should match your custom definition.

    $virtualnetwork = @{
        Name = 'myVirtualNetwork'
        ResourceGroupName = 'myERRG'
    } 
    Get-AzVirtualNetwork @virtualnetwork
    

Next steps