Skip to content

Commit e308227

Browse files
Merge pull request #222948 from halkazwini/nw-vm-pc2
Network Watcher: Freshness: Manage packet captures with Azure Network Watcher using the portal
2 parents afbb48e + 14c4957 commit e308227

File tree

5 files changed

+79
-60
lines changed

5 files changed

+79
-60
lines changed
76.6 KB
Loading
105 KB
Loading
102 KB
Loading

articles/network-watcher/network-watcher-packet-capture-manage-portal.md

Lines changed: 72 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,117 @@
11
---
2-
title: Manage packet captures - Azure portal
2+
title: Manage packet captures in VMs with Network Watcher - Azure portal
33
titleSuffix: Azure Network Watcher
4-
description: Learn how to manage the packet capture feature of Network Watcher using the Azure portal.
4+
description: Learn how to manage packet captures in virtual machines with the packet capture feature of Network Watcher using the Azure portal.
55
services: network-watcher
6-
documentationcenter: na
76
author: shijaiswal
87
ms.service: network-watcher
98
ms.topic: how-to
10-
ms.tgt_pltfrm: na
119
ms.workload: infrastructure-services
12-
ms.date: 01/07/2021
10+
ms.date: 01/04/2023
1311
ms.author: shijaiswal
12+
ms.custom: template-how-to, engagement-fy23
1413
---
1514

16-
# Manage packet captures with Azure Network Watcher using the portal
15+
# Manage packet captures in virtual machines with Azure Network Watcher using the Azure portal
16+
17+
> [!div class="op_single_selector"]
18+
> - [Azure portal](network-watcher-packet-capture-manage-portal.md)
19+
> - [PowerShell](network-watcher-packet-capture-manage-powershell.md)
20+
> - [Azure CLI](network-watcher-packet-capture-manage-cli.md)
21+
> - [Azure REST API](network-watcher-packet-capture-manage-rest.md)
1722
1823
Network Watcher packet capture allows you to create capture sessions to track traffic to and from a virtual machine. Filters are provided for the capture session to ensure you capture only the traffic you want. Packet capture helps to diagnose network anomalies, both reactively, and proactively. Other uses include gathering network statistics, gaining information on network intrusions, to debug client-server communication, and much more. Being able to remotely trigger packet captures, eases the burden of running a packet capture manually on a desired virtual machine, which saves valuable time.
1924

2025
In this article, you learn to start, stop, download, and delete a packet capture.
2126

22-
## Before you begin
27+
## Prerequisites
2328

24-
Packet capture requires the following outbound TCP connectivity:
25-
- to the chosen storage account over port 443
26-
- to 169.254.169.254 over port 80
27-
- to 168.63.129.16 over port 8037
29+
- An Azure account with an active subscription. [Create one for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
30+
- A virtual machine with the following outbound TCP connectivity:
31+
- to the chosen storage account over port 443
32+
- to 169.254.169.254 over port 80
33+
- to 168.63.129.16 over port 8037
2834

2935
> [!NOTE]
30-
> The ports mentioned in the latter two cases above are common across all Network Watcher features that involve the Network Watcher extension and might occasionally change.
31-
36+
> The ports mentioned in the latter two cases are common across all Network Watcher features that involve the Network Watcher extension and might occasionally change.
3237
33-
If a network security group is associated to the network interface, or subnet that the network interface is in, ensure that rules exist that allow the previous ports. Similarly, adding user-defined traffic routes to your network may prevent connectivity to the above mentioned IPs and ports. Please ensure they are reachable.
38+
If a network security group is associated to the network interface, or subnet that the network interface is in, ensure that rules exist to allow outbound connectivity over the previous ports. Similarly, ensure outbound connectivity over the previous ports when adding user-defined routes to your network.
3439

3540
## Start a packet capture
3641

37-
1. In your browser, navigate to the [Azure portal](https://portal.azure.com) and select **All services**, and then select **Network Watcher** in the **Networking section**.
38-
2. Select **Packet capture** under **Network diagnostic tools**. Any existing packet captures are listed, regardless of their status.
39-
3. Select **Add** to create a packet capture. You can select values for the following properties:
40-
- **Subscription**: The subscription that the virtual machine you want to create the packet capture for is in.
41-
- **Resource group**: The resource group of the virtual machine.
42-
- **Target virtual machine**: The virtual machine that you want to create the packet capture for.
43-
- **Packet capture name**: A name for the packet capture.
44-
- **Storage account or file**: Select **Storage account**, **File**, or both. If you select **File**, the capture is written to a path within the virtual machine.
45-
- **Local file path**: The local path on the virtual machine where the packet capture will be saved (valid only when *File* is selected). The path must be a valid path. If you are using a Linux virtual machine, the path must start with */var/captures*.
46-
- **Storage accounts**: Select an existing storage account, if you selected *Storage account*. This option is only available if you selected **Storage**.
47-
42+
1. Sign in to the [Azure portal](https://portal.azure.com).
43+
1. In the search box at the top of the portal, enter *Network Watcher*.
44+
1. In the search results, select **Network Watcher**.
45+
1. Select **Packet capture** under **Network diagnostic tools**. Any existing packet captures are listed, regardless of their status.
46+
1. Select **+ Add** to create a packet capture. In **Add packet capture**, enter or select values for the following settings:
47+
48+
| Setting | Value |
49+
| --- | --- |
50+
| **Basic Details** | |
51+
| Subscription | Select the Azure subscription of the virtual machine. |
52+
| Resource group | Select the resource group of the virtual machine. |
53+
| Target type | Select **Virtual machine**. |
54+
| Target instance | Select the virtual machine. |
55+
| Packet capture name | Enter a name or leave the default name. |
56+
| **Packet capture configuration** | |
57+
| Capture location | Select **Storage account**, **File**, or **Both**. |
58+
| Storage account | Select your **Standard** storage account. <br> This option is available if you selected **Storage account** or **Both**. |
59+
| Local file path | Enter a valid local file path where you want the capture to be saved in the target virtual machine. If you're using a Linux machine, the path must start with */var/captures*. <br> This option is available if you selected **File** or **Both**. |
60+
| Maximum bytes per packet | Enter the maximum number of bytes to be captured per each packet. All bytes are captured if left blank or 0 entered. |
61+
| Maximum bytes per session | Enter the total number of bytes that are captured. Once the value is reached the packet capture stops. Up to 1 GB is captured if left blank. |
62+
| Time limit (seconds) | Enter the time limit of the packet capture session in seconds. Once the value is reached the packet capture stops. Up to 5 hours (18,000 seconds) is captured if left blank. |
63+
| **Filtering (optional)** | |
64+
| Add filter criteria | Select **Add filter criteria** to add a new filter. |
65+
| Protocol | Filters the packet capture based on the selected protocol. Available values are **TCP**, **UDP**, or **Any**. |
66+
| Local IP address | Filters the packet capture for packets where the local IP address matches this value. |
67+
| Local port | Filters the packet capture for packets where the local port matches this value. |
68+
| Remote IP address | Filters the packet capture for packets where the remote IP address matches this value. |
69+
| Remote port | Filters the packet capture for packets where the remote port matches this value. |
70+
4871
> [!NOTE]
4972
> Premium storage accounts are currently not supported for storing packet captures.
5073
51-
- **Maximum bytes per packet**: The number of bytes from each packet that are captured. If left blank, all bytes are captured.
52-
- **Maximum bytes per session**: The total number of bytes that are captured. Once the value is reached the packet capture stops.
53-
- **Time limit (seconds)**: The time limit before the packet capture is stopped. The default is 18,000 seconds.
54-
- Filtering (Optional). Select **+ Add filter**
55-
- **Protocol**: The protocol to filter for the packet capture. The available values are TCP, UDP, and Any.
56-
- **Local IP address**: Filters the packet capture for packets where the local IP address matches this value.
57-
- **Local port**: Filters the packet capture for packets where the local port matches this value.
58-
- **Remote IP address**: Filters the packet capture for packets where the remote IP address matches this value.
59-
- **Remote port**: Filters the packet capture for packets where the remote port matches this value.
60-
6174
> [!NOTE]
62-
> Port and IP address values can be a single value, range of values, or a range, such as 80-1024, for port. You can define as many filters as you need.
75+
> Port and IP address values can be a single value, multiple values, or a range, such as 80-1024, for port. You can define as many filters as you need.
76+
77+
1. Select **Start packet capture**.
6378

64-
4. Select **OK**.
79+
:::image type="content" source="./media/network-watcher-packet-capture-manage-portal/add-packet-capture.png" alt-text="Screenshot of Add packet capture in Azure portal showing available options.":::
6580

66-
After the time limit set on the packet capture has expired, the packet capture is stopped, and can be reviewed. You can also manually stop a packet capture session.
81+
1. Once the time limit set on the packet capture is reached, the packet capture stops and can be reviewed. To manually stop a packet capture session before it reaches its time limit, select the **...** on the right-side of the packet capture in **Packet capture** page, or right-click it, then select **Stop**.
82+
83+
:::image type="content" source="./media/network-watcher-packet-capture-manage-portal/stop-packet-capture.png" alt-text="Screenshot showing how to stop a packet capture in Azure portal.":::
6784

6885
> [!NOTE]
69-
> The portal automatically:
70-
> * Creates a network watcher in the same region as the region the virtual machine you selected exists in, if the region doesn't already have a network watcher.
71-
> * Adds the *AzureNetworkWatcherExtension* [Linux](../virtual-machines/extensions/network-watcher-linux.md) or [Windows](../virtual-machines/extensions/network-watcher-windows.md) virtual machine extension to the virtual machine, if it's not already installed.
86+
> The Azure portal automatically:
87+
> * Creates a network watcher in the same region as the region of the target virtual machine, if the region doesn't already have a network watcher.
88+
> * Adds `AzureNetworkWatcherExtension` to [Linux](../virtual-machines/extensions/network-watcher-linux.md) or [Windows](../virtual-machines/extensions/network-watcher-windows.md) virtual machines, if the extension isn't already installed.
7289
7390
## Delete a packet capture
7491

75-
1. In the packet capture view, select **...** on the right-side of the packet capture, or right-click an existing packet capture, and select **Delete**.
76-
2. You are asked to confirm you want to delete the packet capture. Select **Yes**.
92+
1. Sign in to the [Azure portal](https://portal.azure.com).
93+
1. In the search box at the top of the portal, enter *Network Watcher*, then select **Network Watcher** from the search results.
94+
1. Select **Packet capture** under **Network diagnostic tools**.
95+
1. In the **Packet capture** page, select **...** on the right-side of the packet capture that you want to delete, or right-click it, then select **Delete**.
7796

78-
> [!NOTE]
79-
> Deleting a packet capture does not delete the capture file in the storage account or on the virtual machine.
97+
:::image type="content" source="./media/network-watcher-packet-capture-manage-portal/delete-packet-capture.png" alt-text="Screenshot showing how to delete a packet capture from Network Watcher in Azure portal.":::
8098

81-
## Stop a packet capture
99+
1. Select **Yes**.
82100

83-
In the packet capture view, select **...** on the right-side of the packet capture, or right-click an existing packet capture, and select **Stop**.
101+
> [!NOTE]
102+
> Deleting a packet capture does not delete the capture file in the storage account or on the virtual machine.
84103
85104
## Download a packet capture
86105

87-
Once your packet capture session has completed, the capture file is uploaded to blob storage or to a local file on the virtual machine. The storage location of the packet capture is defined during creation of the packet capture. A convenient tool to access capture files saved to a storage account is Microsoft Azure Storage Explorer, which you can [download](https://storageexplorer.com/).
106+
Once your packet capture session has completed, the capture file is saved to a blob storage or a local file on the target virtual machine. The storage location of the packet capture is defined during creation of the packet capture. A convenient tool to access capture files saved to a storage account is Azure Storage Explorer, which you can [download](https://storageexplorer.com/) after selecting the operating system.
88107

89-
If a storage account is specified, packet capture files are saved to a storage account at the following location:
108+
- If a storage account is specified, packet capture files are saved to a storage account at the following location:
90109

91-
```
92-
https://{storageAccountName}.blob.core.windows.net/network-watcher-logs/subscriptions/{subscriptionId}/resourcegroups/{storageAccountResourceGroup}/providers/microsoft.compute/virtualmachines/{VMName}/{year}/{month}/{day}/packetCapture_{creationTime}.cap
93-
```
110+
```
111+
https://{storageAccountName}.blob.core.windows.net/network-watcher-logs/subscriptions/{subscriptionId}/resourcegroups/{storageAccountResourceGroup}/providers/microsoft.compute/virtualmachines/{VMName}/{year}/{month}/{day}/packetCapture_{creationTime}.cap
112+
```
94113
95-
If you selected **File** when you created the capture, you can view or download the file from the path you configured on the virtual machine.
114+
- If a file path is specified, the capture file can be viewed on the virtual machine or downloaded.
96115
97116
## Next steps
98117

articles/network-watcher/toc.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,19 +139,19 @@
139139
items:
140140
- name: Manage a packet capture
141141
items:
142-
- name: Azure portal VM
142+
- name: Virtual machine - portal
143143
href: network-watcher-packet-capture-manage-portal.md
144-
- name: Azure portal virtual machine scale set
144+
- name: Virtual machine scale set - portal
145145
href: network-watcher-packet-capture-manage-portal-vmss.md
146-
- name: Azure PowerShell VM
146+
- name: Virtual machine - PowerShell
147147
href: network-watcher-packet-capture-manage-powershell.md
148-
- name: Azure PowerShell virtual machine scale set
148+
- name: Virtual machine scale set - PowerShell
149149
href: network-watcher-packet-capture-manage-powershell-vmss.md
150-
- name: The Azure CLI
150+
- name: Virtual machine - Azure CLI
151151
href: network-watcher-packet-capture-manage-cli.md
152-
- name: REST VM
152+
- name: Virtual machine - REST
153153
href: network-watcher-packet-capture-manage-rest.md
154-
- name: REST virtual machine scale set
154+
- name: Virtual machine scale set - REST
155155
href: network-watcher-packet-capture-manage-rest-vmss.md
156156
- name: Analyze a packet capture
157157
items:

0 commit comments

Comments
 (0)