Transport by wuyunyi


									             Transport Layer: Basics
             Homework #2 solutions
             Intro to transport
             Congestion control basics

Fall, 2001                      CS 640   1
                      Homework #2 - Solutions
•   8.8: Q: Why is server unsure of client’s ID until it receives 3rd message? What attack is
    server exposed to without 3rd message?
     – A: A bad guy could replay message exchange of prior transaction.
•   8:19: Q: How can DES be used to encrypt Telnet sessions?
     – A: Use padding. But, padding with eg. seven zero bytes is vulnerable to code breaking. So,
       you could pad with random bytes or pad with zero’s and then do cipher block chaining.
•   8:24: Q: Assume filtering routers given in the diagram. How must they be configured so
          that outsiders can Telent to net 2 but not net 1?
     – A: R1 blocks inbound traffic to the Telent port unless it is bound for net 2. R2 blocks all Telent
       traffic from net 2 to net 1.

                                                    R1        Net 1        R2
                                                                                   Net 2
                   Outside World

      Fall, 2001                                 CS 640                                           2
            Homework #2 Solutions contd.
• Pings:
   – Berkeley: ~56ms, Germany: ~124ms, Singapore: ~300ms
   – Berkeley: 0% loss, Germany: 0% loss, Singapore: 10% loss
• Traceroute (outgoing)
         • Berkeley: 13 hops (Abilene),
         • Germany: 19 hops (BBN, Sprint, Ebone)
         • Singapore: 17 hops (Abovenet)
• Traceroute (incoming)
         • Berkeley: 14 hops (Abilene)
         • Germany: 19 hops (Ebone, Spring, BBN)
         • Singapore: 19 hops (BBN)

    Fall, 2001                         CS 640                   3
                 Context – up to now…
• Basics of the Internet
   – Layering and protocols
• Packet switching vs. circuit switching
   – Internet vs. telephone network
   – Packet switching/statistical multiplexing improves utilization
   – Packets can be lost or corrupted
• Applications generate data transferred over networks
   – We have talked about a few…
• Measurement and performance
   – What does traffic look like?

   Fall, 2001                        CS 640                           4
To Boldly Go Where We Have Yet to Go
• Recall Internet Architecture                                           5

      – Layers used to define functionality                Transport

      – Our focus up to now has been layer 5                Network
             • Applications demand reliable transport
             • Application may demand predictable delays                 2

• We are now going down to layer 4                                       1

      – This layer is tricky!
      – Goal at the end of the next two weeks is an
        understanding of the Reno version of TCP

Fall, 2001                          CS 640                           5
  Layering and Encapsulation Revisited
• Each layer in the Internet architecture relies on layers
  below to provide services in black box fashion
   –   Layers make complex system easier to understand and specify
   –   Makes implementation more flexible
   –   Can make implementation a bigger and less efficient
   –   Layers are implemented by protocols – rules for communication
• Data from applications moves up and down protocol stack
   – Application level data is chopped into packets (segments)
   – Encapsulation deals with attaching headers at layers 2, 3, 4
   Fall, 2001                   CS 640                              6
• Encapsulation (header/body)

                              Host 1                                  Host 2
                  Application                         Application
                   program                             program

                 Data                                          Data

                        RRP                              RRP

             RRP Data                                         RRP Data

                        HHP                             HHP

                                       HHP RRP Data

Fall, 2001                                                                     7
                     End-to-End Protocols
• Underlying network is best-effort
      –      drop messages
      –      re-orders messages
      –      delivers duplicate copies of a given message
      –      limits messages to some finite size
      –      delivers messages after an arbitrarily long delay
• Common end-to-end services
      –      guarantee message delivery
      –      deliver messages in the same order they are sent
      –      deliver at most one copy of each message
      –      support arbitrarily large messages
      –      support synchronization
      –      allow the receiver to flow control the sender
      –      support multiple application processes on each host
Fall, 2001                               CS 640                    8
      Basic function of transport layer
• How can processes on different systems get the right
• Ports are numeric locators which enable messages to be
  demultiplexed to proper process.
      – Ports are addresses on individual hosts, not across the Internet.
• Ports are established using well-know values first
      – Port 80 = http, port 53 = DNS
• Ports are typically implemented as message queues
• Simplest function of the transport layer:
  multiplexing/demultiplexing of messages
      – Enables processes on different systems to communicate
      – End-to-end since only processes on end hosts invoke this protocol

Fall, 2001                          CS 640                                  9
           Other transport layer functions
• Connection control
    – Setting up and tearing down communication between processes
• Error detection within packets – our first focus
    – Checksums
• Reliable, in order delivery of packets – our second focus
    – Acknowledgement schemes
• Flow control
    – Matching sending and receiving rates between end hosts
• Congestion control
    – Managing congestion in the network

  Fall, 2001                       CS 640                           10
        User Datagram Protocol (UDP)
•   Unreliable and unordered datagram service
•   Adds multiplexing/demultiplexing
•   Adds reliability through optional checksum
•   No flow or congestion control
•   Endpoints identified by ports
      – servers have well-known ports
      – see /etc/services on Unix           0              16                31

• Header format                                  SrcPort          DstPort

                                                Checksum          Length


• Optional checksum
      – Computed over psuedo header + UDP header + data

Fall, 2001                      CS 640                                      11
                  UDP Checksums
• Optional in current Internet
• Psuedoheader consists of 3 fields from IP header:
  protocol number (TCP or UDP), IP src, IP dst and
  UDP length field
      – Psuedoheader enables verification that message was
        delivered between correct source and destination.
      – IP dest address was changed during delivery, checksum
        would reflect this
• UDP uses the same checksum algorithm as IP
      – Internet checksum
Fall, 2001                   CS 640                         12
                Basics of dealing with errors
• Bit errors can be introduced in packets
• This problem has been studied for a long time
   – Error detection (and correction) codes
   – Cyclic redundancy check (CRC) is a common error detection method
• Basic idea of any scheme is to add redundant data
   – Extreme example – send two identical copies of data
         • Poor for many reasons
   – A primary goal is to send minimal amount of redundant data
         • CRC used in Ethernet has 32 bits for each 1500 byte packet
   – Another goal is to make generation of checksum fast

   Fall, 2001                            CS 640                         13
                  Checksum basics contd.
• Simple parity is the most basic method for error detection
    – Odd/even parity
• Internet Checksum
    – Basic idea: sender adds up all words and transmit the sum
          • Add using 16 bit one’s complement arithmetic then take one’s complement of
            the result to get checksum
    – Receiver adds up all words and compares with checksum
    – It’s very simple and efficient to code this
          • Reason that this is used instead of CRC
    – Not really great detecting errors
          • CRC is much stronger
• Forward error correction is another possibility
   Fall, 2001                            CS 640                                  14
                         UDP in practice
• Minimal specification makes UDP very flexible
      – Any kind of end-to-end protocol can be implemented
             • See programming assignment #1
             • TCP can be implemented using UDP
• Examples
      – Most commonly used in multimedia applications
             • These are frequently more robust to loss
      – RPC’s
      – Many others…

Fall, 2001                            CS 640                 15
                Congestion in the Internet
• Checksums are effective for detecting bit errors but
  bit errors are not the only problem…

• We know that traffic has bursty characteristics
    –   Statistical multiplexing of ON/OFF sources
    –   Heavy-tailed file sizes
    –   Routers have limited buffer capacity
    –   Packets received after buffers are full are dropped
          • Buffers do protect from short bursts                                 Optimal        Load
• Congestion lengthens delays and lowers throughput
    – Standard throughput/load curve

   Fall, 2001                             CS 640                                           16
   How can we deal with congestion?
• Over-provision networks
      – Very expensive
      – Commonly done
             • Networks designed to normally operate at 5% capacity
• Develop protocols to respond to congestion
      – Route away from congestion
             • Good idea
             • How can we do it?
      – Retransmit in the face of loss
             • This is the state of the art

Fall, 2001                               CS 640                       17
               Congestion Control Basics
• UDP will send packets at a specified rate
    – Does not have any mechanism for dealing with congestion
• Issues:
    – Detecting congestion
    – Reacting to congestion
    – Avoding congestion
          • Shaping traffic
          • QoS mechanisms
• Transport protocol will deal with congestion…
  Fall, 2001                   CS 640                      18

To top