The TCP/IP Protocol Suite Tutorial - Fujitsu

Transcription

The TCP/IP Protocol SuiteTutorialDecember 20, 2006

Trademarks and CopyrightsMicrosoft , Windows , Outlook , andInternet Explorer are registeredtrademarks or trademarks of MicrosoftCorporation in the United States and/orother countries.AOL , AOL Instant messenger andAIM are trademarks or registeredtrademarks of America Online,Incorporated.Yahoo! and the Yahoo! logo are registeredtrademarks of Yahoo, Inc.Acrobat and Acrobat Reader are aregistered trademarks of Adobe Systems,Incorporated.All other products or services mentioned in this document are identified by the trademarks, service marks, or product names as designated by thecompanies that market those products or services or own those marks. Inquiries concerning such products, services, or marks should be madedirectly to those companiesThis document and its contents are provided by Fujitsu Network Communications, Inc. (FNC) for guidance purposes only. This document is provided“as is” with no warranties or representations whatsoever, either express or implied, including without limitation the implied warranties ofmerchantability and fitness for purpose. FNC does not warrant or represent that the contents of this document are error free.Furthermore, the contents of this document are subject to update and change at any time without notice by FNC, since FNC reserves the right,without notice, to make changes in equipment design or components as progress in engineering methods may warrant. No part of the contents ofthis document may be copied, modified, or otherwise reproduced without the express written consent of FNC.Unpublished work and only distributed under restriction.Copyright Fujitsu Network Communications, Inc. All Rights Reserved.

TCP/IP Protocol Suite TutorialTable of ContentsIntroduction .1-1Objectives.1-1Standards .1-1Distribution Method .1-1Optional Reading.1-1The OSI Reference Model .1-3Purpose .1-3The TCP/IP Protocol Suite.1-5Before We Begin.1-7The Application Layer .1-8Application Layer Examples .1-8The Transport Layer .1-9User Datagram Protocol.1-9Transmission Control Protocol .1-10The Internet Layer .1-14The Internet Protocol .1-15IP Routing .1-19Address Resolution Protocol .1-20The Network Access Layer.1-21Point-to-Point Protocol.1-23Ethernet .1-25A TCP/IP Networking Example.1-29Wireless Fidelity.1-36Worldwide Interoperability for Microwave Access .1-40Frame Relay .1-44Asynchronous Transfer Mode.1-47Multiprotocol Label Switching .1-52Tutorial Review .1-55Review Answers .1-59GlossaryRelease 1.0, December 20, 2006Fujitsu and Fujitsu Customer Use Onlyi

TCP/IP Protocol Suite TutorialList of FiguresFigure 1-1: The OSI Reference Model. 1-2Figure 1-2: Comparing the OSI and TCP/IP Models . 1-4Figure 1-3: Encapsulation. 1-6Figure 1-4: The UDP Packet Structure . 1-9Figure 1-5: TCP Packet Structure. 1-12Figure 1-6: Classful Addressing. 1-15Figure 1-7: NAT . 1-16Figure 1-8: The IP Packet Structure . 1-18Figure 1-9: The Point-to-Point Protocol Frame. 1-22Figure 1-10: Ethernet Frame Formats . 1-24Figure 1-11: PPP Encapsulated in an Ethernet Frame. 1-28Figure 1-12: TCP/IP Example. 1-29Figure 1-13: Communicating at the Application Level . 1-29Figure 1-14: Using TCP to Transport HTTP Messages. 1-30Figure 1-15: Using DNS to Resolve Hostnames . 1-30Figure 1-16: Establishing a TCP/IP Connection . 1-31Figure 1-17: Invoking the IP Protocol . 1-31Figure 1-18: Using ARP to Determine MAC Addresses . 1-32Figure 1-19: Using Ethernet to Transmit an IP Datagram . 1-32Figure 1-20: Sending the Frame to the Default Gateway . 1-33Figure 1-21: Routing the Frame to the Final Destination. 1-34Figure 1-22: The 802.11 MAC Frame Format . 1-35Figure 1-23: WiMAX MAC PDU Format . 1-39Figure 1-24: Frame Relay Packet Structure . 1-43Figure 1-25: ATM Cell Structure . 1-46Figure 1-26: Mixed Service Types on an MPLS Core . 1-51Figure 1-27: The MPLS Label Stack. 1-54iiFujitsu and Fujitsu Customer Use OnlyRelease 1.0, December 20, 2006

TutorialThe TCP/IP Protocol SuiteIntroductionThis self-study tutorial satisfies the prerequisite for TransmissionControl Protocol/Internet Protocol (TCP/IP) networkingknowledge that is required for attendance at Fujitsu NetworkCommunications Inc. (FNC) Educational Services datanetworking product training /training/edservtcpip.pdfThe tutorial can be viewed using Acrobat Reader .ObjectivesFNC-500-0005-010, Guide to ATMAfter completing this lesson, the student should be able to:ATM TutorialOptional Reading Describe the OSI 7-layer networking modelEthernet Tutorial Describe the TCP/IP networking modelThe referenced optional reading can be downloaded by going tothe following URL: Define basic networking terminology Understand the various TCP/IP networking om/training/ Identify the relationships between the components of theTCP/IP protocol suiteStandardsThe student can complete the tutorial and take the self evaluationat the end of the tutorial. If the student passes the tutorial, theFNC prerequisite qualification for data networking is complete. Ifthe student does not pass the tutorial, sections in the tutorialrelating to questions missed should be reviewed. Each studentshould be familiar with concepts and terms of the tutorial prior toattending class.Distribution MethodThe data networking tutorial is available at the following Internetaddress:Release 1.0, December 20, 2006Fujitsu and Fujitsu Customer Use Only1-1

The TCP/IP Protocol SuiteTutorialFigure 1-1: The OSI Reference Model1-2Fujitsu and Fujitsu Customer Use OnlyRelease 1.0, December 20, 2006

TutorialThe TCP/IP Protocol SuiteThe OSI Reference ModelAs many networking tutorials do, this one begins with anintroduction to the Open Systems Interconnection (OSI)Reference Model (OSI Model). The OSI model is a layered,abstract description for communication and computer networkprotocol design, developed as part of the Open SystemsInterconnection initiative. It is also called the OSI 7-layer model.Session LayerPurposeThe transport layer provides transparent transfer of data betweenend users, thus relieving the upper layers from transfer concernswhile providing reliable data transfer. The transport layer controlsthe reliability of a given link through flow control, segmentation/desegmentation, and error control.The OSI model divides the functions of a protocol into a series oflayers. Each layer has the property that it only uses the functionsof the layer directly below, and only exports functionality to thelayer directly above. A system that implements protocol behaviorconsisting of a series of these layers is known as a protocol stackor simply stack. Protocol stacks can be implemented either inhardware or software, or a mixture of both. Typically, only thelower layers are implemented in hardware, with the higher layersbeing implemented in software.Application LayerThe application layer provides a means for the user to accessinformation on the network through an application. This layer isthe main interface for users to interact with the application andtherefore the network.Presentation LayerThe presentation layer transforms data to provide a standardinterface for the application layer. Encoding, data compression,data encryption and similar manipulation of the presentation isdone at this layer to present the data as a service or protocoldeveloper sees fit.Release 1.0, December 20, 2006The session layer controls the connections (sessions) betweencomputers. It establishes, manages and terminates theconnections between the local and remote application.Transport LayerNetwork LayerThe network layer provides the means of transferring datasequences from a source to a destination by using one or morenetworks while maintaining the quality of service requested bythe Transport layer. The Network layer performs network routingfunctions, and might also perform segmentation/desegmentation, and report delivery errors.Data Link LayerThe data link layer provides the means to transfer data betweennetwork entities and to detect and possibly correct errors thatmay occur in the Physical layer. It arranges bits from the physicallayer into logical chunks of data, known as frames.Physical LayerThe physical layer defines all the electrical and physicalspecifications for devices. This includes the layout of pins,voltages, and cable specifications.Fujitsu and Fujitsu Customer Use Only1-3

The TCP/IP Protocol SuiteTutorialFigure 1-2: Comparing the OSI and TCP/IP Models1-4Fujitsu and Fujitsu Customer Use OnlyRelease 1.0, December 20, 2006

TutorialThe TCP/IP Protocol SuiteThe TCP/IP Protocol SuiteThe TCP/IP protocol suite, also referred to as the Internetprotocol suite, is the set of communications protocols thatimplements the protocol stack on which the Internet and mostcommercial networks run. It is named after the two mostimportant protocols in the suite: the Transmission ControlProtocol (TCP) and the Internet Protocol (IP).The transport layer of the TCP/IP model maps fairly closely to thetransport layer of the OSI model. Two commonly used transportlayer entities are TCP and User Datagram Protocol (UDP)The TCP/IP protocol suite—like the OSI reference model—isdefined as a set of layers. Upper layers are logically closer to theuser and deal with more abstract data, relying on lower layerprotocols to translate data into forms that are transmittedphysically over the network.The Internet layer of the TCP/IP model maps to the network layerof the OSI model. Consequently, the Internet layer is sometimesreferred to as the network layer. The primary component of theInternet layer is the Internet Protocol (IP).Many of the TCP/IProuting protocols are also classified as part of the Internet layer.The TCP/IP protocol is the primary focus of this tutorial.Network Access LayerTCP/IP Model and the OSI Reference ModelThe lowest layer of the TCP/IP protocol stack is the networkaccess layer. The network access layer contains two sublayers,the media access control (MAC) sublayer and the physicalsublayer. The MAC sublayer aligns closely with the data linklayer of the OSI model, and is sometimes referred to by thatname. The physical sublayer aligns with the physical layer of theOSI model.The TCP/IP protocol suite was developed before the OSIreference model. As such, it does not directly map to the 7-layerOSI reference model. The TCP/IP protocol stack has only layersthat can be loosely mapped to the OSI protocol stack, as shownin Figure 1-2.Application LayerThe application layer of the TCP/IP model corresponds to theapplication layer of the OSI reference model.Some well known examples of application level entities within theTCP/IP domain are:Transport LayerInternet LayerNote: Some references divide the TCP/IP model into5 layers, with the MAC and physical layersoccupying the lowest two layers.Examples of the network access layer that will be discussed inthis tutorial include: FTP/Telnet/SSH Ethernet HTTP/Secure HTTP (SHTTP) Wireless Fidelity (Wi-FI)/WiMAX POP3/SMTP PPP, PPP over Ethernet (PPPoE) SNMP ATM/Frame RelayRelease 1.0, December 20, 2006Fujitsu and Fujitsu Customer Use Only1-5

The TCP/IP Protocol SuiteTutorialFigure 1-3: Encapsulation1-6Fujitsu and Fujitsu Customer Use OnlyRelease 1.0, December 20, 2006

TutorialThe TCP/IP Protocol SuiteBefore We Begin.In order to better understand the operation of the TCP/IP protocolsuite, some important concepts and terms should be understoodbeforehand.EncapsulationIn computer networking, encapsulation means including datafrom an upper layer protocol into a lower layer protocol. This is amethod of abstraction for networking that allows different layersto add features/functionality. Figure 1-3 illustrates the concept ofencapsulating data from one layer within data passed to another.Protocol Data UnitDatagramThe terms datagram and packet are often used interchangeably.However, in the strictest sense, a datagram is a packet that is nottransmitted reliably through the network. More specifically thedatagram is the PDU used by UDP and IP.SegmentA segment is the unit of data exchanged by TCP peers. It isencapsulated in a TCP packet and passed to the internetprotocol (IP).FrameIn networking, protocol data unit (PDU) is a generic term forinformation that is delivered to the next lower level in the protocolstack.Service Data UnitThe service data unit (SDU) is the data that a layer receives fromthe layer above. Generally speaking, the PDU for one layerbecomes the SDU of the next lower layer.PacketIn the generic sense, a packet is a formatted block of informationcarried by a computer network. A packet typically consists ofthree elements: a header, the payload, and a trailer.A frame is a data block of fixed or variable length which has beenformatted and encoded for digital transmission over a node-tonode link. Frames typically are used from the MAC sublayerdownward. A frame can be thought of as the physical envelopethat delivers an upper level packet or datagram.CellA cell is a 53-byte fixed-length MAC sublayer PDU used byAsynchronous Transfer Mode (ATM) networks. It serves thesame purpose as the frames used in Ethernet and Frame Relaynetworks.In the context of defining a protocol, a packet is used to passinformation between layers of the stack. The packet payloadcontains the peer-exchanged PDU data. In this way, the packetcan be thought of an envelope. The payload contains the PDUand the header provides delivery instructions to be used by thelower levels of the stack.Release 1.0, December 20, 2006Fujitsu and Fujitsu Customer Use Only1-7

The TCP/IP Protocol SuiteTutorialThe Application LayerThe application layer is the topmost level of the TCP/IP protocolsuite. It receives data from user applications and issues requeststo the transport layer. The details of moving data between theapplication and other computers is shielded by the underlyinglayers. Internet Message Access Protocol (IMAP)Application Layer Examples Simple Mail Transfer Protocol (SMTP)Applications that pass data between computers on networks areconsidered part of the application layer domain. Within theapplication layer, additional protocols may be used byapplications to interface with the transport layer. Simple Network Management Protocol (SNMP)Microsoft For example, a Web browser such asInternetExplorer exists at the application layer. The Hypertext TransferProtocol (HTTP) is incorporated into browsers to facilitatecommunicating with Web sites by invoking transport layerservices.e-mail programs, such as Microsoft Outlook depend onapplication-level protocols such as the post office protocol (POP)or the Simple Mail Transfer Protocol (SMTP) to interface with thetransport layer. Internet Relay Chat (IRC) Post Office Protocol Version 3 (POP3) Network Time Protocol (NTP) Terminal Emulation Protocol (Telnet) Uniform Resource Locator (URL) Yahoo! Messenger ProtocolAs the TCP/IP application layer maps to the OSI application,presentation and session layers, it is also responsible for detailssuch as character formats (For example, ASCII vs. EBCDIC) andbasic encryption.Application layer examples include: AIM , AOL Instant MessengerTM Protocol BitTorrent Domain Name Service (DNS) Dynamic Host Configuration Protocol (DHCP) File Transfer Protocol (FTP) Hypertext Transfer Protocol (HTTP)1-8Fujitsu and Fujitsu Customer Use OnlyRelease 1.0, December 20, 2006

TutorialThe TCP/IP Protocol SuiteThe Transport LayerWithin the TCP/IP protocol suite, the two most common transportlayer entities are the UDP and the TCP.User Datagram ProtocolThe User Datagram Protocol is very simple. The PDU used byUDP is called a datagram. Datagrams are considered unreliable,in that there is no guarantee datagrams will be received in thecorrect order, if at all. If reliability of the information transmitted isneeded, UDP should not be used.and SMTP, are assigned standard port numbers. The portnumber is used by the UDP client on the receiving end to knowwhat application to pass user data to.The UDP Packet StructureThe UDP packet structure is illustrated in Figure 1-4. It consistsof 5 fields, some of which are optional: Source Port—The sending application. This is an optionalfield.While UDP is unreliable, the lack of error checking and correctionmake UDP fast and efficient for many less data intensive or timesensitive applications, such as the Domain Name Service (DNS),the Simple Network Management Protocol (SNMP), the DynamicHost Configuration Protocol (DHCP) and the Routing InformationProtocol (RIP). UDP is also well suited for streaming video. Destination Port—The target application at the receivingend.Basic Protocol Operation Data—The user data to be transmitted.The UPD protocol is simple in operation. When invoked by theapplication layer, the UDP protocol performs the followingoperations: Length—The length of the entire packet. Checksum—Optional field used to perform basic errorcorrection on the packet.Figure 1-4: The UDP Packet Structure1. Encapsulates the user data into UDP datagrams2. Passes the datagram to the IP layer for transmissionAt the opposite end, the UDP datagram is passed up to UDPfrom the IP layer. UDP then removes the user data from thedatagram and presents it upward to the application layer.PortsA port is a number that identifies the application using the UDPservice. It can be thought of as an address for applications. Forexample, the application level protocols used for e-mail, POP3Release 1.0, December 20, 2006Fujitsu and Fujitsu Customer Use Only1-9

The TCP/IP Protocol SuiteTutorialTransmission Control ProtocolData TransferIn the TCP/IP protocol suite, TCP is the intermediate layerbetween IP below it, and an application above it. Using TCP,applications on networked hosts can establish reliableconnections to one another. The protocol guarantees in-orderdelivery of data from the sender to the receiver.A few key features set TCP apart from UDP:Basic Protocol Operation Error-free data transfer Ordered-data transfer Retransmission of lost packets Discarding of duplicate packetsThe Transmission Control Protocol is connection-oriented,meaning user data is not exchanged between TCP peers until aconnection is established between the two end points. Thisconnection exists for the duration of the data transmission.TCP connections have three phases:1. Connection establishment2. Data transfer3. Connection termination Congestion throttlingError Free Data TransferError-free data transfer is guaranteed by TCP. It does this bycalculating a 16-bit checksum over the TCP packet (header anddata). At the receiving end, if the checksum does not match thecontents of the packet, it is discarded. Because the sending sidedoes not receive an acknowledgement of the discarded packet, itis retransmitted.Connection EstablishmentOrdered-Data TransferTo establish a connection, TCP uses a 3-way handshake. Beforea client attempts to connect with a server, the server must firstbind to a port to open it up for connections. This is called apassive open. Once the passive open is established, a client mayinitiate an active open. The server then sends anacknowledgement to the client. At this point, both the client andserver have received an acknowledgement of the connection.Streams of data called segments are used by TCP peers tospeak to each other. The segments can be quite large, so TCPbreaks up the segments into smaller units of data. These unitsare encapsulated in the TCP packet that is passed to the IPprotocol. Each unit of data is assigned a sequence number,which becomes part of the TCP packet. At the receiving end, theTCP module uses the sequence numbers in the packet toreconstruct the user data in the correct order.1-10Fujitsu and Fujitsu Customer Use OnlyRelease 1.0, December 20, 2006

TutorialThe TCP/IP Protocol SuiteRetransmission of Lost PacketsConnection TerminationWhen transmitting large amounts of data, it is not unusual forsome information to get lost along the way. In order to guaranteereliable transfer of data, TCP requires an acknowledgement ofeach packet it sends. This acknowledgement is sent by the TCPmodule at the receiving host. If an acknowledgement is notreceived within a specified time period, it will be retransmitted.The connection termination phase uses, at most, a four-wayhandshake, with each side of the connection terminatingindependently. When an end point wishes to stop its half of theconnection, it transmits a special packet with a flag indicating it isfinished. The other end acknowledges the flag. A typicalconnection termination includes this two-phase handshake fromboth ends of the connection.Discarding Duplicate PacketsThe TCP client retransmits packets that it determines to be lost.The TCP module at the receive side may eventually receivepackets that were considered to be lost after the sending sidehas retransmitted the data. This may result in the receiving endreceiving two or more copies of the same packet. The receivingend TCP module uses the unique sequence numbers in thepacket to determine if data duplication has occurred and discardsany packets it determines to be duplicates.Congestion ThrottlingThe final property of TCP is congestion throttling or flow control.The goal is for TCP to be able to send data to the receiving endat the fastest rate possible, without overwhelming it.TCP SocketsTransmission Control Protocol is connection-oriented. A virtualconnection is first created then maintained through the durationof data transfer. The end points of the connection between TCPpeers are called sockets. A socket is identified by a combinationof the source host address and port together with the destinationhost address and port. Arriving TCP data packets are identifiedas belonging to a specific TCP connection by its socket. From alogical standpoint, TCP peers communicate directly with eachother over the socket connection. In reality, reading and writingpackets to a socket is how TCP interfaces with the IP layer belowit.When TCP first begins transmitting data to the far end, it sets atimer. The timer determines how long the sender should wait fora packet to be acknowledged before retransmitting it. If allpackets are received well before the timer expires, TCP willincrementally increase the transmission speed, until packetsbegin to become unacknowledged during the time out period.When a significant number of packets have to be retransmitted,TCP slows down the rate at which it sends data to the other end.Release 1.0, December 20, 2006Fujitsu and Fujitsu Customer Use Only1-11

The TCP/IP Protocol SuiteTutorialTCP Packet StructureA TCP packet consists of two sections, header and data. Allfields may not be used in every transmission. A flag field is usedto indicate the type of transmission the packet represents andhow the packet should be interpreted.The header consists of 11 fields, of which 10 are required: Source port—Identifies the sending application. Urgent pointer—If the URG flag is set, then this 16-bit fieldis an offset from the sequence number indicating the lasturgent data byte. Options—Additional header fields (called options) mayfollow the urgent pointer. Data—The contents of this field are the user data beingtransmitted between two application level entities. Destination port—Identifies the destination application.Figure 1-5: TCP Packet Structure Sequence number—Used for assembling segmented datain the proper order at the receiving end. Acknowledgement number—The sequence number thesender (the receiving end) expects next. Data offset—The size of the TCP header, it is also theoffset from the start of the TCP packet to the data portion. Reserved—Reserved for future use, should be set to zero. Flags (also known as control bits)—contains 6 1-bit flags:- URG—Urgent pointer field is significant.- ACK—Acknowledgement field is significant.- PSH—Push function.- RST—Reset the connection.- SYN—Synchronize sequence numbers.- FIN—No more data from sender. Window—The number of bytes the sender is willing toreceive starting from the acknowledgement field value. Checksum—used for error-checking of the header anddata.1-12Fujitsu and Fujitsu Customer Use OnlyRelease 1.0, December 20, 2006

TutorialThe TCP/IP Protocol SuiteApplications that use TCPThe following is a list of common applications that directly usethe reliable data transfer services provided by TCP: File Transfer Protocol (FTP)—Provides a mechanism formoving data files between systems. The FTP client andserver programs, as well as most Web browsers, contain animplementation of the FTP protocol. HyperText Transfer Protocol (HTTP)—Protocol used tomove Web pages across an internet connection. The HTTPprotocol is built into Web browsers and Web servers. Interactive Mail Access Protocol (IMAP)—Provides clientsaccess to e-mail messages and mailboxes over a network.It is incorporated into e-mail applications. Post Office Protocol (POP)—Allows clients to read andremove e-mail residing on a remote server. It isincorporated into e-mail applications. Remote Login (Rlogin)—Provides network remote logincapability. Simple Mail Transfer Protocol (SMTP)—Used to deliver email from one system to another. It is incorporated into email applications. Secure Shell (SSH)—Provides remote access to computerswhile providing encryption of the data. Telnet—Provides network terminal, or remote logincapability.Release 1.0, December 20, 2006Fujitsu and Fujitsu Customer Use Only1-13

The TCP/IP Protocol SuiteTutorialThe Internet LayerThe Internet layer is the third layer in the TCP/IP protocol suite.The Internet layer responds to service requests from thetransport layer (typically TCP or UDP) and issues servicerequests to the network access layer.The various Internet layer modules provide: Translation between logical addresses and physicaladdresses Routing from the source to the destination computer Managing traffic problems, such as switching, routing, andcontrolling the congestion of data packets Maintaining the quality of service requested by the transportlayerThe transport layer is responsible for application-to-applicationdata delivery. The Internet layer is responsible for source host todestination host packet delivery, whereas the next layer (networkaccess) is responsible for node to node (hop to hop) framedelivery.1-14Fujitsu and Fujitsu Customer Use OnlyRelease 1.0, December 20, 2006

TutorialThe TCP/IP Protocol SuiteThe Internet ProtocolThe Internet Protocol (IP) is a data-oriented protocol used forcommunicating data across a network. It is a best effort protocol;it does not guarantee delivery. It also makes no guarantee as tothe correctness of the data it transports. Transmission using IPmay result in duplicated packets and/or packets out-of-order. Allof these contingencies are addressed by an upper layer protocol(For example, TCP) for applications that require reliable delivery.Class B addresses support 65,000 hosts on each of 16,000networks.Class C addresses support 254 hosts on each of 2 millionnetworks.Figure 1-6: Classful AddressingIP AddressingThe IP peers address each other using IP addresses. An IPaddress is a logical identifier for a computer or device on anetwork. The key feature of IP addresses is that they can berouted across networks.The format of an IP address is a 32-bit numeric address writtenas four numbers separated by periods, sometimes referred to asa dotted-q

The TCP/IP protocol suite, also referred to as the Internet protocol suite, is the set of communications protocols that implements the protocol stack on which the Internet and most commercial networks run. It is named after the two most important protocols in the suite: the Transmission Control Protocol (TCP) and the