`
liuhaixiao
  • 浏览: 151366 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

TCP/IP协议分析-协议分层[1]

阅读更多
摘抄:http://net.csai.cn/Router_TCP_IP/200707091516311924.htm
 <nobr id="key0" style="border-bottom: 2px dotted; text-decoration: underline; color: rgb(102, 0, 255); background-color: transparent;" onclick="return kwC();" target="_blank" oncontextmenu="return false;" onmouseover="kwE(event,0, this);" onmouseout="kwL(event, this);" onmousemove="kwM(0);">协议</nobr>分层

  正如OSI七层模型定义的一样,TCP/IP协议也根据不同的通信功能分为不同的层次,TCP/IP通常被认为是一个四层协议系统,TCP/IP的四层跟OSI的七层对应关系如表1-2所示。

  表1-2 TCP/IP协议与OSI七层模型的对应关系

OSI七层模型<o:p></o:p>

TCP/IP协议<o:p></o:p>

应用层<o:p></o:p>

应用层(Application<o:p></o:p>

表示层<o:p></o:p>

会话层<o:p></o:p>

传输层<o:p></o:p>

传输层(Transport<o:p></o:p>

<nobr id="key3" style="border-bottom: 1px dotted rgb(102, 0, 255); text-decoration: underline; color: rgb(102, 0, 255); background-color: transparent;" onclick="return kwC();" target="_blank" oncontextmenu="return false;" onmouseover="kwE(event,3, this);" onmouseout="kwL(event, this);" onmousemove="kwM(3);">网络</nobr>层<o:p></o:p>

网络层(Internet<o:p></o:p>

数据链路层<o:p></o:p>

网络接口层(Network<o:p></o:p>

物理层<o:p></o:p>

<o:p> </o:p>

  1、网络接口层

  也叫数据链路层,通常包括操作系统中的设备驱动程序和计算机中对应的网络接口卡,它们一起处理与传输媒介的物理接口细节。上表中TCP/IP协议没有相应的层次对应OSI七层模型中的物理层,正是因为TCP/IP协议的这种特性,使得其构筑的Internet被广泛的应用。

  2、网络层

  也叫互联网层,处理路由选择等分组在网络中的活动。在TCP/IP协议组件中,网络层协议包括IP协议(Internet Protocol,网际协议)、ICMP协议(Internet互联网控制报文协议),以及IGMP协议(Internet组<nobr id="key4" style="border-bottom: 1px dotted rgb(102, 0, 255); text-decoration: underline; color: rgb(102, 0, 255); background-color: transparent;" onclick="return kwC();" target="_blank" oncontextmenu="return false;" onmouseover="kwE(event,4, this);" onmouseout="kwL(event, this);" onmousemove="kwM(4);">管理</nobr>协议)。

  3、传输层

  主要功能是为两台主机上的应用程序提供端到端的通信。在TCP/IP协议组件中,有两个互不相同的传输协议:TCP(传输控制协议)和UDP(用户数据报协议)。

  TCP为两台主机提供高可靠性的数据<nobr id="key5" style="border-bottom: 1px dotted rgb(102, 0, 255); text-decoration: underline; color: rgb(102, 0, 255); background-color: transparent;" onclick="return kwC();" target="_blank" oncontextmenu="return false;" onmouseover="kwE(event,5, this);" onmouseout="kwL(event, this);" onmousemove="kwM(5);">通信</nobr>。它所做的工作包括把应用程序交给它的数据分成合适的小块交给下面的网络层、确认接收到的分组、设置发送最后确认分组的超时时钟等。

  另一方面,UDP为应用层提供一种非常简单的服务。它只是把数据报从一台主机发送到另一台主机,但并不保证该<nobr id="key7" style="border-bottom: 1px dotted rgb(102, 0, 255); text-decoration: underline; color: rgb(102, 0, 255); background-color: transparent;" onclick="return kwC();" target="_blank" oncontextmenu="return false;" onmouseover="kwE(event,11, this);" onmouseout="kwL(event, this);" onmousemove="kwM(11);">数据</nobr>报能到达另一端。

  TCP提供了高可靠性,因此不需要应用层去考虑,UDP则把所有必需的的可靠性交给应用层自己解决。

  4、应用层

  应用层负责处理特定的应用程序TCP/IP提供了大量的应用程序,下面几种是最为通用的:WWW <nobr id="key2" style="border-bottom: 1px dotted rgb(102, 0, 255); text-decoration: underline; color: rgb(102, 0, 255); background-color: transparent;" onclick="return kwC();" target="_blank" oncontextmenu="return false;" onmouseover="kwE(event,2, this);" onmouseout="kwL(event, this);" onmousemove="kwM(2);">国际</nobr>互联网、Telnet 远程登录、FTP 文件传输协议、SMTP 用于电子邮件的简单邮件传输协议、SNMP 简单网络管理协议。

  表1-3 TCP/IP协议层与对应的服务

TCP/IP协议<o:p></o:p>

对应的服务<o:p></o:p>

应用层<o:p></o:p>

WWWSMTPFTPTelnetGopherSNMP<o:p></o:p>

SocketNetBIOS<o:p></o:p>

传输层<o:p></o:p>

TCPUDP<o:p></o:p>

网络层<o:p></o:p>

IPARPRARPICMP<o:p></o:p>

网络接口层<o:p></o:p>

EthernetX.25PPPSLIP<o:p></o:p>

  如表1-3所示,FTP是一种应用层协议,TCP是一种传输层协议,IP是一种网络层协议,而以太网协议则应用于网络接口层上。TCP/IP协 议组件是一组不同的协议组合在一起构成的协议族。尽管通常称该协议组件为TCP/IP,但TCP和IP只是其中的两种协议而已。

  在TCP/IP协议组件中,网络层IP提供的是一种不可靠的<nobr id="key6" style="border-bottom: 1px dotted rgb(102, 0, 255); text-decoration: underline; color: rgb(102, 0, 255); background-color: transparent;" onclick="return kwC();" target="_blank" oncontextmenu="return false;" onmouseover="kwE(event,7, this);" onmouseout="kwL(event, this);" onmousemove="kwM(7);">服务</nobr>。也就是说,它只是尽可能快地把分组从源结点送到目的结点,但是并不提供任何可靠性保证。而另一方面,TCP在不可靠的IP层上提供了一个可靠的传输层。为了提供这种可靠的服务,TCP采用了超时重传,发送和接收端到端的确认分组等机制。

  TCP和UDP是两种最为著名的传输层协议,二者都使用IP作为网络层协议。

  如前面所说的,TCP采用的超时重传、确认分组机制,使得可以提供可靠的服务。UDP不提供可靠性:它把应用程序传给IP层的数据发送出去,但 是并不保证它们能到达目的地。UDP是一个简单的面向数据报的传输层协议:进程的每个输出操作都正好产生一个UDP数据报,并组装成一份待发送的IP数据 报。IP数据报的长度如果如果超过网络的MTU,那么就要对IP数据报进行分片。

  IP是网络层上的主要协议,同时被TCP和UDP使用。TCP和UDP的每组数据都通过端系统和每个中间路由器中的IP层在互连网中进行传输。

  ICMP是IP协议的附属协议,它用来把一个UDP数据报多播到多个主机。IP层用它来与其他主机或路由器交换错误报文和其他重要信息。ICMP主要被IP使用,应用程序也有可能访问它。Ping和Traceroute是我们经常要使用的诊断工具,它们就是使用的ICMP。

  ICMP包括了各种类型的ICMP报文,报文的类型由类型字段和<nobr id="key1" style="border-bottom: 1px dotted rgb(102, 0, 255); text-decoration: underline; color: rgb(102, 0, 255); background-color: transparent;" onclick="return kwC();" target="_blank" oncontextmenu="return false;" onmouseover="kwE(event,1, this);" onmouseout="kwL(event, this);" onmousemove="kwM(1);">代码</nobr>字段共同决定。

  ARP(地址解析协议)和RARP(逆地址解析协议)是某些网络接口(如以太网和令牌环网)使用的特殊协议,用来转换IP层和网络接口层使用的地址。


TCP/IP协议分析-协议分层[2]

以下是我们在Microsoft Windows 2000中输入ARP命令返回的结果:

C:\>arp<o:p></o:p>

<o:p> </o:p>

Displays and modifies the IP-to-Physical address translation tables used <o:p></o:p>

by address resolution protocol (ARP).<o:p></o:p>

//显示和修改由地址解析<nobr onmousemove="kwM(0);" onmouseout="kwL(event, this);" onmouseover="kwE(event,0, this);" oncontextmenu="return false;" target="_blank" onclick="return kwC();" style="border-bottom: 1px dotted rgb(102, 0, 255); text-decoration: underline; color: rgb(102, 0, 255); background-color: transparent;" id="key0">协议</nobr>使用的IP物理地址表<o:p></o:p>

<o:p> </o:p>

ARP -s inet_addr eth_addr [if_addr]<o:p></o:p>

ARP -d inet_addr [if_addr]<o:p></o:p>

ARP -a [inet_addr] [-N if_addr]<o:p></o:p>

<o:p> </o:p>

  -a            Displays current ARP entries by interrogating the current<o:p></o:p>

                protocol data.  If inet_addr is specified, the IP and Physical<o:p></o:p>

                addresses for only the specified computer are displayed. If<o:p></o:p>

                more than one network interface uses ARP, entries for each <o:p></o:p>

ARP table are displayed.<o:p></o:p>

//显示询问当前协议数据的ARP当前入口,如果指定了//inet_addr,则只显示指定计算机的IP地址和物理地址;如//果有不只一个网卡<nobr onmousemove="kwM(3);" onmouseout="kwL(event, this);" onmouseover="kwE(event,3, this);" oncontextmenu="return false;" target="_blank" onclick="return kwC();" style="border-bottom: 1px dotted rgb(102, 0, 255); text-decoration: underline; color: rgb(102, 0, 255); background-color: transparent;" id="key3">使用</nobr>ARP,则显示每一个网卡的ARP//表。<o:p></o:p>

<o:p> </o:p>

  -g         Same as -a. //类似于-a<o:p></o:p>

<o:p> </o:p>

  inet_addr   Specifies an internet address.<o:p></o:p>

             //指定一个Internet<nobr onmousemove="kwM(4);" onmouseout="kwL(event, this);" onmouseover="kwE(event,4, this);" oncontextmenu="return false;" target="_blank" onclick="return kwC();" style="border-bottom: 1px dotted rgb(102, 0, 255); text-decoration: underline; color: rgb(102, 0, 255); background-color: transparent;" id="key4">地址</nobr><o:p></o:p>

<o:p> </o:p>

  -N if_addr   Displays the ARP entries for the network interface specified<o:p></o:p>

             by if_addr.<o:p></o:p>

             //显示由if_addr指定的网卡的ARP入口<o:p></o:p>

<o:p> </o:p>

  -d         Deletes the host specified by inet_addr. inet_addr may be<o:p></o:p>

             wildcarded with * to delete all hosts.<o:p></o:p>

             //删除由inet_addr指定的主机,如果inet_addr是通配符*,则删<o:p></o:p>

//除所有主机<o:p></o:p>

<o:p> </o:p>

  -s         Adds the host and associates the Internet address inet_addr<o:p></o:p>

             with the Physical address eth_addr.  The Physical address <o:p></o:p>

is given as 6 hexadecimal bytes separated by hyphens. The <o:p></o:p>

entry is permanent.<o:p></o:p>

//增加主机,并把Internet地址inet_addr和<nobr onmousemove="kwM(5);" onmouseout="kwL(event, this);" onmouseover="kwE(event,5, this);" oncontextmenu="return false;" target="_blank" onclick="return kwC();" style="border-bottom: 1px dotted rgb(102, 0, 255); text-decoration: underline; color: rgb(102, 0, 255); background-color: transparent;" id="key5">物理</nobr>地址eth_addr<o:p></o:p>

//进行关联,物理地址是6个以连字符号“-”隔开的16进制<o:p></o:p>

//位,这个入口是永久的<o:p></o:p>

<o:p> </o:p>

  eth_addr    Specifies a physical address.<o:p></o:p>

             //指定物理地址<o:p></o:p>

<o:p> </o:p>

  if_addr      If present, this specifies the Internet address of the<o:p></o:p>

              interface whose address translation table should be modified.<o:p></o:p>

              If not present, the first applicable interface will be used.<o:p></o:p>

              //如果出现,则代表网卡的Internet地址,该地址的地址转换表<o:p></o:p>

              //将要修改。如果不出现,则使用第一个可用的<nobr onmousemove="kwM(2);" onmouseout="kwL(event, this);" onmouseover="kwE(event,2, this);" oncontextmenu="return false;" target="_blank" onclick="return kwC();" style="border-bottom: 1px dotted rgb(102, 0, 255); text-decoration: underline; color: rgb(102, 0, 255); background-color: transparent;" id="key2">接口</nobr><o:p></o:p>

Example:<o:p></o:p>

  > arp -s 157.55.85.212   00-aa-00-62-c6-09  .... Adds a static entry.<o:p></o:p>

                                           //增加一个静态入口<o:p></o:p>

<o:p> </o:p>

  > arp -a                                .... Displays the arp table.<o:p></o:p>

                                          //显示ARP

 

分享到:
评论

相关推荐

    TCP/IP协议详解-卷1-协议

    《TCP/IP协议详解-卷1-协议》是网络通信领域的一本权威著作,它深入浅出地阐述了TCP/IP协议族的基本概念、原理和实现。这本书对于理解互联网背后的工作机制至关重要,无论是网络工程师、程序员还是对网络技术感兴趣...

    详细解析tcp ip协议.pdf

    TCP/IP协议族采用了分层的设计方法,一般将其划分为四个层次:应用层、传输层、网络层和数据链路层(有时还包括物理层,但TCP/IP协议本身并未直接定义物理层)。 - **应用层**:提供了一系列的应用程序接口(API),...

    TCP-IP详解卷一:协议_TCP-IP详解_TCP/IP_tcp/ip详解_

    《TCP-IP详解卷一:协议》是网络通信领域的一本经典著作,深入解析了TCP/IP协议族的核心概念和技术。TCP/IP(Transmission Control Protocol/Internet Protocol)是互联网的基础,它定义了电子设备如何互相连接并...

    TCP/IP详解论文

    1. TCP/IP协议的定义 TCP/IP协议是供已连接因特网的计算机进行通信的通信协议。TCP/IP指传输控制协议/网际协议(Transmission Control Protocol/Internet Protocol)。TCP/IP定义了电子设备(比如计算机)如何连入...

    TCP-IP协议族(第4版)中文高清带标签目录.PDF

    1. **引言**:这部分首先引入了TCP/IP协议族的重要性,阐述了互联网的基础及其发展背景。它解释了TCP/IP协议如何在全球范围内连接各种不同的计算机网络,形成一个庞大的信息交换系统。 2. **OSI模型**:开放系统...

    TCP/IP协议培训教程

    #### 二、TCP/IP协议分层结构 - **四层模型**:TCP/IP模型通常被划分为四个层次,每个层次负责不同的功能。 - **链路层**(Data Link Layer):处理与物理介质的交互,包括设备驱动程序和网络接口卡,确保数据在...

    TCP/IP协议栈的设计与实现

    TCP/IP协议族以分层方式设计,每一层负责解决通信问题的一部分。LwIP遵循这种分层设计理念,但同时为了提高性能,允许一定程度的跨层交互。在传统的TCP/IP实现中,底层协议族作为操作系统内核的一部分实现,而应用层...

    TCP/IP协议详细介绍

    在这篇文章中,我们将详细介绍TCP/IP协议的核心内容,包括计算机网络体系结构的分层、传输层中的TCP和UDP协议、网络层中的IP协议以及IP协议相关技术。 首先,我们来看一下计算机网络体系结构。一般而言,计算机网络...

    《TCP/IP:协议分析与应用编程》课后题答案

    以上总结了《TCP/IP:协议分析与应用编程》课程中的核心知识点,涵盖了协议分层的优势、网络协议的基本要素、OSI参考模型与TCP/IP模型的关系、TCP/IP的数据传输流程、网络层的功能、客户机/服务器模式、IP地址的引入...

    TCP/IP协议分析

    TCP/IP分层,每层的协议,数据进入协议栈整合,接受数据的解析过程等图解。

    TCP/IP协议栈设计文档

    - **协议栈分层**:参照TCP/IP参考模型,Microchip TCP/IP协议栈同样被划分为多个层次,包括应用层、传输层、网络层和链路层。 - **应用层**:提供高级应用程序接口,支持HTTP服务器等应用。 - **传输层**:主要...

    TCP/IP协议详细介绍.docx

    TCP/IP 协议采用的分层模型与 OSI 参考模型类似,但有一些区别。OSI 参考模型注重“通信协议必要的功能是什么”,而 TCP/IP 则更强调“在计算机上实现协议应该开发哪种程序”。 二、 TCP/IP 基础 TCP/IP 协议的...

    tcp/ip协议族

    本篇旨在深入解析TCP/IP协议族的关键概念、分层模型以及各层的功能,同时通过具体示例阐述数据传输过程,最后介绍SnifferPro软件的基本使用方法。 #### 分层思想的重要性 网络通信的复杂性要求一种系统性的方法来...

    TCP/IP协议详解卷一

    - “模型”可能指的是TCP/IP协议栈的分层模型,这种模型有助于理解不同层之间的交互与数据流动的过程。 - “层”的概念则表明文档会详细探讨每一层的具体功能,如应用层负责处理用户数据的格式化、编码及错误检测...

    s7600 TCP-IP协议栈.rar_c++ 实现tcp/ip_tcp/ip协议栈

    首先,TCP/IP协议栈包括四层(按照传统分层模型):应用层、传输层、网络层和数据链路层。每一层都有其特定的任务和协议: 1. **应用层**:这是最顶层,包含如HTTP、FTP、DNS等具体的应用协议,它们处理用户直接...

    Tcp/Ip三卷合集

    作为网络专业人士,了解和深入TCP/IP协议是极为重要的,Stevens的作品通过详实的叙述、深入的分析和丰富的实例,向读者展示了一个庞大而复杂的网络世界。 在《TCP/IP详解卷一:协议》中,Stevens从最基础的网络概念...

    计算机网络体系结构与tcp/ip协议

    TCP/IP协议族的分层设计使得网络通信的实现更加模块化和灵活。通过各层之间的接口,上层可以调用下层的服务,而无需关心底层的实现细节。例如,应用层的HTTP协议只需要知道如何通过TCP连接发送和接收数据,而无需...

    tcp/ip协议 第一卷

    ### TCP/IP协议详解 #### 一、概述 TCP/IP(Transmission Control Protocol/Internet Protocol),即传输控制协议/因特网互联协议,是互联网最基础且核心的协议之一。该协议集定义了数据在网络中的传输方式及其...

Global site tag (gtag.js) - Google Analytics