Fundamentals 10 min read

Demystifying Network Layers: From Physical to Application Explained

This article walks through the OSI network model layers—physical, data link, network, transport, and application—explaining hardware components, MAC and IP addressing, subnet masks, TCP/UDP protocols, ports, and how data is encapsulated and decapsulated across each layer.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Demystifying Network Layers: From Physical to Application Explained

Network knowledge is essential for embedded Linux development, yet many struggle with the many layers and their functions. Below is a concise overview of the classic network model.

Physical Layer

The physical layer corresponds to hardware: network interface cards (NICs), PHY chips, and the actual cables connecting PCs, switches, and cloud servers. It handles the transmission of raw bits (0s and 1s) over the medium.

Data Link Layer

This layer introduces the globally unique MAC address, allowing devices to identify each other on the same local network. It also defines how bits are grouped into frames.

Network Layer

Here the IP address comes into play. While MAC addresses are unique, IP addresses may not be; a device can have multiple IPs. The network layer determines routing and subnetting.

IP Protocol

IPv4 uses a 32‑bit address, typically written as four decimal octets (e.g., 172.16.254.1). The address is split into a network part and a host part. Devices in the same subnet share the same network prefix.

To identify whether two IPs belong to the same subnet, a subnet mask is used. The mask is a 32‑bit number with network bits set to 1 and host bits set to 0 (e.g., 255.255.255.0 for a /24 network). By performing a bitwise AND between each IP and the mask, the resulting network addresses can be compared.

Transport Layer

The transport layer provides sockets and protocols such as TCP and UDP. It also introduces ports so multiple applications on the same device can communicate independently.

UDP is simple, adding only source and destination ports, but offers no reliability.

TCP adds reliability through acknowledgments, retransmissions, and ordering, at the cost of increased complexity and resource usage.

Application Layer

Application‑level protocols (e.g., HTTP, FTP, SMTP) encapsulate data for specific services. For example, a web browser uses HTTP over TCP/IP to retrieve web pages.

Data transmission follows a layered encapsulation: each layer adds its header before passing the packet down, and the receiver strips headers layer by layer to retrieve the original payload.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

TCPApplication LayerUDPOSI modelSubnet MaskIP addressing
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.