

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 故障診斷網路問題
<a name="network-issues"></a>

如果您遇到網路問題，您可以使用此處顯示的程序來診斷問題。

## 您想要擷取封包追蹤
<a name="capture-packet-trace"></a>

封包追蹤是驗證封包透過層到達其目的地的路徑的程序。您可以使用下列 CLI NetApp ONTAP 命令控制封包追蹤程序：
+ **network tcpdump start** – 開始封包追蹤
+ **network tcpdump show** – 顯示目前正在執行的封包追蹤
+ **network tcpdump stop** – 停止執行中的封包追蹤

這些命令可供在檔案系統上具有 `fsxadmin`角色的使用者使用。

**從檔案系統擷取封包追蹤**

1. 若要在檔案系統的 NetApp ONTAP CLI 中 SSH，請遵循 *Amazon FSx for NetApp ONTAP 使用者指南*中 [使用 NetApp ONTAP CLI](managing-resources-ontap-apps.md#netapp-ontap-cli) 一節所述的步驟。

   ```
   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\$1name* 取代為節點的名稱 （例如，`FsxId01234567890abcdef-01`)。
   + 將 *svm\$1name* 取代為儲存虛擬機器的名稱 （例如 `fsx`)。
   + 將 *junction\$1path\$1name* 取代為磁碟區的名稱 （例如 `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 for ONTAP 中，所有網路流量都會使用 `e0e` 介面。

   使用封包追蹤時，請記住下列事項：
   + 啟動封包追蹤時，您必須包含要存放追蹤檔案的路徑，格式為：/clus/*svm\$1name*/*junction-path-name*
   + 或者，提供封包追蹤的檔案名稱。如果未指定 filter\$1name，則會以 *node-name*\$1*port-name*\$1*yyyymmdd\$1hhmmss*.trc 格式自動產生 
   + 如果指定滾動追蹤，則 filter\$1name 的尾碼會加上數字，指出輪換序列中的位置。
   + 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) man 頁面](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 共用存取。

如需擷取封包追蹤的詳細資訊，請參閱《[》中的如何使用 ONTAP 9.10\$1 中的偵錯網路傾印。](https://kb.netapp.com/onprem/ontap/hardware/How_to_use_debug_tcpdump_in_ONTAP_9.10) NetApp Knowledge Base