LayersintheTCP/IPModelTCP/IP模型中的分层Thelayersnearthetoparelogicallyclosertotheuserapplication,whilethosenearthebottomarelogicallyclosertothephysicaltransmissionofthedata.Viewinglayersasprovidingorconsumingaserviceisamethodofabstractiontoisolateupperlayerprotocolsfromthedetailoftransmittingbitsover,forexample,Ethernetandcollisiondetection,whilethelowerlayersavoidhavingtoknowthedetailsofeachandeveryapplicationanditsprotocol.在逻辑上,接近于顶部的层次对用户更加亲和,而接近于底部的层次对于数据的物理传输更加亲和。有一种方法是将层次视为可以提供并使用服务的,这样就可以抽象地隔离传输比特细节的上层协议,例如,以太网与碰撞检测,此时低分层不必须了解任何设备及其协议。Thisabstractionalsoallowsupperlayerstoprovideservicesthatthelowerlayerscannot,orchoosenotto,provide.Again,theoriginalOSIReferenceModelwasextendedtoincludeconnectionlessservices.Forexample,IPisnotdesignedtobereliableandisabesteffortdeliveryprotocol.Thismeansthatalltransportlayerimplementationsmustchoosewhetherornottoprovidereliabilityandtowhatdegree.UDPprovidesdataintegrity(viaachecksum)butdoesnotguaranteedelivery;TCPprovidesbothdataintegrityanddeliveryguarantee(byretransmittinguntilthereceiveracknowledgesthereceptionofthepacket).此抽象概念也允许上层提供服务,然而低层不可提供服务,或选择型不可提供服务。此外,原始的OSI参照模型可被扩展用于包含非面向连接的服务。例如,IP协议并非设计为可以靠的,但却是一种最有效的传输协议。那意味着所有的传输层的实现必须选择是否拥有可依靠性及可依靠性的级别。UDP协议提供数据的保存(通过校检和),但并不保证传输;TCP供数据的保存,也保证数据的传输(通过中继站的转发,直至接收方承认包的获取时中继站进行转发)。LinkLayer链路层TheLinkLayeristhenetworkingscopeofthelocalnetworkconnectiontowhichahostisattached.ThisregimeiscalledthelinkinInternetliterature.ThisisthelowestcomponentlayeroftheInternetprotocols,asTCP/IPisdesignedtobehardwareindependent.AsaresultTCP/IPhasbeenimplementedontopofvirtuallyanyhardwarenetworkingtechnologyinexistence.链路层是指某个主机所依附的局域网的网络范围。这个制度被称为是网络的连接。这是互联网协议的最低组成部分,例如TCP/IP协议是独立于硬件的。结果就是TCP/IP协议可以在现今几乎所有的硬件网络技术上实现。TheLinkLayerisusedtomovepacketsbetweentheInternetLayerinterfacesoftwodifferenthostsonthesamelink.Theprocessesoftransmittingandreceivingpacketsonagivenlinkcanbecontrolledinthesoftwaredevicedriverforthenetworkcard,aswellasonfirmwareorspecializedchipsets.Thesewillperformdatalinkfunctionssuchasaddingapacketheadertoprepareitfortransmission,andthenactuallytransmittheframeoveraphysicalmedium.TheTCP/IPmodelincludesspecificationsoftranslatingthenetworkaddressingmethodsusedintheInternetProtocoltodatalinkaddressing,suchasMediaAccessControl(MAC),howeverallotheraspectsbelowthatlevelareimplicitlyassumedtoexistintheLinkLayer,butarenotexplicitlydefined.链路层是用来作为在同一链路上的网络层之间移动数据包的接口。在一个给定的链路上,传输、接收包的进程可以控制在安装有网卡的软件设备驱动设备上,也可在固件或专门的芯片组上。这些将执行数据链路的功能,例如,增加一个数据包的头来准备传输,然后实际上地在物理介质上传输帧。TCP/IP模型包括在网络协议中使用的网络寻址方法的规范,例如介质访存控制协议(MAC),然而其他方面的水平都是完全地假定存在于链路层上,然而这些并没有明确的定义。TheLinkLayerisalsothelayerwherepacketsmaybeselectedtobesentoveravirtualprivatenetworkorothernetworkingtunnel.Inthisscenario,theLinkLayerdatamaybeconsideredapplicationdatawhichtraversesanotherinstantiationoftheIPstackfortransmissionorreceptionoveranotherIPconnection.Suchaconnection,orvirtuallink,maybeestablishedwithatransportprotocolorevenanapplicationscopeprotocolthatservesasatunnelintheLinkLayeroftheprotocolstack.Thus,theTCP/IPmodeldoesnotdictateastricthierarchicalencapsulationsequence.链路层也是在虚拟专用网络或其他网络隧道中可以选择发送数据包的层。在这种情况下,链路层的数据可以被认为是通过遍历另一个IP协议栈的实例化来发送或接受来自另一个IP的连接的应用数据。这样的链接,或者虚电路,可以通过一个传送协议或者一个应用范围协议来建立,作为协议栈在链路层中的通道。因此,TCP/IP模型并不能决定一个严格意义上的分层封装序列。InternetLayer网络层TheInternetLayersolvestheproblemofsendingpacketsacrossoneormorenetworks.Internetworkingrequiressendingdatafromthesourcenetworktothedestinationnetwork.Thisprocessiscalledrouting.网络层解决了在一个或多个网络上发送数据包的问题。互联网网络要求从源网络发送数据到目的网络。此进程命名为路径选择。IntheInternetProtocolSuite,theInternetProtocolperformstwobasicfunctions:在互联网协议套件中,网络协议执行两项基本功能:Hostaddressingandidentification:Thisisaccomplishedwithahierarchicaladdressingsystem(seeIPaddress).主机寻址与识别:这是通过一个分层寻址系统来实现的(如IP地址)。Packetrouting:Thisisthebasictaskofgettingpacketsofdata(datagrams)fromsourcetodestinationbysendingthemtothenextnetworknode(router)closertothefinaldestination.数据包路径选择:基本任务是从源网络获得的数据包(数据报),通过发送到下一个网络节点(路由器)更接近最终的目的地的方法,发送到目的网络。IPcancarrydataforanumberofdifferentupperlayerprotocols.Theseprotocolsareeachidentifiedbyauniqueprotocolnumber:forexample,InternetControlMessageProtocol(ICMP)andInternetGroupManagementProtocol(IGMP)areprotocols1and2,respectively.IP可以携带不同数量的上层协议。这些协议分别是由不同的协议号来标识的:例如,控制报文协议(ICMP)和互联网组管理协议(IGMP)分别是1号协议和2号协议。SomeoftheprotocolscarriedbyIP,suchasICMP(usedtotransmitdiagnosticinformationaboutIPtransmission)andIGMP(usedtomanageIPMulticastdata)arelayeredontopofIPbutperforminternetworkingfunctions.ThisillustratesthedifferencesinthearchitectureoftheTCP/IPstackoftheInternetandtheOSImodel.部分协议是由IP携带,例如ICMP(用来传输IP传输的诊断信息)和IGMP(用来管理IP组播数据)在IP数据报的头部,但表现出互联网网络的功能。这说明了在互联网和OSI模型中TCP/IP协议栈的结构差异。TransportLayer传输层TheTransportLayer'sresponsibilitiesincludeend-to-endmessagetransfercapabilitiesindependentoftheunderlyingnetwork,alongwitherrorcontrol,segmentation,flowcontrol,congestioncontrol,andapplicationaddressing(portnumbers).Endtoendmessagetransmissionorconnectingapplicationsatthetransportlayercanbecategorizedaseitherconnection-oriented,implementedinTransmissionControlProt