Comprehensive Overview of Computer Networks: Layers, Protocols, and Key Concepts
This article provides a comprehensive overview of computer networking, covering network classifications, the OSI and TCP/IP layer models, physical, data link, network, transport, and application layer functions, key protocols such as IP, TCP, UDP, DNS, and essential concepts like NAT, routing, and error detection.
1. Overview of Computer Networks
Computer networks are classified by scope (WAN, MAN, LAN) and by user type (public, private). The TCP/IP four‑layer model and the OSI seven‑layer model are compared, and basic design principles—layer independence, flexibility, and complete decoupling—are outlined.
1.1 Network Classification
By scope: WAN, MAN, LAN. By user: public network, private network.
1.2 Layered Structure
The TCP/IP four‑layer model is contrasted with the OSI seven‑layer architecture.
1.3 Basic Design Principles for Layered Architectures
Layers are independent of each other.
Each layer must be sufficiently flexible.
Layers are completely decoupled.
1.4 Performance Metrics
Rate (bps), delay (transmission, propagation, queuing, processing), and round‑trip time (RTT) are introduced.
2. Physical Layer
The physical layer connects devices and transmits raw bit streams, providing a reliable medium for upper layers.
Key devices include repeaters (amplifiers) and hubs (multi‑port repeaters). The section also explains channel types: simplex, half‑duplex, and full‑duplex.
3. Data Link Layer
3.1 Overview
The data link layer offers reliable transmission of frames between adjacent nodes, handling physical addressing, framing, flow control, error detection, and retransmission.
Important concepts: frames as the basic data unit, Ethernet protocol, and devices such as bridges and switches.
3.2 Error Detection
Parity check (limited to single‑bit errors) and cyclic redundancy check (CRC) are described.
3.3 Maximum Transmission Unit (MTU)
MTU limits the size of a data frame; the path MTU is determined by the smallest MTU along the route.
3.4 Ethernet Protocol Details
Each device has a unique 48‑bit MAC address. Ethernet frames consist of type, source/destination MACs, payload (46‑1500 bytes), and a 4‑byte CRC. The minimum Ethernet frame size is 64 bytes.
3.5 LAN Types
Ethernet (IEEE 802.3) – widely deployed, high speed, low cost.
3.6 Ethernet Frame Structure
Type (2 bytes) – identifies upper‑layer protocol.
Destination and source MAC (6 bytes each).
Payload (46‑1500 bytes).
CRC (4 bytes).
3.7 MAC Address Characteristics
48 bits (6 bytes), globally unique.
Represented in hexadecimal, separated by ‘-’ or ‘:’.
Broadcast address: FF‑FF‑FF‑FF‑FF‑FF.
4. Network Layer
The network layer provides end‑to‑end packet delivery, addressing, routing, and connection management. The core protocol is IP (IPv4/IPv6), complemented by ARP, RARP, ICMP, and IGMP.
4.1 IP Protocol Details
IP creates a virtual inter‑network, abstracting physical differences. Header fields include version, header length, total length, TTL, and protocol identifier (e.g., TCP, UDP).
4.2 IP Forwarding Process
4.3 Subnetting
Class A (8 bits network, 24 bits host), Class B (16 bits network, 16 bits host), Class C (24 bits network, 8 bits host); Class D for multicast, Class E reserved.
4.4 Network Address Translation (NAT)
NAT allows multiple private hosts to share a single public IP, translating internal addresses to the public address and maintaining a translation table.
4.5 ARP and RARP
ARP maps IPv4 addresses to MAC addresses; RARP performs the reverse mapping.
4.6 ICMP
ICMP carries error messages and operational information; common utilities include ping and traceroute.
4.7 Routing Overview
Routing algorithms must be correct, complete, simple, adaptable, stable, and fair. Autonomous Systems (AS) use interior gateway protocols (e.g., RIP, OSPF) and exterior gateway protocols (e.g., BGP).
4.8 RIP Protocol
RIP is a distance‑vector protocol using hop count, limited to 15 hops, suitable for small networks.
4.9 OSPF Protocol
OSPF is a link‑state protocol based on Dijkstra’s algorithm, suitable for large networks, supporting multiple equal‑cost paths and hierarchical routing.
4.10 BGP Protocol
BGP operates between ASes, exchanging full routing tables initially and incremental updates thereafter, encapsulated in TCP.
5. Transport Layer
The transport layer segments data, provides reliable (TCP) or unreliable (UDP) end‑to‑end delivery, and handles flow and congestion control.
5.1 UDP Details
UDP is connectionless, offers no reliability guarantees, and has a minimal 8‑byte header (source port, destination port, length, checksum).
5.2 TCP Details
TCP provides reliable, connection‑oriented, byte‑stream transport with features such as segmentation, reassembly, flow control, congestion control, and error detection.
Key TCP functions include data segmentation/reassembly, multiplexing, flow control, congestion control, addressing, error detection, and reliable end‑to‑end transmission.
5.2.1 TCP Segment Structure
The TCP header (20‑60 bytes) contains sequence number, acknowledgment number, flags, window size, checksum, and options.
5.3 Reliable Transmission Principles
Reliability is achieved through error detection (e.g., CRC), acknowledgments, retransmission, sequencing, and timers. Protocols include Stop‑and‑Wait and sliding‑window (ARQ) mechanisms.
5.4 Congestion Control
TCP uses slow start, congestion avoidance, fast retransmit, and fast recovery to manage network congestion.
5.5 Three‑Way Handshake
Connection establishment uses SYN, SYN‑ACK, and ACK messages to synchronize sequence numbers and confirm bidirectional communication.
5.6 Four‑Way Handshake (Connection Termination)
Termination proceeds with FIN, ACK, FIN, ACK exchanges, followed by a 2 MSL (Maximum Segment Lifetime) wait to ensure all packets have expired.
6. Application Layer
The application layer provides network services to end‑user applications. Major protocols include DNS, DHCP, HTTP/HTTPS, FTP, Telnet, SMTP, POP3, and others.
6.1 DNS
DNS translates human‑readable domain names to IP addresses using a hierarchical lookup (browser cache → hosts file → router cache → DNS servers).
6.2 DHCP
DHCP automatically assigns IP addresses to hosts on a LAN using UDP.
6.3 HTTP and HTTPS
HTTP (TCP/80) is a reliable request/response protocol; HTTPS (TCP/443) adds SSL/TLS encryption for confidentiality and integrity.
HTTP methods include GET, POST, DELETE, HEAD, OPTIONS, and PUT.
HTTPS secures HTTP traffic via SSL/TLS, providing encryption, authentication, and data integrity.
Article source: 奇妙的Linux世界 (copyright belongs to the original author).
Architecture Digest
Focusing on Java backend development, covering application architecture from top-tier internet companies (high availability, high performance, high stability), big data, machine learning, Java architecture, and other popular fields.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.