An IPv4 address has 32 bits, written as four numbers from 0 to 255: 192.168.1.10. Together with the mask (255.255.255.0 or /24) it says which network a device is in (Subnetting and VLSM).
Without options the header is 20 bytes long, five rows of 32 bits. The values come from a real packet of the simulation.
IPv4Packet · RFC 791, RFC 2474, RFC 3168
0481216202428
Version4 bits4
IHL4 bits5
DSCP6 bits0
ECN2 bits0
Total length16 bits140
Identification16 bits0x0006
Flags3 bitsDF
Fragment offset13 bits0
TTL8 bits64
Protocol8 bits6
Header checksum16 bits0x9aa7
Source IP32 bits192.168.10.100
Destination IP32 bits192.168.20.10
Options0–40 bytes
Payload≤ 65515 bytes120 Byte
Each row has 32 bits (4 bytes), bit 0 on the left, as the RFCs draw their headers. Dashed: variable or optional. Point at a field for an explanation.
Field
Length
Example value
Meaning
Version
4 bits
4
4 for IPv4.
IHL
4 bits
5
Internet header length in 32-bit words: 5 = 20 bytes without options.
DSCP
6 bits
0
Differentiated services: traffic class for quality of service (RFC 2474), 0 = best effort.
ECN
2 bits
0
Explicit congestion notification: routers signal congestion without dropping packets (RFC 3168).
Total length
16 bits (2 bytes)
140
Length of header and payload in bytes, at most 65,535.
Identification
16 bits (2 bytes)
0x0006
Packet number; all fragments of a packet carry the same one.
Flags
3 bits
DF
Bit 0 reserved, DF = don't fragment, MF = more fragments follow.
Fragment offset
13 bits
0
Position of the fragment in the original packet, in steps of 8 bytes.
TTL
8 bits
64
Time to live: each router subtracts 1; at 0 the packet is dropped (ICMP time exceeded).
Protocol
8 bits
6
What is inside: 1 ICMP, 6 TCP, 17 UDP, 50 ESP, 89 OSPF.
Header checksum
16 bits (2 bytes)
0x9aa7
Checksum over the header only (RFC 1071); each router recalculates it because of the TTL.
Source IP
32 bits (4 bytes)
192.168.10.100
Sender, unchanged along the whole path (except with NAT).
Destination IP
32 bits (4 bytes)
192.168.20.10
Destination, routers decide the path by it.
Options (optional)
0–40 bytes
Rarely used (e.g. record route); IHL is then greater than 5.
Payload
≤ 65515 bytes
120 Byte
The segment or message of the next layer (TCP, UDP, ICMP …).
Values: Real frame from the demo “DNS, TCP and HTTP” (no. 36, 158 bytes), exactly as the packet list in leyoNET shows it.
On the way through several networks the Ethernet header changes at every router, the IP header stays; only TTL and checksum change.
Typical mistakes
Wrong mask: two devices think they are in the same network but are not (or vice versa).
Gateway outside the network: leyoNET allows the entry but warns; this makes troubleshooting tasks possible.
Duplicate address: two devices with the same address in the same network; leyoNET marks both with a red exclamation mark.
How to do it in leyoNET
The same text as in the app’s help (F1 key).
IP addresses
Every device needs an IP address and a mask (e.g. 192.168.1.10/24). The mask says which part is the network. If the destination is in another network, the device sends the packet to its gateway (the router). The DNS server turns names into addresses.
Values are saved as soon as you leave the field (Tab, Enter or clicking elsewhere, including another device). If the mask is missing, leyoNET fills in the usual mask of the address class (e.g. /24 for 192.168.x.x); you can change it at any time.
Duplicate addresses
If two devices in the same network have the same IP address, a red ! appears on the device, the address turns red and the form shows a warning. In the simulation, addresses obtained via DHCP count too.
The same network means: connected through cables, switches, access points or modems without a router in between. Behind different routers (e.g. two home networks with 192.168.1.1) the same private address is fine.
See an example
Slow motion This is how it looks in the simulation: every dot is a frame on the cable.Default gateway
Two subnets connected by a router.
PC 1 sees that the target is in another network and sends the packet to its router. The TTL drops by one.
RFC 1918 – Address Allocation for Private Internets
RFC 5737 – IPv4 Address Blocks Reserved for Documentation
Read on
Subnetting and VLSMSplit a network into smaller ones, read masks and prefixes, compute host range and broadcast – evenly or as needed.
How routing worksDefault gateway, routing table, longest prefix and administrative distance – and when to route statically, automatically or dynamically.
ARPHow a device finds the MAC address for an IP address in its own network – with a broadcast request, a reply and a cache.
ICMP, ping and tracerouteEcho request and reply, “destination unreachable” and “TTL expired”: how ping and traceroute work.