1 / 19

UDP (User Datagram Protocol)

Chapter 9:. UDP (User Datagram Protocol). 2003. 6. Echo. Daytime. SNMP. SNMP/ Trap. Echo. Daytime. SNMP. SNMP/ Trap. 7. 13. 161. 162. 5000. 5001. 161. 162. TCP. TCP. IP. IP. 데이터링크. 데이터링크. 물리계층. 물리계층. 사용자 데이터그램 프로토콜. 특징 비연결형 IP 전달 서비스 + 최소한의 신뢰성 제공 (선택적 체크 섬)

fifi
Download Presentation

UDP (User Datagram Protocol)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 9: UDP (User Datagram Protocol) 2003. 6.

  2. Echo Daytime SNMP SNMP/ Trap Echo Daytime SNMP SNMP/ Trap 7 13 161 162 5000 5001 161 162 TCP TCP IP IP 데이터링크 데이터링크 물리계층 물리계층 사용자 데이터그램 프로토콜 • 특징 • 비연결형 IP 전달 서비스 + 최소한의 신뢰성 제공 (선택적 체크 섬) • 포트 대 포트(port-to-port) 전송 • 대표적인 응용 : • SNMP(Simple Network Management Protocol) • 실시간 인터넷 방송 Client Server

  3. IP 헤더 IP 데이터 20byte + 옵션 UDP헤드 (8byte) UDP 데이터 0 8 16 24 31 근원지 포트 목적지 포트 길이 체크 섬 UDP의 구조 • 근원지 / 목적지 포트 • 근원지,목적지 컴퓨터의 프로그램이 사용하는 포트 번호 • 길이 • UDP 데이터그램의 크기(헤더+데이터)를 바이트 단위로 나타냄 • 체크 섬 • UDP 데이터에 오류가 있는지 검사하기 위해 사용

  4. UDP 데이터그램 분석

  5. UDP 데이터그램 분석 • 근원지 포트 / 목적지 포트 • 근원지 / 목적지 포트 0x07C1은 1985번 Registered Port 사용 ※ Registered Port : 1024~49151번 • 길이 / 체크 섬 • UDP 데이터그램의 길이는 0x001C 즉 28바이트임 • 체크 섬을 위한 코드는 0x242E(9262)임

  6. 포트 번호 표 • 교재, TCP/IP 프로토콜 분석 및 네트워크 프로그래밍, 부록 5 참조 • AMAN2002 Online Help의 “well-known port”참조

  7. 연습문제 • 10 00 20 00 00 80 AB CD • 헤더 필드 설명

  8. Guru를 이용한 UDP 데이터그램 분석

  9. UDP 데이터그램 캡처 프로그램 작성 ※ 프로젝트 생성 및 라이브러리 경로 설정은 『ch04. 이더넷(Ethernet)』의 “이더넷 캡처 프로그램 작성”과 동일

  10. 5 6 1 List Control 2 3 4 Edit Box Edit Box Button 대화상자 디자인

  11. Control 속성

  12. 이벤트 처리 ※ 어댑터 오픈 대화상자 표시, 어댑터 열기, 패킷 캡처, 어댑터 닫기 함수의 설명은 『ch04. 이더넷(Ethernet)』 과 동일하므로 생략함

  13. 패킷 분석 • UDP 헤더의 시작지점 arrTemp[0] arrTemp[14] arrTemp[14 + IpHLen] arrTemp[14]의 하위 4비트 arrTemp 헤더길이 :IpHLen 이더넷 헤더 IP 헤더 UDP 헤더 arrTemp[14+9] 프로토콜 필드 0x11(17)→ UDP

  14. 패킷 분석 • List Control 에 패킷 헤더 정보 표시 . . . // 획득된 패킷은 arrTemp에 저장 int iLengthOfPacket = pDlg->Ncap(arrTemp, MaxBufferLen); if(iLengthOfPacket <0 ) continue; #define EtherHeaderLength 14 // UDP 프로토콜은 IP 헤더의 프로토콜 필드값이 0x11(17)이므로 // - IP의 프로토콜 필드 값이 0x11인 것만 골라냄 if( arrTemp[EtherHeaderLength + 9] == 0x11) { // IP 헤더 길이 정보 획득 unsigned char MASK = 0x0F; arrTemp[EtherHeaderLength] = arrTemp[EtherHeaderLength] & MASK; int iIpHeaderLength = arrTemp[EtherHeaderLength]<<2; . . .

  15. 패킷 분석 • List Control 에 패킷 헤더 정보 표시 // 근원지 포트 CString strUdpSrcPort = _T(""); unsigned int iSourcePort = pDlg->Twobytes_to_number( arrTemp[EtherHeaderLength + iIpHeaderLength], arrTemp[EtherHeaderLength + iIpHeaderLength+1]); strUdpSrcPort.Format("SRC : %d", iSourcePort); m_ListUdpPacketInfo.SetItem(i, 1, LVIF_TEXT, strUdpSrcPort, 0, 0, 0, 0); // 목적지 포트 CString strUdpDesPort = _T(""); unsigned int iDestinationPort = pDlg->Twobytes_to_number( arrTemp[EtherHeaderLength + iIpHeaderLength +2], arrTemp[EtherHeaderLength + iIpHeaderLength+3]); strUdpDesPort.Format("DEST : %d", iDestinationPort); m_ListUdpPacketInfo.SetItem(i, 2, LVIF_TEXT, strUdpDesPort, 0, 0, 0, 0); . . .

  16. 패킷 분석 • List Control 에 패킷 헤더 정보 표시 //UDP 데이터그램의 전체 길이 CString strUdpTotalLength = _T(""); unsigned int iTotalLength = pDlg->Twobytes_to_number( arrTemp[EtherHeaderLength + iIpHeaderLength +4], arrTemp[EtherHeaderLength + iIpHeaderLength+5]); strUdpTotalLength.Format("TOTAL : %d", iTotalLength); m_ListUdpPacketInfo.SetItem(i, 3, LVIF_TEXT, strUdpTotalLength, 0, 0, 0, 0); // 체크 섬 CString strUdpCheckSum = _T(""); unsigned int iCheckSum = pDlg->Twobytes_to_number( arrTemp[EtherHeaderLength + iIpHeaderLength + 6], arrTemp[EtherHeaderLength + iIpHeaderLength+7]); strUdpCheckSum.Format("CHK : %d", iCheckSum); m_ListUdpPacketInfo.SetItem(i, 4, LVIF_TEXT, strUdpCheckSum, 0, 0, 0, 0); . . .

  17. UdpViewer 실행 화면

  18. UdpViewer를 이용한 Udp 데이터그램 분석 • 0번 패킷 분석 • 근원지 포트번호  송신지에서 7671번 Registered Port를 사용함 • 목적지 포트번호  수신지에서 38329번 Registered Port를 사용함 • 길이  17493바이트임 • 체크 섬  송신지에서 계산한 체크 섬은 16904임

  19. 참고 문헌 • 서승호 외, AMAN2002를 이용한 TCP/IP 프로토콜 분석 및 네트워크 프로그래밍, 정익사, 2002. • RFC 768, J. Postel, User Datagram Protocol, August 1980. • RFC 1240, C. Shue, W. Haggerty, OSI Connectionless Transport Service on top of UDP Version: 1, June 1991. • RFC 1791, T. Sung, TCP And UDP Over IPX Networks With Fixed Path MTU, April 1995. • Behrouz Forouzan, “Introduction to Data Communication and Networking”, Mcgrwohill, 1999 • Fred Halsall, “Data Communications, Computer Networks and Open Systems”, Addison-wesley, 1995.

More Related