»User Datagram Protocol
  • designed by David Patrick Reed in 1980 (RFC 768)
  • Unrealiable Datagram Protocol, Universal Datagram Protocol
  • simple transmission model
  • unrealiable service
  • don't send hand-shaking message
  • no error control
  • not ordered
  • fast communciation
  • DNS,SNMP,RIP,DHCP,IPTV,VOIP,online games... use it
  • encapsulations in OSI - Transport Layer
»Packet Structure
+ Bits 0 - 15 16 - 31
0 Source Port Destination Port
32 Length Checksum
64 Data
Source Port: Optional Field (Default Zero)
Destination Port: Arbitrary field Length: 8 Byte ( header ) + 65527 Byte ( Data Size ) Checksum: error checking of the header and data for transmission.Don't return error message.Don't resend with pseudo Ipv4-header ;
+ Bits 0 - 7 8 - 15 16 - 23 24 - 31
0 Source address
32 Destination address
64 Zeros Protocol UDP length
96 Source Port Destination Port
128 Length Checksum
160 Data
Source Address : Source Ip Address Destination Address: Destination Ip Adress or Broadcast Address Protocol:UDP Protocol Number 17 with pseudo ipv6-header
+ Bits 0 - 7 8 - 15 16 - 23 24 - 31
0 Source address
32
64
96
128 Destination address
160
192
224
256 UDP length
288 Zeros Next Header
320 Source Port Destination Port
352 Length Checksum
384 Data
Next Header: UDP protocol Number 17 (0x0011) If you want to work about UDP in Linux systems, you can use "/usr/include/linux/udp.h". This file include structure of udp header. udp.h
struct udphdr { __be16 source; __be16 dest; __be16 len; __sum16 check; };
I captured a UDP packet from my interface . Lets find IP and UDP header field.
--------------------Packet----------------------
00 16 6f b4 9d 7d 00 08 a1 bc 3c 6b 08 00 45 00 00 93 00 00 40 00 40 11 b6 fc c0 a8 01 01 c0 a8 01 0c 00 35 df fa 00 7f 07 71 a3 1f 81 80 00 01 00 01 00 02 00 02 03 77 77 77 04 63 6f 6d 75 03 65 64 75 02 74 72 00 00 01 00 01 c0 0c 00 01 00 01 00 00 80 79 00 04 c1 ff 61 08 c0 10 00 02 00 01 00 00 4f 5a 00 07 04 6e 73 30 32 c0 10 c0 10 00 02 00 01 00 00 4f 5a 00 07 04 6e 73 30 31 c0 10 c0 50 00 01 00 01 00 00 4f 5a 00 04 c1 ff 61 02 c0 3d 00 01 00 01 00 00 4f 5a 00 04 d4 af 97 88
-------------------------------------------------
In a packet, sorting header respectively , mac header +ip header+udp header+... mac header: 00 16 6f b4 9d 7d -> Dest mac Address AB CF 01 1C 2C 3B -> Src mac Address 80 00 -> Ether Type (it means Next Header IPv4) ip header: 4 ->Version ipv4 5 -> IHL 20 Byte or 5 lines 00 -> ToS 00 93 -> Total Length : 147 00 00 -> Identification 40 00 -> Flags ... 40 -> TTL : 64 11 -> Protocol 17 : UDP b6 fc -> Ip Header Checksum 46844 c0 a8 01 01 -> Src Addr : 192.168.1.1 c0 a8 01 0c -> Dst Addr : 192.168.1.12 udp header: 00 35 ->Src port :53 (it means DNS port so UDP Data Field DNS Header) df fa -> Dest port :57338 00 7f -> length :127 07 71 -> Checksum :1905 udp data: a3 1f 81 80 00 01 00 01 00 02 00 02 03 77 77 77 04 63 6f 6d 75 03 65 64 75 02 74 72 00 00 01 00 01 c0 0c 00 01 00 01 00 00 80 79 00 04 c1 ff 61 08 c0 10 00 02 00 01 00 00 4f 5a 00 07 04 6e 73 30 32 c0 10 c0 10 00 02 00 01 00 00 4f 5a 00 07 04 6e 73 30 31 c0 10 c0 50 00 01 00 01 00 00 4f 5a 00 04 c1 ff 61 02 c0 3d 00 01 00 01 00 00 4f 5a 00 04 d4 af 97 88

About

seruhatto