OSI模型与TCP/IP模型

Networking

OSI Model

mnemonic(记忆口诀) :"Please Do Not Throw Spinach Pizza Away." (Layer 1- Layer7)or " A nxious P ale S hakespeare T reated N ervous D runks Patiently"(Layer7 - Layer1)

TCP/IP Model

四层模型:Application, Transport, Internet and Network Interface 五层模型:Application,Transport,Network,Link,Physical(现代网络教科书大多使用)

IP Addresses and Subnets

IP address:如 192.168.0.1 or 172.16.159.243. 有IPv4/IPv6,默认是IPv4(IP version 4)

由四个octet组成,octet代表8 bits

192.168.1.0网络地址 (标识整个网段),192.168.1.255广播地址(向网段内所有设备发送数据)

Looking Up Your Network Configuration

  • Windows: ipconfig

  • Linux and UNIX-based systems, ifconfig or ip address show or ip a s

  • The host (laptop) IP address is 192.168.66.89/24

从左往右就有3 octet 相同 24=3*8.所以IP address 范围是 192.168.66.1 to 192.168.66.254

子网掩码二进制中「从左到右连续 1 的 bit 位数」替代完整子网掩码

the subnet mask (子网掩码)255.255.255.0 可以写成/24

Private Addresses

RFC 1918 defines the following three ranges of private IP addresses:

  • 10.0.0.0 - 10.255.255.255 (10/8)

  • 172.16.0.0 - 172.31.255.255 (172.16/12)

  • 192.168.0.0 - 192.168.255.255 (192.168/16)

UDP and TCP

UDP (User Datagram Protocol):用户数据报协议 connectionless, 速度快,准确度更低

A port number: 2 octets it ranges between 1 and 65535; port 0 不可用

TCP(T ransmission C ontrol Protocol): 传输控制协议 要连接

A TCP connection is established using what's called a three-way handshake. Two flags are used: SYN (Synchronize) and ACK (Acknowledgment)

  1. SYN Packet: The client initiates the connection by sending a SYN packet to the server. This packet contains the client's randomly chosen initial sequence number.客户端发起连接

  2. SYN-ACK Packet: The server responds to the SYN packet with a SYN-ACK packet, which adds the initial sequence number randomly chosen by the server.服务端确认连接

  3. ACK Packet: The three-way handshake is completed as the client sends an ACK packet to acknowledge the reception of the SYN-ACK packet.客户端确认连接

Encapsulation

封装过程:

  • Application data: It all starts when the user inputs the data they want to send into the application. For example, you write an email or an instant message and hit the send button. The application formats this data and starts sending it according to the application protocol used, using the layer below it, the transport layer.

  • Transport protocol segment or datagram : The transport layer, such as TCP or UDP, adds the proper header information and creates the TCP segment (数据段) (or UDP datagram). This segment is sent to the layer below it, the network layer.

  • Network packet : The network layer, i.e. the Internet layer, adds an IP header to the received TCP segment or UDP datagram. Then, this IP packet is sent to the layer below it, the data link layer.

  • Data link frame : The Ethernet(以太网) or WiFi receives the IP packet and adds the proper header and trailer, creating a frame.

de-Encapsulation(解封装)从Layer 1->Layer 7

相关推荐
路由侠内网穿透.3 分钟前
本地部署静态网站托管平台 Netlify 并实现外部访问(Windows 版本)
网络·网络协议
akarinnnn9 分钟前
深入理解内存函数:原理、应用与优化
c语言·网络·数据结构·算法
Patrick_Wilson10 分钟前
CLI 工具突然变慢了?别急着怀疑网络,按这四步排查
网络协议·性能优化·命令行
咖喱o30 分钟前
VRRP
运维·网络·智能路由器
AI云原生34 分钟前
容器网络模型与服务发现:从踩坑到精通,Kubernetes 网络问题排查全指南
服务器·网络·云原生·容器·kubernetes·云计算·服务发现
AI科技星34 分钟前
基于平行素数对等腰梯形网格拓扑的完备性证明哥德巴赫猜想1+1
c语言·开发语言·网络·量子计算·agi
长谷深风11144 分钟前
HTTP请求全过程解析【个人八股】
网络·网络协议·http·多线程下载·tcp 连接·请求报文、响应报文·网络请求流程
xhbh6661 小时前
MC端口映射完全教程:路由器虚拟服务器配置+防火墙放行+内网穿透备用方案
运维·服务器·网络·网络协议·tcp/ip·智能路由器·流量端口转发
code monkey.1 小时前
【Linux之旅】Linux 网络基础全解析:从协议分层到 Socket 编程,构建高性能网络服务的底层基石
linux·网络·php
艾莉丝努力练剑1 小时前
【Linux网络】Linux 网络编程:HTTP(四)从手写服务器到生产级 Nginx 与 cpp-httplib 实战
linux·运维·服务器·网络·c++·nginx·http