Week1_NetworkTutorial

Embed Size (px)

DESCRIPTION

Networking theory Basics

Citation preview

  • Brief Tutorial onNetworks and CommunicationsCS-4513 Distributed Systems (Slides include materials from Operating System Concepts, 7th ed., by Silbershatz, Galvin, & Gagne, Distributed Systems: Principles & Paradigms, 2nd ed. By Tanenbaum and Van Steen, and Distributed Systems: Concepts and Design, 4th ed., by Coulouris, et. al.)

    Networks and Communications

  • ContextNetworking was formerly regarded as just another form of I/OToday, focus is Distributed ComputingShared files and other resources among physically separated systems on networksNFS, remote printing, etc.Integrated computations across networkAirline reservations, ATMs, etc.Interactive games and multimediaNote: this topic overlaps with CS-3516Also with CS-513/ECE-506

    Networks and Communications

  • TopicsFundamentalsSocket interfaceProtocol StackKinds of network connectionsKinds of CommunicationRemote Procedure CallMessage-oriented communicationStream-oriented communicationNamingNames, addresses, routes

    Networks and Communications

  • Networks and Communications

  • Network GoalAllow activities on multiple computer systems to communicate with each otherShared memory, files, or dataMessage passingRemote Procedure CallIntegrated applications distributed across physical spaceCreate abstractions that make these (relatively) transparent

    Networks and Communications

  • Principal Abstraction SocketOriginally created in BSD UnixSubsequently, part of most operating systemsAllows opening a connection between two processes across networkConnection: a serial conversation between two end pointse.g., processes, threads, tasks on different machinesorganized as a sequence of messages or datagramsdistinct from all other connections

    Networks and Communications

  • Networks and Communications

  • Definition ProtocolFormal set of rules that govern the formats, contents, and meanings of messages from computer to computer, process to process, etc.

    Must be agreed to by all parties to a communication

    May be defined in terms of other protocols

    Networks and Communications

  • There are many, many protocolsTCP, UDP, IP, NCP, SMTP, SNNP, NNTP, FTP, TFTP, POP, IMAP, HTTP, VMRL, Appletalk, Netware, Remote Procedure Call, NFS, CORBA, GLOBE, JINI, Network Streaming, How to make sense out of all of them?

    Networks and Communications

  • Network Stack1983 Open System Interconnection (OSI) 7 layer Reference ModelWorking group of the International Standards Organization (ISO)Defines seven layersDescribe how applications communicate with each otherVia network-aware devices Most day-to-day protocolswork on a slightly modified layer systemE.g. TCP/ IP uses a 6-rather than a 7-layer model

    Networks and Communications

  • OSI 7-layer modelPrimarily a software and protocol architecture Layers of model correspond to layers of abstractionEach layer has a well-defined functionLayers chosen so that international standards can be definedBoundaries between layers chosen to minimize information flow across interfacesNumber of layers:Large enoughDistinct functions need not be thrown togetherSmall enough Architecture does not become unwieldy

    Networks and Communications

  • The OSI 7-layer model(in a nutshell)Silbershatz, 16.6-16.7 Coulouris et al, 3.3.4

    Networks and Communications

  • Annotated OSI 7-Layer StackSilbershatz, page 630

    Networks and Communications

  • The OSI 7-layer model (continued)Layer 2 Data Link LayerTake the raw transmission facility and transform it into an abstract link that appears free of errors to layer 3.Error correcting coding (e.g. FEC)Rate Control (Slow device not overrun by high speed device)Defines Packet abstractionLayer 1 Physical LayerDefines the physical and electrical characteristics of the network. Transmitting of raw bits over the communication channelDefines Bit abstractionPhysical LayerData LinkLayerNetworkLayerTransportLayerSessionLayerPresentationLayerApplicationLayer

    Networks and Communications

  • The OSI 7-layer model (continued)Layer 2 Data Link LayerTake the raw transmission facility and transform it into an abstract link that appears free of errors to layer 3.Error correcting coding (e.g. FEC)Rate Control (Slow device not overrun by high speed device)Defines Packet abstractionLayer 1 Physical LayerDefines the physical and electrical characteristics of the network. Transmitting of raw bits over the communication channelDefines Bit abstraction

    Networks and Communications

  • The OSI 7-layer model (continued)Layer 3 Network LayerControlling the operation of the subnet How packets are routedCongestion ControlAccounting function (billing)Network StatisticsExample - IP layer (IPv4, IPv6)Differences between v4, v6 source/destination addressingV4 32 bit addressingV6 128 bit addressingDefines Internet abstraction i.e., packets that can be sent from anywhere to anywhere

    Networks and Communications

  • The OSI 7-layer model (continued)Layer 4 Transport LayerAccept data from higher layersSplit it up into smaller units if need bePasses these to the network layerEnsures that the packets all arrive correctly at the destination in the right orderIsolates higher layers from changes in the underlying hardwareTwo types of service to provideReliable or unreliable deliveryTrue end-to-end layer Example: TCP or UDP Defines Connection abstraction i.e., data to destination

    Networks and Communications

  • The OSI 7-layer model (continued)Layer 7 Application LayerUser layer protocol, multiple protocols requiredExample http, ftp, smtp Layer 6 Presentation LayerPerforms certain functions that are requested sufficiently often to warrant finding a general solution for them rather than letting each user solve the problemExample encoding data Layer 5 - Session LayerAllows users on different machines to establish sessions between themExample SSL, RPC

    Networks and Communications

  • Summary OSI 7-layer model

    Networks and Communications

  • Layered ProtocolsOSI 7-layer model was intended to be a foundation of a family of international standard protocolsThose protocols never gained much acceptanceRole of Session and Presentation layers is murky, at best.Internet protocols (TCP/IP, etc.) are dominant

    Networks and Communications

  • The TCP/IP Protocol Layers

    Networks and Communications

  • The TCP/IP Protocol LayersDefined by manufacturers, industry sub-groups, and separate standards bodiesSubsumed by middleware

    Networks and Communications

  • Modified Layers

    Networks and Communications

  • Examples of MiddlewareAuthentication protocolsCommit protocols for atomic transactionsMultimedia protocolsRemote Procedure Call protocols (RPC)

    Networks and Communications

  • Styles of CommunicationMessage-orientedRemote Procedure CallStreaming

    Networks and Communications

  • Some TermsPacket:A unit of communication at Data Link layeraka datagramIP Address:A four-part number used by Network Layer to route a packet from one computer to anotherPort:A 16-bit number used within one computer to identify who/where to send packet toWell-known port:A port with number < 1024, used by agreement for standard services e.g.,telnet (23), ftp (21), smtp (25), pop (110)

    Networks and Communications

  • More TermsSocket:End point of a communicationUsually used in pairs, one for each directionComprises [IP Address: Port #]Connection:A logical linkage between pairs of sockets at two endpoints for purposes of a particular communication between those endpointsi.e., a serial conversation between endpointsUsually two-way

    Networks and Communications

  • ConnectionThe backbone of most message-oriented communication protocolsEach party retains knowledge of the otherEach party retains information about state of the other (vis a vis the protocol itself)Each party knows if connection is broken

    Note: some popular protocols are connection-less one side retains no state information about other side

    Networks and Communications

  • Establishing a ConnectionProcess a on machine m creates a socketOS assigns a new port number q to that socketProcess a attempts to open a connection to machine n:pp is a well-known portProcess b on machine n is listening on pReceives request from m:qProcess b forks a process or spawns a thread c to talk with m:q, then resumes listening on pThread/process cCreates a new socket r for this connectionReplies to m:q with return address n:ra and c continue to communicate over this pair of sockets until they are finished.

    Networks and Communications

  • Typical Client-Server ConnectionCreate socket On server sideBind I.e., connect socket to port # (usually well-known port)ListenSit and wait for a communication to come inAcceptCreate new socket for purpose of responding to this caller

    Networks and Communications

  • NotesResponder to request for connection does not have to be the original server machineDelegate workload to other server systemsSystems often include a connection ID as part of request to open connectionUnique or randomly chosenReduces spoofing of server responsesUnix/Linux will not re-use a socket # within 30 secondsTo avoid confusion between old connection and new

    Networks and Communications

  • Reliable ConnectionsTransport layer partitions messages into packetsTCP Transmission Control ProtocolSequence number of current packetSequence number of last packet received correctlyReceiver keeps track of seq. # of packetsReassembles in right orderNotify sender of missing, broken packetsSender keeps copy of each packet until receipt acknowledgedRetransmits packets if no acknowledgementWindow defines how many packet buffers to maintain for efficient transmissionAllows many packets in flight

    Networks and Communications

  • Reliable Connections (continued)Packet iPacket i+1Packet i+2Packet i+3Packet i+ktimerecd i

    Networks and Communications

  • Reliable Connections (continued)Packet iPacket i+1Packet i+2Packet i+3Packet i+ktimerecd irecd i

    Networks and Communications

  • Reliable Connections (continued)Packet iPacket i+1Packet i+2Packet i+3Packet i+ktimerecd irecd irecd i+2

    Networks and Communications

  • Reliable Connections (continued)Packet iPacket i+1Packet i+2Packet i+3Packet i+ktimerecd irecd irecd i+2recd i+2lost

    Networks and Communications

  • Reliable Connections (continued)If acknowledgement received for packet iDelete from buffer all packets iIf no acknowledgement received within a reasonable time for packet kRetransmit from buffer all packets kResultRecovers from loss of packetsRecovers from loss of acknowledgementsWorks well for reasonably reliable internetDoesnt work so well for noisy, unreliable networks

    Networks and Communications

  • ReminderHow do we know if a packet is received correctly?Cyclic Redundancy Check (CRC)Polynomial computed from packet header and bodyUsually 16 or 32 bits, computed by hardwareAppended to messageRecomputed on reception, compared with transmitted CRCEqual packet received correctly

    Networks and Communications

  • Examples of Connection-based ProtocolsTelnet (virtual terminal)2-way communication by character streamLine-by-line organizationSMTP (Simple Mail Transport Protocol)For sending mailLayered on top of telnet protocolPOP (Post Office Protocol)For receiving your mailLayered on top of telnet protocolFTP (File Transfer Protocol)For transmitting ASCII or binary filesBinary data transmission not layered on telnet protocol

    Networks and Communications

  • Connection-less communicationSome communication protocols dont need the overhead of reliable connectionsWhen some number of errors can be toleratedWhere recovery from those errors is easy

    UDP User Datagram ProtocolThe internet connection-less protocol (layer 4)Breaks messages into packetsMessages delivered atomically or not at allDoes not send acknowledgement of correct receipt

    Networks and Communications

  • ExamplesHTTP (HyperText Transport Protocol)Web server responds directly to requestsIf client does not get response, retries requestNFS (Network File System)For access to files on servers as if they are localIf client does not get response, retries requestRPC (Remote Procedure Call)Next topic

    Networks and Communications

  • SummarySocket, connectionNetwork stack, 7-layer modelEstablishing a connectionReliable transmission

    Reading assignmentCoulouris, Chapter 3

    Networks and Communications