You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: 'Quickstart: Create and configure Route Server - Azure CLI'
3
-
description: In this quickstart, you learn how to create and configure an Azure Route Server using Azure CLI.
2
+
title: 'Quickstart: Create an Azure Route Server - Azure CLI'
3
+
description: In this quickstart, you learn how to create an Azure Route Server using the Azure CLI.
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/23/2024
9
9
ms.custom: mode-api, devx-track-azurecli
10
10
ms.devlang: azurecli
11
11
---
12
12
13
-
# Quickstart: Create and configure Route Server using Azure CLI
13
+
# Quickstart: Create an Azure Route Server using the Azure CLI
14
14
15
-
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 will also advertise the virtual network routes to the NVA. For more information, see [Azure Route Server](overview.md).
15
+
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 the Azure CLI.
16
16
17
17
:::image type="content" source="media/quickstart-configure-route-server-portal/environment-diagram.png" alt-text="Diagram of Route Server deployment environment using the Azure CLI." lightbox="media/quickstart-configure-route-server-portal/environment-diagram.png":::
18
18
@@ -21,200 +21,111 @@ This article helps you configure Azure Route Server to peer with a Network Virtu
21
21
## Prerequisites
22
22
23
23
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
24
-
- The steps in this article run the Azure CLI commands interactively in [Azure Cloud Shell](/azure/cloud-shell/overview). To run the commands in the Cloud Shell, select **Open Cloudshell** at the upper-right corner of a code block. Select **Copy** to copy the code, and paste it into Cloud Shell to run it. You can also run the Cloud Shell from within the Azure portal. You can also [install Azure CLI locally](/cli/azure/install-azure-cli) to run the commands. If you run Azure CLI locally, sign in to Azure using the [az login](/cli/azure/reference-index#az-login) command.
25
-
- Review the [service limits for Azure Route Server](route-server-faq.md#limitations).
26
24
27
-
## Create a resource group and a virtual network
25
+
- Review the [service limits for Azure Route Server](route-server-faq.md#limitations).
28
26
29
-
### Create a resource group
27
+
- Azure Cloud Shell or Azure CLI.
30
28
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 [az group create](/cli/azure/group#az-group-create). This example creates a resource group named **myRouteServerRG**in the **westus**location:
29
+
The steps in this article run the Azure CLI commands interactively in [Azure Cloud Shell](/azure/cloud-shell/overview). To run the commands in the Cloud Shell, select **Open Cloud Shell**at the upper-right corner of a code block. Select **Copy**to copy the code, and paste it into Cloud Shell to run it. You can also run the Cloud Shell from within the Azure portal.
32
30
33
-
```azurecli-interactive
34
-
az group create \
35
-
--name myRouteServerRG \
36
-
--location westus
37
-
```
31
+
You can also [install Azure CLI locally](/cli/azure/install-azure-cli) to run the commands. If you run Azure CLI locally, sign in to Azure using the [az login](/cli/azure/reference-index#az-login) command.
38
32
39
-
###Create a virtual network
33
+
## Create a route server
40
34
41
-
Create a virtual network with [az network vnet create](/cli/azure/network/vnet#az-network-vnet-create). This example creates a default virtual network named **myVirtualNetwork**. If you already have a virtual network, you can skip to the next section.
42
-
43
-
```azurecli-interactive
44
-
az network vnet create \
45
-
--name myVirtualNetwork \
46
-
--resource-group myRouteServerRG \
47
-
--address-prefix 10.0.0.0/16
48
-
```
35
+
In this section, you create a route server. Prior to creating the route server, create a resource group to host all resources including the route server. You'll also need to create a virtual network with a dedicated subnet for the route server.
49
36
50
-
### Add a dedicated subnet
37
+
1. Create a resource group using [az group create](/cli/azure/group#az-group-create). The following example creates a resource group named **RouteServerRG** in the **WestUS** region:
51
38
52
-
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), otherwise you might receive an error message when deploying the Route Server. Create a subnet configuration named **RouteServerSubnet** with [az network vnet subnet create](/cli/azure/network/vnet/subnet#az-network-vnet-subnet-create):
39
+
```azurecli-interactive
40
+
az group create --name 'RouteServerRG' --location 'westus'
41
+
```
53
42
54
-
1.Run the following command to add the *RouteServerSubnet*to your virtual network.
43
+
1. Create a virtual network using [az network vnet create](/cli/azure/network/vnet#az-network-vnet-create). The following example creates a default virtual network named **myRouteServerVNet** in the **WestUS** region with **RouteServerSubnet** subnet. 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.
55
44
56
-
```azurecli-interactive
57
-
az network vnet subnet create \
58
-
--name RouteServerSubnet \
59
-
--resource-group myRouteServerRG \
60
-
--vnet-name myVirtualNetwork \
61
-
--address-prefix 10.0.0.0/24
45
+
```azurecli-interactive
46
+
# Create a virtual network and a route server subnet.
subnetId=$(az network vnet subnet show --name 'RouteServerSubnet' --resource-group 'RouteServerRG' --vnet-name 'myRouteServerVNet' --query id -o tsv)
62
50
```
63
51
64
-
1. Make note of the RouteServerSubnet ID. To obtain and store the resource ID of the *RouteServerSubnet* to the `subnet_id` variable, use [az network vnet subnet show](/cli/azure/network/vnet/subnet#az-network-vnet-subnet-show):
65
-
66
-
```azurecli-interactive
67
-
subnet_id=$(az network vnet subnet show \
68
-
--name RouteServerSubnet \
69
-
--resource-group myRouteServerRG \
70
-
--vnet-name myVirtualNetwork \
71
-
--query id -o tsv)
72
-
73
-
echo $subnet_id
74
-
```
75
-
76
-
## Create the Route Server
77
-
78
-
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 [az network public-ip create](/cli/azure/network/public-ip#az-network-public-ip-create):
52
+
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 [az network public-ip create](/cli/azure/network/public-ip#az-network-public-ip-create).
79
53
80
54
```azurecli-interactive
81
-
az network public-ip create \
82
-
--name RouteServerIP \
83
-
--resource-group myRouteServerRG \
84
-
--version IPv4 \
85
-
--sku Standard
55
+
# Create a Standard public IP.
56
+
az network public-ip create --resource-group 'RouteServerRG' --name 'RouteServerIP' --sku Standard --version 'IPv4'
86
57
```
87
58
88
-
2. Create the Azure Route Server with [az network routeserver create](/cli/azure/network/routeserver#az-network-routeserver-create). This example creates an Azure Route Server named **myRouteServer**. The *hosted-subnet* is the resource ID of the RouteServerSubnet created in the previous section.
59
+
1. Create the route server using [az network routeserver create](/cli/azure/network/routeserver#az-network-routeserver-create) command. 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 steps.
Use [az network routeserver peering create](/cli/azure/network/routeserver/peering#az-network-routeserver-peering-create) to establish BGP peering between the Route Server and the NVA:
68
+
## Set up peering with NVA
103
69
104
-
The `peer-ip` is the virtual network IP assigned to the NVA. The `peer-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.
70
+
In this section, you learn how to configure BGP peering with a network virtual appliance (NVA). Use [az network routeserver peering create](/cli/azure/network/routeserver/peering#az-network-routeserver-peering-create) command 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)
To set up peering with a different NVA or another instance of the same NVA for redundancy, use the previous command with different *PeerName*, *PeerIp*, and *PeerAsn*.
116
-
117
76
## Complete the configuration on the NVA
118
77
119
-
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 [az network routeserver show](/cli/azure/network/routeserver#az-network-routeserver-show):
120
-
121
-
```azurecli-interactive
122
-
az network routeserver show \
123
-
--name myRouteServer \
124
-
--resource-group myRouteServerRG
125
-
```
126
-
127
-
The output will look like the following example:
78
+
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 [az network routeserver show](/cli/azure/network/routeserver#az-network-routeserver-show) command to get the IP and ASN of the route server.
128
79
80
+
```azurecli-interactive
81
+
az network routeserver show --resource-group 'RouteServerRG' --name 'myRouteServer'
If you have a virtual network gateway (ExpressRoute or VPN) in the same virtual network, you can enable *b2b traffic* to exchange routes between the gateway and the Route Server.
1. To enable route exchange between Azure Route Server and the gateways, use [az network routerserver update](/cli/azure/network/routeserver#az-network-routeserver-update) with the `--allow-b2b-traffic` flag set to **true**:
155
-
156
-
```azurecli-interactive
157
-
az network routeserver update \
158
-
--name myRouteServer \
159
-
--resource-group myRouteServerRG \
160
-
--allow-b2b-traffic true
161
-
```
162
-
163
-
2. To disable route exchange between Azure Route Server and the gateways, use [az network routerserver update](/cli/azure/network/routeserver#az-network-routeserver-update) with the `--allow-b2b-traffic` flag set to **false**:
164
-
165
-
```azurecli-interactive
166
-
az network routeserver update \
167
-
--name myRouteServer \
168
-
--resource-group myRouteServerRG \
169
-
--allow-b2b-traffic false
170
-
```
171
-
172
-
## Troubleshooting
173
-
174
-
Use the [az network routeserver peering list-advertised-routes](/cli/azure/network/routeserver/peering#az-network-routeserver-peering-list-advertised-routes) to view routes advertised by the Azure Route Server:
175
-
176
-
```azurecli-interactive
177
-
az network routeserver peering list-advertised-routes \
178
-
--name myNVA \
179
-
--routeserver myRouteServer \
180
-
--resource-group myRouteServerRG
181
-
```
117
+
## Clean up resources
182
118
183
-
Use the [az network routeserver peering list-learned-routes](/cli/azure/network/routeserver/peering#az-network-routeserver-peering-list-learned-routes) to view routes learned by the Azure Route Server:
119
+
When no longer needed, delete the resource group and all of the resources it contains using [az group delete](/cli/azure/group#az-group-delete) command.
184
120
185
121
```azurecli-interactive
186
-
az network routeserver peering list-learned-routes \
187
-
--name myNVA \
188
-
--routeserver myRouteServer
189
-
--resource-group myRouteServerRG \
122
+
# Delete the resource group and all the resources it contains.
123
+
az group delete --name 'myResourceGroup' --yes --no-wait
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.
197
-
198
-
1. Remove the BGP peering between Azure Route Server and an NVA with [az network routeserver peering delete](/cli/azure/network/routeserver/peering#az-network-routeserver-peering-delete):
199
-
200
-
```azurecli-interactive
201
-
az network routeserver peering delete \
202
-
--name myNVA \
203
-
--routeserver myRouteServer \
204
-
--resource-group myRouteServerRG
205
-
```
206
-
207
-
2. Remove the Azure Route Server with [az network routeserver delete](/cli/azure/network/routeserver#az-network-routeserver-delete):
208
-
209
-
```azurecli-interactive
210
-
az network routeserver delete \
211
-
--name myRouteServer \
212
-
--resource-group myRouteServerRG
213
-
```
214
-
215
126
## Next step
216
127
217
128
Continue to learn more about how Azure Route Server interacts with ExpressRoute and VPN Gateways:
218
129
219
130
> [!div class="nextstepaction"]
220
-
> [Azure ExpressRoute and Azure VPN support](expressroute-vpn-support.md)
131
+
> [Configure peering between a route server and NVA](peer-route-server-with-virtual-appliance.md)
0 commit comments