Get Your Free IT Resume Guide

Networking Basics: TCP, UDP, TCP/IP and OSI Model

The Transmission Control Protocol/Internet Protocol (TCP/IP) suite was created by the U.S. Department of Defense (DoD) to ensure that communications could survive any conditions and that data integrity wouldn’t be compromised under malicious attacks.

The Open Systems Interconnection Basic Reference Model (OSI Model) is an abstract description for network protocol design, developed as an effort to standardize networking.

In this article, I will present the differences between the DoD and the OSI models and then provide details about the DoD’s version of TCP/IP. I will also describe the protocols used at the various layers of the DoD model and provide you with the details of TCP and UDP protocols. Throughout this article you will find useful information concerning the protocol suite of the century: TCP/IP.

So if you’re preparing for your CCENT or CCNA exams, or if you’re just interested in networking, this is one article you don’t want to miss! Fasten your seat belts and have a good ride!

TCP/IP and the OSI Model Comparison

Let’s Start by Comparing TCP/IP and the OSI Models. The TCP/IP model is basically a shorter version of the OSI model. It consists of four instead of seven layers. Despite their architectural differences, both models have interchangeable transport and network layers and their operation is based upon packet-switched technology. The diagram below indicates the differences between the two models:

TCP/IP and OSI Models

  • Application Layer: The Application layer deals with representation, encoding and dialog control issues. All these issues are combined together and form a single layer in the TCP/IP model whereas three distinctive layers are defined in the OSI model.
  • Host-to-Host: Host-to-Host protocol in the TCP/IP model provides more or less the same services with its equivalent Transport protocol in the OSI model. Its responsibilities include application data segmentation, transmission reliability, flow and error control.
  • Internet: Again Internet layer in TCP/IP model provides the same services as the OSIs Network layer. Their purpose is to route packets to their destination independent of the path taken.
  • Network Access: The network access layer deals with all the physical issues concerning data termination on network media. It includes all the concepts of the data link and physical layers of the OSI model for both LAN and WAN media.

The diagram below shows clearly the way TCP/IP protocol suite relates to the TCP/IP model.

TCP/IP Protocol Suite 2

Host-to-Host Layer Protocols

Two protocols: Transmission Control Protocol (TCP) and User Datagram Protocol (UDP) are defined for transmitting datagrams. We will look at the details of both these protocols as well as their interaction with the upper layer.

Transmission Control Protocol (TCP)

TCP is connection-oriented in the sense that prior to transmission end points need to establish a connection first. TCP protocol data units are called segments. The sending and receiving TCP entities exchange data in the form of segments, which consist of a fixed 20-byte header followed by a variable size data field.

TCP is responsible for breaking down a stream of bytes into segments and reconnecting them at the other end, retransmitting whatever might be lost and also organizing the segments in the correct order. The segment size is restricted by the maximum transfer unit (MTU) of the underlying link layer technology (MTU is generally 1500 bytes which is the maximum payload size of the Ethernet).

The image below shows the TCP segment format. The most important fields are explained further on.

TCP Segment Format 3

  • Source Port and Destination Port fields together identify the two local end points of the particular connection. A port plus its hosts’ IP address forms a unique end point. Ports are used to communicate with the upper layer and distinguish different application sessions on the host.
  • The Sequence Number and Acknowledgment Number fields specify bytes in the byte stream. The sequence number is used for segment differentiation and is useful for reordering or retransmitting lost segments. The Acknowledgment number is set to the next segment expected.
  • Data offset or TCP header length indicates how many 4-byte words are contained in the TCP header.
  • The Window field indicates how many bytes can be transmitted before an acknowledgment is received.
  • The Checksum field is used to provide extra reliability and security to the TCP segment.
  • The actual user data are included after the end of the header.

Let’s have a look at how a TCP segment is captured by Ethereal network analyzer. The image below shows a request-response message sequence carried over TCP. Notice the fields discussed above: Source Port, Destination Port, Sequence number, Acknowledgement number, Window size and checksum.

TCP Ethereal 4

User Datagram Protocol (UDP)

UDP protocol consists of fewer fields compared to TCP. The reason for that is because certain data types do not require reliable delivery and extra overhead. Real-time traffic for example, needs to be transported in an efficient way without error correction and retransmission mechanisms.

UDP is considered to be a connectionless protocol. It leaves reliability to be handled by the application layer. All it cares about is fast transmission. The UDP segment format is presented in the diagram below:

UDP Segment Format 5

Let’s see how a UDP segment is captured by Ethereal. Notice the small header size.

UDP Ethereal 6

Which One Should You Use?

Choosing the right transport protocol to use depends on the type of data to be transferred. For information that needs reliability, sequence transmission and data integrity — TCP is the transport protocol to use. For data that require real-time transmission with low overhead and less processing — UDP is the right choice.

The following table summarizes the key-characteristics of each one of these protocols. Keep them in mind when choosing the transport protocol for your data.

TCP vs UDP 7

More Related Posts

  1. Networking Basics: Part 4 – Workstations and Servers
  2. Network+ Videos 1 and 2
  3. Cisco ATA 180 Series Analog Phone Adapters
  4. Warning: Your Wireless Communication Might Not Be Secure!
  5. Network+ Videos 3 and 4: Ping the Router on a Stick

Discussion

21 comments and trackbacks for “Networking Basics: TCP, UDP, TCP/IP and OSI Model

Comments

  1. Posted by Robert Van Dyke on July 21, 2008, 3:08 pm

    best whitepaper on TCP/UDP and OSIvsTCP model I have ever seen.
    Wow! I have never seen or more practical nor more comprehensive workup!
    Definitely a 360 view!

    Thanks!

  2. Posted by Brajesh Soni on September 5, 2008, 12:58 am

    Its a nice article and very useful.
    could you explain more about NETWORK ACCESS layer-Ethernet, ATM.

    Thanks and Regards
    Brajesh Soni

  3. Posted by aston mushowani on September 16, 2008, 7:02 am

    thanx for an educative easy to understand paper. networking has never been this easy.thanx for packaging your information in an easy to understand layout and language

  4. Posted by student on October 6, 2008, 5:50 am

    it was really helpfull and i really need to compare osi with tcp/ip thanks for the short but sweeeeeet info.

  5. Posted by Manish on June 27, 2009, 12:01 am

    thanks for such good artical. its really awesome & easy to understand. Good Work Keep it up..

  6. Posted by mark on August 16, 2009, 7:28 pm

    excellent explanations.can’t beat this.

  7. Posted by Hozefa on August 20, 2009, 3:43 am

    Hi Stelios, Article is good for basic clarification / understanding of TCP-IP. Useful for beginners.

  8. Posted by XuanThich on September 23, 2009, 7:49 pm

    thanks you!

  9. Posted by Mullaiselvan. M on November 21, 2009, 12:21 am

    :-) Simple!. Clear. Thanks

  10. Posted by johnson on January 20, 2010, 1:18 am

    thank you Stelios !

  11. Posted by Peter on January 20, 2010, 11:56 am

    Great article. One of the best I have ever seen on TCP/IP. Keep up the good work. Thank you very much for your help.

  12. Posted by mohammad ismail aakhil on January 27, 2010, 12:00 am

    hats off
    excellent article.

  13. Posted by mdakramkhan on August 25, 2010, 5:46 am

    THANKS YOU ,

  14. Posted by prachi sanghvi on August 27, 2010, 1:07 am

    Thank u so much!!!!!!!! This help me very much

  15. Posted by Hemal on September 15, 2010, 1:59 am

    UDP supports multicast while TCP does not

  16. Posted by sameer on October 11, 2010, 2:00 am

    it is really helpful…

  17. Posted by Zana on November 28, 2010, 2:35 pm

    Great work welldone easy to understand well written essay .. wikipedia makes my life harder to understand but your article satisfies my lectures … welldone and thank you for your kind help to contribute into society …

  18. Posted by sam on December 9, 2010, 12:39 pm

    THIS IS GREAT!!! YOURE THE BEST!!!!

  19. Posted by hari on May 1, 2012, 2:14 am

    the concepts are very clear and the topic is nicely explained.very useful for the beginners.

    with regards
    hari

  20. Posted by Divya on May 4, 2012, 2:50 am

    hello sir,

    The article is superb…I have one doubt…

    BOth TCP/IP and OSI have the same functions. Then where we use TCP/IP and where we use OSI and why?what is the need to develope this TCP/IP protocol???

  21. Posted by Zed on May 6, 2012, 3:00 pm

    simply fantastic, thank you for the article

Post a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>