Introduction
The same four bytes can appear as a dotted address, an integer in an inventory or a field in a packet diagram. Reading those bytes alongside the IPv4 header connects address arithmetic to packet delivery.
Read a 32-bit value in network order
Dotted notation prints four unsigned bytes in order from most significant to least significant. Each byte runs from 0 to 255. In 198.51.100.42 the first octet has a place value of 256³ and the fourth has a place value of one.
A dotted address identifies a value. To determine subnet boundaries, supply the prefix length or a contiguous mask. The historical A, B and C classes explain some older documentation. A current configuration can place its boundary at any bit from 0 through 32.
Account for the header before the payload
The IPv4 Internet Header Length field counts four-byte words. IHL 5 therefore denotes a 20-byte header. Options can increase the header to 60 bytes. Total Length includes the header and its payload in bytes, with a maximum field value of 65,535.
The Protocol field identifies the next protocol, such as TCP, UDP or ICMP. The header checksum covers the IPv4 header. Upper-layer protocols use their own integrity mechanisms. A link MTU limits the IP packet that fits on that hop without link-independent fragmentation.
Follow a packet across a router
A forwarding router decrements the Time To Live value by at least one. This bounds the life of packets caught in a routing loop. Changing the TTL also requires updating the IPv4 header checksum.
If the packet is too large for the outbound MTU, ordinary IPv4 forwarding can fragment it when permitted. With Don't Fragment set, the router drops the oversized packet and normally returns an ICMP fragmentation-needed message. Path MTU discovery uses that feedback.
Diagram
- IP packet · 1,500 bytes
- IPv4 header · 20 bytes
- IP payload · 1,480 bytes
- TCP data · 1,460 bytes
Worked examples
Read the first IPv4 byte 0x45
- Split 0x45 into the high hex digit 4 and low digit 5. The upper four bits identify version 4. The lower four encode an IHL of five words.
- Multiply 5 by 4 bytes to obtain the 20-byte header. With Total Length 1,500, the IP payload contains 1,480 bytes.
- If Protocol is 6 and the TCP header also occupies 20 bytes, the segment carries 1,460 application bytes. Adding IPv4 or TCP options reduces that amount at the same packet size.
IPv4 Calculator: Locate 192.0.2.77 inside a /26
- A /26 keeps 24 bits from the first three octets and two bits from the last. Six host bits give a block of 64 addresses.
- Write 77 as 01001101. Keeping the first two bits gives 01000000, or 64. Filling the remaining six with ones gives 01111111, or 127.
- The block is 192.0.2.64/26. On a conventional LAN its first and last ordinary host addresses are 192.0.2.65 and 192.0.2.126.
Reference table
| Header field | Unit or meaning | Example |
|---|---|---|
| IHL | 32-bit words | 5 means 20 bytes |
| Total Length | Bytes including IPv4 header | 1,500 |
| TTL | Forwarding lifetime | 64 before this hop |
| Protocol | Next protocol number | 6 = TCP, 17 = UDP |
Configuration example
- Interface = 198.51.100.42/26
- IP MTU = 1500 bytes
- IPv4 options = none in this example
- TCP options = none in this example
Common mistakes
- Treating the IHL field as a number of bytes.
- Adding an Ethernet header to IPv4 Total Length when checking the IP MTU.
Frequently asked questions
What does /32 mean on a route?
All 32 address bits must match. The route represents exactly one IPv4 value and can identify a loopback or another specific destination.
Is the IPv4 Protocol number the service port?
No. The protocol number selects a payload format, for example UDP 17. A UDP header then carries source and destination port numbers.
How many bytes are in the minimum IPv4 header?
The minimum header is 20 bytes. The IHL field counts 32-bit words, so a value of five represents 20 bytes; options can make it longer.
Does IPv4 Total Length include Ethernet framing?
No. It counts the IPv4 header and IPv4 payload. Link-layer framing is outside that length field.
What happens when an IPv4 packet is larger than an outgoing MTU?
Depending on the Don't Fragment setting and path behavior, it may be fragmented or dropped with an ICMP message. Path MTU discovery uses this feedback to find a usable packet size.
Does an IPv4 Protocol number identify a TCP or UDP port?
No. The Protocol field identifies the payload protocol, such as TCP or UDP. A TCP or UDP header then contains the service ports.
What does TTL protect against?
IPv4 Time To Live bounds how many forwarding hops a packet can survive. Routers decrement it so a packet cannot circulate forever in a forwarding loop.
Is the IPv4 header checksum an end-to-end payload checksum?
No. It covers the IPv4 header only and is recomputed when mutable header fields such as TTL change. Transport protocols have separate integrity fields.
Can IPv4 fragmentation be reassembled at every router?
No. Fragmentation can occur during forwarding when permitted, but fragments are normally reassembled by the destination host, not each intermediate router.
Why use documentation IPv4 ranges in examples?
The designated documentation blocks avoid using a real organization's address in examples. They should not be treated as ordinary public service addresses.
What is the difference between limited broadcast and directed broadcast?
The limited broadcast address is 255.255.255.255 and is confined to the local link. A directed broadcast targets the all-ones host part of a particular IPv4 subnet and is commonly filtered by routers.
Can two routers advertise the same IPv4 prefix?
They can provide alternative routes to the same prefix. Routing policy and metrics determine whether one is preferred or both are installed for load sharing.
Why is classful addressing considered historical?
The original A, B, and C boundaries fixed network sizes at coarse octet edges. CIDR allows a prefix boundary at any bit and is used for modern allocation and routing.
What is the IPv4 header checksum recalculated over?
It covers the IPv4 header, not the payload. Because forwarding changes TTL, a router updates the checksum as the packet traverses the path.
When can a /31 IPv4 prefix be useful?
On a point-to-point link, RFC 3021 allows both addresses to be assigned to the two endpoints. It avoids reserving separate network and broadcast values where those functions are not needed.

