An early architectural document, RFC 1122, emphasizes architectural principles over layering.<ref>[ftp://ftp.rfc-editor.org/in-notes/rfc1958.txt Architectural Principles of the Internet], RFC 1958, B. Carpenter, June 1996</ref>
* [[End-to-end principle|End-to-End Principle]]: This principle has evolved over time. Its original expression put the maintenance of state and overall intelligence at the edges, and assumed the Internet that connected the edges retained no state and concentrated on speed and simplicity. Real-world needs for firewalls, network address translators, web content caches and the like have forced changes in this principle.<ref>[http://www.csd.uoc.gr/~hy558/papers/Rethinking_2001.pdf Rethinking the design of the Internet: The end to end arguments vs. the brave new world], Marjory S. Blumenthal, David D. Clark, August 2001</ref>
* [[Robustness Principle]]: "In general, an implementation must be conservative in its sending behavior, and liberal in its receiving behavior. That is, it must be careful to send well-formed datagrams, but must accept any datagram that it can interpret (e.g., not object to technical errors where the meaning is still clear)." <ref>[http://www.ietf.org/rfc/rfc0791.txt?number=791 p.23 INTERNET PROTOCOL DARPA INTERNET PROGRAM PROTOCOL SPECIFICATION September 1981 Jon Postel Editor]</ref> "The second part of the principle is almost as important: software on other hosts may contain deficiencies that make it unwise to exploit legal but obscure protocol features." <ref>[http://tools.ietf.org/html/rfc1122#page-12 Requirements for Internet Hosts -- Communication Layerslayers p.13 October 1989 R. Braden, Editor]</ref>
Even when the layers are examined, the assorted architectural documents—there is no single architectural model such as ISO 7498, the OSI reference model—have fewer and less rigidly-defined layers than the OSI model, and thus provide an easier fit for real-world protocols. In point of fact, one frequently referenced document, RFC 1958, does not contain a stack of layers. The lack of emphasis on layering is a strong difference between the IETF and OSI approaches. It only refers to the existence of the "internetworking layer" and generally to "upper layers"; this document was intended as a 1996 "snapshot" of the architecture: "The Internet and its architecture have grown in evolutionary fashion from modest beginnings, rather than from a Grand Plan. While this process of evolution is one of the main reasons for the technology's success, it nevertheless seems useful to record a snapshot of the current principles of the Internet architecture."
RFC 1122, entitled ''Host Requirements'', is structured in paragraphs referring to layers, but the document refers to many other architectural principles not emphasizing layering. It loosely defines a four-layer model, with the layers having names, not numbers, as follows:
*Application Layerlayer (process-to-process): This is the scope within which applications create user data and communicate this data to other processes or applications on another or the same host. The communications partners are often called ''peers''. This is where the "higher level" protocols such as [[SMTP]], [[File Transfer Protocol|FTP]], [[Secure Shell|SSH]], [[HTTP]], etc. operate.
*Transport Layerlayer (host-to-host): The Transporttransport Layerlayer constitutes the networking regime between two network hosts, either on the local network or on remote networks separated by routers. The Transporttransport Layerlayer provides a uniform networking interface that hides the actual topology (layout) of the underlying network connections. This is where flow-control, error-correction, and connection protocols exist, such as [[Transmission Control Protocol|TCP]]. This layer deals with opening and maintaining connections between Internet hosts.
*Internet Layerlayer (internetworking): The Internetinternet Layerlayer has the task of exchanging datagrams across network boundaries. It is therefore also referred to as the layer that establishes internetworking, indeed, it defines and establishes the [[Internet]]. This layer defines the addressing and routing structures used for the TCP/IP protocol suite. The primary protocol in this scope is the [[Internet Protocol]], which defines [[IP address]]es. Its function in routing is to transport datagrams to the next IP router that has the connectivity to a network closer to the final data destination.
*Link Layerlayer: This layer defines the networking methods within the scope of the local network link on which hosts communicate without intervening routers. This layer describes the protocols used to describe the local network topology and the interfaces needed to affect transmission of Internet Layerlayer datagrams to next-neighbor hosts. (cf. the OSI Datadata Linklink Layerlayer).
The [[Internet Protocol Suite]] and the layered [[protocol stack]] design were in use before the [[OSI model]] was established. Since then, the TCP/IP model has been compared with the OSI model in books and classrooms, which often results in confusion because the two models use different assumptions, including about the relative importance of strict layering.
This model lacks the formalism of the OSI reference model and associated documents, but the IETF does not use a formal model and does not consider this a limitation, as in the comment by [[David D. Clark]], "We reject: kings, presidents and voting. We believe in: rough consensus and running code." Criticisms of this model, which have been made with respect to the OSI Reference Model, often do not consider ISO's later extensions to that model.
# For multiaccess links with their own addressing systems (e.g. Ethernet) an address mapping protocol is needed. Such protocols can be considered to be below IP but above the existing link system. While the IETF does not use the terminology, this is a subnetwork dependent convergence facility according to an extension to the OSI model, the Internalinternal Organizationorganization of the Networknetwork Layerlayer (IONL).<ref>[http://www.iso.org/iso/en/CatalogueDetailPage.CatalogueDetail?CSNUMBER=16011 Internal Organization of the Network Layerlayer], ISO 8648</ref>
# ICMP & IGMP operate on top of IP but do not transport data like UDP or TCP. Again, this functionality exists as layer management extensions to the OSI model, in its ''Management Framework'' (OSIRM MF) <ref>[http://www.iso.org/iso/en/CatalogueDetailPage.CatalogueDetail?CSNUMBER=14258&ICS1=35&ICS2=100&ICS3=70 Open Systems Interconnection -- Basic Reference Model -- Part 4: Management framework], ISO 7498/4</ref>
# The SSL/TLS library operates above the transport layer (uses TCP) but below application protocols. Again, there was no intention, on the part of the designers of these protocols, to comply with OSI architecture.
The following is a description of each layer in the TCP/IP networking model starting from the lowest level.
===Link Layerlayer===
The [[Linklink Layerlayer]] is the networking scope of the local network connection to which a host is attached. This regime is called the ''link'' in Internet literature. This is the lowest component layer of the Internet protocols, as TCP/IP is designed to be hardware independent. As a result TCP/IP is able to be implemented on top of virtually any hardware networking technology.
The Linklink Layerlayer is used to move packets between the Internet Layerlayer interfaces of two different hosts on the same link. The processes of transmitting and receiving packets on a given link can be controlled both in the [[software]] [[device driver]] for the [[network card]], as well as on [[firmware]] or specialized [[chipsets]]. These will perform [[Data Linklink Layerlayer|data link]] functions such as adding a [[packet header]] to prepare it for transmission, then actually transmit the frame over a [[Physical Layerlayer|physical]] [[transmission medium|medium]]. The TCP/IP model includes specifications of translating the network addressing methods used in the Internet Protocol to data link addressing, such as [[Media Access Control]] (MAC), however all other aspects below that level are implicitly assumed to exist in the Linklink Layerlayer, but are not explicitly defined.
This is also the layer where packets may be selected to be sent over a [[virtual private network]] or other [[tunneling protocol|networking tunnel]]. In this scenario, the Linklink Layerlayer data may be considered application data which traverses another instantiation of the IP stack for transmission or reception over another IP connection. Such a connection, or virtual link, may be established with a transport protocol or even an application scope protocol that serves as a [[tunneling protocol|tunnel]] in the Linklink Layerlayer of the protocol stack. Thus, the TCP/IP model does not dictate a strict hierarchical encapsulation sequence.
===Internet Layerlayer===
The [[Internetinternet Layerlayer]] has the responsibility of sending packets across potentially multiple networks. [[Internetworking]] requires sending data from the source [[computer network|network]] to the destination network. This process is called [[routing]].<ref>[http://www.comsci.us/datacom/ippacket.html IP Packet Structure]</ref>
In the Internet Protocol Suite, the Internet Protocol performs two basic functions:
Some of the protocols carried by IP, such as ICMP (used to transmit diagnostic information about IP transmission) and IGMP (used to manage [[IP Multicast]] data) are layered on top of IP but perform internetworking functions. This illustrates the differences in the architecture of the TCP/IP stack of the Internet and the OSI model.
===Transport Layerlayer===
The responsibility of the [[Transporttransport Layerlayer]] includes end-to-end message transfer independent of the underlying network, along with error control, segmentation, flow control, congestion control, and application addressing (port numbers). End to end message transmission or connecting applications at the transport layer can be categorized as either [[connection-oriented]], implemented in [[Transmission Control Protocol]] (TCP),
or [[connectionless]], implemented in [[User Datagram Protocol]] (UDP).
The Transporttransport Layerlayer can be thought of as a transport mechanism, e.g., a vehicle with the responsibility to make sure that its contents (passengers/goods) reach their destination safely and soundly, unless another protocol layer is responsible for safe delivery.
The Transporttransport Layerlayer provides this service of connecting applications through the use of [[TCP and UDP port|service ports]]. Since IP provides only a [[best effort delivery]], the Transporttransport Layerlayer is the first layer of the TCP/IP stack to offer reliability. IP can run over a reliable data link protocol such as the [[High-Level Data Link Control]] (HDLC). Protocols above transport, such as RPC, also can provide reliability.
For example, the Transmission Control Protocol (TCP) is a connection-oriented protocol that addresses numerous reliability issues to provide a [[reliable byte stream]]:
The applications at any given network address are distinguished by their TCP or UDP [[TCP and UDP port|port]]. By convention certain ''well known ports'' are associated with specific applications. (''See [[List of TCP and UDP port numbers]].'')
===Application Layerlayer===
The [[Applicationapplication Layerlayer]] contains the higher-level protocols used by most applications for network communication. Examples of application layer protocols include the [[File Transfer Protocol]] (FTP) and the [[Simple Mail Transfer Protocol]] (SMTP).<ref>[http://www.kohala.com/start/tcpipiv1.html ''TCP/IP Illustrated: the protocols''], ISBN 0-201-63346-9, W. Richard Stevens, February 1994</ref> Data coded according to application layer protocols are then [[encapsulation (networking)|encapsulated]] into one or (occasionally) more transport layer protocols (such as the [[Transmission Control Protocol]] (TCP) or [[User Datagram Protocol]] (UDP)), which in turn use [[lower layer protocol]]s to effect actual data transfer.
Since the IP stack defines no layers between the application and transport layers, the application layer must include any protocols that act like the OSI's presentation and session layer protocols. This is usually done through [[Library (computer science)|libraries]].
Application Layerlayer protocols generally treat the Transporttransport Layerlayer (and lower) protocols as [[Black Box|black boxesbox]]es which provide a stable network connection across which to communicate, although the applications are usually aware of key qualities of the transport layer connection such as the [[Transport Layerlayer|end point]] [[IP Address|IP addresses]] and [[port number]]s. As noted above, layers are not necessarily clearly defined in the Internet protocol suite. Application layer protocols are most often associated with [[client–server]] applications, and the commoner [[server (computing)|servers]] have specific [[TCP and UDP port|ports]] assigned to them by the [[Internet Assigned Numbers Authority|IANA]]: [[HyperText Transfer Protocol|HTTP]] has port 80; [[Telnet]] has port 23; etc. [[client (computing)|Clients]], on the other hand, tend to use [[ephemeral port]]s, i.e. port numbers assigned at random from a range set aside for the purpose.
Transport and lower level layers are largely unconcerned with the specifics of application layer protocols. [[Router (computing)|Router]]s and [[network switch|switches]] do not typically "look inside" the encapsulated traffic to see what kind of application protocol it represents, rather they just provide a conduit for it. However, some [[Firewall (computing)|firewall]] and [[bandwidth throttling]] applications do try to determine what's inside, as with the [[Resource Reservation Protocol]] (RSVP). It's also sometimes necessary for [[Network Address Translation]] (NAT) facilities to take account of the needs of particular application layer protocols. (NAT allows hosts on private networks to communicate with the outside world via a single visible IP address using [[port forwarding]], and is an almost ubiquitous feature of modern domestic [[broadband router]]s).
==Hardware and software implementation==
Normally, application programmers are concerned only with interfaces in the Applicationapplication Layerlayer and often also in the Transporttransport Layerlayer, while the layers below are services provided by the TCP/IP stack in the operating system. Microcontroller firmware in the network adapter typically handles link issues, supported by driver software in the operational system. Non-programmable analog and digital electronics are normally in charge of the physical components below the Linklink Layerlayer, typically using an [[application-specific integrated circuit]] (ASIC) chipset for each network interface or other physical standard.
However, hardware or software implementation is not stated in the protocols or the layered model. High-performance routers are to a large extent based on fast non-programmable digital electronics, carrying out link level switching.
==OSI and TCP/IP layering differences==
The three top layers in the OSI model—the [[Applicationapplication Layerlayer]], the [[Presentationpresentation Layerlayer]] and the [[Sessionsession Layerlayer]]—are not distinguished separately in the TCP/IP model where it is just the Application Layerlayer. While some pure OSI protocol applications, such as [[X.400]], also combined them, there is no requirement that a TCP/IP protocol stack must impose monolithic architecture above the Transporttransport Layerlayer. For example, the [[Network File System]] (NFS) application protocol runs over the [[External Data Representation|eXternal Data Representation]] (XDR) presentation protocol, which, in turn, runs over a protocol called [[Remote Procedure Call]] (RPC). RPC provides reliable record transmission, so it can run safely over the best-effort [[User Datagram Protocol]] (UDP) transport.
The Sessionsession Layerlayer roughly corresponds to the Telnet [[virtual terminal]] functionality{{Citation needed|date=June 2009}}, which is part of text based protocols such as the [[HTTP]] and [[SMTP]] TCP/IP model Applicationapplication Layerlayer protocols. It also corresponds to TCP and UDP port numbering, which is considered as part of the transport layer in the TCP/IP model. Some functions that would have been performed by an OSI presentation layer are realized at the Internet application layer using the [[MIME]] standard, which is used in application layer protocols such as [[HTTP]] and [[SMTP]].
The IETF protocol development effort is not concerned with strict layering, and some of its protocols may not fit cleanly into the OSI model. These conflicts, however, are apparent also in the original OSI model, ISO 7498, when not considering the annexes to this model (e.g., ISO 7498/4 Management Framework), or the ISO 8648 Internal Organization of the Network Layerlayer (IONL). When the IONL and Management Framework documents are considered, the [[Internet Control Message Protocol|ICMP]] and [[Internet Group Management Protocol|IGMP]] are neatly defined as layer management protocols for the network layer. In like manner, the IONL provides a structure for "subnetwork dependent convergence facilities" such as [[Address Resolution Protocol|ARP]] and [[Reverse Address Resolution Protocol|RARP]].
IETF protocols can be encapsulated recursively, as demonstrated by tunneling protocols such as [[Generic Routing Encapsulation]] (GRE). While basic OSI documents do not consider tunneling, there is some concept of tunneling in yet another extension to the OSI architecture, specifically the transport layer gateways within the International Standardized Profile framework.<ref>[http://www.iso.org/iso/en/CatalogueDetailPage.CatalogueDetail?CSNUMBER=30726 Framework and taxonomy of International Standardized Profiles], ISO 10000, October 1998</ref> The associated OSI development effort, however, has been abandoned given the overwhelming adoption of TCP/IP protocols.
These textbooks are secondary sources that may contravene the intent of RFC 1122 and other IETF primary sources such as RFC 3439.<ref name=R3439 />
Different authors have interpreted the RFCs differently regarding the question whether the Linklink Layerlayer (and the TCP/IP model) covers [[Physical Layerlayer]] issues, or whether the hardware layer is outside the scope of TCP/IP. Some authors have tried to use other names for the Linklink Layerlayer, such as ''network interface layer'', in an effort to avoid confusion with the [[Datadata Linklink Layerlayer]] of the seven-layer [[OSI model]]. Others have attempted to map the Internet Protocol model onto the OSI Model. The mapping sometimes results in a hybrid model with five layers where the Linklink Layerlayer is split into a Datadata Linklink Layerlayer on top of a physical layer. In literature with a bottom-up approach to Internet communication,<ref name=Forouzan/><ref name=Comer/><ref name=Stallings/> in which hardware issues are emphasized, those are often discussed in terms of the OSI model.
The Internetinternet Layerlayer is usually directly mapped into the OSI Model's [[Networknetwork Layerlayer]], a more general concept of network functionality. The Transporttransport Layerlayer of the TCP/IP model, which may be described as a host-to-host layer, is mapped to OSI Layerlayer 4 (Transporttransport Layerlayer), sometimes also including aspects of OSI Layerlayer 5 ([[Sessionsession Layerlayer]]) functionality. OSI's [[Applicationapplication Layerlayer]], [[Presentationpresentation Layerlayer]], and the remaining functionality of the Sessionsession Layerlayer are collapsed into TCP/IP's Applicationapplication Layerlayer. The argument is that these OSI layers do usually not exist as separate processes and protocols in Internet applications.{{Citation needed|date=April 2009}}
However, the Internet protocol stack has never been altered by the Internet Engineering Task Force from the four layers defined in RFC 1122. The IETF makes no effort to follow the OSI model although RFCs sometimes refer to it and often use the OSI layer numbers. The IETF has repeatedly stated{{Citation needed|date=April 2009}} that Internet protocol and architecture development is not intended to be OSI-compliant. RFC 3439, addressing Internet architecture, contains a section entitled: "Layering Considered Harmful".<ref name=R3439>{{citation
|