Skip to content

Commit 6cafc6e

Browse files
committed
add ipv4 header notes
1 parent a279b81 commit 6cafc6e

File tree

3 files changed

+122
-0
lines changed

3 files changed

+122
-0
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ Personal notes for learning [CCNA](https://www.cisco.com/site/us/en/learn/traini
1111
* [Ethernet LAN Switching](./contents/ethernet_lan_switching/)
1212
* [IPv4 Addressing](./contents/ipv4_addressing/)
1313
* [Switch Interfaces](./contents/switch_interfaces/)
14+
* Routing
15+
* [IPv4 Header](./contents/ipv4_header/)
1416

1517

1618
## Network node icons

contents/ipv4_header/README.md

+120
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# IPv4 Header
2+
3+
![](docs/ipv4_header.png)
4+
5+
## Fields
6+
* [Version](#version)
7+
* [IHL](#ihl)
8+
* [DSCP](#dscp)
9+
* [ECN](#ecn)
10+
* [Total Length](#total-length)
11+
* [Identification](#identification)
12+
* [Flags](#flags)
13+
* [Fragment Offset](#fragment-offset)
14+
* [Time To Live](#time-to-live)
15+
* [Protocol](#protocol)
16+
* [Header Checksum](#header-checksum)
17+
* [Source and Destination IP Addresses](#source-and-destination-ip-addresses)
18+
* [Options](#options)
19+
20+
## Version
21+
22+
* `4 bits`
23+
* identifies the version of IP used
24+
* IPv4 = 4 (`0100`)
25+
* IPv6 = 6 (`0110`)
26+
27+
## IHL
28+
29+
Internet Header Length
30+
31+
* `4 bits`
32+
* indicates total length of the header ([options field](#options) if variable)
33+
* 4-byte increments
34+
* `5 = 5 * 4-bytes = 20 bytes`
35+
* `5 <= IHL <= 15`
36+
37+
## DSCP
38+
Differentiated Services Codepoint
39+
40+
* `6 bits`
41+
* used for QoS (Quality of Service)
42+
* used to prioritize delay-sensitive data (streaming audio, video, etc)
43+
44+
## ECN
45+
46+
Explicit Congestion Notification
47+
48+
* `2 bits`
49+
* provides e2e notification of network congestion without dropping packets
50+
* optional field that requires both endpoints, as well as the network infra, to support it
51+
52+
## Total Length
53+
54+
* `16 bits`
55+
* indicates the total length of the packet (L3 header + L4 segment)
56+
* measured in bytes
57+
* `20 = 20 bytes`
58+
* `20 <= Total Length <= 65535`
59+
60+
## Identification
61+
62+
* `16 bits`
63+
* if a packet is fragmented due to being too large, this field is used to identify which packet the fragment belongs to
64+
* all fragments of the same packet will have their own IPv4 header with the same value in this field
65+
* packets are fragmented if larger than the MTU (Maximum Transmission Unit)
66+
* MTU is usually `1500 bytes`
67+
* same as max size of ethernet frame payload
68+
* fragments are reassembled by the receiving host
69+
70+
## Flags
71+
72+
* `3 bits`
73+
* used to control/identify fragments
74+
* `bit 0` is reserved and always set to 0
75+
* `bit 1` is the **don't fragment** (DF bit), used to indifcate a packet should not be fragmented
76+
* `bit 2` is the **more fragments** (MF bit)
77+
* `1` if there are more fragments in the packet
78+
* `0` for the last fragment
79+
80+
## Fragment Offset
81+
82+
* `13 bits`
83+
* indicates position of the fragment within the original unfragmented IP packet
84+
* allows fragmented packets to be reassembled even if the fragments arrive out of order
85+
86+
## Time To Live
87+
88+
* `8 bits`
89+
* a router will drop a packet with a TTL of 0
90+
* used to prevent infinite loops and congestion
91+
* originally designed to indicate the packets maximum lifetime in seconds
92+
* in practice, indicates a *hop count*: each time the packet arrives at a router, the router decreases the TTL by 1
93+
* recommended default TTL is `64`
94+
95+
## Protocol
96+
97+
* `8 bits`
98+
* indicates the protocol of the encapsulated LAYER 4 (Transport) PDU
99+
* `6` = TCP
100+
* `17` = UDP
101+
* `1` = ICMP (ping)
102+
* `89` = OSPF (Open Shortest Path First, dynamic routing protocol)
103+
104+
## Header Checksum
105+
106+
* `16 bits`
107+
* calculated checksum used to check for errors in the IPv4 header
108+
* router receives the packet, calculates the checksum and compares it to the one in this field.
109+
* if they do not match the router drops the package
110+
111+
## Source and Destination IP Addresses
112+
113+
* `32 bits` each
114+
* IPv4 Addresses of the sender and intended receiver of the package
115+
116+
## Options
117+
118+
* `0 - 320 bits`
119+
* rarely used
120+
* if IHL field is greater than `5`, it means that Options are present
17.3 KB
Loading

0 commit comments

Comments
 (0)