Module 1: How Networks Are Layered
Networking can feel like a long list of unrelated terms and protocols. Layering provides a structure for relating them to one another.
Cables, addresses, ports, and names belong to different layers, and each one solves a different part of getting data from one machine to another. During troubleshooting, the layers help show what a symptom can explain and where a problem may be occurring.
In This Module
Section titled “In This Module”- Why networks are built in layers at all
- The four layers of the Transmission Control Protocol/Internet Protocol (TCP/IP) model
- The Open Systems Interconnection (OSI) model, and how it maps onto TCP/IP
- Encapsulation, or what wraps what as data leaves your machine
Why Layers Exist
Section titled “Why Layers Exist”Think about mailing a letter. You write it, put it in an envelope, address the envelope, and drop it in a box. You do not know which trucks carry it, which sorting facilities it passes through, or whether part of the trip happens by plane. You do not need to know. The postal system handles delivery, and you handle the message.
Networks work the same way, and for the same reason. Each layer solves one problem and trusts the layer below it to solve the next one down.
The payoff is that layers can change independently. An organization can replace every switch in a building with faster models, and not one application has to be reconfigured, because the applications never dealt with cables or switches in the first place. Someone can invent a faster physical medium without anyone rewriting web servers.
Another practical benefit appears during troubleshooting. When communication fails, layers help narrow down where to look.
The TCP/IP Model
Section titled “The TCP/IP Model”This is the model the internet actually runs on. It takes its name from the Transmission Control Protocol (TCP) and the Internet Protocol (IP), and it has four layers.
Protocol examples in the table include Hypertext Transfer Protocol (HTTP), Domain Name System (DNS), Secure Shell (SSH), Simple Mail Transfer Protocol (SMTP), User Datagram Protocol (UDP), Internet Control Message Protocol (ICMP), and Address Resolution Protocol (ARP).
| Layer | Its job | Examples |
|---|---|---|
| Application | Provide network services used by applications | HTTP, DNS, SSH, SMTP |
| Transport | Deliver data to the correct application process | TCP, UDP |
| Internet | Address and route packets between networks | IP, ICMP |
| Link | Deliver frames and resolve addresses on a local link | Ethernet, Wi-Fi, ARP |
Each example gets its own treatment later.
ARP is included in the Link layer because it finds the media access control (MAC) address associated with an IPv4 address on the local network. That MAC address is needed to deliver the frame to the next device.
Read the table from the bottom up and it tells a story.
- The Link layer moves frames between devices on the same local network.
- The Internet layer routes packets between networks.
- The Transport layer delivers data to the correct application on the destination device. TCP provides reliability when it is needed.
- The Application layer provides network services that software can use.
The OSI Model
Section titled “The OSI Model”The Open Systems Interconnection (OSI) model is older, has seven layers, and describes roughly the same thing in more detail.
| OSI layer | Name | Maps to TCP/IP | What it covers |
|---|---|---|---|
| 7 | Application | Application | Network services used by applications, including HTTP and DNS |
| 6 | Presentation | Application | Data formatting, encoding, compression, and encryption |
| 5 | Session | Application | Communication sessions between applications |
| 4 | Transport | Transport | Delivery between applications, including TCP, UDP, and port numbers |
| 3 | Network | Internet | IP addressing and routing between networks |
| 2 | Data Link | Link | Frames, MAC addresses, and switches on the local network |
| 1 | Physical | Link | Transmission through cables, radios, and network interfaces |
Both models appear in technical conversations. Systems use the TCP/IP model, but people often use OSI numbers when discussing networking. A load balancer described as “layer 7” works with application traffic. A “layer 3” problem involves IP addressing or routing.
Encapsulation
Section titled “Encapsulation”Encapsulation is what layering looks like in practice. As your data heads down the stack, each layer wraps it in a header carrying the information that layer needs.
Say your browser requests a web page.
- The application layer produces the HTTP request, the actual text of what you want.
- The transport layer wraps it in a TCP header carrying the source and destination ports, which identify the programs on each end. The result is a segment.
- The internet layer wraps that in an IP header carrying the source and destination IP addresses, which identify the machines. The result is a packet.
- The link layer wraps that in an Ethernet header carrying MAC addresses, which identify the next device on the local network. The result is a frame.
- The frame goes out as electrical signals, light, or radio waves.
On the receiving machine the process runs in reverse. Each layer strips its own header, reads it, and hands the contents up.
One detail here explains a great deal of later material. The source and destination IP addresses normally describe the end-to-end conversation, while the Ethernet header is rebuilt at every hop. Each router strips the frame it received, decides where the packet goes next, and builds a new frame for that next hop. Network Address Translation (NAT), covered in Module 7, is an important exception because it deliberately changes address information in transit.
That is why MAC addresses are used for delivery on the local network, while IP addresses are used to deliver packets between networks.
Further Learning
Section titled “Further Learning”These optional references go deeper than this module needs.
- What is the OSI Model? walks all seven layers with an example message travelling down and back up the stack.
- What is the network layer? explains headers, packets, and how the OSI and TCP/IP models compare.
- If you prefer video, Ed Harmoush’s Networking Fundamentals YouTube series is one of my favorites and covers a wide range of topics.
Main Takeaways
Section titled “Main Takeaways”- Networking layers separate communication into distinct responsibilities.
- Encapsulation adds layer-specific information as data moves toward the network. The destination removes that information in reverse order.
- Layers provide a way to relate protocols and narrow where a communication problem occurs.
Continue to Module 2 to set up the tools used throughout the guide, and optionally build the lab.