Header Formats
Burton Rosenberg
7 March 2003
Ethernet Header (DIX a.k.a. II)
0 4 8 12 16 20 24 28 32 36 40 44 47
+-------+-------+-------+-------+-------+-------+-------+------+-------+-------+-------+-------+
| destination address |
+-------+-------+-------+-------+-------+-------+-------+------+-------+-------+-------+-------+
| source address |
+-------+-------+-------+-------+-------+-------+-------+------+-------+-------+-------+-------+
| protocol |
+-------+-------+-------+-------+
Ethernet Header (802.3 w/ 802.2 SNAP)
0 4 8 12 16 20 24 28 32 36 40 44 47
+-------+-------+-------+-------+-------+-------+-------+------+-------+-------+-------+-------+
| destination address |
+-------+-------+-------+-------+-------+-------+-------+------+-------+-------+-------+-------+
| source address |
+-------+-------+-------+-------+-------+-------+-------+------+-------+-------+-------+-------+
| length | -- c o n t i n u e d b e l o w --
+-------+-------+-------+-------+-------+-------+-------+------+-------+-------+-------+-------+
| 0xAA | 0xAA | 0x03 | 0x000000 |
+-------+-------+-------+-------+-------+-------+-------+------+-------+-------+-------+-------+
| protocol |
+-------+-------+-------+-------+
IP Header
0 4 8 12 16 20 24 28 31
+-------+-------+-------+-------+-------+-------+-------+------+
| ver | hdrlen| T O S | total length (bytes) |
+-------+-------+-------+-------+-------+-------+-------+------+
| identification | |D|M| frag offset (13bits) |
+-------+-------+-------+-------+-------+-------+-------+------+
| T T L | protocol | header checksum |
+-------+-------+-------+-------+-------+-------+-------+------+
| source IP address |
+-------+-------+-------+-------+-------+-------+-------+------+
| destination IP address |
+-------+-------+-------+-------+-------+-------+-------+------+
| options (optional) |
+-------+-------+-------+-------+-------+-------+-------+------+
| |
| D A T A |
| |
+-------+-------+-------+-------+-------+-------+-------+------+
Flags:
D, DF: Don't fragment
M, MF: More fragments
UDP Header
0 4 8 12 16 20 24 28 31
+-------+-------+-------+-------+-------+-------+-------+------+
| source port | destination port |
+-------+-------+-------+-------+-------+-------+-------+------+
| UDP length | UDP checksum (covers all) |
+-------+-------+-------+-------+-------+-------+-------+------+
| |
| D A T A |
| |
+-------+-------+-------+-------+-------+-------+-------+------+
TCP Header
0 4 8 12 16 20 24 28 31
+-------+-------+-------+-------+-------+-------+-------+------+
| source port | destination port |
+-------+-------+-------+-------+-------+-------+-------+------+
| sequence number |
+-------+-------+-------+-------+-------+-------+-------+------+
| acknowledgement number |
+-------+-------+-------+-------+-------+-------+-------+------+
| hdrlen| |U|A|P|R|S|F| window size |
+-------+-------+-------+-------+-------+-------+-------+------+
| TCP checksum | urgent pointer |
+-------+-------+-------+-------+-------+-------+-------+------+
| options (optional) |
+-------+-------+-------+-------+-------+-------+-------+------+
| |
| D A T A |
| |
+-------+-------+-------+-------+-------+-------+-------+------+
Flags:
U, URG: urgent pointer valid
A, ACK: acknowledgement number valid
P, PSH: push data
R, RST: reset connection
S, SYN: synchronize sequence numbers, initiate connection
F, FIN: finish connection