Network Layer
100%

Network Basics · Lesson 7

Network Layer

Learn how IP addressing, prefixes, routing tables, and hop limits move packets between networks.

The network layer provides logical addressing and best-effort packet delivery across interconnected networks. In the Internet protocol suite, IPv4 and IPv6 carry packets while routers choose the next hop toward each destination.

IP Packets

An IP header includes source and destination addresses plus fields needed for forwarding and protocol processing. The payload commonly contains a TCP segment, UDP datagram, or ICMP message. IP does not guarantee arrival, order, or absence of duplicates.

What delivery service does IP provide by itself?

Prefixes and Subnets

An address and prefix length define which leading bits form a network prefix. Hosts use this information and their routes to decide whether a destination is on-link or requires a next-hop router. A subnet is an address range under a prefix and policy; subnets are not automatically connected to every other subnet.

What helps a host decide whether an IPv4 destination is on-link?

Routing Decisions

Linux consults routing policy and tables to select an outgoing interface, next hop, and preferred source information. Among otherwise eligible routes, the most specific matching prefix is normally preferred. Inspect the actual decision for a destination with:

$ ip route get 203.0.113.10

This is a local route lookup, not proof that every downstream router has a working route or that the destination accepts traffic.

Which route normally wins among eligible routes to the same destination?

Hop Limits and Forwarding Changes

Each IPv4 packet has a TTL and each IPv6 packet a Hop Limit. A router decrements it; when it reaches zero, the router drops the packet and can send an ICMP error. This prevents forwarding loops from circulating indefinitely.

Routers normally preserve end-to-end IP addresses, but NAT, tunnels, proxies, and other middleboxes can transform or wrap packets. Link-layer headers change at each routed hop regardless.

Why is TTL or Hop Limit decremented by routers?

Lesson complete

You finished Network Layer

You can now explain how an IP host selects the next step toward a destination.

  • Treat IP delivery as best effort.

  • Use prefixes and routes to distinguish on-link and routed destinations.

  • Apply longest-prefix matching to route selection.

  • Recognize how hop limits bound forwarding loops.

Keep your learning progress

Create a free account to save this lesson and continue learning on any device.

Create a free account
Next Lesson
Back to Network Basics