|
| 1 | +--- |
| 2 | +title: 'Configure BGP peering to an NVA: PowerShell' |
| 3 | +titleSuffix: Azure Virtual WAN |
| 4 | +description: Learn how to create a BGP peering with Virtual WAN hub router using Azure PowerShell. |
| 5 | +author: cherylmc |
| 6 | +ms.service: virtual-wan |
| 7 | +ms.topic: conceptual |
| 8 | +ms.date: 09/08/2022 |
| 9 | +ms.author: cherylmc |
| 10 | + |
| 11 | +--- |
| 12 | +# Configure BGP peering to an NVA - PowerShell |
| 13 | + |
| 14 | +This article helps you configure an Azure Virtual WAN hub router to peer with a Network Virtual Appliance (NVA) in your virtual network using BGP Peering using Azure PowerShell. The virtual hub router learns routes from the NVA in a spoke VNet that is connected to a virtual WAN hub. The virtual hub router also advertises the virtual network routes to the NVA. For more information, see [Scenario: BGP peering with a virtual hub](scenario-bgp-peering-hub.md). You can also create this configuration using the [Azure portal](create-bgp-peering-hub-portal.md). |
| 15 | + |
| 16 | +:::image type="content" source="./media/create-bgp-peering-hub-portal/diagram.png" alt-text="Diagram of configuration."::: |
| 17 | + |
| 18 | +## Prerequisites |
| 19 | + |
| 20 | +Verify that you've met the following criteria before beginning your configuration: |
| 21 | + |
| 22 | +[!INCLUDE [Before you begin](../../includes/virtual-wan-before-include.md)] |
| 23 | + |
| 24 | +### Azure PowerShell |
| 25 | + |
| 26 | +[!INCLUDE [PowerShell](../../includes/vpn-gateway-cloud-shell-powershell-about.md)] |
| 27 | + |
| 28 | +#### <a name="signin"></a>Sign in |
| 29 | + |
| 30 | +[!INCLUDE [Sign in](../../includes/vpn-gateway-cloud-shell-ps-login.md)] |
| 31 | + |
| 32 | +## Create a virtual WAN |
| 33 | + |
| 34 | +```azurepowershell-interactive |
| 35 | +$virtualWan = New-AzVirtualWan -ResourceGroupName "testRG" -Name "myVirtualWAN" -Location "West US" |
| 36 | +``` |
| 37 | + |
| 38 | +## Create a virtual hub |
| 39 | + |
| 40 | +A hub is a virtual network that can contain gateways for site-to-site, ExpressRoute, or point-to-site functionality. Once the hub is created, you'll be charged for the hub, even if you don't attach any sites. |
| 41 | + |
| 42 | +```azurepowershell-interactive |
| 43 | +$virtualHub = New-AzVirtualHub -VirtualWan $virtualWan -ResourceGroupName "testRG" -Name "westushub" -AddressPrefix "10.0.0.1/24" |
| 44 | +``` |
| 45 | + |
| 46 | +## Connect the VNet to the hub |
| 47 | + |
| 48 | +Create a connection between your hub and VNet. |
| 49 | + |
| 50 | +```azurepowershell-interactive |
| 51 | +$remote = Get-AzVirtualNetwork -Name "[vnet name]" -ResourceGroupName "[resource group name]" |
| 52 | +$hubVnetConnection = New-AzVirtualHubVnetConnection -ResourceGroupName "[parent resource group name]" -VirtualHubName "[virtual hub name]" -Name "[name of connection]" -RemoteVirtualNetwork $remote |
| 53 | +``` |
| 54 | + |
| 55 | +## Configure a BGP peer |
| 56 | + |
| 57 | +Configure BGP peer for the $hubVnetConnection you created. |
| 58 | + |
| 59 | +```azurepowershell-interactive |
| 60 | +New-AzVirtualHubBgpConnection -ResourceGroupName "testRG" -VirtualHubName "westushub" -PeerIp 192.168.1.5 -PeerAsn 20000 -Name "testBgpConnection" -VirtualHubVnetConnection $hubVnetConnection |
| 61 | +``` |
| 62 | + |
| 63 | +Or, you can configure BGP for an existing virtual hub VNet connection. |
| 64 | + |
| 65 | +```azurepowershell-interactive |
| 66 | +$hubVnetConnection = Get-AzVirtualHubVnetConnection -ResourceGroupName "[resource group name]" -VirtualHubName "[virtual hub name]" -Name "[name of connection]" |
| 67 | +
|
| 68 | +New-AzVirtualHubBgpConnection -ResourceGroupName "[resource group name]" -VirtualHubName "westushub" -PeerIp 192.168.1.5 -PeerAsn 20000 -Name "testBgpConnection" -VirtualHubVnetConnection $hubVnetConnection |
| 69 | +``` |
| 70 | + |
| 71 | +## Modify a BGP peer |
| 72 | + |
| 73 | +Update an existing hub BGP peer connection. |
| 74 | + |
| 75 | +```azurepowershell-interactive |
| 76 | +Update-AzVirtualHubBgpConnection -ResourceGroupName "[resource group name]" -VirtualHubName "westushub" -PeerIp 192.168.1.6 -PeerAsn 20000 -Name "testBgpConnection" -VirtualHubVnetConnection $hubVnetConnection |
| 77 | +``` |
| 78 | + |
| 79 | +## Delete a BGP peer |
| 80 | + |
| 81 | +Remove an existing hub BGP connection. |
| 82 | + |
| 83 | +```azurepowershell-interactive |
| 84 | +Remove-AzVirtualHubBgpConnection -ResourceGroupName "[resource group name]" -VirtualHubName "westushub" -Name "testBgpConnection" |
| 85 | +``` |
| 86 | + |
| 87 | +## Next steps |
| 88 | + |
| 89 | +For more information about BGP scenarios, see [Scenario: BGP peering with a virtual hub](scenario-bgp-peering-hub.md). |
0 commit comments