|
1 | 1 | ---
|
2 |
| -title: 'Quickstart: Create and configure Route Server - Azure PowerShell' |
3 |
| -description: In this quickstart, you learn how to create and configure an Azure Route Server using Azure PowerShell. |
| 2 | +title: 'Quickstart: Create an Azure Route Server - PowerShell' |
| 3 | +description: In this quickstart, you learn how to create an Azure Route Server using Azure PowerShell. |
4 | 4 | author: halkazwini
|
5 | 5 | ms.author: halkazwini
|
6 | 6 | ms.service: azure-route-server
|
7 | 7 | ms.topic: quickstart
|
8 |
| -ms.date: 08/14/2024 |
| 8 | +ms.date: 09/20/2024 |
9 | 9 | ms.custom: devx-track-azurepowershell, mode-api
|
10 | 10 | ---
|
11 | 11 |
|
12 |
| -# Quickstart: Create and configure Route Server using Azure PowerShell |
| 12 | +# Quickstart: Create an Azure Route Server using PowerShell |
13 | 13 |
|
14 |
| -This article helps you configure Azure Route Server to peer with a Network Virtual Appliance (NVA) in your virtual network using Azure PowerShell. Route Server learns routes from your NVA and program them on the virtual machines in the virtual network. Azure Route Server also advertises the virtual network routes to the NVA. For more information, see [Azure Route Server](overview.md). |
| 14 | +In this quickstart, you learn how to create an Azure Route Server to peer with a Network Virtual Appliance (NVA) in your virtual network using Azure PowerShell. |
15 | 15 |
|
16 | 16 | :::image type="content" source="media/quickstart-configure-route-server-portal/environment-diagram.png" alt-text="Diagram of Route Server deployment environment using the Azure PowerShell." lightbox="media/quickstart-configure-route-server-portal/environment-diagram.png":::
|
17 | 17 |
|
18 | 18 | [!INCLUDE [route server preview note](../../includes/route-server-note-preview-date.md)]
|
19 | 19 |
|
20 | 20 | ## Prerequisites
|
21 | 21 |
|
22 |
| -* An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F). |
23 |
| -* Make sure you have the latest PowerShell modules, or you can use Azure Cloud Shell in the portal. |
24 |
| -* Review the [service limits for Azure Route Server](route-server-faq.md#limitations). |
25 |
| -* If you're running PowerShell locally, you also need to run `Connect-AzAccount` to create a connection with Azure. |
| 22 | +- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F). |
26 | 23 |
|
27 |
| -## Create resource group and a virtual network |
| 24 | +- Review the [service limits for Azure Route Server](route-server-faq.md#limitations). |
28 | 25 |
|
29 |
| -### Create a resource group |
| 26 | +- Azure Cloud Shell or Azure PowerShell. |
30 | 27 |
|
31 |
| -Before you can create an Azure Route Server, you have to create a resource group to host the Route Server. Create a resource group with [New-AzResourceGroup](/powershell/module/az.Resources/New-azResourceGroup). This example creates a resource group named **myRouteServerRG** in the **WestUS** location: |
| 28 | + The steps in this article run the Azure PowerShell cmdlets interactively in [Azure Cloud Shell](/azure/cloud-shell/overview). To run the cmdlets in the Cloud Shell, select **Open Cloud Shell** at the upper-right corner of a code block. Select **Copy** to copy the code and then paste it into Cloud Shell to run it. You can also run the Cloud Shell from within the Azure portal. |
32 | 29 |
|
33 |
| -```azurepowershell-interactive |
34 |
| -$rg = @{ |
35 |
| - Name = 'myRouteServerRG' |
36 |
| - Location = 'WestUS' |
37 |
| -} |
38 |
| -New-AzResourceGroup @rg |
39 |
| -``` |
40 |
| - |
41 |
| -### Create a virtual network |
| 30 | + You can also [install Azure PowerShell locally](/powershell/azure/install-azure-powershell) to run the cmdlets. If you run PowerShell locally, sign in to Azure using the [Connect-AzAccount](/powershell/module/az.accounts/connect-azaccount) cmdlet. |
42 | 31 |
|
43 |
| -Create a virtual network with [New-AzVirtualNetwork](/powershell/module/az.network/new-azvirtualnetwork). This example creates a default virtual network named **myVirtualNetwork** in the **WestUS** location: If you already have a virtual network, you can skip to the next section. |
| 32 | +## Create a route server |
44 | 33 |
|
45 |
| -```azurepowershell-interactive |
46 |
| -$vnet = @{ |
47 |
| - Name = 'myVirtualNetwork' |
48 |
| - ResourceGroupName = 'myRouteServerRG' |
49 |
| - Location = 'WestUS' |
50 |
| - AddressPrefix = '10.0.0.0/16' |
51 |
| -} |
52 |
| -$virtualNetwork = New-AzVirtualNetwork @vnet |
53 |
| -``` |
| 34 | +In this section, you create a route server. Prior to creating the route server, you create a resource group to host all resources including the route server. You'll also create a virtual network with a dedicated subnet for the route server. |
54 | 35 |
|
55 |
| -### Add a dedicated subnet |
| 36 | +1. Create a resource group using [New-AzResourceGroup](/powershell/module/az.Resources/New-azResourceGroup). The following example creates a resource group named **RouteServerRG** in the **WestUS** region: |
56 | 37 |
|
57 |
| -Azure Route Server requires a dedicated subnet named *RouteServerSubnet*. The subnet size has to be at least /27 or shorter prefix (such as /26 or /25) or you'll receive an error message when deploying the Route Server. Create a subnet configuration named **RouteServerSubnet** with [Add-AzVirtualNetworkSubnetConfig](/powershell/module/az.network/add-azvirtualnetworksubnetconfig): |
| 38 | + ```azurepowershell-interactive |
| 39 | + # Create a resource group. |
| 40 | + New-AzResourceGroup = -Name 'RouteServerRG' -Location 'WestUS' |
| 41 | + ``` |
58 | 42 |
|
59 |
| -```azurepowershell-interactive |
60 |
| -$subnet = @{ |
61 |
| - Name = 'RouteServerSubnet' |
62 |
| - VirtualNetwork = $virtualNetwork |
63 |
| - AddressPrefix = '10.0.0.0/24' |
64 |
| -} |
65 |
| -$subnetConfig = Add-AzVirtualNetworkSubnetConfig @subnet |
| 43 | +1. The route server requires a dedicated subnet named *RouteServerSubnet*. The subnet size has to be at least /27 or shorter prefix (such as /26 or /25) or you'll receive an error message when deploying the route server. Create a subnet configuration for **RouteServerSubnet** using [New-AzVirtualNetworkSubnetConfig](/powershell/module/az.network/new-azvirtualnetworksubnetconfig). |
66 | 44 |
|
67 |
| -$virtualnetwork | Set-AzVirtualNetwork |
| 45 | + ```azurepowershell-interactive |
| 46 | + # Create subnet configuration. |
| 47 | + $subnet = New-AzVirtualNetworkSubnetConfig -Name 'RouteServerSubnet' -AddressPrefix '10.0.1.0/27' |
| 48 | + ``` |
68 | 49 |
|
69 |
| -$vnetInfo = Get-AzVirtualNetwork -Name myVirtualNetwork -ResourceGroupName myRouteServerRG |
70 |
| -$subnetId = (Get-AzVirtualNetworkSubnetConfig -Name RouteServerSubnet -VirtualNetwork $vnetInfo).Id |
71 |
| -``` |
| 50 | +1. Create a virtual network using [New-AzVirtualNetwork](/powershell/module/az.network/new-azvirtualnetwork). The following example creates a default virtual network named **myRouteServerVNet** in the **WestUS** region. |
72 | 51 |
|
73 |
| -## Create the Route Server |
| 52 | + ```azurepowershell-interactive |
| 53 | + # Create a virtual network and place into a variable. |
| 54 | + $vnet = New-AzVirtualNetwork -Name 'myRouteServerVNet' -ResourceGroupName 'RouteServerRG' -Location 'WestUS' -AddressPrefix '10.0.0.0/16' -Subnet $subnet |
| 55 | + # Place the subnet ID into a variable. |
| 56 | + $subnetId = (Get-AzVirtualNetworkSubnetConfig -Name 'RouteServerSubnet' -VirtualNetwork $vnet).Id |
| 57 | + ``` |
74 | 58 |
|
75 |
| -1. To ensure connectivity to the backend service that manages Route Server configuration, assigning a public IP address is required. Create a Standard Public IP named **RouteServerIP** with [New-AzPublicIpAddress](/powershell/module/az.network/new-azpublicipaddress): |
| 59 | +1. To ensure connectivity to the backend service that manages Route Server configuration, assigning a public IP address is required. Create a Standard Public IP named **RouteServerIP** using [New-AzPublicIpAddress](/powershell/module/az.network/new-azpublicipaddress). |
76 | 60 |
|
77 | 61 | ```azurepowershell-interactive
|
78 |
| - $ip = @{ |
79 |
| - Name = 'myRouteServerIP' |
80 |
| - ResourceGroupName = 'myRouteServerRG' |
81 |
| - Location = 'WestUS' |
82 |
| - AllocationMethod = 'Static' |
83 |
| - IpAddressVersion = 'Ipv4' |
84 |
| - Sku = 'Standard' |
85 |
| - } |
86 |
| - $publicIp = New-AzPublicIpAddress @ip |
| 62 | + # Create a Standard public IP and place it into a variable. |
| 63 | + $publicIp = New-AzPublicIpAddress -ResourceGroupName 'RouteServerRG' -Name 'myRouteServerIP' -Location 'WestUS' -AllocationMethod 'Static' -Sku 'Standard' IpAddressVersion = 'Ipv4' |
87 | 64 | ```
|
88 |
| - |
89 |
| -2. Create the Azure Route Server with [New-AzRouteServer](/powershell/module/az.network/new-azrouteserver). This example creates an Azure Route Server named **myRouteServer** in the **WestUS** location. The *HostedSubnet* is the resource ID of the RouteServerSubnet created in the previous section. |
90 |
| -
|
91 |
| - ```azurepowershell-interactive |
92 |
| - $rs = @{ |
93 |
| - RouteServerName = 'myRouteServer' |
94 |
| - ResourceGroupName = 'myRouteServerRG' |
95 |
| - Location = 'WestUS' |
96 |
| - HostedSubnet = $subnetId |
97 |
| - PublicIP = $publicIp |
98 |
| - } |
99 |
| - New-AzRouteServer @rs |
| 65 | +
|
| 66 | +1. Create the route server using [New-AzRouteServer](/powershell/module/az.network/new-azrouteserver). The following example creates a route server named **myRouteServer** in the **WestUS** region. The *HostedSubnet* is the resource ID of the RouteServerSubnet created in the previous section. |
| 67 | +
|
| 68 | + ```azurepowershell-interactive |
| 69 | + New-AzRouteServer -RouteServerName 'myRouteServer' -ResourceGroupName 'RouteServerRG' -Location 'WestUS' -HostedSubnet $subnetId -PublicIP $publicIp |
100 | 70 | ```
|
101 | 71 |
|
102 | 72 | [!INCLUDE [Deployment note](../../includes/route-server-note-creation-time.md)]
|
103 | 73 |
|
104 |
| -## Create BGP peering with an NVA |
105 |
| -
|
106 |
| -To establish BGP peering from the Route Server to your NVA use [Add-AzRouteServerPeer](/powershell/module/az.network/add-azrouteserverpeer): |
| 74 | +## Set up peering with NVA |
107 | 75 |
|
108 |
| -The `your_nva_ip` is the virtual network IP assigned to the NVA. The `your_nva_asn` is the Autonomous System Number (ASN) configured in the NVA. The ASN can be any 16-bit number other than the ones in the range of 65515-65520. This range of ASNs is reserved by Microsoft. |
| 76 | +In this section, you learn how to configure BGP peering with a network virtual appliance (NVA). Use [Add-AzRouteServerPeer](/powershell/module/az.network/add-azrouteserverpeer) to establish BGP peering from the route server to your NVA. The following example adds a peer named **myNVA** that has an IP address of **10.0.0.4** and an ASN of **65001**. For more information, see [What Autonomous System Numbers (ASNs) can I use?](route-server-faq.md#what-autonomous-system-numbers-asns-can-i-use) |
109 | 77 |
|
110 | 78 | ```azurepowershell-interactive
|
111 |
| -$peer = @{ |
112 |
| - PeerName = 'myNVA' |
113 |
| - PeerIp = 'your_nva_ip' |
114 |
| - PeerAsn = 'your_nva_asn' |
115 |
| - RouteServerName = 'myRouteServer' |
116 |
| - ResourceGroupName = myRouteServerRG' |
117 |
| -} |
118 |
| -Add-AzRouteServerPeer @peer |
| 79 | +Add-AzRouteServerPeer -ResourceGroupName 'RouteServerRG' -RouteServerName 'myRouteServer' -PeerName 'myNVA' -PeerAsn '65001' -PeerIp '10.0.0.4' |
119 | 80 | ```
|
120 | 81 |
|
121 |
| -To set up peering with a different NVA or another instance of the same NVA for redundancy, use the same command as above with different *PeerName*, *PeerIp*, and *PeerAsn*. |
122 |
| - |
123 | 82 | ## Complete the configuration on the NVA
|
124 | 83 |
|
125 |
| -To complete the configuration on the NVA and enable the BGP sessions, you need the IP and the ASN of Azure Route Server. You can get this information by using [Get-AzRouteServer](/powershell/module/az.network/get-azrouteserver): |
| 84 | +To complete the peering setup, you must configure the NVA to establish a BGP session with the route server's peer IPs and ASN. Use [Get-AzRouteServer](/powershell/module/az.network/get-azrouteserver) to get the IP and ASN of the route server. |
126 | 85 |
|
127 | 86 | ```azurepowershell-interactive
|
128 |
| -$routeserver = @{ |
129 |
| - RouteServerName = 'myRouteServer' |
130 |
| - ResourceGroupName = 'myRouteServerRG' |
131 |
| -} |
132 |
| -Get-AzRouteServer @routeserver |
| 87 | +Get-AzRouteServer -ResourceGroupName 'RouteServerRG' -RouteServerName 'myRouteServer' |
133 | 88 | ```
|
134 | 89 |
|
135 | 90 | The output looks like the following:
|
136 | 91 |
|
137 |
| -``` |
138 |
| -RouteServerAsn : 65515 |
139 |
| -RouteServerIps : {10.5.10.4, 10.5.10.5} |
| 92 | +```output |
| 93 | +ResourceGroupName Name Location RouteServerAsn RouteServerIps ProvisioningState HubRoutingPreference AllowBranchToBranchTraffic |
| 94 | +----------------- ---- -------- -------------- -------------- ----------------- -------------------- -------------------------- |
| 95 | +RouteServerRG myRouteServer westus 65515 {10.0.1.4, 10.0.1.5} Succeeded ExpressRoute False |
140 | 96 | ```
|
141 | 97 |
|
142 | 98 | [!INCLUDE [NVA peering note](../../includes/route-server-note-nva-peering.md)]
|
143 | 99 |
|
144 |
| -## <a name = "route-exchange"></a>Configure route exchange |
145 |
| - |
146 |
| -If you have a virtual network gateway (ExpressRoute or VPN) in the same virtual network, you can enable *BranchToBranchTraffic* to exchange routes between the gateway and the Route Server. |
147 |
| - |
148 |
| -[!INCLUDE [VPN gateway note](../../includes/route-server-note-vpn-gateway.md)] |
149 |
| - |
150 |
| -[!INCLUDE [downtime note](../../includes/route-server-note-vng-downtime.md)] |
151 |
| - |
152 |
| -1. To enable route exchange between Azure Route Server and the gateway(s), use [Update-AzRouteServer](/powershell/module/az.network/update-azrouteserver) with the *-AllowBranchToBranchTraffic* flag: |
153 |
| - |
154 |
| -```azurepowershell-interactive |
155 |
| -$routeserver = @{ |
156 |
| - RouteServerName = 'myRouteServer' |
157 |
| - ResourceGroupName = 'myRouteServerRG' |
158 |
| - AllowBranchToBranchTraffic |
159 |
| -} |
160 |
| -Update-AzRouteServer @routeserver |
161 |
| -``` |
162 |
| - |
163 |
| -2. To disable route exchange between Azure Route Server and the gateway(s), use [Update-AzRouteServer](/powershell/module/az.network/update-azrouteserver) without the *-AllowBranchToBranchTraffic* flag: |
164 |
| - |
165 |
| -```azurepowershell-interactive |
166 |
| -$routeserver = @{ |
167 |
| - RouteServerName = 'myRouteServer' |
168 |
| - ResourceGroupName = 'myRouteServerRG' |
169 |
| -} |
170 |
| -Update-AzRouteServer @routeserver |
171 |
| -``` |
172 |
| - |
173 |
| -## Troubleshooting |
174 |
| - |
175 |
| -Use the [Get-AzRouteServerPeerAdvertisedRoute](/powershell/module/az.network/get-azrouteserverpeeradvertisedroute) to view routes advertised by the Azure Route Server. |
176 |
| - |
177 |
| -```azurepowershell-interactive |
178 |
| -$remotepeer = @{ |
179 |
| - RouteServerName = 'myRouteServer' |
180 |
| - ResourceGroupName = 'myRouteServerRG' |
181 |
| - PeerName = 'myNVA' |
182 |
| -} |
183 |
| -Get-AzRouteServerPeerAdvertisedRoute @remotepeer |
184 |
| -``` |
185 |
| - |
186 |
| -Use the [Get-AzRouteServerPeerLearnedRoute](/powershell/module/az.network/get-azrouteserverpeerlearnedroute) to view routes learned by the Azure Route Server. |
187 |
| - |
188 |
| -```azurepowershell-interactive |
189 |
| -$remotepeer = @{ |
190 |
| - RouteServerName = 'myRouteServer' |
191 |
| - ResourceGroupName = 'myRouteServerRG' |
192 |
| - PeerName = 'myNVA' |
193 |
| -} |
194 |
| -Get-AzRouteServerPeerLearnedRoute @remotepeer |
195 |
| -``` |
196 | 100 | ## Clean up resources
|
197 | 101 |
|
198 |
| -If you no longer need the Azure Route Server, use the first command to remove the BGP peering, and then the second command to remove the Route Server. |
199 |
| - |
200 |
| -1. Remove the BGP peering between Azure Route Server and an NVA with [Remove-AzRouteServerPeer](/powershell/module/az.network/remove-azrouteserverpeer): |
| 102 | +When no longer needed, delete the resource group and all of the resources it contains using [Remove-AzResourceGroup](/powershell/module/az.resources/remove-azresourcegroup). |
201 | 103 |
|
202 | 104 | ```azurepowershell-interactive
|
203 |
| -$remotepeer = @{ |
204 |
| - PeerName = 'myNVA' |
205 |
| - RouteServerName = 'myRouteServer' |
206 |
| - ResourceGroupName = 'myRouteServerRG' |
207 |
| -} |
208 |
| -Remove-AzRouteServerPeer @remotepeer |
| 105 | +# Delete the resource group and all the resources it contains. |
| 106 | +Remove-AzResourceGroup -Name 'RouteServerRG' -Force |
209 | 107 | ```
|
210 | 108 |
|
211 |
| -2. Remove the Azure Route Server with [Remove-AzRouteServer](/powershell/module/az.network/remove-azrouteserver): |
212 |
| - |
213 |
| -```azurepowershell-interactive |
214 |
| -$routeserver = @{ |
215 |
| - RouteServerName = 'myRouteServer' |
216 |
| - ResourceGroupName = 'myRouteServerRG' |
217 |
| -} |
218 |
| -Remove-AzRouteServer @routeserver |
219 |
| -``` |
220 |
| - |
221 |
| -## Next steps |
222 |
| - |
223 |
| -After you've created the Azure Route Server, continue on to learn more about how Azure Route Server interacts with ExpressRoute and VPN Gateways: |
| 109 | +## Next step |
224 | 110 |
|
225 | 111 | > [!div class="nextstepaction"]
|
226 |
| -> [Azure ExpressRoute and Azure VPN support](expressroute-vpn-support.md) |
| 112 | +> [Configure peering between a route server and NVA](peer-route-server-with-virtual-appliance.md) |
0 commit comments