1 / 66

How to use it

How to use it. Press Space to go alonge slide animation Don’t hurry to press Space next time. Wait for end of animation If you want to go back, use key «PgUp». Version 08 June 1999 Come later - presentation is under construction now. Encapsulation data into Ethernet packet.

oraw
Télécharger la présentation

How to use it

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. How to use it • Press Space to go alonge slide animation • Don’t hurry to press Space next time. Wait for end of animation • If you want to go back, use key «PgUp». Version 08 June 1999 Come later - presentation is under construction now

  2. Encapsulation data into Ethernet packet 46 to 1500 bytes IP datagram TCP segment Ethernet frame IP header TCP header TCP header Application data Application data User data Application header User data TCP header Application data IP header Ethernet header Ethernet trailer

  3. 802.3 MAC 802.2 LLC 802.2 SNAP type cntl 03 SSAP 0xAA DSAP 0xAA CRC Source address Destination address length Org code 00 ARP request/reply Type 0806 PAD Type 8035 Type 0800 IP Datagram RARP request/reply DATA PAD 18 4 6 6 2 1 1 2 3 1 2 2 38-1492 2 28 18 28 38-1492 IEEE 802.2/802.3 Encapsulation (RFC 1042) LENGTH contain length packet from next byte till CRC (CRC isn’t included) DSAP (Destination Service Access Point) and SSAP (Source Service Access Point) both are set to 0xAA. or CNTL (Control field) is set to 3. ORG CODE allways is 0 in all bytes TYPE field identifies data that follows. For example, type 0x0800 (hex) identifies IP datagram follows or

  4. 46-1500 bytes CRC Destination address Source address type Type 0806 RARP request/reply PAD PAD Type 0800 IP Datagram DATA ARP request/reply Type 8035 18 4 2 6 6 28 2 18 2 46-1500 2 46-1500 28 Ethernet Encapsulation (RFC 894) or or

  5. TTL Protocol Header checksum Source address Destination address Options (+padding) DATA IP packet structure Version.Current protocol version is 4. 0 15 16 31 IHL - IP header length. IHL is quantity of 32-bit words in IP header. This field has 4-bit length => maximum header length is 60 bytes 4-bit ver 4-bit IHL TOS 16-bit total packet length 16-bit identification flags3-bit 13-bit Fr offset TOS - type of service contain of a 3-bit precedence bits (ignored), 4 TOS bits, and unused bit which must be 0. 4 TOS bits: minimize delay maxm,ize throughput maximize reliability minimize monetary costOnly 1 of these 4 bits can be turned on TPL - total packet length is total IP packet’s length in bytes. Then maximum length of IP packet is 65535 bytes. IDENTIFICATIN - this field is used when IP need fragment fatagrams. Identification identifies each datagram and is incremented each time a datagram is sent We’ll see meaning of this field when we talk about fragmentationFLAGS and FRAGMENT OFFEST we’’ see also when we talk about fragmentation Continue...

  6. 4-bit ver 4-bit IHL TOS 16-bit total packet length 16-bit identification flags3-bit 13-bit Fr offset IP packet structure 0 15 16 31 TTL - time-to-live sets an upper limit of routers through which a datagram can pass. This field is decremented each time when datagram pass the router. When this field became 0 a datagram is dropped by router and ICMP message is sent to datagram’s sender. TTL Protocol Header checksum Source address PROTOCOL - this field identifies DATA portion of datagram (which protocol is encapsulated into IP datagram). Destination address Options (+padding) HEADER CHECKSUM is calculetaed for IP header only. DATA SOURCE and DESTINATION addresses is sender’s and receiver’s IP addresses. OPTIONS is a variable-length field which contain som eoptions. We’ll discuss some of them later. The option field always end on a 32-bit boundary. PAD bytes (value is 0) are added if neccessary. DATA is data.

  7. Class Range Special case IP addresses IP address classes A 0.0.0.0 to 127.255.255.255 B 128.0.0.0 to 191.255.255.255 C 192.0.0.0 to 223.255.255.255 D 224.0.0.0 to 239.255.255.255 Multicast E 240.0.0.0 to 247.255.255.255

  8. 32-bit IP address 48-bit Ethernet address ARP and RARP • ARPFor example, we are working on the Ethernet network. Ethernet driver and adapter are using MAC-address. TCP/IP is using IP addresses. When host want to send data to another host it known onlt receiver’s IP address and put this information to TCP/IP stack. Then TCP/IP stack need mechanism to have correspondence between MAC and IP addresses. IP have two algorithms for solve it. ARP RARP • RARPIf system don’t have hard or floppy drive and should boot from network it can’t take IP address from local resourses. Such system have only MAC-address. RARP is algorithm which allow system to obtain IP address from network

  9. Send IP datagram to IP address ARP Host ARP IP Resolve IP address to hardware address Do I know hardware address? Yes Yes No Ethernet driver ARP request Host Host Ethernet driver Ethernet driver ARP Is somebody looking for my address? Is somebody looking for my address? ARP No Yes Ignore request Send ARP reply

  10. RARP Diskless workstation Boot Read own hardware network address I have a IP address!!! Send RARP request Send RARP reply Somebody wants to have IP address! Give to somebody IP address from my table RARP server

  11. Sender IP address Source address type Target IP address Hard type Dest address op Sender Ethernet address Target Ethernet address Prot type Prot size Hard size 2 2 2 2 4 4 6 6 6 6 1 1 ARP packet type 0x806 hardware type Specified hardware type. 1 for an Ethernet protocol type 0x800 for IP hardware size Size of hardware address. 6 for an Ethernet protocol size Size of protocol address. 4 for IP op Type of operation (request or reply). ARP request - 1, ARP reply - 2, RARP request - 3, RARP reply - 4. Dest address Broadcast

  12. ICMP - Internet Control Message ProtocolRFC 792packet structure IP header ICMP message The same for all type of messages 20 8-bit type 8-bit code 16-bit checksum (for entire ICMP message) Contents depend on type and code

  13. ICMP address mask request and reply Type 17-request 18 - reply Code - 0 16-bit checksum (for entire ICMP message) identifier (anything) sequence number (anything) 12 bytes Subnet mask ICMP timestamp request and reply Type 13-request 14 - reply Code - 0 16-bit checksum (for entire ICMP message) identifier (anything) sequence number (anything) 32-bit originate timestamp 20 bytes 32-bit receive timestamp 32-bit transmit timestamp

  14. Data portion of ICMP message IP datagram ICMP message Ethernet header IP header ICMP header IP header of datagram that generated error UDP header 20 20 8 8 14 ICMP port unreachable error Must include IP header of the datagram that generated the error At least 8 byte that followed this IP header. In this example it is UDP header General format ICMP unreachable message type 3 code 0-15 16-bit checksum (for entire ICMP message) 8 bytes Unused (must be 0) IP header uncluding options + first 8 bytes of original IP datagram data

  15. ICMP echo request and echo reply (PING) Client Server I want to know is server alive Server is alive I received “ping” to my address Answer to client Send echo request Send echo reply Packets: type 0 - reply 8 - request code 0 16-bit checksum (for entire ICMP message) 8 bytes identifier sequence number Optional data identifier - process ID of the sending process sequence number - starts at 0 and incremented every time a new echo request is sent Server must reply identifier and sequence number fields. Historically ping has operated in mode where it sends an echo request once a second.

  16. IP addr R2 Incoming interface IP addr of server IP addr R1 code IP addr R3 len ptr IP addr R2 IP addr R1 1 1 1 4 4 4 4 4 4 4 IP record option (-r option) Send echo reply Send echo request with -r option Client Router 1 Router 2 Server Router 3 Packet IP option: Routers put into RR packet IP addresses of their outgoing interfaces 12 4 20 24 28 8 16 Ptr: = Code 1-byte field specifying the type of IP option. For RR option its value is 7 Len total number of bytes of the RR option. Ping always provides a 38-byte option, to record up to 9 IP addresses - maximum There is the limited room in the IP header for the list of IP addresses, because entire IP header is limited to 15*32-bit words (60 bytes). There are only up to 40 bytes for option field in IP header

  17. BROADCASTING Four types of IP broadcast Name Address Description Limited 255.255.255.255 limited broadcast never forwarded by a router. Net-directred netid.255.255.255 routers forward this kind of broadcast. These broadcast asign for netid IP network Subnet-directred host ID all is 1 bit broadcast for specific subnet. For example, knowledge of 172.19.128.255is broadcast for subnet 172.19.128.x mask is required with subnet mask 255.255.255.0 All-subnet-directred knowledge of If network is subneted this is all-subnet-directed mask is required broadcast. If network isn’t subneted this is net-directed subnet ID all 1, broadcast host ID all 1

  18. Class D 224.0.0.0 to 239.255.255.255 Multicast 1 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 MULTICASTING !Note! On an Ethernet multicast address is 01:00:00:00:00:00 Addressing Do you remember? Here is format of a class D IP address First four bit for class D:1110 0000 = 2241110 1111 = 239 28 bit multicast group ID IP address The set of host listening to a particular IP multicast address is called a host group. A host group can span multiple networks. Membership in a host group is dynamic - hosts may join and leave host group at will. There is no restriction on the number of hosts in a host group, and a host not have to belong to a group to send a message to that group.

  19. MULTICASTING Class D IP address 0 0 0 0 0 0 1 0 0 0 0 0 1 0 1 0 0 0 1 0 1 0 0 0 1 1 1 1 0 48-bit Ethernet address Converting Multicast Group addresses to Ethernet Addresses The Ethernet addresses corresponding to IP multicasting are in the range 01:00:5e:00:00:00 through 01:00:5e:7f:ff:ff We have 23 bits in the Etherntet address to correspond to the IP multicast group ID. The mapping places the low order 23 bits of the multicast group ID into these 23 bits of the Ethernet address. These 5 bits in the multicast froup ID are not used to form the Ethernet address 5e Low-order 23 bits of multicast group ID is copied to Ethernet address Since the upper 5 bits of the multicast group ID are ignored in this mapping, it is not uniwue. 32 different multicast group IDs map to same Ethernet address (1111 = 31). The device driver or the IP software must perform filtering, since the interface card may receive multicast frames in which the host is really not interested.

  20. IGMP reports and queries (Internet Group Management Protocol) Multicast groups participant: No Process 3 1 Group Address Group 1 224.8.8.1 Group 2 224.8.8.2 Wait for random timer Example, 2 seconds Wait for 0-10 seconds Join to group 1 Host IP IGMP report Dest IP - 224.8.8.1 Group IP - 224.8.8.1 Another GMP report Dest IP - 224.8.8.1 Group IP - 224.8.8.1 IGMP report Dest IP - 224.8.8.1 Group IP - 224.8.8.1 Another IGMP report Dest IP - 224.8.8.2 Group IP - 224.8.8.2 IGMP report Dest IP - 224.8.8.2 Group IP - 224.8.8.2 IGMP report Dest IP - 224.8.8.2 Group IP - 224.8.8.2 IGMP query Dest IP - 224.0.0.1 Group IP - 0 Another IGMP report Dest IP - 224.8.8.1 Group IP - 224.8.8.1 IGMP report Dest IP - 224.8.8.1 Group IP - 224.8.8.1 Interface 1 Don’t report group 2 next time IP Group 1 alive Group 2 alive IP Wait for 0-10 seconds Wait for 0-10 seconds Wait for random timer Example, 3 seconds Join to group 1 Group 1 reported Join to group 2 Report group 2 only Leave group 2 Host Multicast groups on interface 1: 1 2 Process 1 Process 2 Timer! Send IGMP query Multicast groups participant: No 1 2 Router

  21. IP datagram IP header IGMP message 20 8 0 4 8 16 31 IGMP packet IGMP message IGMP version (1) IGMP type (1-2) unused 16-bit checksum 8 bytes 32-bit group address (calss D IP address) Version 1 Type 1 - multicast router query 2 - response sent by a host Group address class D IP address. For query address is set to 0

  22. UDP

  23. 0 16 31 UDP packet Source port Destination port UDP length UDP checksum DATA (if any)

  24. TFTPTrivial File Transfer Protocol IP datagram TFTP message UDP datagram 0 IP header UDP header Opcode 1=RRQ 2=WRQ filename mode Error number 0 opcode 5=error 0 opcode 3=data data Error message Block number opcode 4=ACK Block number 1 2 2 1 N 1 2 8 20 2 2 N N 2 0-512 2 Packet types Requestes Data packet Mode netascii octet Data ACK packet Error packet

  25. TFTP operations File transfer opcode 3 blcok number 1 bytes 512 Dest UDP port - appl Source UDP port - new port number, was appointed for this file transfer by TFTP server Those ports numbers will be used during file transfer. File trnsfer opcode 3 blcok number 2 bytes 356 (last block of “File”) Read request for “File” opcode 1 Dest UDP port 69 Source UDP port - appl ACK opcode 4 block number 1 ACK opcode 4 block number 2 Receiving block 2. Data size < 512 byte => last block of file Receiving block 1 File can be read by client? Client received block 1 Need file “File” from server YES Process Client Server In case of write file the client sends the WRQ. If all is OK, server responds with ACK and block number 0. And so on. Error messages. Server responds with this type of packet if a read request or write request can’t be processed. Also read or write error during file transmission can cause this message to be sent, and transmission is then terminated.

  26. UDP datagram IP datagram IP header UDP header BOOTP request/reply 20 8 300 BOOTP: Bootstrap Protocol BOOTP Packet Format

  27. BOOTP datagram 0 7 8 15 16 23 24 31 opcode hardware type hardware address length hopcount Opcode - 1 - request, 2 - reply Transaction ID H type - 1 for Ethernet H addr length - 6 for Ethernet number of seconds unused Hop count - set to 0 by client Trans ID - set by client and returned by the server client IP address Number of seconds - set by client your IP address Client IP - set by client. If client don’t have an address => 0 server IP address Your IP - filled by the server with client’s IP address 300 bytes Server IP - filled by the server gateway IP address Gateway IP - filled by a proxy server. If is. client hardware address (16 bytes) Client H address - must be set by client server hostname (64bytes) Server hostname - null terminating string that is optionally filled in by the server boot filename (128 bytes) Boot filename -fully qualified, null terminated pathnema of a file to bootstrap from vendor-specific information (64 bytes)

  28. 0 255 4 IP address of preferred gateway 0 IP address of preferred gateway N subnet mask 0 1 1 1 1 4 4 4 1 1 BOOTP Port numbers Server 67 Client 68 Vendor-Specific information End of the items. Any bytes after this should be set to 255 Pad Examples Subnet mask many fields ... Gateway If information in vendor-specific filed is provided, the first 4 bytes of this area are set to th IP address 99.130.83.99. This is called magic cookie. tag length

  29. BOOTP operations Server’s reply Source IP - 1.1.1.1 Your IP - 1.1.1.2 Server IP - 1.1.1.1 Gateway IP - 1.1.1.1 Boot file name - BFILE ARP request to see if anyone else on network has same adress Target IP - 1.1.1.2 Source IP - 0.0.0.0 Client sends second ARP request 0.5 second later, and third ARP request 0.5 second after it. Third ARP request Source IP address is 1.1.1.2 (client’s address) Client’s request Dest UDP port 67 Source IP 0.0.0.0 Dest IP - 255.255.255.255 ARP reply Sender - 1.1.1.1 Target IP - 1.1.1.1 Target harware address - server’s Client’s request Source IP 1.1.1.2 Dest IP - 255.255.255.255 ARP request “who is server” Sender IP - 1.1.1.2 Target IP - 1.1.1.1 TFTP Clients read boot file BFILE from the server Server’s reply Source IP - 1.1.1.1 Your IP - 1.1.1.2 Server IP - 1.1.1.1 Gateway IP - 1.1.1.1 Boot file name - BFILE Client’s request Source IP 1.1.1.2 Dest IP - 255.255.255.255 Server’s reply Source IP - 1.1.1.1 Your IP - 1.1.1.2 Server IP - 1.1.1.1 Gateway IP - 1.1.1.1 Boot file name - BFILE I have IP, I have loodable image. I can start! BOOTP process UDP port 68 My IP address unique! Is my IP address unique? Receiving information NOBODY ANSWER BOOTP server UDP port 67 Boot process Client. Port 68. Server. Port 67. IP - 1.1.1.1 For client - 1.1.1.2

  30. TCP

  31. 0 16 31 TCP packet Source port Destination port Sequence number Acknowledgment number Headerlength (4) Reserved(6) flags (6) Window Header checksum Urgent pointer Options (+padding) DATA The MSS option is using only in SYN packets

  32. TCP sequence and aknowledgement Receiving SEQ 10 and 10 bytes Receiving SEQ 30 DATA 20 ACK 20 Receiving SEQ 20 DATA 10 ACK 50 ACK = 10 (SEQ) + 10 bytes my ACK = 30 + 20 Server received my data, his ACK = 20 my curr SEQ = prev send plus data = 10 + 10 my ACK = 20 + 10 Client received my data, his ACK = 50 my curr SEQ = prev send plus data = 30 + 20 Send 10 bytes SEQ 10 ACK No Send 20 bytes SEQ 30 ACK 20 Send 10 bytes SEQ 20 ACK 50 Send 20 bytes SEQ 50 ACK 30 Send my own data with my own SEQ and ACK = 20 Client Server And so on….

  33. The connection establishment completed TCP connection establishment Receiving packet. Send packet with S (SYN) flag. (SYN segement). Packet contain the port number of the server that the client want to connect Receiving server’s respond SEQ 348 ACK 146 Flags SA ACK 349 Flags A SEQ 145 ACK - Flags S Respond with own SYN segment containing own SN and ACK for client’s SYN plus one (SYN comsumes one sequence number) ACK = 145 + 1 = 146 Server respond contain correct ACK Acknowledge server’s SYN with ACK = server’s SN + 1 = 348 + 1 = 349 Client ISN = 145 ISN = 348 Server Active open Passive open ISN - initial sequence number Described three segments complete the connection establishment. This is often called the three-way handshake.

  34. The connection closed TCP connection termination Receiving FIN packet. Receiving FIN packet. User type “quite”, for example ACK 427 Flags A SEQ 658 ACK 426 Flags FA ACK 659 Flags A SEQ 426 ACK 659 Flags FA Respond with correspondent ACK Respond with correspondent ACK Next ACK should be, for example, 426 and my own SN must be 658 I should close second direction Now is «half-close». It can be some data is sending by server to client, with corresponding ACKs. Then server close another direction of connection Send FIN - packety with FIN flag Client Server Active close Passive close TCP connection is full duplex, and each direction must be shut down independenly

  35. active open passive open active close passive close TCP states for connection establishment and termination Client Server SYN J SYN_SENT SYN_RCVD SYN K, ack J+1 ESTABLISHED ack K+1 ESTABLISHED FIN M FIN_WAIT_1 CLOSE_WAIT ack M+1 FIN_WAIT_2 FIN N LAST_ACK TIME_WAIT ack N+1 CLOSED Client stays in this state for twice the MSL

  36. 2 MSL state Client Server • All received datagram is discarded • There is impossible to open another connection for this socket pairs (IP tuple) Quiet Time If a host in the 2MSL wait crashes, reboots within MSL seconds and immediatly establishes new connections isung the same local and foreign IP addresses and port number. To protect this scenario RFC 793 states that TCP should not create any connectionfor MSL seconds after rebooting. This is called the quiet time. Reset Segments Reset segment - “reset” bit in TCP header is set to 1.Any queued data is thrown away and the reset is sent immediately. The receiver of the RST can tell that the other end did an abort instead of a normal close. ExampleWe trying to connect to server with port number that’s not in use on the destionation. UDP sends “port unreachable” message in this case. TCP sends reset segment. SEQ 0 ACK 401 Flags RA SEQ 400 Flags S port 10000 Server doesn’t have process with port 10000 FIN - orderly release. RST - abortive release.

  37. Half-Open Packet Packet Packet Packet Packet But sometimes something can crash. All is fine ! Alive computer don’t know that peer is died. Peer havn’t sent FIN or RES segments. Connection is Half-Open

  38. Simultaneous Open active open active open active open passive open SYN_SENT SYN J SYN K SYN_SENT SYN_RCVD SYN_RCVD SYN K, ack J+1 SYN J, ack K+1 ESTABLISHED ESTABLISHED Usual connection open SYN J SYN_SENT SYN_RCVD SYN K, ack J+1 ESTABLISHED ack K+1 ESTABLISHED Simultaneous Open Result - one connection, not two.

  39. Simultaneous Close active close active close passive close active close FIN J FIN K FIN_WAIT_1 FIN_WAIT_1 CLOSING ack J+1 CLOSING ack K+1 TIME_WAIT TIME_WAIT Usual connection close FIN M FIN_WAIT_1 CLOSE_WAIT ack M+1 FIN_WAIT_2 FIN N LAST_ACK TIME_WAIT ack N+1 CLOSED Simultaneous Close

  40. len=10 shift count MSS len=4 len=3 kind=3 timestamp echo reply kind=2 kind=1 kind=8 kind=0 timestamp value 1 byte 1 byte 2 byte 1 byte 1 byte 1 byte 1 byte 1 byte 4 byte 4 byte 1 byte 1 byte (examples) TCP options (RFC 792 and 1323) End of option list Those options don’t have length field. The other do. length is th total length, uncluding the kind and len bytes. No operations Maximum segment size Window scale factor Timestamp

  41. Delayed Acknowledgment (delayed ACK) For example, delayed ACK here is 200 ms. See to client. Client Server PSH 2:6 (4) ack 11 START KERNEL long time... is waiting And now... ack 6 Client don’t send ACK immediatly. It delay ACK, hoping to have data to send them in the same direction as the ACK. It can wait till next “delay ACK” boundary. Another instant PSH 6:12 (4) ack 11 TIME 200 ms intervals Here delayed ACK flag is turned off is waiting PSH 11:15 (4) ack 12 piggyback TCP has decided to sent data packet.

  42. Client Server Nagle algoritm APPLICATION PSH 2:3 (1) ack 2 TCP has received packet. Now it can send data from buffer. TCP doesn’t send packet. We are waiting for first packet’s ACK. TCP has data for send entire packet. And TCP does it. TCP doesn’t send packet. We are waiting for first packet’s ACK. ack 3 Send packet PSH 3:5 (2) ack 2 mss (20bytes) 20 bytes PSH 5:25 (20) ack 2 ack 5 TCPbuffer 1 byte 1 byte 1 byte ack 25 bla.., bla... bla… bla… tume has passed PSH 8:10 (2) ack 55 PSH 55:56 (1) ack 10 ack 56 ACK is receiving, I have data, preparing and send packet PSH 10:12 (2) ack 56 * Befor packet was pushed into physical media another packet from server had been received PSH 56:58 (2) ack 10 Now I have data for sending again. And I have “free” ACK from server (packet *) PSH 56:58 (2) ack 12

  43. TCP timers • Retransmission timer. This timer is used when expecting an acknowledfment from other end. • Persist timer keeps window size information flowing even if the other end closes its receive window. • Keepalive timer detect when the other end on an otherwise idle connection crashes or reboots. • 2MSL timer measures the time a connection has been in the TIME_WAIT state.

  44. Err = M - A A  A + gErr D D + h(|Err| - D) RTO = A + 4D Round-Trip Time PSH 2:3 (1) ack 2 Measured RTT (M) ack 3 Send bytes Receive ACK for that bytes There are some formules which are used for calculate retransmissiom timeout value (RTO). A - smoothed RTT (an estimator of average)D - smoothed mean deviationg - 0.125 (1/8)h - 0.25 Karn’s algoritm.Algoritm specify that when retransmission occurs, we cannot update the RTT estimator when the acknowledgement for the retransmitted data finally arrives.

  45. . . . RTT example. Measurement. Most implementation measure only one RTT value per connection at any time. If the timer for a given connection is already in use when a data segment is transmitted, that segment is not timed. start timer 1:257 (256) ack 1 1 RTT №11.061 sec 2 ack 257 stop timer 257:513 (256) ack 1 3 start timer 513:769 (256) ack 1 4 RTT №20.808 sec 5 ack 513 8 ack 769 stop timer 769:1025 (256) ack 1 6 start timer 1025:1281 (256) ack 1 7 10 ack 1025 1281:1537 (256) ack 1 9 12 ack 1281 RTT №31.015 sec stop timer 1537:1793 (256) ack 1 11

  46. 1:257 (256) ack 1 1 RTT №11.061 sec 2 ack 257 257:513 (256) ack 1 3 513:769 (256) ack 1 4 RTT №20.808 sec 5 ack 513 8 ack 769 769:1025 (256) ack 1 6 1025:1281 (256) ack 1 7 10 ack 1025 1281:1537 (256) ack 1 9 12 ack 1281 RTT №31.015 sec 1537:1793 (256) ack 1 11 1.53 2.53 1.03 3.03 0.03 0.53 2.03 . . . RTT №2. RTT №3. RTT №1. 3 ticks 1 tick 2 ticks RTT example. Measurement. The timing is done by incrementing a counter every 500-ms TCP timer routine is invoked. Figure shows the relationship in our example between actual RTT that we can determin by network analyzator and the counted clock ticks. start timer stop timer start timer stop timer start timer stop timer

  47. 1:257 (256) ack 1 1 RTT №11.061 sec (3 2 ack 257 257:513 (256) ack 1 3 Err = M - A 513:769 (256) ack 1 4 RTT №20.808 sec 5 ack 513 A  A + gErr 8 ack 769 769:1025 (256) ack 1 6 D D + h(|Err| - D) 1025:1281 (256) ack 1 7 10 ack 1025 RTO = A + 4D 1281:1537 (256) ack 1 9 12 ack 1281 RTT №31.015 sec 1537:1793 (256) ack 1 11 . . . RTT example. Calculation. RTT №1 = 3 ticksRTT №2 = 1 ticksRTT №3 = 2 ticks A is initialized to 0D is initialized to 3Initial RTO = A + 2D = 0 + 2*3 = 6 seconds(Factor 2 is used only for initial calculation) When the ACK for the second data segment arrives (segment 5) measured RTT is 1 and update isErr = M - A = 0.5 - 2 = -1.5A = A + g*Err = 2 - 0.125*1.5 = 1.8125D = D + H(|Err| - D) = 1 + 0.25*(1.5 - 1) = 1.125RTO = A + 4D = 1.8125 + 4*1.125 = 6.3125But most implementation use RTO as a multiple of 500 ms. In our instance RTO will be 6 seconds. When the ACK for the first data segment arrives (segment 2) measured RTT is 3 and our estimators initialized asA = M + 0.5 = 1.5 + 0.5 = 2D = A/2 = 1RTO = A+4D = 2+ 4*1 = 6 seconds

  48. to appl to appl to appl all saved to appl Congestion example. There is normal data flow 6401:6657 (256) ack 1 6657:6913 (256) ack 1 ack 6657 6913:7169 (256) ack 1 ack 6913 7169:7425 (256) ack 1 Host knows that prevous packet is missed. Then host send ACK for prevous received packet and save receiving packet. Congestion. For example, router lost packet ack 6913 (save 256) 7425:7681 (256) ack 1 7681:7937 (256) ack 1 First duplicate ACK ack 6913 (save 256) 7937:8193 (256) ack 1 ack 6913 (save 256) Second duplicate ACK There is third duplicate ACKs 3rd ACK 6913:7169 (256) ack 1retransmission ack 6913 (save 256) 8193 :8449 (256) ack 1 ack 8193 Received missed packet. Now this host has all data bytes 6913-8192. ack 8449 TCP count the number of duplicate ACKs received, and when the third one is received assume that a segment has been lost. TCP retransmit only one one segment, starting with that sequence number. We discuss fast retransmit algoritm later.

  49. Slow start. cwnd = 1 1:513 (512) ack 1 Slow start works with congestion window - CWND. CWND is initialized to 1 (one) segment and is increased by one segment each time an ACK is received. ack 513 cwnd = 2 513:1025 (512) ack 1 1025:1537 (512) ack 1 ack 1025 At some point the capacity of the network can be reached and some packets can be discarded. This situation tells to the sender that its CWND is too large. We’’ ll see later mechanism of CWND adjusting. cwnd = 3 1537:2049 (512) ack 1 2049:2561 (512) ack 1 ack 1537 Sender sends only two segments because ACK for segment 1025:1537 hasn’t received. Result: We have CWND = 3 and 3 sended (without ACK) segments. cwnd = 4 2561:3073 (512) ack 1 3073:3585 (512) ack 1 The sender can transmit up to the minimum of the congestion window and advertized windiw. CWND is flow control imposed by sender. And so on CWND is maintained in bytes

  50. Congestion avoidance algoritm. Congestion avoidance and slow start are different. But in practice congestion avoidance and slow start are implemented together. When congestion occurs TCP slows down the transmission rate of packets into the network and then invoke slow start to get things going again. Congestion avoidance and slow start require that two variables be maintained for each connection: • CWND • A slow start treshold size, ssthresh There are two indications of packet loss: • a timeout occure • the receipt of duplicate ACKs

More Related