Useful headers

From the corresponding wikipedia articles.

https://en.wikipedia.org/wiki/IPv4

IPv4 header format
Offsets Octet 0 1 2 3
Octet Bit 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
0 0 Version IHL DSCP ECN Total Length
4 32 Identification Flags Fragment Offset
8 64 Time To Live Protocol Header Checksum
12 96 Source IP Address
16 128 Destination IP Address
20 160 Options (if IHL > 5)
60 480

https://en.wikipedia.org/wiki/IPv6_packet

IPv6 Header
Offsets Octet 0 1 2 3
Octet Bit 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
0 0 Version Traffic class Flow label
4 32 Payload length Next header Hop limit
8 64 Source address
12 96
16 128
20 160
24 192 Destination address
28 224
32 256
36 288

https://en.wikipedia.org/wiki/Transmission_Control_Protocol

TCP segment header
Offsets Octet 0 1 2 3
Octet Bit  7  6  5  4  3  2  1  0  7  6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
0 0 Source port Destination port
4 32 Sequence number
8 64 Acknowledgment number (if ACK set)
12 96 Data offset Reserved
0 0 0
NS
CWR
ECE
URG
ACK
PSH
RST
SYN
FIN
Window Size
16 128 Checksum Urgent pointer (if URG set)
20
160
Options (if data offset > 5. Padded at the end with "0" bytes if necessary.)
60 480

https://en.wikipedia.org/wiki/User_Datagram_Protocol

UDP datagram header
Offsets Octet 0 1 2 3
Octet Bit  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
0  0 Source port Destination port
4 32 Length Checksum

DNS: https://datatracker.ietf.org/doc/html/rfc1035#section-4.1.1