1 / 38

TCP : Reliable Byte Stream

TCP : Reliable Byte Stream. TCP guarantees reliable, in-order delivery of a stream of bytes. It is a full duplex protocol. Flow-control mechanism: Gives the receiver the control to limit how much data a sender can transmit. Flow-control vs. Congestion control:

karly-howe
Télécharger la présentation

TCP : Reliable Byte Stream

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. TCP : Reliable Byte Stream • TCP guarantees reliable, in-order delivery of a stream of bytes. • It is a full duplex protocol. • Flow-control mechanism: Gives the receiver the control to limit how • much data a sender can transmit. • Flow-control vs. Congestion control: • 1. Flow control prevents the sender from overrunning the capacity of receivers. • Congestion control prevents too much of data being injected into the network • thereby preventing links or switches being overloaded. • 2. Flow control is end-to-end issue. • Congestion control concern how hosts and networks should interact. • Connection establishment • Connection termination • Connection management modeling

  2. TCP : Segment Header Data Source Port Destination Port Sequence Number Acknowledgement Number Window Size Checksum Urgent Pointer Options TCP’s demux key is given by the 4-tuple <srcIP, srcPort, destIP, destPort> SeqNo: indicates the sequence number for the first byte of data carried in this segment. AckNo: specifies the next byte expected thereby implicitly acknowledging all earlier sequence numbers. TCP header length: to take care of the variable options field. Unused 6 bits. URG - if set means urgent pointer is in use. ACK – if set means the AckNo is valid. PSH – push it up to the appln.., not to buffer it. RST – reset, problems. SYN – to establish connections. FIN – to release the connection

  3. TCP : Three-way handshake • TCP connection establishment: • Server passively waits for a connection • by executing a LISTEN and ACCEPT. • Client executes CONNECT, specifying • the IP address and port to which it want • to connect, max TCP segment size willin • to accept, etc. This sends a TCP segment • with the SYN =1 and ACK=0. Waits for the • response. • At server: • if (no process is LISTENing on port) • sends a RST=1 reply • (connection rejected) • else • SYN=1,ACK=1,SEQ=y, AckNo=x+1 • 4. Client: SYN=1,ACK=1,SEQ=x+1, AckNo=y+1 Active participant (client) Passive Participant (server) SYN=1, SEQ=x SYN=1, ACK=1, SEQ=y, ACK=x+1 SYN=1, ACK=1, SEQ=x+1, ACK=y+1

  4. TCP: connection release • TCP connection Termination: • TCP connections are full duplex. • Consider two simplex connections. • Either party sends a FIN, meaning that it has no more data to send. • Once FIN is acknowledged, that direction is closed. • While data may flow in other direction. • Once both the directions are closed, the connection is released. • Normally 4 TCP segments are needed. • FIN  •  ACK •  FIN • ACK  • 8. However: • FIN  •  ACK + FIN • ACK  • Requires 3 TCP segments. ACK piggybacks the FIN.

  5. CONNECT/SYN CLOSED Close/ - LISTEN/ - Close/ - SYN/SYN+ACK LISTEN RST/ - SEND/SYN SYN_RCVD SYN_SENT SYN/SYN+ACK (simultaneous open) CLOSE/FIN ACK/ - SYN+ACK/ACK ESTABLISHED CLOSE/FIN FIN/ACK FIN/ACK FINWAIT1 CLOSING CLOSE_ WAIT FIN+ACK/ACK ACK/ - ACK/ - CLOSE/FIN FINWAIT2 TIME_WAIT LAST_ACK FIN/ACK Active close Passive close TIMEOUT/- ACK/ - CLOSED Go back to start

  6. TCP: connection management • TCP connection management: • Events: • CONNECT/LISTEN/SEND/CLOSE • Actions: • Sending a control segment: • SYN/FIN/RST/ -- (no action) • States: • CLOSED: no connection is active • LISTEN: server is waiting for an incoming call • SYN_RCVD: connection request has arrived • SYN_SENT: appln.. has started to open a connection • ESTABLISHED: data transfer state • FIN WAIT1: appln says it has finished. • FINWAIT2: other side agrees to release • TIME_WAIT : wait for all packets to die off • CLOSING: both sides have tried to close simultaneously • CLOSE WAIT: other side has initiated a release • LAST ACK: wait for all packets to die off

  7. TCP: connection management TCP connection management: When the application is finished: client: close FIN and moves to FIN_WAIT1, waits for ACK. server: ACK client: moves FIN_WAIT2 the connection CLIENTSERVER is closed. But the SERVERCLIENT is still open. server: close  FIN (LAST_ACK) client: both sides are closed to TIME_WAIT, allows the packets to die off.

  8. TCP: connection management TCP connection management: Some issues: 1. Clients ACK to the server is lost, then the connection still works correctly. This is because the client side is in established state and it sends data to the other end with ACK flag set and the server moves to the established state. 2. From LISTEN state, the server invokes send, that is, the server knows the other end, and ignites the connection to establish. Connection termination: Client closes first: ESTABLISHEDFIN_WAIT1FIN_WAIT2TIME_WAITCLOSED Server closes first: ESTABLISHEDclose_waitlast_ackclosed Both sides close at the same time: ESTABLISHEDFIN_WAIT1CLOSINGTIME_WAITCLOSED Another possibility: ESTABLISHEDFIN_WAIT1TIME_WAITCLOSED ?

  9. TCP: connection management TCP connection management: One more issue: TIME_WAIT state cannot move to CLOSED state until it has waited for two times the maximum time an IP datagram might live in the Internet (120 seconds) Local side sends ACK in response to the other sides FIN, but this is lost or delayed. The other side may retransmit the FIN. If it moves directly to CLOSED state, then another pair of application processes may start the same connection. (with the same port numbers). The delayed FIN segment 2nd one will immediately initiate the termination of the later connection.

  10. Congestion Control Algorithms When too many packets overwhelm the network, the performance degrades, this situation is called congestion. Causes of congestion: 1. A sudden inflow of packets in 3 or more input lines vying for the same output line, causes the packets to be queued. Router goes out of buffer. Even increasing the buffer size may not help, as the queued up packets may timeout. 2. Slow processors at the routers may cause congestion as the jobs in hand, namely, queuing buffers, updating tables etc., may get delayed. 3. Bandwidth of the input output lines. Perfect Maximum carrying capacity Desirable Packets delivered Congested Packets sent

  11. Congestion Control Algorithms DECbit: There is a congestion bit at the packet header. Intermediate router: if(avg. queue length > 1) congestion bit is set. else nothing done. Destination: copies the congestion bit into the ACK. Source: Adjusts its sending rate.

  12. Congestion Control Algorithms RED (Random Early Detection): Each router monitors its own queue length. When detects an imminent congestion, source is notified to adjust its congestion window. Implementation: Drop a packet, source is implicitly notified. Drop a random packet as to the fact the router does not know who is to be notified. For each arriving packet a drop probability is assigned and when it goes above a threshold, the packet is dropped.

  13. Congestion Control Algorithms Choke packets: Router sends a choke packet back to the source, a header bit is turned on in the original packet and forwarded so that it does not produce any more choke packets along the path. Source gets the choke packet and gets the signal to slow down. Ignores the other choke packets for the same destination for some time period.

  14. Congestion Control Algorithms Hop-by-Hop Choke packets: Sensitivity of the earlier algorithm is slow. Here, choke packet takes the effect at each hop back to the source, such that the flow is reduced at each step giving immediate relief to the router.

  15. Congestion Control Algorithms Load shedding: This is the last resort to avert congestion. If too many packets, just drop some of them indiscriminately. Wine policy: Older packets are important e.g. file transfer Milk policy: Newer packets are important, e.g. multimedia packet Source should mark the importance of the packet in these terms such that a good discarding policy can be followed. The priority of the packet may also be linked with the cost of sending the packet.

  16. Congestion Control Algorithms Jitter Control: For applications such as audio and video streaming, it does not matter much if the packets take 20 or 30 msec to be delivered, as long as the transit time is constant. The standard deviation in transit times is called jitter.

  17. Traffic shaping Non-uniform injection of traffic into the network from hosts causes congestion, if a mechanism is there to smoothen out the traffic out of the host. Leaky bucket algorithm:

  18. Traffic shaping Leaky bucket algorithm: When the bucket is full, packets are discarded. r – leaky bucket rate C– bucket capacity M - Capacity of the link

  19. Token bucket algorithm: Here, the leaky bucket holds token generated at a fixed rate. When the host wants to send a packet, it has to grab a token and destroy it and send the packet. Tokens are a kind of right to send the packet. C-capacity of the bucket, r-rate to token generation, S-burst period, M-maximum output rate. C+r*S=M*S

  20. TCP Congestion Control Congestion window. Additive increases/Multiplicative decrease. Slow start.

  21. NAT: Network Address Translation NAT is an immediate but temporary solution to the IPv4 address exhaustion problem. NAT also provides a simple packet filtering function by forwarding only solicited traffic to private network hosts. Private address ranges are 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16

  22. NAT: Network Address Translation NAT is an immediate but temporary solution to the IPv4 address exhaustion problem. NAT also provides a simple packet filtering function by forwarding only solicited traffic to private network hosts. Private address ranges are 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16

  23. NAT: Network Address Translation Outgoing packet at the NAT: NAT will intercept this outgoing packet and create a port mapping using the destination IP address (server), destination port, external IP address of the NAT, external port, network protocol, and the internal IP address and port from the client. The NAT will maintain a table of these mappings, storing this port mapping in the table.

  24. NAT: Network Address Translation Incoming packet at the NAT: NAT receives these packets from the server and compares them to its table of port mappings. If the NAT finds a port mapping where the source IP address, source port, destination port, and network protocol of the incoming packet match the remote host IP address, remote port, external port, and network protocol of the port mapping, the NAT will perform a reverse translation. The NAT replaces the external IP address and external port in the destination fields of the packet with the client’s private IP address and internal port.

  25. NAT: Network Address Translation NAT with a pool of global addresses:

  26. NAT: Network Address Translation • Shortcomings of NAT: • Violates the IP architecture, unique IP address across the network. • NAT changes the Internet from connection-less network to connection-oriented network. NAT box has to remember the state, the mapping from private to global IP addresses. If NAT crashes TCP becomes inoperative. • Some applications insert IP addresses in the payload, NAT cannot handle them. Examples, ftp and IP telephony etc.

  27. NAT: Network Address Translation Original intent: a possible short-term response to address depletion unmanaged devices that are transparent to end-to-end protocol interaction, requiring no specific interaction between the end systems and the NAT device Reality: near-ubiquitous deployment across the Internet, well entrenched into the network landscape. May be disruptive to some other forms of protocol operation.

  28. NAT: Network Address Translation NAT operation: Active units placed in the data path, usually as a functional component of a border router or site gateway. NATs intercept all IP packets, and may forward the packet onward with or without alteration to the contents of the packet, or may elect to discard the packet. The essential difference here from a conventional router or a firewall is the discretional ability of the NAT to alter the IP packet before forwarding it on. NATs are IP address translators.

  29. NAT: Network Address Translation

  30. DNS: Domain Name Service • Why DNS? • IP addresses are not user friendly. DNS does the job of translating the user-friendly names to router friendly addresses. • Host names differs from host addresses: • Names are of variable length and mnemonics, addresses are of fixed length. • Names do not contain any information which help locating the host. Addresses have routing information embedded in them. • Names may have many levels of hierarchy. • hosts.txt • A new host added to the internet, the <name, addr> tuple is sent to NIC and who in turn sends out mails to different sites every few days and the system administrator at each site updates the hosts.txt file of every host of the site. This system rightly does not scale to large networks.

  31. DNS: Domain Name Service User Example: abc@cs.princeton.edu cs.princeton.edu Name server Mail program 192.12.69.5 192.12.69.5 TCP 192.12.69.5 IP

  32. DNS: Domain Name Service Domain hierarchy: A hierarchical name space is implemented, processed right to left.

  33. DNS: Domain Name Service Name servers:

  34. DNS: Domain Name Service • Name servers: • Partition the hierarchy into subtrees called zones. • Zone is the fundamental unit implementation in DNS. • Information contained in each zone is implemented in two or more name servers. • Client send queries to name server, the name server sends back the requested information or sends back a pointer to another server that the client should query next. • DNS:  is a hierarchy of name servers.

  35. DNS: Binding

  36. DNS: Binding

  37. <princeton.edu,cit.princeton.edu,NS,IN> <cit.princeton.edu,128.196.28.233,A,IN> <cisco.com,ns.cisco.com,NS,IN> <ns.cisco.com,128.96.32.20,A,IN> <cs.princeton.edu,gnat.cs.princeton.edu,NS,IN> <gnat.cs.princeton.edu,128.12.69.5,A,IN> <ee.princeton.edu,helios.ee.princeton.edu,NS,IN> <helios.ee.princeton.edu,128.196.28.5,A,IN> <jupiter.physics.princeton.edu,128.196.4.1,A,IN> ……………………. Root Name Server Princeton Name Server Cisco Name Server <cs.princeton.edu,gnat.cs.princeton.edu,MX> <ciacada.cs.princeton.edu,128.12.69.5,A> <cic.cs.princeton.edu,cicada.cs.princeton.edu,CNAME> <www.cs.princeton.edu,ciacada.princeton.edu,CNAME> <gnat.cs.princeton.edu,128.196.4.1,A> ……………………. CS Name Server EE Name Server

  38. Client sends query to the root server. • In fact to the local name server • Root server returns the best match, princeton.edu • and the records related to this record, A record here • for cit.princeton.edu . • 4. Princeton name server cannot match it. • So sends back NS record and A record here. • 5. Finally resolved at 192.12.69.5. Root Name Server princeton.edu, 128.196.128.233 ciacada.cs.princeton.edu ciacada.cs.princeton.edu Local Name Server ciacada.cs.princeton.edu Princeton Name Server Client 192.12.69.60 cs.princeton.edu 192.12.69.5 • Advantage at local name server: • 1. The local server has to be made known • about the root servers • 2. The data cached at the local server • may help in resolution without going to the network. ciacada.cs.princeton.edu ciacada.cs.princeton.edu, 192.12.69.60 CS Name Server

More Related