Monday, November 21, 2011

TCP/IP

Introduction

Most users of the internet see it only as a series of web pages, one intertwined with the next. However few realize the complex structure which lies beneath the web. Despite being a vast network of interconnected sub networks subsequently comprising of miles of wires and millions of switches, routers and servers, there lies hundreds of internationally recognized standards. This framework of standards allows computers and networks to communicate seamlessly with one another and across great distances with reliability. The Internet Protocol Suite, a group of standards created in the 1980s is the foundation for other web standards. It serves as the juncture point for technologies of different levels to communicate.


OSI Model

To understand the basic framework for all computer networking regardless of scope (Internet vs. Local Area Network) requires an understanding of the Open Systems Interconnection model described by the International Organization for Standardization.
The chart above describes a correspondence between two hosts, or computers across a network. Data transferred between hosts travel through different layers, some theoretical, some software, others in pure hardware. A request through this system proceeds down the stack of the sender, across to the receiver, then up the receiver stack until it reaches its destination layer. The dashed arrows in the diagram show that higher layers can talk to one another, but only if they traverse through lower layers in the stack. For example, if the transport layer of host 1 wishes to communicate to host 2 it must first communicate to the adjacent network layer, which subsequently communicates to the adjacent data link layer, through the adjacent physical layers and so-on.

Layers can only communicate with ones it is adjacent to (through an interface). A common example illustrating this concept could be a web browser on your computer. Web browsers operate regardless of the network interface card you have installed on your computer. Since a web browser communicates through other layers which interface with the network card, it does not need to have an understanding of every type of network interface (which exist in the link and physical layers) but only layers with which it directly interacts. This same concept exists with the Internet Protocol Suite. Software for TCP / IP has been developed for almost every computer platform that exists. However, it contains the same basic framework that allows all computers to communicate with one another. Here are short descriptions on how each layer contributes to the OSI Model:

Physical Layer: This layer describes the actual physical hardware that devices use to interconnect. Standards of voltage, bits and cable types are defined here.

Data Link Layer: This layer groups bits together into what are commonly called frames. These frames contain arbitrary data provided by higher levels in the hierarchy. The Data Link Layer provides mechanisms to prevent transmission errors and implement flow control.

Network Layer: The Network Layer provides a routing standard for networks to communicate with one another. This is where the Internet Protocol (the core protocol in the Internet Protocol Suite) resides in the OSI Model. The network layer is present in high-level networking devices such as hosts and routers, but not in others such as basic switches and networking hubs.

Transport Layer: This layer is in charge of making sure data from higher layers are transferred, not only without error, but will guarantee retransmission upon failure. Protocols in this layer such as the Transmission Control Protocol (TCP) and the User Datagram Protocol (UDP) send data packets and wait for a response from the remote host. Some protocols are sophisticated enough to resend lost packets and correct certain errors with little or no delay.

Session and Presentation Layers: The session layer allows higher layers to create a seamless transfer of data between hosts when a larger view of data transport is necessary. The presentation layer is used to translate machine-independent data received into machine-dependent data for the application layer to interpret. This could be due to differences in character encoding, the decryption of encrypted data or the decompression of compressed data.

Application Layer: This is the layer which most users directly interact with. Machine-dependent applications run at this layer which presents the network to the end user. In a common example on the World Wide Web, the client uses a web browser to send a request to a server. The web browser on the client machine runs in the application layer. The corresponding application on the server side is a web server running software to decode the WWW request and send a response.

Internet Protocol Suite

While these layers may seem to provide a great framework for network communication, they are useless without hardware and software. For the purpose of explaining the Internet Protocol (IP) suite, the layers will be combined into four simple groups as shown in the illustration below:

The IP Suite is comprised of software and hardware applications that run in the Application, Transport, Internet and Link layers. The majority of software for the IP Suite resides in the top three layers and will therefore be the focus of this post. As you may have guessed, the Internet Protocol exists in the Internet Layer. This is the protocol with which all data communicating over a network must traverse. It describes basic intercommunication between hosts including the definition of Internet Protocol addresses and subnets (the grouping of addresses together). The figure below illustrates the flow of data through the Internet Protocol:

Internet Protocol

The Internet Protocol (IP) was developed in 1974 by Vint Cerf and Bob Kahn and described in a paper titled “A Protocol for Packet Network Interaction”. At the time ARPANET, a predecessor to the modern-day Internet was in use and utilized a packet switched network. While ARPANET had only a handful of hosts participating in the network, the Internet Protocol allowed for seemingly infinite hosts which all could reside on the same network and described by different addresses. The most popular version of the Internet Protocol is IPv4. This version uses 32bit addressing commonly displayed in for octets of 8 bits each separated by dots (e.g. 192.168.1.0). In the past ten years the space of available addresses on the Internet has been becoming smaller thereby reducing the number of uniquely identifiable hosts that could be on the internet. IPv6, a new standard for the Internet Protocol is slowly being phased in. This version institutes a 128 bit addressing standard. Instead of the 4.29 x 10^9 addresses available in IPv4, there are 3.4 x 10^38 addresses available in the IPv6 standard. This increase in addresses not only allows for more unique hosts on the internet but also can increase traffic flow due to more efficient routing plans and the elimination of Network Address Translation (NAT) which had been previously implemented to expand the IPv4 space as much as possible. Below is a diagram explaining the various bits contained within each IP header attached to every data packet that flows through the IP layer:
Transmission Control Protocol

The Transmission Control Protocol (TCP) was created in conjunction with IP (thereby being referred to as TCP/IP). TCP is one of the protocols that live in the Transport Layer of both the OSI Model and the Internet Protocol Suite model. TCP is considered a “reliable protocol” which means that its purpose is to verify the receipt of data from host to host. When TCP sends data over IP it waits for an acknowledgement from the remote server. If one is not received it retransmits the data. This can be compared to the User Datagram Protocol (UDP), another core module of the IP Suite, in which no reliability is implemented. Below is a sample transmission of TCP in which a handshake is used to initiate a session:

In TCP data is sent with the expectation of an acknowledgement (ACK) being sent in return, potentially with other data. Duplex (two-way) conversations can happen simultaneously over one TCP session by sending ACKs in the same packet as other data. Many popular services that are used every day rely on TCP. Web browsing, email and the transfer of files over FTP use TCP.

TCP vs. UDP

The main difference between protocols such as TCP and UDP rely in the idea that TCP is a reliable protocol which institutes some delay (especially if there is packet loss) whereas UDP is an unreliable protocol which is simpler and faster. Each serves a specific purpose and the improper use of one or the other could prove catastrophic. Say, for example, you wished to transfer a file from a server to your local machine. If the transfer software utilized UDP, the unreliable protocol, any packets that were lost in the transfer due to network congestion or hardware issues would be lost and not part of your final download. These pieces would be lost and therefore you would not have a complete file. The server would not retransmit these lost packets because UDP does not listen for ACKs. TCP would be the more appropriate choice in this scenario.

On the contrary say you were streaming video and the network was relatively congested. UDP would be the more appropriate choice here because a few lost packets would not detract much from the overall video. You are more concerned with speed and update rate. Any lost data will be already in the past and unnecessary.

Conclusion

The Internet has grown much over the past 20 years. Much of that growth can be attributed to the development of standards such as TCP/IP. The creation of this framework has allowed for an internet that is unbounded by platform or proprietary technology. Although many people, myself included, may sometimes view the internet as what is presented by the World Wide Web, it is important to remember the complicated framework that lies beneath and permits the communication with which we sometimes take for granted.

Works Cited
Barr, Michael. "TCP/IP and UDP/IP for Embedded Systems | Embedded Systems Experts." Embedded Systems Experts. Netrino LLC, 12 Mar. 2007. Web. 22 Nov. 2011. http://www.netrino.com/Embedded-Systems/How-To/Embedded-TCP-IP.
"Defenses Against TCP SYN Flooding Attacks." The Internet Protocol Journal 9.4. Cisco Systems, Inc. Cisco Systems. Web. 22 Nov. 2011. http://www.cisco.com/web/about/ac123/ac147/archived_issues/ipj_9-4/syn_flooding_attacks.html.
Jessup, Troy. "Network Protocol Headers." Troy Jessup - Network Security Professional. Troy Jessup, Aug. 2010. Web. 22 Nov. 2011. http://www.troyjessup.com/headers/.
Leon-Garcia, Alberto, and Indra Widjaja. Communication Networks: Fundamental Concepts and Key Architectures. 2nd ed. New York: McGraw-Hill, 2004. Print.
"Open Systems Interconnection Reference Model." Hill2dot0. 21 Oct. 2008. Web. 22 Nov. 2011. http://wiki.hill.com/wiki/index.php?title=OSI_reference_model.
Steenkiste, Peter. "Layered Architecture." 18-345: Introduction to Telecommunication Networks. Pittsburgh. Spring 2011. Lecture.

No comments:

Post a Comment