TCP / IP protocol layering

1, TCP / IP protocol layering model

Application layer

  The application layer determines the communication activities of providing application services to users;
  The application layer is responsible for handling specific application details;
  TCP / IP protocol suite stored within a variety of common application services. For example, FTP (File Transfer Protocol, File Transfer Protocol) and DNS (Domain Name System, the domain name system) service is one of the two categories. HTTP, RTP, RTCP and other protocols at this layer.

Transport Layer

  The application layer provides services to an upper layer, provided in the data transfer between two computers connected to the network, communication part of the top face portion, but also the user function in the lowest layer. Router transporting layer is not used when forwarding packets, only used the network layer, data link layer and the physical layer;
  It provides a logical communication transport layer is the application process communicate with each other (in fact, the communication between two hosts is a communication between two hosts in the application process)
  In a different transport layer protocols of two properties: TCP (Transmission Control Protocol, Transmission Control Protocol) and UDP (User Data Protocol, User Datagram Protocol).
   TCP provides a highly reliable data communication to two hosts. All it does it comprises the application to the appropriate data into small blocks to the network layer below, acknowledgment packets received, provided the final confirmation packet transmission timeout timers. Since the end of the transport layer provides a highly reliable communication, the application layer can ignore all these details. In order to provide reliable service, TCP retransmission timeout mechanism uses a transmission and reception end acknowledgment packet or the like.
  UDP was the application layer provides a very simple service. It just transmitted packet is called datagrams from one host to another host, but does not guarantee that the packets reach the other end. It refers to a datagram one information unit (e.g., a certain number of bytes of information specified by the sender) transmitted from the sender to the recipient. Any necessary reliability of the UDP protocol layer must be provided by the application.

Network layer

  Network layer for processing data packets flowing on the network. Packet is a minimum data unit transmission network. This layer defines how to reach the other side of a path through a computer (a so-called transmission line), and transmits the data packets to each other.
  When transmission by a plurality of computers or other network device between the computer, the network layer is to choose the role of a transmission path in many options.
Also referred to as Internet layer (Internet layer as a first drawing), processes the packet in the network, for example, routing of the packet. In the TCP / IP protocol suite, network layer protocols such as IP protocol (Internet Protocol), ICMP protocol (Internet Internet Control Message Protocol), and IGMP protocol (Internet Group Management Protocol).
  IP is a network layer protocol, provides an unreliable service, it is only as fast as the packet from the source node to the destination node, but does not provide any guarantee reliability. It is also used by TCP and UDP. Each TCP and UDP data are transmitted via the Internet in the terminal and IP layers of each intermediate router.
  ICMP protocol IP protocol is a subsidiary. IP layer it with other hosts or routers to exchange error messages and other important information.
  IGMP is the Internet Group Management Protocol. It is used to a UDP datagram multicasting to multiple hosts.

Link layer

  Hardware for the link layer processing section connected to the network. It comprises a control operating system, hardware, device drivers, NIC (Network Interface Card, a network adapter, i.e. NIC), and the visible portion of the optical fiber and other physical (including all further connected to transmission media, etc.). It is visible on the hardware within the scope of the link layer.
  Also known as data link layer or the network interface layer (in the figure as a first network interface layer and hardware layer), typically includes an operating system, device drivers and a corresponding computer network interface card. They are processed together with details of the physical interface cable (or any other transmission medium) is. ARP (Address Resolution Protocol) and the RARP (Reverse Address Resolution Protocol) protocol is a certain special network interface (such as Ethernet and Token Ring) used for converting the IP layer address and network interface layer used.

2, TCP / IP and OSI Model Model Comparison

  OSI model, i.e., Open Systems Interconnection Reference Model (Open System Interconnection Reference Model), the International Organization for Standardization (ISO) made of a variety of attempts to interconnect computers worldwide network standard frame, referred to as OSI. 
  TCP/IP协议模型(Transmission Control Protocol/Internet Protocol),包含了一系列构成互联网基础的网络协议,是Internet的核心协议,通过20多年的发展已日渐成熟,并被广泛应用于局域网和广域网中,目前已成为事实上的国际标准。TCP/IP协议簇是一组不同层次上的多个协议的组合,通常被认为是一个四层协议系统,与OSI的七层模型相对应。

3、数据的封装与分用

3.1、数据的封装

  当应用程序用TCP传送数据时,数据被送入协议栈中,然后逐个通过每一层直到被当作一串比特流送入网络。其中每一层对收到的数据都要增加一些首部信息(有时还要增加尾部信息),该过程如上图所示。
  TCP传给IP的数据单元称作TCP报文段或简称为TCP段(TCP segment);UDP数据与TCP数据基本一致。唯一的不同是UDP传给IP的信息单元称作UDP数据报(UDP datagram),而且UDP的首部长为8字节,TCP的首部长度为20字节。IP传给网络接口层的数据单元称作IP数据报(IP datagram)。通过以太网传输的比特流称作帧(Frame )。

3.2、数据的分用

  当目的主机收到一个以太网数据帧时,数据就开始从协议栈中由底向上升,同时去掉各层协议加上的报文首部。每层协议盒都要去检查报文首部中的协议标识,以确定接收数据的上层协议。这个过程称作分用(Demultiplexing)。协议是通过目的端口号、源I P地址和源端口号进行解包的。

4、TCP/IP通信传输流

  利用 TCP/IP 协议族进行网络通信时,会通过分层顺序与对方进行通 信。发送端从应用层往下走,接收端则往应用层往上走。
  如上图所示,我们用 HTTP 举例来说明,首先作为发送端的客户端在应用层 (HTTP 协议)发出一个想看某个 Web 页面的 HTTP 请求。 
  接着,为了传输方便,在传输层(TCP 协议)把从应用层处收到的数 据(HTTP 请求报文)进行分割,并在各个报文上打上标记序号及端 口号后转发给网络层。
  在网络层(IP 协议),增加作为通信目的地的 MAC 地址后转发给链 路层。这样一来,发往网络的通信请求就准备齐全了。
  接收端的服务器在链路层接收到数据,按序往上层发送,一直到应用 层。当传输到应用层,才能算真正接收到由客户端发送过来的 HTTP 请求。
  发送端在层与层之间传输数据时,每经过一层时必定会被打上一个该 层所属的首部信息。反之,接收端在层与层传输数据时,每经过一层时会把对应的首部消去。
  这种把数据信息包装起来的做法称为封装(encapsulate)。

5、负责传输的IP协议

  按层次分,IP(Internet Protocol)网际协议位于网络层。Internet Protocol 这个名称可能听起来有点夸张,但事实正是如此,因为几乎 所有使用网络的系统都会用到 IP 协议。TCP/IP 协议族中的 IP 指的就 是网际协议,协议名称中占据了一半位置,其重要性可见一斑。可能 有人会把“IP”和“IP 地址”搞混,“IP”其实是一种协议的名称。
  IP 协议的作用是把各种数据包传送给对方。而要保证确实传送到对方 那里,则需要满足各类条件。其中两个重要的条件是 IP 地址和 MAC 地址(Media Access Control Address)。
  IP 地址指明了节点被分配到的地址,MAC 地址是指网卡所属的固定地址。IP 地址可以和 MAC 地址进行配对。IP 地址可变换,但 MAC 地址基本上不会更改。
  使用 ARP 协议凭借 MAC 地址进行通信。
  IP 间的通信依赖 MAC 地址。在网络上,通信的双方在同一局域网 (LAN)内的情况是很少的,通常是经过多台计算机和网络设备中转 才能连接到对方。而在进行中转时,会利用下一站中转设备的 MAC 地址来搜索下一个中转目标。这时,会采用 ARP 协议(Address Resolution Protocol)。ARP 是一种用以解析地址的协议,根据通信方 的 IP 地址就可以反查出对应的 MAC 地址。
  下面是我们访问一个网页,各种协议在里面起的作用。
 

Guess you like

Origin www.cnblogs.com/Jummyer/p/11106629.html