

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 排除网络问题
<a name="network-issues"></a>

如果遇到网络问题，您可以按照此处显示的过程来诊断问题。

## 您想捕获数据包跟踪
<a name="capture-packet-trace"></a>

数据包跟踪流程验证数据包通过各层到达目的地的路径。您可以使用以下 NetApp ONTAP CLI 命令来控制数据包跟踪流程：
+ **network tcpdump start** – 开始数据包跟踪
+ **network tcpdump show** – 显示当前正在运行的数据包跟踪
+ **network tcpdump stop** – 停止正在运行的数据包跟踪

这些命令可供在文件系统上拥有 `fsxadmin` 角色的用户使用。

**从文件系统捕获数据包跟踪**

1. 要通过 SSH 登录文件系统的 NetApp ONTAP CLI，请按照《*Amazon for [使用 NetApp ONTAP CLI](managing-resources-ontap-apps.md#netapp-ontap-cli) NetApp ONTAP 用户指南》中记录的步骤 FSx 进行*操作。

   ```
   ssh fsxadmin@{{file-system-management-endpoint-ip-address}}
   ```

1. 使用以下命令在 ONTAP CLI 中进入诊断权限级别。

   ```
   ::> set diag
   ```

   当系统提示继续操作时，请输入 `y`。

   ```
   Warning: These diagnostic commands are for use by NetApp personnel only.
   Do you want to continue? {y|n}: y
   ```

1. 确定文件系统上用于保存数据包跟踪的位置。卷必须处于在线状态，并且必须安装于具有有效连接路径的命名空间中。使用以下命令检查符合以下标准的卷：

   ```
   ::*> volume show -junction-path !- -fields junction-path
   vserver volume    junction-path 
   ------- --------- ------------- 
   fsx     test_vol1 /test_vol1    
   fsx     test_vol2 /test_vol2
   fsx     test_vol2 /test_vol3
   ```

1. 使用最少的必需参数开始跟踪。替换以下内容：
   + {{node\_name}}替换为节点的名称（例如，`FsxId01234567890abcdef-01`）。
   + {{svm\_name}}替换为存储虚拟机的名称（例如，`fsx`）。
   + {{junction\_path\_name}}替换为卷名（例如，`test-vol1`）。

   ```
   ::*> debug network tcpdump start -node {{node_name}} -ipspace Default -pass-through "-i e0e -w /clus/{{svm_name}}/{{junction_path_name}}"
   Info: Started network trace on interface "e0e"
   Warning: Snapshots should be disabled on the tcpdump destination volume while packet traces are occurring. Use the
   "volume modify -snapshot-policy none -vserver fsx -volume test_vol1" command to disable Snapshots on the
   tcpdump destination volume.
   ```
**重要**  
只能在 `e0e` 接口和 `Default` IP 空间中捕获数据包跟踪。在 FSx ONTAP 中，所有网络流量都使用该`e0e`接口。

   使用数据包跟踪时，请注意以下几点：
   + 开始数据包跟踪时，必须包含要存储跟踪文件的路径，格式为：/clus//{{svm\_name}}{{junction-path-name}}
   + （可选）提供数据包跟踪的文件名。如果未指定 filter\_name，则会自动生成格式为：{{node-name}}\_ \_ .trc {{port-name}} {{yyyymmdd\_hhmmss}} 
   + 如果滚动跟踪已指定，则 filter\_name 后跟数字，表示旋转序列中的位置。
   + ONTAP CLI 还接受以下可选 **-pass-through** 参数：

     ```
     -B, --buffer-size=<KiB>
     -c <number_of_packets>
     -C <file_size-mB>
     -F <filter_expression_filename>
     -G <rotate_seconds>
     --time-stamp-precision {micro|nano}
     -Q, --direction {in|out|inout}
     -s, --snapshot-length=<bytes>
     -U, --packet-buffered
     -W <rotate_file_count>
     <filter-expression>
     ```
   + 有关筛选器表达式的信息，请参阅 [pcap-filter（7）手册页](https://www.tcpdump.org/manpages/pcap-filter.7.html)。

1. 查看正在进行的跟踪：

   ```
   ::*> debug network tcpdump show
   Node                     IPspace  Port     Filename
   -----------------------  -------- -------- --------
   FsxId123456789abcdef-01  Default  e0e      /clus/fsx/test_vol1/FsxId123456789abcdef-01_e0e_20230605_181451.trc
   ```

1. 停止跟踪：

   ```
   ::*> debug network tcpdump stop -node FsxId123456789abcdef-01 -ipspace Default -port e0e
   Info: Stopped network trace on interface "e0e"
   ```

1. 返回管理员权限级别：

   ```
   ::*> set -priv admin
   ::>
   ```

1. 访问数据包跟踪。

   数据包跟踪存储在您使用 **debug network tcpdump start** 命令指定的卷中，可通过 NFS 导出或与该卷对应的 SMB 共享进行访问。

有关捕获包跟踪的更多信息，请参阅 [如何在 NetApp Knowledge Base 的 ONTAP 9.10\+ 中使用调试网络 dump](https://kb.netapp.com/onprem/ontap/hardware/How_to_use_debug_tcpdump_in_ONTAP_9.10)。