Linux Network Programming [] 2 OSI model

Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/zztingfeng/article/details/90573074

A OSI Reference Model

Second Slice function

(1) physical layer (Physical Layer)
The physical layer is the lowest layer of the OSI reference model, which uses the transmission medium data link layer provides the physical connection. It is primarily concerned with physical link from one node to another node transmission bit stream, the physical link may be a copper wire, satellite, microwave, or other communication medium. It is a problem of concern are: how many volts represents 1? How many volts represents 0? Clock rate is how much? Full-duplex or half-duplex transmission? The physical layer is generally concerned with mechanical, electrical, functional and procedural characteristics of the link.
(2) data link layer (Data Link Layer)
data link layer is to provide services to the network layer, to solve communication problems between two adjacent nodes, protocol data unit transfer is called a data frame.
Data frame includes a physical address (also known as a MAC address), the control information code, data and check code. The main role of the layer is to check, acknowledgment feedback and retransmission and other means, will not translate into a reliable physical link layer, the network link is error-free data.
Further, the data link layer also coordinate the data transmission rate of sending and receiving sides, i.e., flow control, in order to prevent the recipient by the sender processing time to be caused by high-speed data lines and the blocking buffer overflow.
(3) a network layer (Network Layer)
The network layer provides services to the transport layer protocol data unit referred to as a transmission data packet or packets. The main role of the layer is how to solve the problem by transmitting data packets in each node, i.e. the data packet to the destination selection algorithm (routing) through the path. In addition, excessive number of packet data communication in order to avoid network congestion caused subnetwork, need to be controlled (congestion control) of the number of packets flowing. When the packet is to communicate across multiple subnets to reach their destination, but also solve the problem of Internet interconnection.
(4) Transport Layer (Transport Layer)
Role of the transport layer to provide reliable end to end to the upper layer protocols and transparent data transfer service, including a processing error control and flow control problems. The top layer to shield the details of the underlying data communication, so that the user sees only high in a host entity to transfer between two hosts, and control settings by the user, and reliable data path.
The transport layer protocol data units called segments or transmitted packets.
(5) session layer (Session Layer)
session layer main function is communication (dialogue) between the management and coordination of the various processes on different hosts and that is responsible for establishing, managing and terminating sessions between applications. The reason is that it is named after the session layer session concept is very similar between the two entities. For example, an interactive user session to log on to the computer begins to write-off end.
(6) Presentation Layer (Presentation Layer)
data representing coding process flows through the junction layer representation problems, a system to ensure that the information sent by the application layer the application layer can be read out of another system. If necessary, the layer may provide a standard representation, a variety of computer-internal data into a format for representing a standard for communication with the network representation. Data compression and encryption functions are one of the conversion layer may be provided representation.
(7) an application layer (Application Layer)
The application layer is the highest layer of the OSI reference model, the network is an interface with the user. The network layer is accomplished through the application user applications, such as file transfer, e-mail and the like.

Third data package

每层封装后的数据单元的叫法不同,在应用层、表示层、会话层的协议数据单元统称为data(数据),在传输层协议数据单元称为segment(数据段),在网络层称为packet(数据包),数据链路层协议数据单元称为frame(数据帧),在物理层叫做bits(比特流)。
当数据到达接收端时,每一层读取相应的控制信息根据控制信息中的内容向上层传递数据单元,在向上层传递之前去掉本层的控制头部信息和尾部信息(如果有的话)。此过程叫做解封装。
这个过程逐层执行直至将对端应用层产生的数据发送给本端的相应的应用进程。
以用户浏览网站为例说明数据的封装、解封装过程。
当用户输入要浏览的网站信息后就由应用层产生相关的数据,通过表示层转换成为计算机可识别的ASCII码,再由会话层产生相应的主机进程传给传输层。传输层将以上信息作为数据并加上相应的端口号信息以便目的主机辨别此报文,得知具体应由本机的哪个任务来处理;在网络层加上IP地址使报文能确认应到达具体某个主机,再在数据链路层加上MAC地址,转成bit流信息,从而在网络上传输。报文在网络上被各主机接收,通过检查报文的目的MAC地址判断是否是自己需要处理的报文,如果发现MAC地址与自己不一致,则丢弃该报文,一致就去掉MAC信息送给网络层判断其IP地址;然后根据报文的目的端口号确定是由本机的哪个进程来处理,这就是报文的解封装过程

四 比喻

7 应用层:老板
6 表示层:相当于公司中演示文稿、替老板写信的助理
5 会话层:相当于公司中收寄信、写信封与拆信封的秘书
4 传输层:相当于公司中跑邮局的送信职员
3 网络层:相当于邮局中的排序工人
2 数据链路层:相当于邮局中的装拆箱工人
1 物理层:相当于邮局中的搬运工人

交换机集线器路由器等很多网络设备的设计都是参照OSI模型设计的。

Guess you like

Origin blog.csdn.net/zztingfeng/article/details/90573074