Which of the following header fields identify which TCP/IP application gets data received by the computer.. Table 6-2 TCP/IP Transport Layer Features Multiplexing using ports Function th
Trang 1Fundamentals of TCP/IP
Transport, Applications,
and Security
The CCNA exams focus mostly on a deeper and broader examination of the topics covered
in Chapter 3 (LANs), Chapter 4 (WANs), and Chapter 5 (routing) This chapter explains the basics of a few topics that receive less attention on the exams: the TCP/IP transport layer, the TCP/IP application layer, and TCP/IP network security Although all three topics are covered on the various CCNA exams, the extent of that coverage is much less compared to LANs, WANs, and routing
“Do I Know This Already?” Quiz
The “Do I Know This Already?” quiz allows you to assess whether you should read the entire chapter If you miss no more than one of these ten self-assessment questions, you might want to move ahead to the “Exam Preparation Tasks” section Table 6-1 lists the major headings in this chapter and the “Do I Know This Already?” quiz questions covering the material in those sections This helps you assess your knowledge of these specific areas The answers to the “Do I Know This Already?” quiz appear in Appendix A
1. PC1 is using TCP and has a window size of 4000 PC1 sends four segments to PC2 with 1000 bytes of data each, with sequence numbers 2000, 3000, 4000, and 5000 PC2 replies with an acknowledgment number of 5000 What should PC1 do next?
a. Increase its window to 5000 or more segments
b. Send the next segment, with sequence number 6000
c. Resend the segment whose sequence number was 5000
d. Resend all four previously sent segments
Table 6-1 “Do I Know This Already?” Foundation Topics Section-to-Question Mapping
TCP/IP Layer 4 Protocols: TCP and UDP 1–6
Trang 22. Which of the following are not features of a protocol that is considered to match OSI Layer 4?
a. Error recovery
b. Flow control
c. Segmenting of application data
d. Conversion from binary to ASCII
3. Which of the following header fields identify which TCP/IP application gets data received by the computer?
f. Ordered data transfer
5. Which of the following functions is performed by both TCP and UDP?
Trang 36. What do you call data that includes the Layer 4 protocol header, and data given to Layer 4 by the upper layers, not including any headers and trailers from Layers 1 to 3?
e. The file name.html includes the hostname
8. When comparing VoIP with an HTTP-based mission-critical business application, which of the following statements are accurate about the quality of service needed from the network?
a. VoIP needs better (lower) packet loss
b. HTTP needs less bandwidth
c. HTTP needs better (lower) jitter
d. VoIP needs better (lower) delay
9. Which of the following is a device or function whose most notable feature is to examine trends over time to recognize different known attacks as compared to a list of common attack signatures?
a. VPN
b. Firewall
c. IDS
d. NAC
Trang 410. Which of the following is a device or function whose most notable feature is to encrypt packets before they pass through the Internet?
a. VPN
b. Firewall
c. IDS
d. NAC
Trang 5Foundation Topics
This chapter begins by examining the functions of Transmission Control Protocol (TCP), which are many, as compared to the functions of User Datagram Protocol (UDP), of which there are few The second major section of the chapter examines the TCP/IP application layer, including some discussion of how DNS name resolution works Finally, the third major section examines the importance and concepts of network security, introducing some
of the core concepts, terminology, and functions important for security today
TCP/IP Layer 4 Protocols: TCP and UDP
The OSI transport layer (Layer 4) defines several functions, the most important of which are error recovery and flow control Likewise, the TCP/IP transport layer protocols also implement these same types of features Note that both the OSI model and TCP/IP model call this layer the transport layer But as usual, when referring to the TCP/IP model, the layer name and number are based on OSI, so any TCP/IP transport layer protocols are considered Layer 4 protocols
The key difference between TCP and UDP is that TCP provides a wide variety of services
to applications, whereas UDP does not For example, routers discard packets for many reasons, including bit errors, congestion, and instances in which no correct routes are known As you have read already, most data-link protocols notice errors (a process called
error detection) but then discard frames that have errors TCP provides for retransmission
(error recovery) and help to avoid congestion (flow control), whereas UDP does not As a result, many application protocols choose to use TCP
However, do not let UDP’s lack of services make you think that UDP is worse than TCP
By providing few services, UDP needs fewer bytes in its header compared to TCP, resulting
in fewer bytes of overhead in the network UDP software does not slow down data transfer
in cases where TCP may purposefully slow down Also, some applications, notably today voice over IP (VoIP) and video over IP, do not need error recovery, so they use UDP So, UDP also has an important place in TCP/IP networks today
Table 6-1 lists the main features supported by TCP and/or UDP Note that only the first item listed in the table is supported by UDP, whereas all items in the table are supported
by TCP
Trang 6Next, this section describes the features of TCP, followed by a brief comparison to UDP.
Transmission Control Protocol
Each TCP/IP application typically chooses to use either TCP or UDP based on the application’s requirements For instance, TCP provides error recovery, but to do so, it consumes more bandwidth and uses more processing cycles UDP does not perform error recovery, but it takes less bandwidth and uses fewer processing cycles Regardless of which
of the two TCP/IP transport layer protocols the application chooses to use, you should understand the basics of how each of these transport layer protocols works
TCP, as defined in RFC 793, accomplishes the functions listed in Table 6-2 through mechanisms at the endpoint computers TCP relies on IP for end-to-end delivery of the data, including routing issues In other words, TCP performs only part of the functions necessary
to deliver the data between applications Also, the role that it plays is directed toward providing services for the applications that sit at the endpoint computers Regardless of whether two computers are on the same Ethernet or are separated by the entire Internet, TCP performs its functions the same way
Figure 6-1 shows the fields in the TCP header Although you don’t need to memorize the names of the fields or their locations, the rest of this section refers to several of the fields, so the entire header is included here for reference
Table 6-2 TCP/IP Transport Layer Features
Multiplexing using ports Function that allows receiving hosts to choose the correct
application for which the data is destined, based on the port number.
Error recovery (reliability) Process of numbering and acknowledging data with Sequence
and Acknowledgment header fields.
Flow control using windowing Process that uses window sizes to protect buffer space and
Continuous stream of bytes from an upper-layer process that is
“segmented” for transmission and delivered to upper-layer processes at the receiving device, with the bytes in the same order.
Trang 7Figure 6-1 TCP Header Fields
Multiplexing Using TCP Port Numbers
TCP provides a lot of features to applications, at the expense of requiring slightly more processing and overhead, as compared to UDP However, TCP and UDP both use a concept
called multiplexing Therefore, this section begins with an explanation of multiplexing with
TCP and UDP Afterward, the unique features of TCP are explored
Multiplexing by TCP and UDP involves the process of how a computer thinks when receiving data The computer might be running many applications, such as a web browser, an e-mail package, or an Internet VoIP application (for example, Skype) TCP and UDP multiplexing enables the receiving computer to know which application to give the data to
Some examples will help make the need for multiplexing obvious The sample network consists of two PCs, labeled Hannah and Jessie Hannah uses an application that she wrote to send advertisements that appear on Jessie’s screen The application sends a new
ad to Jessie every 10 seconds Hannah uses a second application, a wire-transfer application, to send Jessie some money Finally, Hannah uses a web browser to access the web server that runs on Jessie’s PC The ad application and wire-transfer application are imaginary, just for this example The web application works just like it would in real life
Bit 0
Header Length (4)
Sequence Number (32)
Destination Port (16)Source Port (16)
Bit 31Bit 16
Bit 15
Reserved (6) Code Bits (6) Window (16)
Options (0 or 32 If Any)Data (Varies)
Bytes
Trang 8Figure 6-2 shows the sample network, with Jessie running three applications:
■ A UDP-based ad application
■ A TCP-based wire-transfer application
■ A TCP web server application
Figure 6-2 Hannah Sending Packets to Jessie, with Three Applications
Jessie needs to know which application to give the data to, but all three packets are from
the same Ethernet and IP address You might think that Jessie could look at whether the
packet contains a UDP or TCP header, but, as you see in the figure, two applications (wire transfer and web) are using TCP
TCP and UDP solve this problem by using a port number field in the TCP or UDP header,
respectively Each of Hannah’s TCP and UDP segments uses a different destination port
number so that Jessie knows which application to give the data to Figure 6-3 shows an
I Received Three Packets, Each from the Same MAC and
IP Address What Application Should Get the Data in Each Packet?
Ad Data
Wire Transfer Data
Eth IP TCP Web PageData Eth
Trang 9Figure 6-3 Hannah Sending Packets to Jessie, with Three Applications Using Port Numbers to
Multiplex
So, for a web server application on Jessie, the socket would be (10.1.1.2, TCP, port 80) because, by default, web servers use the well-known port 80 When Hannah’s web browser connects to the web server, Hannah uses a socket as well—possibly one like this: (10.1.1.1, TCP, 1030) Why 1030? Well, Hannah just needs a port number that is unique on Hannah,
so Hannah sees that port 1030 is available and uses it In fact, hosts typically allocate
dynamic port numbers starting at 1024 because the ports below 1024 are reserved for
well-known applications, such as web services
In Figure 6-3, Hannah and Jessie use three applications at the same time—hence, three socket connections are open Because a socket on a single computer should be unique, a connection between two sockets should identify a unique connection between two computers This uniqueness means that you can use multiple applications at the same time, talking to applications running on the same or different computers Multiplexing, based on sockets, ensures that the data is delivered to the correct applications Figure 6-4 shows the three socket connections between Hannah and Jessie
Port numbers are a vital part of the socket concept Well-known port numbers are used by servers; other port numbers are used by clients Applications that provide a service, such as FTP, Telnet, and web servers, open a socket using a well-known port and listen for connection requests Because these connection requests from clients are required to include both the source and destination port numbers, the port numbers used by the servers must be
Ad Data
Wire Transfer Data
Data
Port 80 Web Server Port 800 Ad Server Port 20,100 Wire Application
Destination Port 800
Destination Port 20,100
Destination Port 80
Trang 10known Therefore, each server has a hard-coded, known port number The known ports are listed at http://www.iana.org/assignments/port-numbers.
well-Figure 6-4 Connections Between Sockets
On client machines, where the requests originate, any unused port number can be allocated The result is that each client on the same host uses a different port number, but a server uses the same port number for all connections For example, 100 web browsers on the same host computer could each connect to a web server, but the web server with 100 clients connected to it would have only one socket and, therefore, only one port number (port 80
in this case) The server can tell which packets are sent from which of the 100 clients by looking at the source port of received TCP segments The server can send data to the correct web client (browser) by sending data to that same port number listed as a destination port The combination of source and destination sockets allows all participating hosts to distinguish between the data’s source and destination Although the example explains the concept using 100 TCP connections, the same port numbering concept applies to UDP sessions in the same way
Popular TCP/IP Applications
Throughout your preparation for the CCNA exams, you will come across a variety of TCP/
IP applications You should at least be aware of some of the applications that can be used
to help manage and control a network
NOTE You can find all RFCs online at http://www.isi.edu/in-notes/rfcxxxx.txt, where
xxxx is the number of the RFC If you do not know the number of the RFC, you can try
searching by topic at http://www.rfc-editor.org/rfcsearch.html
Ad Application Port 1025
Wire Application Port 1028
Web Browser Port 1030
IP Address 10.1.1.1
Ad Application Port 800
Wire Application Port 20,100
Web Server Port 80
IP Address 10.1.1.2
(10.1.1.1, TCP, 1030) (10.1.1.2, TCP, 80) (10.1.1.1, TCP, 1028) (10.1.1.2, TCP, 20100)
(10.1.1.1, UDP, 1025) (10.1.1.2, UDP, 800)
Trang 11The World Wide Web (WWW) application exists through web browsers accessing the content available on web servers Although it is often thought of as an end-user application, you can actually use WWW to manage a router or switch You enable a web server function
in the router or switch and use a browser to access the router or switch
The Domain Name System (DNS) allows users to use names to refer to computers, with DNS being used to find the corresponding IP addresses DNS also uses a client/server model, with DNS servers being controlled by networking personnel, and DNS client functions being part of most any device that uses TCP/IP today The client simply asks the DNS server to supply the IP address that corresponds to a given name
Simple Network Management Protocol (SNMP) is an application layer protocol used specifically for network device management For instance, Cisco supplies a large variety of network management products, many of them in the CiscoWorks network management software product family They can be used to query, compile, store, and display information about a network’s operation To query the network devices, CiscoWorks software mainly uses SNMP protocols
Traditionally, to move files to and from a router or switch, Cisco used Trivial File Transfer Protocol (TFTP) TFTP defines a protocol for basic file transfer—hence the word “trivial.”
Alternatively, routers and switches can use File Transfer Protocol (FTP), which is a much more functional protocol, to transfer files Both work well for moving files into and out of Cisco devices FTP allows many more features, making it a good choice for the general end-user population TFTP client and server applications are very simple, making them good tools as embedded parts of networking devices
Some of these applications use TCP, and some use UDP As you will read later, TCP performs error recovery, whereas UDP does not For instance, Simple Mail Transport Protocol (SMTP) and Post Office Protocol version 3 (POP3), both used for transferring mail, require guaranteed delivery, so they use TCP Regardless of which transport layer protocol is used, applications use a well-known port number so that clients know which port
to attempt to connect to Table 6-3 lists several popular applications and their well-known port numbers
Table 6-3 Popular Applications and Their Well-Known Port Numbers
continues
Trang 12Error Recovery (Reliability)
TCP provides for reliable data transfer, which is also called reliability or error recovery,
depending on what document you read To accomplish reliability, TCP numbers data bytes using the Sequence and Acknowledgment fields in the TCP header TCP achieves reliability
in both directions, using the Sequence Number field of one direction combined with the Acknowledgment field in the opposite direction Figure 6-5 shows the basic operation
Figure 6-5 TCP Acknowledgment Without Errors
In Figure 6-5, the Acknowledgment field in the TCP header sent by the web client (4000)
implies the next byte to be received; this is called forward acknowledgment The
sequence number reflects the number of the first byte in the segment In this case, each TCP segment is 1000 bytes long; the Sequence and Acknowledgment fields count the number of bytes
Table 6-3 Popular Applications and Their Well-Known Port Numbers (Continued)
Web Browser
Web Server
1000 Bytes of Data, Sequence = 1000
1000 Bytes of Data, Sequence = 2000
1000 Bytes of Data, Sequence = 3000
No Data, Acknowledgment = 4000
I Got All 3000 Bytes.
Send ACK!
Trang 13Figure 6-6 depicts the same scenario, but the second TCP segment was lost or is in error
The web client’s reply has an ACK field equal to 2000, implying that the web client is expecting byte number 2000 next The TCP function at the web server then could recover lost data by resending the second TCP segment The TCP protocol allows for resending just that segment and then waiting, hoping that the web client will reply with an
acknowledgment that equals 4000
Figure 6-6 TCP Acknowledgment with Errors
Although not shown, the sender also sets a retransmission timer, awaiting acknowledgment, just in case the acknowledgment is lost or all transmitted segments are lost If that timer expires, the TCP sender sends all segments again
Flow Control Using Windowing
TCP implements flow control by taking advantage of the Sequence and Acknowledgment fields in the TCP header, along with another field called the Window field This Window field implies the maximum number of unacknowledged bytes that are allowed to be outstanding at any instant in time The window starts small and then grows until errors
occur The size of the window changes over time, so it is sometimes called a dynamic
window Additionally, because the actual sequence and acknowledgment numbers grow
over time, the window is sometimes called a sliding window, with the numbers sliding
(moving) upward When the window is full, the sender does not send, which controls the flow of data Figure 6-7 shows windowing with a current window size of 3000 Each TCP segment has 1000 bytes of data
Notice that the web server must wait after sending the third segment because the window
is exhausted When the acknowledgment has been received, another window can be sent
Because no errors have occurred, the web client grants a larger window to the server, so now
4000 bytes can be sent before the server receives an acknowledgment In other words, the
Web Browser
Web Server
1000 Bytes of Data, Sequence = 1000
1000 Bytes of Data, Sequence = 2000
1000 Bytes of Data, Sequence = 3000
No Data, Acknowledgment = 4000
No Data, Acknowledgment = 2000
1000 Bytes of Data, Sequence = 2000
I Probably Lost One.
ACK What I Got in
Order!
I Just Got 2000-2999, and I Already Had 3000-3999 Ask for
4000 Next.
He Lost the Segment with Sequence =
2000 Resend It!
Trang 14receiver uses the Window field to tell the sender how much data it can send before it must stop and wait for the next acknowledgment As with other TCP features, windowing is symmetrical Both sides send and receive, and, in each case, the receiver grants a window
to the sender using the Window field
Figure 6-7 TCP Windowing
Windowing does not require that the sender stop sending in all cases If an acknowledgment
is received before the window is exhausted, a new window begins, and the sender continues
sending data until the current window is exhausted (The term Positive Acknowledgment
and Retransmission [PAR] is sometimes used to describe the error recovery and windowing
processes that TCP uses.)
Connection Establishment and Termination
TCP connection establishment occurs before any of the other TCP features can begin their work Connection establishment refers to the process of initializing sequence and acknowledgment fields and agreeing on the port numbers used Figure 6-8 shows an example of connection establishment flow
This three-way connection establishment flow must end before data transfer can begin The connection exists between the two sockets, although the TCP header has no single socket field Of the three parts of a socket, the IP addresses are implied based on the source and destination IP addresses in the IP header TCP is implied because a TCP header is in use,
SEQ=1000 SEQ=2000 SEQ=3000
SEQ=4000 SEQ=5000 SEQ=6000
ACK=4000 Window=4000
ACK=1000 Window=3000
SEQ=7000
Web Server
Web Browser
Trang 15as specified by the protocol field value in the IP header Therefore, the only parts of the socket that need to be encoded in the TCP header are the port numbers.
Figure 6-8 TCP Connection Establishment
TCP signals connection establishment using 2 bits inside the flag fields of the TCP header
Called the SYN and ACK flags, these bits have a particularly interesting meaning SYN means “Synchronize the sequence numbers,” which is one necessary component in initialization for TCP The ACK field means “The Acknowledgment field is valid in this header.” Until the sequence numbers are initialized, the Acknowledgment field cannot be very useful Also notice that in the initial TCP segment in Figure 6-8, no acknowledgment number is shown; this is because that number is not valid yet Because the ACK field must
be present in all the ensuing segments, the ACK bit continues to be set until the connection
is terminated
TCP initializes the Sequence Number and Acknowledgment Number fields to any number that fits into the 4-byte fields; the actual values shown in Figure 6-8 are simply sample values The initialization flows are each considered to have a single byte of data, as reflected
in the Acknowledgment Number fields in the example
Figure 6-9 shows TCP connection termination This four-way termination sequence is
straightforward and uses an additional flag, called the FIN bit (FIN is short for “finished,”
as you might guess.) One interesting note: Before the device on the right sends the third TCP segment in the sequence, it notifies the application that the connection is coming down It then waits on an acknowledgment from the application before sending the third segment in the figure Just in case the application takes some time to reply, the PC on the right sends the second flow in the figure, acknowledging that the other PC wants to take down the connection Otherwise, the PC on the left might resend the first segment repeatedly
Web Browser
Web Server
SYN, DPORT=80, SPORT=1027
SYN, ACK, DPORT=1027, SPORT=80
ACK, DPORT=80, SPORT=1027
SEQ=200
SEQ=1450, ACK=201
SEQ=201, ACK=1451
Trang 16Figure 6-9 TCP Connection Termination
TCP establishes and terminates connections between the endpoints, whereas UDP does not
Many protocols operate under these same concepts, so the terms connection-oriented and
connectionless are used to refer to the general idea of each More formally, these terms can
be defined as follows:
■ Connection-oriented protocol: A protocol that requires an exchange of messages
before data transfer begins or that has a required preestablished correlation between two endpoints
■ Connectionless protocol: A protocol that does not require an exchange of messages
and that does not require a preestablished correlation between two endpoints
Data Segmentation and Ordered Data Transfer
Applications need to send data Sometimes the data is small—in some cases, a single byte
In other cases, such as with a file transfer, the data might be millions of bytes
Each different type of data-link protocol typically has a limit on the maximum transmission
unit (MTU) that can be sent inside a data link layer frame In other words, the MTU is the
size of the largest Layer 3 packet that can sit inside a frame’s data field For many data-link protocols, Ethernet included, the MTU is 1500 bytes
TCP handles the fact that an application might give it millions of bytes to send by
segmenting the data into smaller pieces, called segments Because an IP packet can often be
no more than 1500 bytes because of the MTU restrictions, and because IP and TCP headers are 20 bytes each, TCP typically segments large data into 1460-byte chunks
The TCP receiver performs reassembly when it receives the segments To reassemble the data, TCP must recover lost segments, as discussed previously However, the TCP receiver
Trang 17must also reorder segments that arrive out of sequence Because IP routing can choose to balance traffic across multiple links, the actual segments may be delivered out of order So,
the TCP receiver also must perform ordered data transfer by reassembling the data into the
original order The process is not hard to imagine: If segments arrive with the sequence numbers 1000, 3000, and 2000, each with 1000 bytes of data, the receiver can reorder them, and no retransmissions are required
You should also be aware of some terminology related to TCP segmentation The TCP
header and the data field together are called a TCP segment This term is similar to a
data-link frame and an IP packet in that the terms refer to the headers and trailers for the
respective layers, plus the encapsulated data The term L4PDU also can be used instead of the term TCP segment because TCP is a Layer 4 protocol
User Datagram Protocol
UDP provides a service for applications to exchange messages Unlike TCP, UDP is connectionless and provides no reliability, no windowing, no reordering of the received data, and no segmentation of large chunks of data into the right size for transmission
However, UDP provides some functions of TCP, such as data transfer and multiplexing using port numbers, and it does so with fewer bytes of overhead and less processing required than TCP
UDP data transfer differs from TCP data transfer in that no reordering or recovery is accomplished Applications that use UDP are tolerant of the lost data, or they have some application mechanism to recover lost data For example, VoIP uses UDP because if a voice packet is lost, by the time the loss could be noticed and the packet retransmitted, too much delay would have occurred, and the voice would be unintelligible Also, DNS requests use UDP because the user will retry an operation if the DNS resolution fails As another example, the Network File System (NFS), a remote file system application, performs recovery with application layer code, so UDP features are acceptable to NFS
Figure 6-10 shows TCP and UDP header formats Note the existence of both Source Port and Destination Port fields in the TCP and UDP headers, but the absence of Sequence Number and Acknowledgment Number fields in the UDP header UDP does not need these fields because it makes no attempt to number the data for acknowledgments or
resequencing
UDP gains some advantages over TCP by not using the Sequence and Acknowledgment fields The most obvious advantage of UDP over TCP is that there are fewer bytes of overhead Not as obvious is the fact that UDP does not require waiting on acknowledgments
or holding the data in memory until it is acknowledged This means that UDP applications
Trang 18are not artificially slowed by the acknowledgment process, and memory is freed more quickly.
Figure 6-10 TCP and UDP Headers
TCP/IP Applications
The whole goal of building an Enterprise network, or connecting a small home or office network to the Internet, is to use applications—applications such as web browsing, text messaging, e-mail, file downloads, voice, and video This section examines a few issues related to network design in light of the applications expected in an internetwork This is followed by a much deeper look at one particular application—web browsing using Hypertext Transfer Protocol (HTTP)
QoS Needs and the Impact of TCP/IP Applications
The needs of networked applications have changed and grown significantly over the years When networks first became popular in Enterprises in the 1970s, the network typically supported only data applications, mainly text-only terminals and text-only printers A single user might generate a few hundred bytes of data for the network every time he or she pressed the Enter key, maybe every 10 seconds or so
The term quality of service (QoS) refers to the entire topic of what an application needs from the network service Each type of application can be analyzed in terms of its QoS requirements on the network, so if the network meets those requirements, the application will work well For example, the older text-based interactive applications required only a small amount of bandwidth, but they did like low delay If those early networks supported
a round-trip delay of less than 1 second, users were generally happy, because they had to wait less than 1 second for a response
The QoS needs of data applications have changed over the years Generally speaking, applications have tended to need more bandwidth, with lower delay as well From those
Source
Port
Dest.
Port Sequence Number
Ack.
Number Offset Reserved Flags
Window Size Checksum Urgent Options PAD2
* Unless Specified, Lengths Shown
Are the Numbers of Bytes