연결 및 성능 관련 문제는 종종 복잡합니다. 문제의 원인을 좁히기 위해서는 상당한 시간과 노력이 걸릴 수 있습니다. 패킷 캡처를 사용하면 문제의 범위를 네트워크의 특정 부분으로 좁힐 수 있습니다. 문제가 네트워크의 고객 쪽, 네트워크의 Azure 쪽 또는 그 사이에 있는지 여부를 확인하는 데 도움이 될 수 있습니다. 문제를 좁히면 디버그하고 수정 작업을 수행하는 것이 더 효율적입니다.
일반적으로 사용할 수 있는 패킷 캡처 도구가 있습니다. 이러한 도구를 사용하여 관련 패킷 캡처를 가져오는 것은 특히 대용량 트래픽 시나리오에서 번거로울 수 있습니다. Azure VPN Gateway 패킷 캡처에서 제공하는 필터링 기능은 주요 차별화 요소입니다. 일반적으로 사용 가능한 패킷 캡처 도구와 함께 VPN Gateway 패킷 캡처를 사용할 수 있습니다.
VPN Gateway에 대한 패킷 캡처 정보
필요에 따라 게이트웨이 또는 특정 연결에서 VPN Gateway 패킷 캡처를 실행할 수 있습니다. 여러 터널에서 패킷 캡처를 동시에 실행할 수도 있습니다. VPN 게이트웨이에서 필터링과 함께 단방향 또는 양방향 트래픽, IKE 및 ESP 트래픽 및 내부 패킷을 캡처할 수 있습니다.
대용량 트래픽에서 문제를 격리할 때 5개의 튜플 필터(원본 서브넷, 대상 서브넷, 원본 포트, 대상 포트, 프로토콜) 및 TCP 플래그(SYN, ACK, FIN, URG, PSH, RST)를 사용하는 것이 유용합니다.
JSON 및 JSON 스키마의 다음 예제에서는 각 속성에 대한 설명을 제공합니다. 패킷 캡처를 실행할 때 유의해야 할 몇 가지 제한 사항은 다음과 같습니다.
- 여기에 표시된 스키마에서 필터는 배열이지만 현재는 한 번에 하나의 필터만 사용할 수 있습니다.
- 동시에 여러 게이트웨이 전체 패킷 캡처를 실행할 수 없습니다.
- 단일 연결에서 동시에 여러 패킷 캡처를 실행할 수 없습니다. 여러 연결에서 동시에 여러 패킷 캡처를 실행할 수 있습니다.
- 게이트웨이당 최대 5개의 패킷 캡처를 병렬로 실행할 수 있습니다. 이러한 패킷 캡처는 게이트웨이 전체 패킷 캡처와 연결당 패킷 캡처의 조합일 수 있습니다.
- MaxPacketBufferSize 단위는 바이트입니다.
- MaxFileSize의 단위는 메가바이트입니다.
비고
내부 패킷과 외부 패킷을 모두 캡처하려는 경우 CaptureSingleDirectionTrafficOnly 옵션을 false 로 설정합니다. MaxPacketBufferSize 설정으로 인해 잘린 패킷이 포함된 pcap 파일을 분석할 때 "TCP 이전 세그먼트가 캡처되지 않음" 및 "TCP ACKed 보이지 않는 세그먼트"와 같은 예기치 않은 경고가 발생할 수 있습니다.
예제 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 파일을 엽니다.
- 패킷 캡처는 정책 기반 게이트웨이에서 지원되지 않습니다.
- 패킷 캡처 데이터 파일의 최대 파일 크기는 500MB입니다.
- 매개 변수가
SASurl올바르게 구성되지 않은 경우 스토리지 오류로 추적이 실패할 수 있습니다. 매개 변수를 올바르게 생성하는SASurl방법에 대한 예제는 Stop-AzVirtualNetworkGatewayPacketCapture를 참조하세요. - 사용자 위임 SAS를 구성하는 경우 사용자 계정에 스토리지 계정(예: Storage Blob 데이터 소유자)에 대한 적절한 RBAC 권한이 부여되었는지 확인합니다.
패킷 캡처 - 포털
이 섹션에서는 Azure Portal을 사용하여 패킷 캡처를 시작하고 중지하는 데 도움이 됩니다.
패킷 캡처 시작 - 포털
Azure Portal에서 패킷 캡처를 설정할 수 있습니다.
Azure Portal에서 VPN 게이트웨이로 이동합니다.
왼쪽에서 VPN Gateway 패킷 캡처 를 선택하여 VPN Gateway 패킷 캡처 페이지를 엽니다.
패킷 캡처 시작을 선택합니다.
패킷 캡처 시작 페이지에서 필요한 조정을 합니다. 내부 패킷과 외부 패킷을 모두 캡처하려면 "단방향 트래픽만 캡처" 옵션을 선택하지 마세요.
설정을 구성한 후 패킷 캡처 시작을 클릭합니다.
패킷 캡처 중지 - 포털
패킷 캡처를 완료하려면 읽기/쓰기 권한이 있는 유효한 SAS(또는 공유 액세스 서명) 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) 파일은 지정된 계정에 저장됩니다.
비고
Azure에서 생성된 컨테이너(예: $logs)를 사용하지 않도록 합니다.
$로 시작하는 컨테이너는 일반적으로 내부 컨테이너이며, 이를 생성하는 서비스만 사용해야 합니다. 예를 들어 Azure $logs 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 Gateway 연결에 대한 패킷 캡처 시작
Start-AzVirtualNetworkGatewayConnectionPacketCapture -ResourceGroupName "YourResourceGroupName" -Name "YourVPNGatewayConnectionName"
선택적 매개 변수 -FilterData 를 사용하여 필터를 적용할 수 있습니다.
VPN 게이트웨이 연결에서 패킷 캡처 중지
Stop-AzVirtualNetworkGatewayConnectionPacketCapture -ResourceGroupName "YourResourceGroupName" -Name "YourVPNGatewayConnectionName" -SasUrl "YourSASURL"
매개 변수 옵션에 대한 자세한 내용은 Stop-AzVirtualNetworkGatewayConnectionPacketCapture를 참조하세요.
다음 단계
VPN Gateway에 대한 자세한 내용은 VPN Gateway란?