Transport and networkLayer 3RFC 791
IP: addresses and hops
How a packet finds its way across many networks, one router at a time.
Ports and use: Network layer
In one sentenceIP puts a source and a destination address on every packet, and each router passes it one step closer.
Think of it like thisIt is the address on an envelope. Each post office only decides which truck to put it on next.
Watch it happen
3 steps and 3 byte-by-byte decodes. Use the buttons or the arrow keys. Hover or focus a field to find its bytes.
- Your laptop
- Router
- Web server
- Packet leaves your laptopYour laptop to Router
- Router lowers the time to liveRouter to Router
- Packet reaches the serverRouter to Web server
Step 1 of 3 Packet leaves your laptop
Your laptop → Router
Your laptop builds a packet for 203.0.113.5. The server is not on your network, so it hands the packet to the router.
IPv4 header leaving the laptop 20 bytes
45 00 00 2c 1c 46 40 00 40 06 20 ce c0 a8 01 0a cb 00 71 05
| Field | Bytes | What it means |
|---|---|---|
| Version and header length | 45 | Version 4, header length 5 words of 4 bytes = 20 bytes. |
| Type of service | 00 | Priority hints. Zero for normal traffic. |
| Total length | 00 2c | The whole packet is 44 bytes: 20 of header plus 24 of data. |
| Identification | 1c 46 | A number used to put fragments back together if the packet is split. |
| Flags and fragment offset | 40 00 | The "Don't Fragment" flag is set, so routers drop it instead of splitting it. |
| Time to live | 40 | 64: the packet may cross at most 64 routers before it is thrown away. |
| Protocol | 06 | 6 means the data inside is a TCP segment (17 would be UDP, 1 would be ICMP). |
| Header checksum | 20 ce | Checks the header for damage. It is recalculated by every router that changes the header. |
| Source address | c0 a8 01 0a | 192.168.1.10: where the packet comes from. |
| Destination address | cb 00 71 05 | 203.0.113.5: where it is going. |
Step 2 of 3 Router lowers the time to live
Router
The router lowers the time to live by one and fixes the checksum. If it reached 0 the router would drop the packet and send back an error.
The same header after one hop 20 bytes
45 00 00 2c 1c 46 40 00 3f 06 21 ce c0 a8 01 0a cb 00 71 05
| Field | Bytes | What it means |
|---|---|---|
| Version and header length | 45 | Version 4, header length 5 words of 4 bytes = 20 bytes. |
| Type of service | 00 | Priority hints. Zero for normal traffic. |
| Total length | 00 2c | The whole packet is 44 bytes: 20 of header plus 24 of data. |
| Identification | 1c 46 | A number used to put fragments back together if the packet is split. |
| Flags and fragment offset | 40 00 | The "Don't Fragment" flag is set, so routers drop it instead of splitting it. |
| Time to live | 3f | 63: one router has handled it. Compare the checksum with the previous step. |
| Protocol | 06 | 6 means the data inside is a TCP segment (17 would be UDP, 1 would be ICMP). |
| Header checksum | 21 ce | Checks the header for damage. It is recalculated by every router that changes the header. |
| Source address | c0 a8 01 0a | 192.168.1.10: where the packet comes from. |
| Destination address | cb 00 71 05 | 203.0.113.5: where it is going. |
Step 3 of 3 Packet reaches the server
Router → Web server
The router picks the next hop from its routing table. After the last router, the server reads the header, sees protocol 6 and passes the data to TCP.
The header as the server receives it 20 bytes
45 00 00 2c 1c 46 40 00 3e 06 22 ce c0 a8 01 0a cb 00 71 05
| Field | Bytes | What it means |
|---|---|---|
| Version and header length | 45 | Version 4, header length 5 words of 4 bytes = 20 bytes. |
| Type of service | 00 | Priority hints. Zero for normal traffic. |
| Total length | 00 2c | The whole packet is 44 bytes: 20 of header plus 24 of data. |
| Identification | 1c 46 | A number used to put fragments back together if the packet is split. |
| Flags and fragment offset | 40 00 | The "Don't Fragment" flag is set, so routers drop it instead of splitting it. |
| Time to live | 3e | 62: two routers have handled it on the way. |
| Protocol | 06 | 6 means the data inside is a TCP segment (17 would be UDP, 1 would be ICMP). |
| Header checksum | 22 ce | Checks the header for damage. It is recalculated by every router that changes the header. |
| Source address | c0 a8 01 0a | 192.168.1.10: where the packet comes from. |
| Destination address | cb 00 71 05 | 203.0.113.5: where it is going. |
Where you meet it
- Every web page, video call and app request on the internet travels inside IP packets.
- Your phone gets an IP address from the Wi-Fi network, and a different one from mobile data.
- Routers, firewalls and cloud networks all make decisions by looking at IP addresses.
Common mistakes
- Thinking an IP address identifies a person. It identifies a network connection, and often many people share one.
- Mixing up private addresses (192.168.x.x, 10.x.x.x) with public ones. Private addresses do not work across the internet.
- Forgetting that IPv4 addresses are running out, which is why IPv6 exists.
- Assuming a packet always arrives. IP only tries its best; TCP adds the promise.
Try it yourself
Run these on your own computer and compare the output with the lesson above.
ip addrLinux: shows your own IP addresses.ipconfigWindows: the same information.traceroute 1.1.1.1Shows each router on the way (tracert on Windows).
Addresses and values in the examples are made up for teaching (the 203.0.113.x range is reserved for documentation). Real traffic carries more options and details. Check the standard named above for the full rules.