接続性とパフォーマンス関連の問題は、多くの場合、複雑です。 問題の原因を絞り込むためだけに、かなりの時間と労力がかかることがあります。 パケット キャプチャは、問題の範囲をネットワークの特定の部分に絞り込むのに役立ちます。 これは、問題がネットワークの顧客側、ネットワークの Azure 側、またはその間のどこかにあるかどうかを判断するのに役立ちます。 問題を絞り込んだ後は、デバッグして修復アクションを実行する方が効率的です。
一般的に使用可能なパケット キャプチャ ツールがいくつかあります。 これらのツールを使用して関連するパケット キャプチャを取得するのは、特に大量のトラフィック シナリオでは面倒な場合があります。 Azure VPN Gateway パケット キャプチャによって提供されるフィルター処理機能は、主な差別化要因です。 VPN Gateway パケット キャプチャは、一般的に使用可能なパケット キャプチャ ツールと共に使用できます。
VPN Gateway のパケット キャプチャについて
VPN Gateway パケット キャプチャは、ニーズに応じて、ゲートウェイまたは特定の接続で実行できます。 同時に複数のトンネルでパケット キャプチャを実行することもできます。 VPN ゲートウェイでのフィルター処理と共に、一方向または双方向のトラフィック、IKE および ESP トラフィック、および内部パケットをキャプチャできます。
大量のトラフィックの問題を分離する場合は、5 タプル フィルター (ソース サブネット、宛先サブネット、送信元ポート、宛先ポート、プロトコル) と TCP フラグ (SYN、ACK、FIN、URG、PSH、RST) を使用すると便利です。
JSON と JSON スキーマの次の例では、各プロパティの説明を示します。 パケット キャプチャを実行するときに注意すべきいくつかの制限事項を次に示します。
- ここで示すスキーマでは、フィルターは配列ですが、現時点では一度に使用できるフィルターは 1 つだけです。
- 複数のゲートウェイ全体のパケット キャプチャを同時に実行することはできません。
- 1 つの接続で同時に複数のパケット キャプチャを実行することはできません。 異なる接続で同時に複数のパケット キャプチャを実行できます。
- ゲートウェイごとに最大 5 つのパケット キャプチャを並列で実行できます。 これらのパケット キャプチャは、ゲートウェイ全体のパケット キャプチャと接続ごとのパケット キャプチャの組み合わせにすることができます。
- MaxPacketBufferSize の単位はバイトです。
- MaxFileSize の単位はメガバイトです。
注
内部パケットと外部パケットの両方 をキャプチャする場合は、CaptureSingleDirectionTrafficOnly オプションを false に設定します。 MaxPacketBufferSize 設定によって切り捨てられたパケットを含む pcap ファイルを分析すると、"TCP Previous segment not captured" や "TCP ACKed unseen segment" のような予期しない警告が発生する可能性があります。
JSON の例
{
"TracingFlags": 11,
"MaxPacketBufferSize": 120,
"MaxFileSize": 200,
"Filters": [
{
"SourceSubnets": [
"10.1.0.0/24"
],
"DestinationSubnets": [
"10.1.1.0/24"
],
"SourcePort": [
500
],
"DestinationPort": [
4500
],
"Protocol": [
6
],
"TcpFlags": 16,
"CaptureSingleDirectionTrafficOnly": true
}
]
}
JSON スキーマ
{
"type": "object",
"title": "The Root Schema",
"description": "The root schema input JSON filter for packet capture",
"default": {},
"additionalProperties": true,
"required": [
"TracingFlags",
"MaxPacketBufferSize",
"MaxFileSize",
"Filters"
],
"properties": {
"TracingFlags": {
"$id": "#/properties/TracingFlags",
"type": "integer",
"title": "The Tracingflags Schema",
"description": "Tracing flags that customer can pass to define which packets are to be captured. Supported values are CaptureESP = 1, CaptureIKE = 2, CaptureOVPN = 8. The final value is OR of the bits.",
"default": 11,
"examples": [
11
]
},
"MaxPacketBufferSize": {
"$id": "#/properties/MaxPacketBufferSize",
"type": "integer",
"title": "The Maxpacketbuffersize Schema",
"description": "Maximum buffer size of each packet. The capture will only contain contents of each packet truncated to this size.",
"default": 120,
"examples": [
120
]
},
"MaxFileSize": {
"$id": "#/properties/MaxFileSize",
"type": "integer",
"title": "The Maxfilesize Schema",
"description": "Maximum file size of the packet capture file. It is a circular buffer.",
"default": 100,
"examples": [
100
]
},
"Filters": {
"$id": "#/properties/Filters",
"type": "array",
"title": "The Filters Schema",
"description": "An array of filters that can be passed to filter inner ESP traffic.",
"default": [],
"examples": [
[
{
"Protocol": [
6
],
"CaptureSingleDirectionTrafficOnly": true,
"SourcePort": [
500
],
"DestinationPort": [
4500
],
"TcpFlags": 16,
"SourceSubnets": [
"10.1.0.0/24"
],
"DestinationSubnets": [
"10.1.1.0/24"
]
}
]
],
"additionalItems": true,
"items": {
"$id": "#/properties/Filters/items",
"type": "object",
"title": "The Items Schema",
"description": "An explanation about the purpose of this instance.",
"default": {},
"examples": [
{
"SourcePort": [
500
],
"DestinationPort": [
4500
],
"TcpFlags": 16,
"SourceSubnets": [
"10.1.0.0/24"
],
"DestinationSubnets": [
"10.1.1.0/24"
],
"Protocol": [
6
],
"CaptureSingleDirectionTrafficOnly": true
}
],
"additionalProperties": true,
"required": [
"SourceSubnets",
"DestinationSubnets",
"SourcePort",
"DestinationPort",
"Protocol",
"TcpFlags",
"CaptureSingleDirectionTrafficOnly"
],
"properties": {
"SourceSubnets": {
"$id": "#/properties/Filters/items/properties/SourceSubnets",
"type": "array",
"title": "The Sourcesubnets Schema",
"description": "An array of source subnets that need to match the Source IP address of a packet. Packet can match any one value in the array of inputs.",
"default": [],
"examples": [
[
"10.1.0.0/24"
]
],
"additionalItems": true,
"items": {
"$id": "#/properties/Filters/items/properties/SourceSubnets/items",
"type": "string",
"title": "The Items Schema",
"description": "An explanation about the purpose of this instance.",
"default": "",
"examples": [
"10.1.0.0/24"
]
}
},
"DestinationSubnets": {
"$id": "#/properties/Filters/items/properties/DestinationSubnets",
"type": "array",
"title": "The Destinationsubnets Schema",
"description": "An array of destination subnets that need to match the Destination IP address of a packet. Packet can match any one value in the array of inputs.",
"default": [],
"examples": [
[
"10.1.1.0/24"
]
],
"additionalItems": true,
"items": {
"$id": "#/properties/Filters/items/properties/DestinationSubnets/items",
"type": "string",
"title": "The Items Schema",
"description": "An explanation about the purpose of this instance.",
"default": "",
"examples": [
"10.1.1.0/24"
]
}
},
"SourcePort": {
"$id": "#/properties/Filters/items/properties/SourcePort",
"type": "array",
"title": "The Sourceport Schema",
"description": "An array of source ports that need to match the Source port of a packet. Packet can match any one value in the array of inputs.",
"default": [],
"examples": [
[
500
]
],
"additionalItems": true,
"items": {
"$id": "#/properties/Filters/items/properties/SourcePort/items",
"type": "integer",
"title": "The Items Schema",
"description": "An explanation about the purpose of this instance.",
"default": 0,
"examples": [
500
]
}
},
"DestinationPort": {
"$id": "#/properties/Filters/items/properties/DestinationPort",
"type": "array",
"title": "The Destinationport Schema",
"description": "An array of destination ports that need to match the Destination port of a packet. Packet can match any one value in the array of inputs.",
"default": [],
"examples": [
[
4500
]
],
"additionalItems": true,
"items": {
"$id": "#/properties/Filters/items/properties/DestinationPort/items",
"type": "integer",
"title": "The Items Schema",
"description": "An explanation about the purpose of this instance.",
"default": 0,
"examples": [
4500
]
}
},
"Protocol": {
"$id": "#/properties/Filters/items/properties/Protocol",
"type": "array",
"title": "The Protocol Schema",
"description": "An array of protocols that need to match the Protocol of a packet. Packet can match any one value in the array of inputs.",
"default": [],
"examples": [
[
6
]
],
"additionalItems": true,
"items": {
"$id": "#/properties/Filters/items/properties/Protocol/items",
"type": "integer",
"title": "The Items Schema",
"description": "An explanation about the purpose of this instance.",
"default": 0,
"examples": [
6
]
}
},
"TcpFlags": {
"$id": "#/properties/Filters/items/properties/TcpFlags",
"type": "integer",
"title": "The Tcpflags Schema",
"description": "A list of TCP flags. The TCP flags set on the packet must match any flag in the list of flags provided. FIN = 0x01,SYN = 0x02,RST = 0x04,PSH = 0x08,ACK = 0x10,URG = 0x20,ECE = 0x40,CWR = 0x80. An OR of flags can be provided.",
"default": 0,
"examples": [
16
]
},
"CaptureSingleDirectionTrafficOnly": {
"$id": "#/properties/Filters/items/properties/CaptureSingleDirectionTrafficOnly",
"type": "boolean",
"title": "The Capturesingledirectiontrafficonly Schema",
"description": "A flags which when set captures reverse traffic also.",
"default": false,
"examples": [
true
]
}
}
}
}
}
}
主な考慮事項
- パケット キャプチャを実行すると、パフォーマンスに影響する可能性があります。 パケット キャプチャが不要な場合は、忘れずに停止してください。
- 推奨される最小パケット キャプチャ期間は 600 秒です。 パス上の複数のコンポーネント間の同期の問題により、パケット キャプチャが短いほど完全なデータが提供されない可能性があります。
- パケット キャプチャ データ ファイルは PCAP 形式で生成されます。 Wireshark または他の一般的に使用可能なアプリケーションを使用して、PCAP ファイルを開きます。
- パケット キャプチャは、ポリシー ベースのゲートウェイではサポートされていません。
- パケット キャプチャ データ ファイルの最大ファイル サイズは 500 MB です。
-
SASurlパラメーターが正しく構成されていない場合、トレースはストレージ エラーで失敗する可能性があります。SASurlパラメーターを正しく生成する方法の例については、「Stop-AzVirtualNetworkGatewayPacketCapture」を参照してください。 - ユーザー委任 SAS を構成する場合は、ストレージ アカウントに対する適切な RBAC アクセス許可 (ストレージ BLOB データ所有者など) がユーザー アカウントに付与されていることを確認します。
パケット キャプチャ - ポータル
このセクションでは、Azure portal を使用してパケット キャプチャを開始および停止する方法について説明します。
パケット キャプチャの開始 - ポータル
パケット キャプチャは、Azure portal で設定できます。
Azure portal で VPN ゲートウェイに移動します。
左側で、[ VPN Gateway パケット キャプチャ ] を選択して [VPN Gateway パケット キャプチャ] ページを開きます。
[ パケット キャプチャの開始] を選択します。
[ パケット キャプチャの開始 ] ページで、必要な調整を行います。 内部パケットと外部パケットの両方をキャプチャする場合は、[単一方向トラフィックのみをキャプチャする] オプションを選択しないでください。
設定を構成したら、[ パケット キャプチャの開始] をクリックします。
パケット キャプチャの停止 - ポータル
パケット キャプチャを完了するには、読み取り/書き込みアクセス権を持つ有効な SAS (または Shared Access Signature) URL を指定する必要があります。 パケット キャプチャが停止すると、パケット キャプチャの出力は、SAS URL によって参照されるコンテナーに書き込まれます。
SAS URL を取得するには、ストレージ アカウントに移動します。
使用するコンテナーに移動し、右クリックしてドロップダウン リストを表示します。 [ SAS の生成 ] を選択して [SAS の生成] ページを開きます。
[SAS の生成] ページで、設定を構成します。 読み取りアクセスと書き込みアクセス権が付与されていることを確認します。
[SAS トークンおよび URL を生成] をクリックします。
SAS トークンと SAS URL が生成され、ボタンのすぐ下に表示されます。 BLOB SAS URL をコピーします。
Azure portal の [VPN Gateway パケット キャプチャ] ページに戻り、[ パケット キャプチャの停止 ] ボタンをクリックします。
(前の手順の) SAS URL を [出力 SAS URL ] テキスト ボックスに貼り付け、[ パケット キャプチャの停止] をクリックします。
パケット キャプチャ (pcap) ファイルは、指定されたアカウントに格納されます。
注
$logsなど、Azure で生成されたコンテナーの使用は避けてください。
$で始まるコンテナーは通常、内部コンテナーであり、それらを作成するサービスのみがそれらを使用する必要があります。 たとえば、 $logs は、ストレージ アカウント関連のログを書き込む目的で Azure Storage アカウントによって使用されます。
パケット キャプチャ - PowerShell
次の例は、パケット キャプチャを開始および停止する PowerShell コマンドを示しています。 パラメーター オプションの詳細については、「 Start-AzVirtualnetworkGatewayPacketCapture」を参照してください。
前提条件
パケット キャプチャ データは、サブスクリプションのストレージ アカウントにログインする必要があります。 ストレージ アカウントの作成を参照してください。
パケット キャプチャを停止するには、ストレージ アカウントの
SASUrlを生成する必要があります。 ユーザー委任 SAS の作成を参照してください。
VPN ゲートウェイのパケット キャプチャを開始する
Start-AzVirtualnetworkGatewayPacketCapture -ResourceGroupName "YourResourceGroupName" -Name "YourVPNGatewayName"
省略可能なパラメーター -FilterData を使用してフィルターを適用できます。
VPN ゲートウェイのパケット キャプチャを停止する
Stop-AzVirtualNetworkGatewayPacketCapture -ResourceGroupName "YourResourceGroupName" -Name "YourVPNGatewayName" -SasUrl "YourSASURL"
パラメーター オプションの詳細については、「 Stop-AzVirtualNetworkGatewayPacketCapture」を参照してください。
VPN ゲートウェイ接続のパケット キャプチャを開始する
Start-AzVirtualNetworkGatewayConnectionPacketCapture -ResourceGroupName "YourResourceGroupName" -Name "YourVPNGatewayConnectionName"
省略可能なパラメーター -FilterData を使用してフィルターを適用できます。
VPN ゲートウェイ接続でのパケット キャプチャの停止
Stop-AzVirtualNetworkGatewayConnectionPacketCapture -ResourceGroupName "YourResourceGroupName" -Name "YourVPNGatewayConnectionName" -SasUrl "YourSASURL"
パラメーター オプションの詳細については、「 Stop-AzVirtualNetworkGatewayConnectionPacketCapture」を参照してください。
次のステップ
VPN Gateway の詳細については、「VPN Gateway とは」を参照してください。