Скачать презентацию Chapter 3 Transport Layer A note on the Скачать презентацию Chapter 3 Transport Layer A note on the

eb7eeb93a1effb239d4798e90a85b073.ppt

  • Количество слайдов: 32

Chapter 3 Transport Layer A note on the use of these ppt slides: We’re Chapter 3 Transport Layer A note on the use of these ppt slides: We’re making these slides freely available to all (faculty, students, readers). They’re in Power. Point form so you can add, modify, and delete slides (including this one) and slide content to suit your needs. They obviously represent a lot of work on our part. In return for use, we only ask the following: v If you use these slides (e. g. , in a class) in substantially unaltered form, that you mention their source (after all, we’d like people to use our book!) v If you post any slides in substantially unaltered form on a www site, that you note that they are adapted from (or perhaps identical to) our slides, and note our copyright of this material. Computer Networking: A Top Down Approach 5 th edition. Jim Kurose, Keith Ross Addison-Wesley, April 2009. Thanks and enjoy! JFK/KWR All material copyright 1996 -2010 J. F Kurose and K. W. Ross, All Rights Reserved Transport Layer 3 -1

Chapter 3: Transport Layer Our goals: v understand principles behind transport layer services: § Chapter 3: Transport Layer Our goals: v understand principles behind transport layer services: § multiplexing/demultipl exing § reliable data transfer § flow control § congestion control v learn about transport layer protocols in the Internet: § UDP: connectionless transport § TCP: connection-oriented transport § TCP congestion control Transport Layer 3 -2

Chapter 3 outline 3. 1 Transport-layer services 3. 2 Multiplexing and demultiplexing 3. 3 Chapter 3 outline 3. 1 Transport-layer services 3. 2 Multiplexing and demultiplexing 3. 3 Connectionless transport: UDP 3. 4 Principles of reliable data transfer 3. 5 Connection-oriented transport: TCP § segment structure § flow control § connection management 3. 6 Principles of congestion control 3. 7 TCP congestion control Transport Layer 3 -3

Transport services and protocols v al ic d en d- en t or sp Transport services and protocols v al ic d en d- en t or sp an tr v g lo v provide logical communication between app processes running on different hosts transport protocols run in end systems § send side: breaks app messages into segments, passes to network layer § rcv side: reassembles segments into messages, passes to app layer more than one transport protocol available to apps § Internet: TCP and UDP application transport network data link physical Transport Layer 3 -4

Transport vs. network layer v v network layer: logical communication between hosts transport layer: Transport vs. network layer v v network layer: logical communication between hosts transport layer: logical communication between processes § relies on, enhances, network layer services Household analogy (pg 200): 12 kids sending letters to 12 kids v processes = kids v app messages = letters in envelopes v hosts = houses v transport protocol = Ann and Bill who demux to in-house siblings v network-layer protocol = postal service Transport Layer 3 -5

Internet transport-layer protocols v reliable, in-order delivery (TCP) network data link physical network d Internet transport-layer protocols v reliable, in-order delivery (TCP) network data link physical network d t network data link physical or sp an tr services not available: en d- v network data link physical en § no-frills extension of “best-effort” IP § connectionless al unreliable, unordered delivery: UDP network data link physical ic v congestion control flow control connection setup connection-oriented g lo § § application transport network data link physical § delay guarantees § bandwidth guarantees Transport Layer 3 -6

Chapter 3 outline 3. 1 Transport-layer services 3. 2 Multiplexing and demultiplexing 3. 3 Chapter 3 outline 3. 1 Transport-layer services 3. 2 Multiplexing and demultiplexing 3. 3 Connectionless transport: UDP 3. 4 Principles of reliable data transfer 3. 5 Connection-oriented transport: TCP § segment structure § flow control § connection management 3. 6 Principles of congestion control 3. 7 TCP congestion control Transport Layer 3 -7

Multiplexing/demultiplexing Multiplexing at send host: gathering data from multiple sockets, enveloping data with header Multiplexing/demultiplexing Multiplexing at send host: gathering data from multiple sockets, enveloping data with header (later used for demultiplexing) Demultiplexing at rcv host: delivering received segments to correct socket = socket application transport network link = process P 3 P 1 application transport network P 2 P 4 application transport network link physical host 1 physical host 2 physical host 3 Transport Layer 3 -8

How demultiplexing works v host receives IP datagrams § each datagram has source IP How demultiplexing works v host receives IP datagrams § each datagram has source IP address, destination IP address § each datagram carries 1 transport-layer segment § each segment has source, destination port number v IP addresses & port numbers used to direct segment to appropriate socket 32 bits source port # dest port # other header fields application data (message) TCP/UDP segment format Transport Layer 3 -9

Connectionless demux different source ports are delivered to the same socket P 2 SP: Connectionless demux different source ports are delivered to the same socket P 2 SP: 6428 DP: 9157 SP: 6428 DP: 5775 SP: 9157 client IP: A P 1 P 3 DP: 6428 server IP: C two-tuple: dest IP/dest port SP: 5775 DP: 6428 Client IP: B SP provides “return address” Transport Layer 3 -10

Connection-oriented demux v TCP socket identified by 4 -tuple: § § v source IP Connection-oriented demux v TCP socket identified by 4 -tuple: § § v source IP address source port number dest IP address dest port number recv host uses all four values to direct segment to appropriate socket v server host may support many simultaneous TCP sockets: § each socket identified by its own 4 -tuple v web servers have different sockets for each connecting client § non-persistent HTTP will have different socket for each request Transport Layer 3 -11

Connection-oriented demux (cont) different source ports are delivered to different sockets P 1 P Connection-oriented demux (cont) different source ports are delivered to different sockets P 1 P 4 P 5 P 2 P 6 P 1 P 3 SP: 5775 DP: 80 S-IP: B D-IP: C client IP: A SP: 9157 DP: 80 S-IP: A D-IP: C SP: 9157 server IP: C DP: 80 S-IP: B D-IP: C Client IP: B four-tuple!! Transport Layer 3 -12

Connection-oriented demux: Threaded Web Server P 1 P 2 P 4 P 1 P Connection-oriented demux: Threaded Web Server P 1 P 2 P 4 P 1 P 3 SP: 5775 DP: 80 S-IP: B D-IP: C client IP: A SP: 9157 DP: 80 S-IP: A D-IP: C SP: 9157 server IP: C DP: 80 S-IP: B D-IP: C client IP: B Transport Layer 3 -13

Port Scanning w/ nmap (http: //insecure. org/nmap) is a tool that scans a host Port Scanning w/ nmap (http: //insecure. org/nmap) is a tool that scans a host to see what TCP and UDP ports it is currently listening too. You can use this to find out what network services are provided by a server. These services are also “open doors” that may be potential security holes. Transport Layer 3 -14

Chapter 3 outline 3. 1 Transport-layer services 3. 2 Multiplexing and demultiplexing 3. 3 Chapter 3 outline 3. 1 Transport-layer services 3. 2 Multiplexing and demultiplexing 3. 3 Connectionless transport: UDP 3. 4 Principles of reliable data transfer 3. 5 Connection-oriented transport: TCP § segment structure § flow control § connection management 3. 6 Principles of congestion control 3. 7 TCP congestion control Transport Layer 3 -15

UDP: User Datagram Protocol v v v “no frills, ” “bare bones” Internet transport UDP: User Datagram Protocol v v v “no frills, ” “bare bones” Internet transport protocol “best effort” service, UDP segments may be: § lost § delivered out of order to app connectionless: § no handshaking between UDP sender, receiver § each UDP segment handled independently of others [RFC 768] Why is there a UDP? v v no connection establishment (which can add delay) simple: no connection state at sender, receiver small segment header no congestion control: UDP can blast away as fast as desired Transport Layer 3 -16

UDP: more v often used for streaming multimedia Length, in apps § loss tolerant UDP: more v often used for streaming multimedia Length, in apps § loss tolerant § rate sensitive v other UDP uses bytes of UDP segment, including header § DNS § SNMP v reliable transfer over UDP: add reliability at application layer § application-specific error recovery! 32 bits source port # dest port # length checksum Application data (message) UDP segment format Transport Layer 3 -17

UDP checksum Goal: detect “errors” (e. g. , flipped bits) in transmitted segment Sender: UDP checksum Goal: detect “errors” (e. g. , flipped bits) in transmitted segment Sender: v v v treat segment contents as sequence of 16 -bit integers checksum: addition (1’s complement sum) of segment contents sender puts checksum value into UDP checksum field Receiver: v v compute checksum of received segment check if computed checksum equals checksum field value: § NO - error detected § YES - no error detected. But maybe errors nonetheless? More later …. Transport Layer 3 -18

Calculating a 1 s Complement Checksum v Note: when adding numbers, a carryout from Calculating a 1 s Complement Checksum v Note: when adding numbers, a carryout from the most significant bit needs to be added to the result 1 1 0 0 1 1 1 0 1 0 1 + wraparound 1 + sum 1 1 0 1 1 1 0 1 1 0 0 “flip the bits” 1 s complement checksum 0 1 0 0 1 1 Transport Layer 3 -19

Internet Checksum Example sender calculates the checksum 0 1 0 0 1 1 send Internet Checksum Example sender calculates the checksum 0 1 0 0 1 1 send the original two 16 -bit numbers plus the checksum to the receiver calculates 1 0 1 1 0 0 the sum adds the checksum + 0 1 0 0 1 1 no errors! 1 1 1 1 Transport Layer 3 -20

Why does UDP Perform Error Checking? v No guarantee that link layer will do Why does UDP Perform Error Checking? v No guarantee that link layer will do it § Ethernet does v UDP is end-to-end error checking, the link layer provides link-to-link error checking § Bit errors may be introduced between the links, e. g. , in the router’s memory, which will not be detected by the link layer v NOTE: UDP does nothing to correct errors, it either drops the bad segment, or passes it to the application layer with a warning Transport Layer 3 -21

Chapter 3 outline 3. 1 Transport-layer services 3. 2 Multiplexing and demultiplexing 3. 3 Chapter 3 outline 3. 1 Transport-layer services 3. 2 Multiplexing and demultiplexing 3. 3 Connectionless transport: UDP 3. 4 Principles of reliable data transfer 3. 5 Connection-oriented transport: TCP § § segment structure reliable data transfer flow control connection management 3. 6 Principles of congestion control 3. 7 TCP congestion control Transport Layer 3 -22

Principles of Reliable data transfer v v top-10 list of important networking topics! characteristics Principles of Reliable data transfer v v top-10 list of important networking topics! characteristics of unreliable channel will determine complexity of reliable data transfer protocol (rdt) Transport Layer 3 -23

Principles of Reliable data transfer v v top-10 list of important networking topics! characteristics Principles of Reliable data transfer v v top-10 list of important networking topics! characteristics of unreliable channel will determine complexity of reliable data transfer protocol (rdt) Transport Layer 3 -24

Principles of Reliable data transfer v v top-10 list of important networking topics! characteristics Principles of Reliable data transfer v v top-10 list of important networking topics! characteristics of unreliable channel will determine complexity of reliable data transfer protocol (rdt) Transport Layer 3 -25

Reliable data transfer: getting started rdt_send(): called from above, (e. g. , by app. Reliable data transfer: getting started rdt_send(): called from above, (e. g. , by app. ). Passed data to deliver to receiver upper layer send side udt_send(): called by rdt, to transfer packet over unreliable channel to receiver deliver_data(): called by rdt to deliver data to upper receive side rdt_rcv(): called when packet arrives on rcv-side of channel Transport Layer 3 -26

Reliable data transfer: getting started We’ll: v incrementally develop sender, receiver sides of reliable Reliable data transfer: getting started We’ll: v incrementally develop sender, receiver sides of reliable data transfer protocol (rdt) v consider only unidirectional data transfer § but control info will flow on both directions! v use finite state machines (FSM) to specify sender, receiver event causing state transition actions taken on state transition state: when in this “state” next state uniquely determined by next event state 1 event actions state 2 Transport Layer 3 -27

Finite State Machines v v Finite state machines model behavior Behavior exists as transitions Finite State Machines v v Finite state machines model behavior Behavior exists as transitions from state to state Transitions are initiated by input or events Transitions are often accompanied by output or actions

Elevator Example Elevator Example

Pattern Recognizer Pattern Recognizer

Even or Odd? Even or Odd?

Rdt 1. 0: v reliable transfer over a reliable channel underlying channel perfectly reliable Rdt 1. 0: v reliable transfer over a reliable channel underlying channel perfectly reliable § no bit errors § no loss of packets v separate FSMs for sender, receiver: § sender sends data into underlying channel § receiver read data from underlying channel Wait for call from above rdt_send(data) packet = make_pkt(data) udt_send(packet) sender Wait for call from below rdt_rcv(packet) extract (packet, data) deliver_data(data) receiver Transport Layer 3 -32