Routing


Introduction to the TCP/IP Suite

As mentioned earlier, TCP/IP is the most widely used protocol suite. The relationship between the four layers of the TCP/IP suite and the seven layers of the OSI model is illustrated in Figure B-5.

Figure B-5. TCP/IP Protocol Suite


The four layers of the TCP/IP suite are the application layer, transport layer, Internet layer, and network interface layer.

The application layer includes the functionality of the OSI application, presentation, and session layers. Applications defined in the TCP/IP suite include the following:

  • FTP and TFTP Transfer files between devices.

  • SMTP and POP3 Provide e-mail services.

  • HTTP Transfers information to and from a world wide web (WWW) server through web-browser software.

  • Telnet Emulates a terminal to connect to devices.

  • Domain Name System (DNS) Translates network device names into network addresses, and vice versa.

  • Simple Network Management Protocol (SNMP) Used for network management, including setting threshold values and reporting network errors.

  • DHCP Assigns dynamic IP addressing information to devices as they require it.

The network interface layer can support a wide variety of LANs and WANs (including those discussed in the "LANs and WANs" section, earlier in this appendix).

The transport layer and the Internet layer are detailed in the following sections.

TCP/IP Transport Layer Protocols

The TCP/IP transport layer includes the following two protocols:

  • TCP Provides connection-oriented, end-to-end reliable transmission. Before sending any data, TCP on the source device establishes a connection with TCP on the destination device, ensuring that both sides are synchronized. Data is acknowledged; any data that is not received properly is retransmitted. FTP is an example of an application that uses TCP to guarantee that the data sent from one device to another is received successfully.

  • User Datagram Protocol (UDP) Provides connectionless, best-effort unacknowledged data transmission. In other words, UDP does not ensure that all the segments arrive at the destination undamaged. UDP does not have the overhead of TCP related to establishing the connection and acknowledging the data. However, this means that upper-layer protocols or the user must determine whether all the data arrived successfully, and retransmit if necessary. TFTP is an example of an application that uses UDP. When all the segments have arrived at the destination, TFTP computes the file check sequence and reports the results to the user. If an error occurs, the user must send the entire file again.

TCP and UDP, being at the transport layer, send segments.

Figure B-6 illustrates the fields in a UDP segment and in a TCP segment.

Figure B-6. UDP Segments Contain at Least 8 Bytes While TCP Segments Contain at Least 20 Bytes


The UDP segment fields are as follows:

  • Source and destination port numbers (16 bits each) Identify the upper-layer protocol (the application) in the sending and receiving devices.

  • Length (16 bits) The total number of 32-bit words in the header and the data.

  • Checksum (16 bits) The checksum of the header and data fields, used to ensure that the segment is received correctly.

  • Data (variable length) The upper-layer data (the application data).

The TCP segment fields are as follows:

  • Source and destination port numbers (16 bits each) Identify the upper-layer protocol (the application) in the sending and receiving hosts.

  • Sequence and acknowledgment numbers (32 bits each) Ensure the correct order of the received data and that the data reached the destination.

  • Header length (4 bits) The number of 32-bit words in the header.

  • Reserved (6 bits) For future use, set to 0.

  • Code bits (6 bits) Indicates different types of segments. For example, the SYN (synchronize) bit sets up a session, the ACK (acknowledge) bit acknowledges a segment, and the FIN (finish) bit closes a session.

  • Window size (16 bits) The number of octets that the receiving device is willing to accept before it must send an acknowledgment.

    Note

    An octet is 8 bits of data.


  • Checksum (16 bits) The checksum of the header and data fields, used to ensure that the segment is received correctly.

  • Urgent (16 bits) Indicates the end of urgent data.

  • Option (0 or 32 bits) Only one option is currently defined: the maximum TCP segment size.

  • Data (variable) The upper-layer data (the application data).

Notice that the UDP header is much smaller than the TCP header. UDP does not need the sequencing, acknowledgment, or windowing fields because it does not establish and maintain connections.

Port number operation, which is the same for both TCP and UDP, is described in the next section. Following that section, the operation of sequence and acknowledgment numbers and windowing are described; these are key to understanding TCP operation.

Port Numbers

Key Point

TCP and UDP use protocol port numbers to distinguish among multiple applications that are running on a single device.


Well-known, or standardized, port numbers are assigned to applications so that different implementations of the TCP/IP protocol suite can interoperate. Well-known port numbers are numbers up to 1023; examples include the following:

  • FTP TCP port 20 (data) and port 21 (control)

  • TFTP UDP port 69

  • SMTP TCP port 25

  • POP3 TCP port 110

  • HTTP TCP port 80

  • Telnet TCP port 23

  • DNS TCP and UDP port 53

  • SNMP UDP port 161

Port numbers from 1024 through 49151 are called registered port numbers; these are registered for use by other applications. The dynamic ports numbers are those from 49152 through 65535; these can be dynamically assigned by hosts as source port numbers when they create and end sessions. Figure B-7 illustrates a device in Toronto that is opening a Telnet session (TCP port 23) with a device in London. Note that the source port from Toronto is 50051. Toronto records this Telnet session with London as port 50051 to distinguish it from any other Telnet sessions it might have running (because you can have simultaneous multiple Telnet sessions running on a device). The London device receives port number 23 and therefore knows that this is a Telnet session. In its reply, it uses a destination port of 50051, which Toronto knows is the Telnet session it opened with London.

Figure B-7. Source and Destination Port Numbers Indicate the Application Being Used


TCP Sequencing, Acknowledgment, and Windowing

To illustrate TCP operation, we follow a TCP session as it is established, data is sent, and the session is closed.

Key Point

A TCP connection is established by a process called a three-way handshake. This process uses the SYN and ACK bits (in the code bits field in the TCP segment) as well as the sequence and acknowledgment number fields..


The TCP three-way handshake is shown in Figure B-8.

Figure B-8. Three-Way Handshake Establishes a TCP Session


In this example, a user in Toronto wants to establish a TCP session with a device in London, for example, to start a Telnet session. The first step in the handshake involves the initiator, Toronto, sending a segment with the SYN bit setthis indicates that it wants to start a session and synchronize with London. This segment also includes the initial sequence number that Toronto is using21 in this example. Assuming that the device in London is willing to establish the session, it returns a segment that also has the SYN bit set. In addition, this segment has the ACK bit set because London is acknowledging that it successfully received a segment from Toronto; the acknowledgment number is set to 22, indicating that London is now expecting to receive segment 22 and therefore that it successfully received number 21. (This is known as an expectational acknowledgment.) This new segment includes the initial sequence number that London is using75 in this example. Finally, Toronto replies with an acknowledgment segment, sequence number 22 (as London is expecting), and acknowledgment number 76 (indicating that it is now expecting number 76 and therefore it has successfully received number 75). The session is now established, and data can be exchanged between Toronto and London.

Note

The sequence and acknowledgment numbers specify octet numbers, not segment numbers. For ease of illustration purposes here, we are assuming a segment is 1 octet of data. This is not the case in real life, but it simplifies the example so that the concepts are easier to understand.


The window size field in the segment controls the flow of the session. It indicates the number of octets that a device is willing to accept before it must send an acknowledgment. Because each host can have different flow restrictions (for example, one host might be very busy and therefore require that a smaller amount of data be sent at one time), each side of the session can have different window sizes, as illustrated in the example in Figure B-9.

Figure B-9. Window Size Indicates the Number of Octets a Device Is Willing to Accept Before It Sends an Acknowledgment


In this example, the window size on Toronto is set to 3, and on London, it is set to 2. When Toronto sends data to London, it can only send 2 octets before it must wait for an acknowledgment. When London sends data to Toronto, it can send 3 octets before it must wait for an acknowledgment.

Note

The window size specifies the number of octets, not the number of segments, that can be sent. For ease of illustration purposes here, we are assuming a segment is 1 octet of data. This is not the case in real life, but it again simplifies the example so that the concepts are easier to understand. The window sizes shown in the example are also small, for ease of explanation purposes. In reality, the window size would be much larger, allowing a lot of data to be sent between acknowledgments.


After all the data for the session is sent, the session can be closed. The process is similar to how it was established, using a handshake. In this case, four steps are used, as illustrated in Figure B-10.

Figure B-10. Four-Way Handshake Closes a TCP Session


In this example, Toronto wants to close its Telnet session with London. The first step in the handshake involves Toronto sending a segment with the FIN bit set, indicating that it wants to finish the session. This segment also includes the sequence number that Toronto is currently using107 in this example. London immediately acknowledges the request. This segment has the ACK bit set with the acknowledgment number set to 108, indicating that London successfully received number 107. This segment includes the sequence number that London is currently using322 in this example. London then informs its Telnet application that half of the session, the connection from Toronto, is now closed. When the application on the London device requests that the other half of the connection (to Toronto) be closed, London sends a new segment with the FIN bit set, indicating that it wants to close the session. Finally, Toronto replies with an acknowledgment segment with acknowledgment number 323 (indicating that it has successfully received number 322). The session is now closed in both directions.

TCP/IP Internet Layer Protocols

The TCP/IP Internet layer corresponds to the OSI network layer and includes the IP routed protocol, as well as protocols for address resolution and message and error reporting.

Protocols

The protocols at this layer include the following:

  • IP Provides connectionless, best-effort delivery of datagrams through the network. A unique IP addressa logical addressis assigned to each interface of each device in the network. IP and IP addresses are introduced later in this appendix and are described in more detail in Chapter 3, "IPv4 Routing Design."

    Note

    Two versions of IP currently exist, IP version 4 (IPv4) and the emerging IP version 6 (IPv6). In this book, the term IP refers to IPv4. IPv6 is introduced in Chapter 10.


  • Internet Control Message Protocol (ICMP) Sends messages and error reports through the network. For example, the ping application included in most TCP/IP protocol suites sends an ICMP echo message to a destination, which then replies with an ICMP echo reply message. Ping provides confirmation that the destination can be reached and gives a measure of how long packets are taking to travel between the source and destination.

  • Address Resolution Protocol (ARP) Requests the MAC address (the data link layer physical address) for a given IP address. The returned MAC address is used as the destination address in the frames that encapsulate the packets of data being routed to the destination IP address.

Note

These protocols are all at the TCP/IP Internet layer, corresponding to the OSI model network layer, Layer 3. They run on top of the TCP/IP network interface layer, corresponding to the OSI model Layers 1 and 2the physical and data link layers.


Note

You might have heard people refer to IP as a LAN protocol; this is because they configure IP on their PCs, which are attached to LANs. In fact, however, IP is a network layer protocolit runs on top of any LAN or WAN.


IP Datagrams

Figure B-11 illustrates the fields of an IP datagram.

Figure B-11. An IP Datagram Contains at Least 20 Bytes


The IP datagram fields are as follows:

  • Version (4 bits) Identifies the IP version, in this case version 4.

  • Header length (4 bits) The number of 32-bit words in the header (including the options).

  • Type of service (ToS) (8 bits) Specifies how the datagram should be handled within the network. These bits mark traffic for a specific quality of service (QoS), which is further described in Chapter 6, "Quality of Service Design."

  • Total length (16 bits) The total number of octets in the header and data fields.

  • Identification (16 bits), flags (3 bits), and fragment offset (13 bits) Handle cases where a large datagram must be fragmentedsplit into multiple packetsto go through a network that cannot handle datagrams of that size.

  • Time to Live (TTL) (8 bits) Ensures that datagrams do not loop endlessly in the network; this field must be decremented by 1 by each router that the datagram passes through.

  • Protocol (8 bits) Indicates the upper-layer (Layer 4, the transport layer) protocol that the data is for. In other words, this field indicates the type of segment that the datagram is carrying, similar to how the port number field in the UDP and TCP segments indicates the type of application that the segment is carrying. A protocol number of 6 means that the datagram is carrying a TCP segment, while a protocol number of 17 means that the datagram is carrying a UDP segment.

  • Header checksum (16 bits) Ensures that the header is received correctly.

  • Source and destination IP addresses (32 bits each) Logical IP addresses assigned to the source and destination of the datagram, respectively. IP addresses are introduced later in this appendix, in the "Addressing" section.

  • IP options and padding (variable length, 0 or a multiple of 32 bits) Used for network testing and debugging.

  • Data (variable) The upper-layer (transport layer) data.




Campus Network Design Fundamentals
Campus Network Design Fundamentals
ISBN: 1587052229
EAN: 2147483647
Year: 2005
Pages: 156

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net