CCNA Routing and Switching Complete Review Guide. Lammle Todd. Читать онлайн. Newlib. NEWLIB.NET

Автор: Lammle Todd
Издательство: Автор
Серия:
Жанр произведения: Зарубежная образовательная литература
Год издания: 0
isbn: 9781119288374
Скачать книгу
This creates a virtual circuit, and this type of communication is known as connection-oriented. During this initial handshake, the two TCP layers also agree on the amount of information that's going to be sent before the recipient's TCP sends back an acknowledgment. With everything agreed upon in advance, the path is paved for reliable communication to take place.

      TCP is a full-duplex, connection-oriented, reliable, and accurate protocol, but establishing all these terms and conditions, in addition to error checking, is no small task. TCP is very complicated, and so not surprisingly, it's costly in terms of network overhead. And since today's networks are much more reliable than those of yore, this added reliability is often unnecessary. Most programmers use TCP because it removes a lot of programming work, but for real-time video and VoIP, User Datagram Protocol (UDP) is often better because using it results in less overhead.

      TCP Segment Format

Since the upper layers just send a data stream to the protocols in the Transport layers, I'll use Figure 1.5 to demonstrate how TCP segments a data stream and prepares it for the Internet layer. When the Internet layer receives the data stream, it routes the segments as packets through an internetwork. The segments are handed to the receiving host's Host-to-Host layer protocol, which rebuilds the data stream for the upper-layer applications or protocols.

Figure 1.5 TCP segment format

      Figure 1.5 shows the TCP segment format and shows the different fields within the TCP header. This isn't important to memorize for the Cisco exam objectives, but you need to understand it well because it's really good foundational information.

      The TCP header is 20 bytes long, or up to 24 bytes with options. You need to understand what each field in the TCP segment is in order to build a strong educational foundation:

      Source port This is the port number of the application on the host sending the data, which I'll talk about more thoroughly a little later in this chapter.

      Destination port This is the port number of the application requested on the destination host.

      Sequence number A number used by TCP that puts the data back in the correct order or retransmits missing or damaged data during a process called sequencing

      Acknowledgment number The value is the TCP octet that is expected next.

      Header length The number of 32-bit words in the TCP header, which indicates where the data begins. The TCP header (even one including options) is an integral number of 32 bits in length.

      Reserved Always set to zero

      Code bits/flags Controls functions used to set up and terminate a session

      Window The window size the sender is willing to accept, in octets

      Checksum The cyclic redundancy check (CRC), used because TCP doesn't trust the lower layers and checks everything. The CRC checks the header and data fields.

      Urgent A valid field only if the Urgent pointer in the code bits is set. If so, this value indicates the offset from the current sequence number, in octets, where the segment of non-urgent data begins.

      Options May be 0, meaning that no options have to be present, or a multiple of 32 bits. However, if any options are used that do not cause the option field to total a multiple of 32 bits, padding of 0s must be used to make sure the data begins on a 32-bit boundary. These boundaries are known as words.

      Data Handed down to the TCP protocol at the Transport layer, which includes the upper-layer headers

      Let's take a look at a TCP segment copied from a network analyzer:

      TCP – Transport Control Protocol

      Source Port: 5973

      Destination Port: 23

      Sequence Number: 1456389907

      Ack Number: 1242056456

      Offset: 5

      Reserved: %000000

      Code: %011000

      Ack is valid

      Push Request

      Window: 61320

      Checksum: 0x61a6

      Urgent Pointer: 0

      No TCP Options

      TCP Data Area:

      vL.5.+.5.+.5.+.5 76 4c 19 35 11 2b 19 35 11 2b 19 35 11

      2b 19 35 +. 11 2b 19

      Frame Check Sequence: 0x0d00000f

      Did you notice that everything I talked about earlier is in the segment? As you can see from the number of fields in the header, TCP creates a lot of overhead. Again, this is why application developers may opt for efficiency over reliability to save overhead and go with UDP instead. It's also defined at the Transport layer as an alternative to TCP.

      User Datagram Protocol (UDP)

      User Datagram Protocol (UDP) is basically the scaled-down economy model of TCP, which is why UDP is sometimes referred to as a thin protocol. Like a thin person on a park bench, a thin protocol doesn't take up a lot of room – or in this case, require much bandwidth on a network.

      UDP doesn't offer all the bells and whistles of TCP either, but it does do a fabulous job of transporting information that doesn't require reliable delivery, using far less network resources. (UDP is covered thoroughly in Request for Comments 768.)

      So clearly, there are times that it's wise for developers to opt for UDP rather than TCP, one of them being when reliability is already taken care of at the Process/Application layer. Network File System (NFS) handles its own reliability issues, making the use of TCP both impractical and redundant. But ultimately, it's up to the application developer to opt for using UDP or TCP, not the user who wants to transfer data faster!

      UDP does not sequence the segments and does not care about the order in which the segments arrive at the destination. UDP just sends the segments off and forgets about them. It doesn't follow through, check up on them, or even allow for an acknowledgment of safe arrival – complete abandonment. Because of this, it's referred to as an unreliable protocol. This does not mean that UDP is ineffective, only that it doesn't deal with reliability issues at all.

      Furthermore, UDP doesn't create a virtual circuit, nor does it contact the destination before delivering information to it. Because of this, it's also considered a connectionless protocol. Since UDP assumes that the application will use its own reliability method, it doesn't use any itself. This presents an application developer with a choice when running the Internet Protocol stack: TCP for reliability or UDP for faster transfers.

      It's important to know how this process works because if the segments arrive out of order, which is commonplace in IP networks, they'll simply be passed up to the next layer in whatever order they were received. This can result in some seriously garbled data! On the other hand, TCP sequences the segments so they get put back together in exactly the right order, which is something UDP just can't do.

      UDP Segment Format

Figure 1.6 clearly illustrates UDP's markedly lean overhead as compared to TCP's hungry requirements. Look at the figure carefully – can you see that UDP doesn't use windowing or provide for acknowledgments in the UDP header?

Figure 1.6 UDP segment

      It's important for you to understand what each field in the UDP segment is:

      Source