IP,TCP,UDP

  • IP(Internet Protocol) PDU
  • TCP(Transfer Control Protocol) PDU
  • UDP(User Datagram Protocol) PDU

IP(Internet Protocol) PDU

┃-- 4bit -|-- 4bit -|-- 8bit --| 3bit |-- 13bit --┃
┏-------------------------------------------------┓
┃ version | ihl     | tos     | tot_len           ┃
┠-------------------------------------------------┨
┃ id                          | flags | frag_off  ┃
┠-------------------------------------------------┨
┃ ttl     | protocol          | header checksum   ┃
┠-------------------------------------------------┨
┃ src addr                                        ┃
┠-------------------------------------------------┨
┃ dest addr                                       ┃
┠-------------------------------------------------┨
┃ options                               | padding ┃
┠-------------------------------------------------┨
┃ data                                            ┃
┗-------------------------------------------------┛

ihl,Internet Header Length,包头长度
tos,Type Of Service,
tot_len,Total Length,
id,Identification,
flags,D(0可分段/1)M(0last fragment/1)
frag_off,Fragment Offset,分段偏移
ttl,Time To Live,while(router++)ttl–;存活时间

Options:
L,Loose Source Routing,松散源路由选择
S,Strict Source Routing,严格源路由选择
R,Record Route,记录路由
T,TimeStamp,时间戳

Protocol Number:
1 – ICMP,Internet Control Message Protocol,因特网消息控制协议
2 – IGMP,Internet Group Management Protocol,因特网组管理协议
4 – IP,Internet Protocol,被IP协议封装的IP
6 – TCP,Transfer Control Protocol,传输控制协议
17 – udP,User Datagram Protocol,用户数据报协议
45 – IDRP,Inter-Domain Routing Protocol,域内路由选择协议
46 – RSVP,Resource ReSerVation Protocol,资源预留协议
47 – GRE,Generic Routing Encapsulation,通用路由封装
54 – NHRP,NBMA Next Hop Resolution Protocol,NBMA下一跳解析协议
88 – IGRP,Cisco Internet Gateway Routing Protocol,思科因特网网关路由选择协议
89 – OSPF,Open Shortest Path First,开放最短路径优先


TCP(Transfer Control Protocol) PDU

┃---  4bit ---|-- 4bit --|-- 8bit --|--- 16bit ---┃
┏-------------------------------------------------┓
┃ src port                          | dest port   ┃
┠-------------------------------------------------┨
┃ seq                                             ┃
┠-------------------------------------------------┨
┃ ack_seq                                         ┃
┠-------------------------------------------------┨
┃ date offset | reserved | ctl flag | windows     ┃
┠-------------------------------------------------┨
┃ check                             | flags       ┃
┠-------------------------------------------------┨
┃ options                           | padding     ┃
┠-------------------------------------------------┨
┃ data                                            ┃
┗-------------------------------------------------┛

Urgent pointer:
U,URG,urgent,(0/1),
A,ACK,acknowledge,(0/1),
P,PSH,push function,(0/1),
R,RST,reset,(0/1),
S,SYN,synchronous, (0/1),
F,FIN,


UDP(User Datagram Protocol) PDU

┃-- 16bit --|-- 16bit --┃
┏-----------------------┓
┃ src port  | dest port ┃
┠-----------------------┨
┃ len       | check     ┃
┠-----------------------┨
┃ date                  ┃
┗-----------------------┛