Categories

Archives

Search

UDP

                           UDP เป็นโปรโตคอลที่ถูกออกแบบมาให้ทำหน้าที่รับส่งข้อมูลโดยมีขั้นตอนการทำงานไม่ซับซ้อนและทำงานได้รวดเร็ว แต่มีจุดด้อยคือไม่มีความน่าเชื่อถือ (unreliable) และเป็นการสื่อสารแบบไม่ต่อเนื่อง (connectionless) โปรโตคอล UDP ทำงานในชั้น Transport Layer ซึ่งจะต้องพึ่งพาโปรโตคอล IP ในการรับส่งข้อมูล

UDP Header

 

UDP Checksum

Checksum เป็น เลข 16 บิตถูกคำนวนด้วยวิธี one’s complement โดยนำ Pseudo Header และข้อมูลทั้งหมดใน UDP Datagram มาคำนวน   Pseudo Header เป็นข้อมูลที่อยู่ในส่วนของ IP Header ประกอบด้วยฟิลด์ source ip address,destination ip address , zero , protocol , udp length ดังแสดงในรูปที่ 5.2


        หากค่า Checksum ที่คำนวนออกมาเป็น 0 ค่า checksum จะถูกเซ็ตเป็น 1 ทั้งหมดแทน (มีค่าเท่ากันในระบบ 1′s complement) ทั้งนี้เพราะในบางแอพพลิเคชั่นที่ไม่ต้องการตรวจสอบค่า checksum ในระดับ UDP จะเซ็ตค่านี้เป็น 0 (disable checksum)   แอปพลิเคชันที่ใช้ UDP เป็นฐานในการส่งข้อมูลคือ Domain name server  (DNS), Streaming media, Voice over IP และ เกมออนไลน์ ในที่แล็ปนี้ ผมใช้ nslookup เพื่อถามหา DNS ไปที่ www.kmitl.ac.th

1. Select one packet. From this packet, determine how many fields there are in the UDP header. (Do not look in the textbook! Answer these questions directly from what you observe in the packet trace.) Name these fields.

ตอบ  : มี 4  packet คือ source ,destination  Length, Checksum

 2. From the packet content field, determine the length (in bytes) of each of the UDP header fields.

ตอบ : ในแต่ละ packet มีรายละเอียดดังนี้ครับ Source 2 bytes, Destination 2 bytes, Length 2 bytes, Checksum 2 bytes.

3.The value in the Length field is the length of what? Verify your claim with your captured UDP packet.

ตอบ : จำนวน lenght ทั้งหมด 41 byte ประกอบด้วย Header 8 byte ,UDP payload 33 bytes.

4. What is the maximum number of bytes that can be included in a UDP payload?

ตอบ : ค่า maximum bytes มีความจุไม่เกิน 65535-41 = 65527 bytes.

5. What is the largest possible source port number?

ตอบ : มีค่า maximum bytes ได้ 65535 bytes

6. What is the protocol number for UDP? Give your answer in both hexadecimal and decimal notation. (To answer this question, you’ll need to look into the IP header.)

ตอบ : หมายเลข protocol UDP คือ (0×11) หรือ 17 ในฐาน dex นั้นเอง

7. Search “UDP” in Google and determine the fields over which the UDP checksum is calculated.

ตอบ : กลับไปดูตามข้างบนครับ ผมได้ post เอาไว้แล้วในรูปของ Pesudo Header

8. Examine a pair of UDP packets in which the first packet is sent by your host and the second packet is a reply to the first packet. Describe the relationship between the port numbers in the two packets.

ตอบ : ทั้ง 2 packet ที่ request และ response กลับมามีความสัมพันธ์ เกี่ยวข้องกลับ Soure port , Destination port