OSI Model - Network Layer
Layer 3 is where an internetwork becomes possible. It gives every host a global address and every router a map, so a packet can cross dozens of networks it has never seen before and still arrive at exactly the right machine.
Layer 3 in the stack
The network layer is Layer 3 of the OSI model. It sits directly above the Data Link layer (Layer 2) and directly below the Transport layer (Layer 4). Each layer answers a different scope of the same problem — moving data:
- Layer 2 moves a frame across a single link (one local network).
- Layer 3 moves a packet across many networks, from a source host to a destination host anywhere on an internetwork.
- Layer 4 moves a segment between the correct applications on those hosts.
The Transport layer gives process-to-process service; the network layer gives host-to-host service across the whole path. In the TCP/IP model, Layer 3 is called the Internet layer, and its defining protocol is IP.
Four jobs of the network layer
Exams expect you to break the network layer into its distinct functions. There are four:
| Job | What it does | Where it happens |
|---|---|---|
| Logical addressing | Assign and use Layer 3 addresses (IP) that identify hosts and networks. | Hosts and routers |
| Routing | Choose the best path from source to destination across the internetwork. | Routers (control plane) |
| Forwarding | Move each individual packet toward its destination, one hop at a time. | Routers (data plane) |
| Fragmentation | Split a packet too large for a link; the destination reassembles it. | Routers (IPv4), destination host |
Routing and forwarding are easy to confuse. Routing is the big-picture decision — “which way should traffic go?” — and it fills a table. Forwarding is what the router does with every single packet that arrives, using that table.
Logical addressing with IP
An IP address is a logical address: it is assigned in software by an administrator or a DHCP server, not burned into the hardware. Because it is logical, it is independent of the underlying link technology — the same IP can travel over Ethernet, Wi-Fi, or fibre without changing. A MAC address, by contrast, is physical and only meaningful on the local link (Layer 2).
IPv4 addresses are 32 bits long; IPv6 addresses are 128 bits. An IP address has two parts: a network portion, which lets routers summarise and forward whole networks, and a host portion, which identifies the specific device inside that network. This two-level, hierarchical structure is what makes global routing scale. If every address were flat and random, routers would need a separate entry for every host on Earth.
Several different protocols define how Layer 3 works:
| Protocol | Purpose |
|---|---|
| IPv4 | The original Internet Protocol (RFC 791). Connectionless and best-effort: it makes no guarantee of delivery, ordering, or error recovery. Those are handled by higher layers. |
| IPv6 | The successor to IPv4, using 128-bit addresses and a simplified fixed header. Defined in RFC 8200. |
| ICMP | Internet Control Message Protocol (RFC 792). Carries error and diagnostic messages that sit alongside IP. The tools ping and traceroute depend on it. |
| Routing protocols | RIP, OSPF (and others) run at Layer 3 to exchange reachability information and build routing tables. In-depth coverage is Week 6. |
Routing and forwarding
Routing is the process of choosing a path from source to destination across an internetwork. Routers keep a routing table (also called a forwarding table) that lists destinations and the next hop for each. Routers learn routes in two ways: they know their directly connected networks automatically, and they learn everything else through routing protocols such as RIP and OSPF (covered in depth in Week 6).
Forwarding is the per-packet action. A router receives a packet on one interface, looks at the destination IP address, finds the matching entry in its forwarding table, and sends the packet out the correct interface toward the next hop. The router needs no knowledge of the full path — only the next hop.
If several entries match, the router uses the most specific match (longest prefix match). If no entry matches, it uses the default route; if there is no default route, the packet is dropped. A dropped packet may trigger an ICMP error message back to the sender.
Fragmentation, MTU and routers
Every link has a maximum transmission unit (MTU) — the largest payload a frame on that link can carry. If a packet is larger than the MTU of the outgoing link, IPv4 can fragment it: the router splits the packet into smaller fragments, gives each a copy of the IP header (with fields that let the pieces be identified and ordered), and the destination host reassembles them. Reassembly happens at the destination, not at intermediate routers.
IPv6 changed the rules: IPv6 routers do not fragment. The sending host must discover the smallest MTU along the path (Path MTU Discovery) and send packets that already fit.
The device that operates at Layer 3 is the router. Each router interface connects to a different network and has its own IP address. A router’s job, step by step:
- Receive a frame on an interface.
- Remove the Layer 2 header and trailer (de-encapsulate down to the packet).
- Read the Layer 3 destination address and consult the forwarding table.
- Build a new Layer 2 frame for the next link (re-encapsulate) and send it.
A host uses a default gateway — a router on its own network — to reach any destination that is not local. If the destination is on the same network, the host sends directly; if not, it sends to the gateway.
Crossing a network boundary
This is the concept that ties Layer 3 to the whole course. When a packet crosses from one network to another, the IP addresses stay the same from source to destination, but the MAC addresses are rewritten at every router hop. The router is exactly the point where the Layer 2 addressing changes because the link changes.
The Layer 3 Protocol Data Unit is the packet. (Older texts also say “datagram”, and IPv6 formally calls it a packet too.) At Layer 3 the IP packet consists of the IP header plus the payload (the transport-layer segment or datagram). Key IPv4 header fields include:
| Field | What it is for |
|---|---|
| Version | Which IP version this is (4 for IPv4, 6 for IPv6). |
| Source / Destination address | The logical addresses that routing and forwarding use. |
| Time To Live (TTL) | A counter decremented at each router; when it reaches zero the packet is dropped, preventing loops (IPv6 calls this Hop Limit). |
| Protocol | Identifies the payload carried inside (for example TCP, UDP, or ICMP). |
| Fragmentation fields | Identification, flags, and fragment offset, used for IPv4 fragmentation and reassembly. |
Review
Check what you have learned with these review questions.
Key terms
- Network layer (Layer 3) — the OSI layer that delivers packets host-to-host across multiple networks using logical addressing.
- Logical address — a software-assigned Layer 3 address (IP) that is independent of the hardware.
- Routing — choosing a path across the internetwork; it populates the routing table.
- Forwarding — the per-packet action of moving a packet to the next hop using the forwarding table.
- Default gateway — the router on the local network that a host uses to reach remote networks.
- Fragmentation — splitting an IPv4 packet to fit a link’s MTU; the destination reassembles it.
- MTU — Maximum Transmission Unit; the largest payload a link can carry in one frame.
- ICMP — Internet Control Message Protocol; error and diagnostic messages that assist IP.
Sources: RFC 791 (Internet Protocol); RFC 1122; RFC 8200 (IPv6); RFC 792 (ICMP); IEEE 802.3 and 802.11; ISO/IEC 7498-1; Cisco CCNA 200-301 exam topics.
Sources & references
- Postel, J. RFC 791: Internet Protocol (1981). rfc-editor.org/rfc/rfc791.
- Braden, R. RFC 1122: Requirements for Internet Hosts — Communication Layers (1989). rfc-editor.org/rfc/rfc1122.
- IEEE. IEEE 802.3 (Ethernet). standards.ieee.org.
- IEEE. IEEE 802.11 (Wireless LAN). standards.ieee.org.
- ISO/IEC. 7498-1:1994 — Information technology — Open Systems Interconnection — Basic Reference Model. iso.org.
- Cisco. CCNA (200-301) Exam Topics, Network Fundamentals. cisco.com.
Target exams: CCNA 200-301 v1.1 · CyberOps Associate 200-201. Last content verification: 2026-10-11.