connection oriented tcp connections demux
play

Connection-Oriented TCP Connections Demux Host receives three TCP - PowerPoint PPT Presentation

Connection-Oriented TCP Connections Demux Host receives three TCP segments Initiated by a three-way all destined to IP address B, port 80 handshake SYN demuxed to different sockets through socket s 4-tuple 1.5 RTTs Sources Application P 1


  1. Connection-Oriented TCP Connections Demux Host receives three TCP segments Initiated by a three-way all destined to IP address B, port 80 handshake SYN demuxed to different sockets through socket’ s 4-tuple 1.5 RTTs Sources Application P 1 P 2 P 3 Destination Destination create shared state on N Y S f o C K A N B 80 B 80 S Y B 80 Application Application both side of connection A 915 C 517 C 915 P 4 P 5 P 6 know first sequence Transport 915 915 517 Src Dst number to be used B ACK of SYN Network Transport Transport A B know other side is ready Link 915 80 Network Network to receive Src Dst Physical Link Link A C C B Physical Physical 915 80 Src Dst Time Time C B 517 80 � 64 Typical TCP Usage Reliable Transport TCP at sender keeps a copy of SYN Three round trips to all sent, but unacknowledged, DATA, seq# = 13, len = 2 Y N S packets f o C K A set up a connection Y N S ACK of SYN ACK 15 send a data packet Packet resent if ACK does not DATA DATA, seq# = 15, len = 3 arrive within a timeout receive a response K C A T A A D Timeout interval adjusts to tear down connection Timeout FIN, ACK round-trip delay DATA, seq# = 15, len = 3 FINs tear down connection C K A AverageRTT = (1 - � ) OldAverageRTT + � LatestRTT N F I AverageVar = (1 - � ) OldAverageVar + � LatestVar ACK 18 Can be piggybacked on A C K Ack where LatestRTT = (ack_receive_time – send_time), LatestVar = |LatestRTT – AverageRTT|, � = 1/8, � = ¼ typically. Time Time Time Time Timeout = AverageRTT + 4 x AverageVar

  2. How Much Data Pipelining “Fits” in a Pipe? Sender allows multiple, “in flight”, yet-to-be- Suppose acknowledged packets (a “window”) bandwidth is b bytes/sec Increases throughput RTT is r seconds Needs buffering at sender and receiver ACK is a small message then, can send b·r bytes before receiving ack Data packet Data packet for first byte… Ack packet Ack packet of course, b and r can change over time… How large should the window be? What if a packet in the middle is missing? TCP Window, Size 4 TCP Congestion Control Additive Increase/Multiplicative Decrease (AIMD) DATA, seq=17 window_size++ every RTT if no packet dropped DATA, seq=18 window_size/2 if packet is dropped DATA, seq=19 ack=18 DATA, seq=20 drop detected by acknowledgments ack=19 When first item ack=20 Slowly builds to max bandwidth, and hovers DATA, seq=21 in window is ack=21 DATA, seq=22 there acknowledged, DATA, seq=23 sender can send DATA, seq=24 Does not achieve maximum bandwidth the 5 th item. Shares bandwidth well with other TCP connections TCP friendliness: linear increase, exponential backoff under congestion

  3. TCP Window Size TCP Slow Start Linear Increase Linear Increase Assuming losses in the network only due to bandwidth Most file transactions end before that happens… Exponential Backoff It takes long to reach window size that matches b·r Window Size: Max Bandwidth Exponential Increase 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 TCP builds large window quickly by doubling window Bandwidth 5, 6, 7, 8, 9, 10 size for each ack received until first loss Effectively doubling window size until first loss 5, 6, 7, 8, 9, 10 … Time TCP Window Size TCP Fairness with Exponential Start If k TCP sessions share same bottleneck link of bandwidth R, each should have rate R/k Max Bandwidth Max Bandwidth IS AIMD fair? Bandwidth Bandwidth Equal Bandwidth Share R Connection 2 Throughput Bandwidth grows equally for both connections: 45 o line Time Time Start at an 1. Additive Increase arbitrary point R Connection 1 Throughput

  4. TCP Fairness TCP Fairness If k TCP sessions share same bottleneck link If k TCP sessions share same bottleneck link of bandwidth R, each should have rate R/k of bandwidth R, each should have rate R/k IS AIMD fair? IS AIMD fair? Equal Bandwidth Share Equal Bandwidth Share R R Connection 2 Throughput Connection 2 Throughput Bandwidth grows equally for both connections: 45 o line Bandwidth halves: half the distance between this point and origin Start at an Start at an 1. Additive Increase arbitrary point arbitrary point 2. Multiplicative Decrease R R Connection 1 Throughput Connection 1 Throughput TCP Fairness TCP Summary If k TCP sessions share same bottleneck link of Reliable ordered message delivery bandwidth R, each should have rate R/k Connection oriented, 3-way handshake Converges around equal bandwidth IS AIMD fair? Transmission window for better throughput Timeouts based on link parameters Equal Bandwidth Share R Congestion control Connection 2 Throughput Linear increase, exponential backoff Bandwidth halves: half the distance between this point and origin Fast adaptation Start at an Exponential increase in the initial phase arbitrary point 2. Multiplicative Decrease R Connection 1 Throughput

  5. Application Application Transport Transport Network Network Link Link Physical Physical Link Layer Network Layer � 79 � 80 Internetworking Internet Overview Connect together multiple local area networks Every host is assigned, and is identified by, and IP address Nodes with multiple NICs can serve as the glue Messages are called datagrams In the beginning… packet is more commonly used… Expensive supercomputers scattered throughout US Header in datagram specifies destination Researchers not necessarily address colocated with them DoD interested in building a Network routes datagram from source to resilient global network destination ARPAnet: a complex system with simple components

  6. IP: Internet’ s IP Addressing Narrow Waist Every (active) NIC has an IP address IPv4: 32-bit descriptor, e.g. 128.84.12.43 IPv6: 128-bit descriptor (but only 64 bits “functional”) Application Layer Transport Layer Each Internet Service Provider (ISP) owns a set of IP addresses Network Layer ISPs assign IP addresses to NICs Data Link Layer IP address not a unique identifier Physical Layer Can be reused Same NIC can have different IP addresses over time from: http:/ /if-we.clients.labzero.com/code/posts/what-title-ii-means-for-tcp/ Datagram Ip Subnetting Forwarding Table 32 bits } IP address Destination Address Range Link Interface } Prefix 24 bits Suffix 11001000 00010111 00010000 00000000 N-bit suffix identifies subnet through 0 11001000 00010111 00010111 11111111 Either as a number (Ex: 128.84.32.00/24) 11001000 00010111 00011000 00000000 through 1 Or as a “netmask” (Ex.: 255.255.255.0) 11001000 00010111 00011000 11111111 Within it, has 2 32-N addresses (hosts) 11001000 00010111 00011001 00000000 through 2 11001000 00010111 00011111 11111111 Big subnets: short prefix, long suffix otherwise 3 Short subnets: long prefix, short suffix What if they don’ t divide up so nicely? Suffix of “all 0” or “all 1” reserved for broadcast

  7. How to Get an Longest prefix matching IP Address Look for the longest address prefix matching Hard-coded by system admin in a file the destination address Unix: / etc/rc.config DHCP: Dynamic Host Configuration Protocol Destination Address Range Link Interface dynamically get address from DHCP server 0 11001000 00010111 00010*** ******** scales only to a single subnet 11001000 00010111 00011000 ******** 1 128.84.96.90 2 11001000 00010111 00011*** ******** 128.84.96.91 otherwise 3 DHCP Server What is the link interface if the DA is 11001000 00010111 00011000 10101010? My physical address is Your IP address is 1a:34:2c:9a:de:cc. 128.84.96.89 What is my IP address? for the next 24 hours NAT: Network NAT: Motivation Address Translation To the rest of the world, local network appears as a single IP address Rest of Local network Internet local IP addresses can be assigned locally, not 10.0.0/24 from ISP 10.0.0.1 address inside local network can change without 10.0.0.4 10.0.0.2 informing outside world 128.84.96.7 ISP can change without changing addresses of all datagrams leaving local datagrams with source or 10.0.0.3 local network network have the same single destination in this network NAP IP address (128.84.96.7) but have 10.0.0/24 address for devices inside local network not explicitly different source port numbers source, destination (as usual) addressable from outside world (+1 for security)

Recommend


More recommend