Network protocol model
本文讨论network protocol model,它是典型的层次化模型/结构;建立起完整的network protocol model非常重要,它让我们完整地认识network。
model | 简介 |
---|---|
OSI model | 理论模型,实际并没有采用它 |
Internet protocol suit | 实际采用的模型 |
wikipedia OSI model
The Open Systems Interconnection model (OSI model) is a conceptual model that characterizes and standardizes the communication functions of a telecommunication or computing system without regard to its underlying internal structure and technology. Its goal is the interoperability of diverse communication systems with standard protocols. The model partitions a communication system into abstraction layers. The original version of the model defined seven layers.
NOTE:
一、上面这段话中的最后一句中的original让我想起来了在大学的时候学习network的时候,其中说明过**实现**和**理论**之间的差异:即实现可能并不会按照理论中所定义的模型来进行,在实现的时候可能会进行简化。
二、需要和Internet protocol suite对比着来看。
A layer serves the layer above it and is served by the layer below it. For example, a layer that provides error-free communications across a network provides the path needed by applications above it, while it calls the next lower layer to send and receive packets that constitute(组成) the contents of that path. Two instances at the same layer are visualized as connected by a horizontal connection in that layer.
NOTE: 这段话从横向和纵向对OSI的各层之间的关系进行了描述。
The model is a product of the Open Systems Interconnection project at the International Organization for Standardization(ISO).
NOTE: 在programmer进行programming的时候,往往是由programmer来自己选择想要使用的protocol;可以看到OSI为我们提供了多种protocol。
NOTE:
上图截取自 csdn 【学习】计算机网络重点知识点面试突击(一)
Communication in the OSI-Model (example with layers 3 to 5)
OSI model by layer
OSI model by layer
layer | name | example |
---|---|---|
7. | Application layer | - FTP - Gopher - HTTP |
6. | Presentation layer | - MIME - XDR |
5. | Session layer | |
4. | Transport layer | - TCP - UDP |
3. | Network layer | - IP (IPv4 IPv6 ) - ICMP |
2. | Data link layer | - ATM - ARP |
1. | Physical layer |
wikipedia Internet protocol suite
The Internet protocol suite is the conceptual model and set of communications protocols used in the Internet and similar computer networks. It is commonly known as TCP/IP because the foundational protocols in the suite are the Transmission Control Protocol (TCP) and the Internet Protocol (IP). It is occasionally known as the Department of Defense (DoD) model because the development of the networking method was funded by the United States Department of Defense through DARPA.
NOTE: 需要注意的是, **Internet protocol suite**才是真正用于Internet的,而不是OSI model 。
The Internet protocol suite provides end-to-end data communication specifying how data should be packetized(打包), addressed(编址), transmitted(传输), routed, and received(接收). This functionality is organized into four abstraction layers(共四层), which classify all related protocols according to the scope of networking involved.[1][2] From lowest to highest, the layers are
1、the link layer, containing communication methods for data that remains within a single network segment (link);
2、the internet layer, providing internetworking between independent networks;
NOTE:
网络层
3、the transport layer, handling host-to-host communication; and
NOTE:
传输层
4、the application layer, providing process-to-process data exchange for applications.
NOTE:
" end-to-end data communication "所链接的是 End-to-end principle,它的核心思想是:
The end-to-end principle is a design framework in computer networking. In networks designed according to this principle, application-specific features reside in the communicating end nodes of the network, rather than in intermediary nodes, such as gateways and routers, that exist to establish the network.
The technical standards underlying the Internet protocol suite and its constituent protocols are maintained by the Internet Engineering Task Force (IETF). The Internet protocol suite predates(早于) the OSI model, a more comprehensive reference framework for general networking systems.
Internet protocol suite by layer
layer | name | example |
---|---|---|
4 | Application layer | FTP HTTP NFS SMTP Telnet |
3 | Transport layer | TCP UDP SCTP DCCP SPX |
2 | Network layer | IP (IPv4 IPv6 ) ICMP IPsec IGMP IPX AppleTalk X.25 PLP |
1 | Link layer | ARP NDP OSPF Tunnels L2TP PPP MAC Ethernet Wi-Fi DSL ISDN FDDI |
NOTE: 看了上面的Internet protocol suite,我所想到的是在使用socket进行programming的时候,我需要指定的内容包括 Transport layer (使用哪种transport protocol,是TCP还是UDP,还是其他的)和 Network layer (使用的是IPV4还是IPV6),即socket是建立在 Transport layer 的;按照OSI model,在 Transport layer 之上还有layer5和layer6才能够到达 Application layer ,但是在Internet protocol suite中, Transport layer 之上就是 Application layer ,并且在实际中,都是采用的Internet protocol suite,所以我也应该按照 Internet protocol suite 来进行思考;我们往往是在 Application layer 进行program,在application layer我们使用socket来实现application layer protocol,以满足application的要求;在我们实际进行program的时候,如果要开发一个network application,我们往往是从从顶向下来进行开发设计的,我们往往是首先开发application protocol,比如redis的RESP 。port是和application layer protocol相关的;
Formal specification and standards
The characteristic architecture of the Internet Protocol Suite is its broad division into operating scopes for the protocols that constitute its core functionality. The defining specification of the suite is RFC 1122, which broadly outlines four abstraction layers.[1] These have stood the test of time, as the IETF has never modified this structure. As such a model of networking, the Internet Protocol Suite predates the OSI model, a more comprehensive reference framework for general networking systems.
NOTE: 摘录原文中的这一段,重要是为了强调 RFC 1122, 它是Internet protocol suit的formal description,所以很多关于Internet protocol suit的问题都可以在其中找到答案,并且可以看到原文中,有多处是引用RFC 1122的,我已经将RFC 1122下载了。
Mechanism
NOTE: 这是我在阅读wikipedia Internet protocol suite的Key architectural principles的插图"Encapsulation of application data descending through the layers described in RFC 1122"时,有感而发,本节标题的含义是: 机制,network protocol model的运行机制。
本文描述protocol stack的运行机制,其实它的运行机制相对是比较简单的,可以看做是两个方向:
1、Descend(向下): 沿着协议栈自顶向下
2、Ascend(向上): 沿着协议栈自底向上
Disassemble / Reassemble
Disassemble 拆开
Reassemble 重新装配、重新集合
显然两者描述的是相反的过程。
不同PDU的最大长度可能不同,这就导致了Disassemble / Reassemble问题,下面是一些与此相关的内容:
2、TCP segment of a reassembled PDU(在 Network\Theory\TCPTCP-segment-of-a-reassembled-PDU
中,对这个问题进行了讨论)
Top-down(自顶向下)
涉及到的操作有:
1) Encapsulation of application data
2) Disassemble: 将上层的数据,按照本层的PDU进行disassemble,生成多个多个本层的PDU
Encapsulation of application data descending through the layers described in RFC 1122
Bottom-up(子底向上): Unpack/Expose
自底向上的过程和自顶向下的过程转换相反,它是涉及到的操作有:
1) Unpack/Expose
2) Reassemble: 将多个本层的PDU,组装为上层的PDU