본문 바로가기
Network

[NSX-T] NSX-T LB에서 패킷 캡처하기

by chan10 2024. 1. 31.

NSX-T LB 패킷 캡처 순서

  1. packet capture 대상 T1 gateway IP 확인
  2. T1-LB vrf 번호 확인
  3. LB Interface uuid 확인
  4. packet capture session 셋팅 & 확인
  5. packet capture 활성화
  6. packet capture session 제거

 

packet capture 대상 T1 gateway IP 확인

NSX-T LB는 T1 gateway 내부에서 생성되기에 먼저 확인하고자 하는 LB의 T1 gateway정보를 확인합니다.

네트워킹 -> Tier-1 게이트웨이 -> T1 gateway -> HA모드 클릭 (활성 대기)-> Active T1 gateway의 VM을 확인하여 어떤 VM에서 서비스 중인지 체크합니다. (Active : t1-03)

 

vCenter에서 해당 Active T1 gateway 접속 IP주소를 확인합니다.

 

확인한 IP주소와 SSH(port 22)를 이용해 T1에 접속 합니다.

예) 접속 정보 : 10.0.0.171 SSH 접속

계정 정보 : admin / adminChan

 

T1-LB vrf 번호 확인

LB에 접속하기 위해 접속하고자 하는 LB의 vrf번호를 확인합니다.

get logical-router

 

LB Interface uuid 확인

vrf를 이용해 T1에 존재하는 LB에 접속합니다. (T1 → LB command 접속)

vrf [number]vrf 1

LB에 접속 후 Interface uuid를 확인합니다. uuid는 다음 스텝인 packet dump sesstion 셋팅 시 필요합니다.

get interfaces

지금까지 packet capture를 위해 필요한 정보를 확인했으니 다시 LB → T1 command로 이동합니다.

exit

 

packet capture session 셋팅 & 확인

packet capture가 필요한 interface 및 packet의 방향성을 정의합니다.

set capture session [number] interface [interface uuid] direction [input/output/dual]

set capture session 1 interface 7261360f-cb73-428d-992e-92b05b915179 direction dual

 

packet capture session 설정이 적용되었는지 확인합니다.

get capture sessions

 

packet capture 활성화 - CLI 확인

이전에 설정한 capture session과 filtering ip를 입력하면 LB를 통하는 packet들을 확인할 수 있습니다.

set capture session [number] [option] expression host [IP Address]

set capture session 1 count 100 expression host 10.100.21.45

 

- 옵션 리스트 -

count Count number of entities

file File

interface Interface configuration

snaplen Capture snapshot length

 

packet capture 활성화 - pcap 파일 다운로드

file 옵션을 추가하면 packet capturp결과를 pcap 파일로 저장할 수 있습니다.

set capture session 1 file capture.pcap count 100 expression host 10.100.21.45

 

다운로드 방법 : ex) 10.30.101.171 SFTP 접속

계정 : root / rootChan

/image/vmware/nsx/file-store/ 경로로 진입하면 pcap파일이 저장되어 있습니다.

 

packet capture session 제거

마지막으로 packet capture를 완료했다면 설정했던 capture session정보를 제거합니다.

del capture session [number]

del capture session 1

 

[참고사이트]

https://howdoesinternetwork.com/2021/nsx-t-edge-packet-capture

https://www.vexpertconsultancy.com/2023/03/vmware-nsx-t-3-x-traffic-capture-on-tier-0-gateway-uplink/