Network Essentials Session 1 R. Venkateswaran
Outline <ul><li>Session 1 </li></ul><ul><ul><li>7-Layer OSI Model </li></ul></ul><ul><ul><li>Network Layer protocols (Inte...
Acknowledgments <ul><li>This presentation has been adapted from presentations available at: </li></ul><ul><li>Prof. Shivku...
Network Models <ul><li>Formal models allow us to deal with various aspects of networks abstractly </li></ul><ul><ul><li>On...
OSI 7-Layer Model IP TCP/UDP Virtual End-to-end connectivity Path selection, Internetworking Error-free communication link...
OSI 7-Layer Host Router Router Host End to end Hop by hop Application Presentation Session Transport Network Link Physical...
TCP/IP Model Host Router Router End to end No session or presentation layers in TCP/IP model Host Hop by hop Application T...
Packet structure Trailer Header Header Header Application Transport Network Data Link Data Transport Layer Data Network La...
Network Layer
Internet Architecture <ul><li>Packet-switched, connectionless datagram network </li></ul><ul><li>IP is  the  network layer...
IP - Minimalist Approach <ul><li>Dumb network </li></ul><ul><ul><li>Connectivity  is the key </li></ul></ul><ul><ul><li>Ne...
IPv4 Header Transport Layer Data… 0 4 8 16 32 IHL Type of Service Total Length Version Fragment Offset Identification Flag...
IP Address <ul><li>IP address: Unique identification of the end-system from a network-layer perspective </li></ul><ul><li>...
Network Mask <ul><li>Define which bits are used to describe the network ID </li></ul><ul><li>Different Representations: </...
Network Mask Examples 137.158.128.0/ 17  (netmask  255.255.128.0 ) 1111 1111 1111 1111  1  000 0000  0000 0000  1111 1111 ...
Subnets <ul><li>All device interfaces having the  same  network ID are part of the same  subnet </li></ul><ul><li>Devices ...
IP router <ul><li>A device with more than one link-layer interface </li></ul><ul><ul><li>Each interface identified by a di...
Hop by Hop Forwarding
IP Forwarding Rules - I <ul><li>Destination is in the same subnet (direct connectivity) </li></ul><ul><ul><li>Recognize th...
IP Forwarding Rules - II <ul><li>Problem 1: Recognize if destination is on the same subnet </li></ul><ul><ul><li>Use netma...
Look up Forwarding Table Destination =12.5.9.16 ------------------------------- payload  Prefix  Interface  Next Hop  12.0...
IP Forwarding – Example 1 Forwarding Table on host 192.1.1.1 Note:  127.0.0.1  is the special address of the local interfa...
IP Forwarding – Example 2 Forwarding Table on host 192.1.1.1 Note:  127.0.0.1  is the special address of the local interfa...
IP Forwarding – Example 2 Forwarding Table on host 192.1.1.4 Note:  127.0.0.1  is the special address of the local interfa...
Routing Protocols <ul><li>Distance Vector Routing protocol </li></ul><ul><ul><li>Each router sends a vector of distances t...
Distance vector algorithm - I <ul><li>Basic idea:   </li></ul><ul><li>Each node periodically sends its own distance vector...
2  0  1 from from x  y  z x y z 0  2  3 from cost to x  y  z x y z 0  2  3 from cost to x  y  z x y z ∞ ∞ ∞ ∞ ∞ cost to x ...
Distance Vector: link cost changes <ul><li>Link cost changes: </li></ul><ul><li>node detects local link cost change  </li>...
Distance Vector: link cost changes <ul><li>Link cost changes: </li></ul><ul><li>good news travels fast  </li></ul><ul><li>...
Comparison of LS and DV algorithms <ul><li>Message complexity </li></ul><ul><li>LS:  with n nodes, E links, O(nE) msgs sen...
Transport Layer
Transport Protocols <ul><li>Protocol implemented entirely at the ends </li></ul><ul><ul><li>Completeness/correctness of fu...
UDP: User Datagram Protocol  [RFC 768] <ul><li>“ No frills”, “bare bones” Internet transport protocol </li></ul><ul><li>“ ...
TCP Header 0 Source Port Destination Port Sequence Number Acknowledgement Number Data Offset Window Reserved ACK URG EOL R...
Connection:  Three-Way  Handshake <ul><li>TCP connection-establishment: 3-way-handshake necessary and sufficient for unamb...
TCP Connection Setup: FSM CLIENT SERVER
TCP – Streams-based Host A Seq=100, 20 bytes data ACK=100 Host B Seq=92, 8 bytes data ACK=120 SendBase = 120 Sendbase = 10...
TCP is Network-friendly <ul><li>Reliable transmission  </li></ul><ul><ul><li>Sliding window concept </li></ul></ul><ul><li...
Stop-and-Wait operation first packet bit transmitted, t = 0 sender receiver RTT   last packet bit transmitted,  t = L / R ...
Pipelining: increased utilization first packet bit transmitted, t = 0 sender receiver RTT  last bit transmitted, t = L / R...
Go-Back-N <ul><li>Sender: </li></ul><ul><li>k-bit seq # in pkt header </li></ul><ul><li>“ window” of up to N, consecutive ...
Go-Back-N
TCP Flow Control <ul><li>receive side of TCP connection has a receive buffer: </li></ul><ul><li>speed-matching service: ma...
TCP Flow control: how it works <ul><li>(Suppose TCP receiver discards out-of-order segments) </li></ul><ul><li>spare room ...
TCP congestion control: <ul><li>two “phases” </li></ul><ul><ul><li>slow start </li></ul></ul><ul><ul><li>congestion avoida...
TCP Slowstart <ul><li>exponential increase (per RTT) in window size (not so slow!) </li></ul><ul><li>loss event: timeout (...
TCP Congestion Avoidance: Tahoe /* slowstart is over  */  /* Congwin > threshold */ Until (loss event) { every w segments ...
Where to from here? <ul><li>IP designed for best-effort service only </li></ul><ul><ul><li>Affecting new applications like...
Outline <ul><li>Session 1 </li></ul><ul><ul><li>7-Layer OSI Model </li></ul></ul><ul><ul><li>Network Layer protocols (Inte...
Thank You !
BACKUP
TCP retransmission - I <ul><li>Premature Timeout </li></ul>Host A Seq=100, 20 bytes data ACK=100 time Host B Seq=92, 8 byt...
TCP retransmission - II <ul><li>Lost ACK packet </li></ul>Host A Seq=92, 8 bytes data ACK=100 loss timeout Host B X Seq=92...
TCP Connection Tear-down Sender Receiver FIN FIN-ACK FIN FIN-ACK Data write Data ack
TCP Connection Tear-down: FSM CLOSING CLOSE WAIT FIN WAIT-1 ESTAB TIME WAIT snd FIN CLOSE send FIN CLOSE rcv ACK of FIN LA...
TCP retransmission - III <ul><li>Cumulative ACKs </li></ul>Host A Seq=92, 8 bytes data ACK=100 loss timeout Host B X Seq=1...
Selective Ack
Selective Ack - Example
Upcoming SlideShare
Loading in...5
×

Introduction to Computer Networks

11,734
-1

Published on

Introductory overview of OSI protocol stack and basic protocols. Useful for the first course on computer networks for undergraduates

Published in: Technology
6 Comments
16 Likes
Statistics
Notes
  • www.CiscoForAll.com join more stuff
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • no
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • thanq its really good and useful to me in thinking about innovation comes along with think of that.... really good work.... tanq for this.....
    Teisha
    http://dashinghealth.com http://healthimplants.com
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • plese send me this
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Dear Sir,
    I am into sales Of IT services. I need this slide desparately to improve on my technickle part. please guide further. Devesh Kumar
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total Views
11,734
On Slideshare
0
From Embeds
0
Number of Embeds
7
Actions
Shares
0
Downloads
1,833
Comments
6
Likes
16
Embeds 0
No embeds

No notes for slide

Introduction to Computer Networks

  1. 1. Network Essentials Session 1 R. Venkateswaran
  2. 2. Outline <ul><li>Session 1 </li></ul><ul><ul><li>7-Layer OSI Model </li></ul></ul><ul><ul><li>Network Layer protocols (Internet Protocol) </li></ul></ul><ul><ul><li>Transport Layer protocols (TCP and UDP) </li></ul></ul><ul><li>Session 2 </li></ul><ul><ul><li>Socket Programming – with focus on BSD Sockets </li></ul></ul><ul><ul><ul><li>Sample codes in C that work on UNIX/Linux systems </li></ul></ul></ul>
  3. 3. Acknowledgments <ul><li>This presentation has been adapted from presentations available at: </li></ul><ul><li>Prof. Shivkumar Kalyanaraman (http://www.ecse.rpi.edu/Homepages/shivkuma/) </li></ul><ul><li>Prof. Sneha Kumar Kasera (http://www.cs.utah.edu/classes/cs5480/) </li></ul><ul><li>Prof. David Hollinger (http://www.cs.rpi.edu/~hollingd/netprog) </li></ul><ul><li>South Asian Network Operators Group (http://ws.edu.isoc.org/workshops/2004/SANOG-IV/ip-services/presentations/ip-intro/ipbasics.ppt) </li></ul>
  4. 4. Network Models <ul><li>Formal models allow us to deal with various aspects of networks abstractly </li></ul><ul><ul><li>One such model is the OSI reference model </li></ul></ul><ul><li>The OSI reference model is a layered model </li></ul><ul><ul><li>Divide a task into pieces and then solve each piece independently </li></ul></ul><ul><ul><li>Establishing a well defined interface between layers </li></ul></ul><ul><li>Major Advantages: </li></ul><ul><ul><li>Each layer can be implemented independently </li></ul></ul><ul><ul><li>Adaptability </li></ul></ul><ul><ul><li>Code Reuse </li></ul></ul><ul><ul><li>Extensibility </li></ul></ul>
  5. 5. OSI 7-Layer Model IP TCP/UDP Virtual End-to-end connectivity Path selection, Internetworking Error-free communication links Transmission of raw signal Mail, Web, etc. 1 3 2 4 5 6 7 Ethernet Data encryption,compression Managing sessions Funtionality Examples Layers Application Presentation Session Transport Network Data Link Physical
  6. 6. OSI 7-Layer Host Router Router Host End to end Hop by hop Application Presentation Session Transport Network Link Physical Network Link Link Network Link Link Physical Physical Application Presentation Session Transport Network Link
  7. 7. TCP/IP Model Host Router Router End to end No session or presentation layers in TCP/IP model Host Hop by hop Application Transport Network Link Physical Network Link Link Network Link Link Physical Physical Application Transport Network Link
  8. 8. Packet structure Trailer Header Header Header Application Transport Network Data Link Data Transport Layer Data Network Layer Data Link Layer Data
  9. 9. Network Layer
  10. 10. Internet Architecture <ul><li>Packet-switched, connectionless datagram network </li></ul><ul><li>IP is the network layer protocol </li></ul><ul><ul><li>Acts as a glue </li></ul></ul><ul><li>Hourglass concept </li></ul><ul><ul><li>all hosts and routers run IP </li></ul></ul><ul><li>Stateless architecture </li></ul><ul><ul><li>no per flow state inside the network </li></ul></ul><ul><li>Hop-by-hop packet forwarding </li></ul><ul><ul><li>Header contains all the information </li></ul></ul>
  11. 11. IP - Minimalist Approach <ul><li>Dumb network </li></ul><ul><ul><li>Connectivity is the key </li></ul></ul><ul><ul><li>Network provides minimal functionalities to support connectivity </li></ul></ul><ul><ul><li>Addressing, forwarding, routing </li></ul></ul><ul><li>Smart end systems </li></ul><ul><ul><li>Transport layer or application performs more sophisticated functionalities </li></ul></ul><ul><ul><li>Flow control, error control, congestion control </li></ul></ul><ul><li>Advantages </li></ul><ul><ul><li>High scalability </li></ul></ul><ul><ul><li>Works across heterogeneous technologies (Ethernet, modem, satellite, wireless) </li></ul></ul><ul><ul><li>Supports diverse applications (telnet, ftp, Web, media streaming) </li></ul></ul><ul><ul><li>Decentralized network administration </li></ul></ul>
  12. 12. IPv4 Header Transport Layer Data… 0 4 8 16 32 IHL Type of Service Total Length Version Fragment Offset Identification Flags Time to Live Protocol Header Checksum Source Address Destination Address Padding Options
  13. 13. IP Address <ul><li>IP address: Unique identification of the end-system from a network-layer perspective </li></ul><ul><li>IP address is 32-bits long (version 4) </li></ul><ul><li>Contains a network ID and host ID </li></ul><ul><ul><li>Use subnet mask to detect the network ID </li></ul></ul><ul><li>Example of IP address: </li></ul><ul><ul><li>133.27.162.125 </li></ul></ul>133 27 162 125 10000101 00011011 10100010 01111101 85 1B A2 7D Decimal Binary HEX NetID Host ID Boundary
  14. 14. Network Mask <ul><li>Define which bits are used to describe the network ID </li></ul><ul><li>Different Representations: </li></ul><ul><ul><li>Decimal dot notation: 255.255.224.0 </li></ul></ul><ul><ul><li>Number of network bits: /19 </li></ul></ul><ul><li>Bitwise-AND of 32-bit IP address with 32-bit netmask yields network ID part of the address (truncated appropriately) </li></ul>
  15. 15. Network Mask Examples 137.158.128.0/ 17 (netmask 255.255.128.0 ) 1111 1111 1111 1111 1 000 0000 0000 0000 1111 1111 1111 1111 0000 0000 0000 0000 1111 1111 1111 1111 1111 1111 11 00 0000 198.134.0.0/ 16 (netmask 255.255.0.0 ) 205.37.193.128/ 26 (netmask 255.255.255.192 ) 1000 1001 1001 1110 1 000 0000 0000 0000 1100 0110 1000 0110 0000 0000 0000 0000 1100 1101 0010 0101 1100 0001 10 00 0000
  16. 16. Subnets <ul><li>All device interfaces having the same network ID are part of the same subnet </li></ul><ul><li>Devices within a subnet can communicate with each other without an intervening router </li></ul>Network consisting of 3 subnets 192.1.1.2 192.1.1.1 192.1.1.3 192.1.1.4 192.1.2.9 192.1.2.2 192.1.2.1 192.1.3.2 192.1.3.1 192.1.3.27
  17. 17. IP router <ul><li>A device with more than one link-layer interface </li></ul><ul><ul><li>Each interface identified by a different IP address (from different subnets) </li></ul></ul><ul><li>Packets arriving at one interface are forwarded out on another interface to get them closer to the destination </li></ul><ul><li>Creates and maintains forwarding tables </li></ul><ul><ul><li>Tables help in making forwarding decisions </li></ul></ul><ul><ul><li>Tables created and updated based on routing information exchanged between routers </li></ul></ul><ul><ul><li>Each router maintains its own forwarding table </li></ul></ul>
  18. 18. Hop by Hop Forwarding
  19. 19. IP Forwarding Rules - I <ul><li>Destination is in the same subnet (direct connectivity) </li></ul><ul><ul><li>Recognize that destination IP address is on same subnet </li></ul></ul><ul><ul><li>Find the destination’s datalink-layer address </li></ul></ul><ul><ul><li>IP packet encapsulated and sent directly to the destination’s datalink-layer address </li></ul></ul><ul><li>Destination is in a different subnet (indirect connectivity) </li></ul><ul><ul><li>Recognize that destination IP address is on different subnet </li></ul></ul><ul><ul><li>Look up destination IP address in a (L3 forwarding) table to find a match, called the next hop router IP address </li></ul></ul><ul><ul><li>Find the next hop router’s datalink-layer address </li></ul></ul><ul><ul><li>IP packet encapsulated and sent directly to the next hop router’s datalink-layer address </li></ul></ul>
  20. 20. IP Forwarding Rules - II <ul><li>Problem 1: Recognize if destination is on the same subnet </li></ul><ul><ul><li>Use netmask to compute network ID of the destination and match it with device’s network ID </li></ul></ul><ul><li>Problem 2: Find a device’s datalink-layer address </li></ul><ul><ul><li>Static mapping </li></ul></ul><ul><ul><li>Dynamic mapping using Address Resolution Protocol (ARP) </li></ul></ul><ul><ul><ul><li>Sender host broadcasts a request: “ What is the Ethernet address of 192.1.1.4? ” </li></ul></ul></ul><ul><ul><ul><li>The device whose IP address is 192.1.1.4 replies back: “ The Ethernet address for 192.1.1.4 is 00-0C-F1-4E-2A-E2 ” </li></ul></ul></ul><ul><ul><ul><li>ARP responses are cached at the sender </li></ul></ul></ul><ul><ul><ul><li>Use arp command to view/modify the cache </li></ul></ul></ul>
  21. 21. Look up Forwarding Table Destination =12.5.9.16 ------------------------------- payload Prefix Interface Next Hop 12.0.0.0/8 10.14.22.19 eth1 12.4.0.0/15 12.5.9.0/24 attached eth2 Serial 1/0/7 10.1.3.77 IP Forwarding Table 0.0.0.0/0 10.14.11.33 eth0 even better OK better best! Longest Prefix Match (Classless) Forwarding
  22. 22. IP Forwarding – Example 1 Forwarding Table on host 192.1.1.1 Note: 127.0.0.1 is the special address of the local interface 192.1.3.2 192.1.1.2 192.1.1.1 192.1.1.3 192.1.1.4 192.1.3.1 192.1.3.27
  23. 23. IP Forwarding – Example 2 Forwarding Table on host 192.1.1.1 Note: 127.0.0.1 is the special address of the local interface 192.1.3.2 192.1.1.2 192.1.1.1 192.1.1.3 192.1.1.4 192.1.3.1 192.1.3.27
  24. 24. IP Forwarding – Example 2 Forwarding Table on host 192.1.1.4 Note: 127.0.0.1 is the special address of the local interface 192.1.3.2 192.1.1.2 192.1.1.1 192.1.1.3 192.1.1.4 192.1.3.1 192.1.3.27
  25. 25. Routing Protocols <ul><li>Distance Vector Routing protocol </li></ul><ul><ul><li>Each router sends a vector of distances to its neighbors </li></ul></ul><ul><ul><li>Vector contains distances to all the nodes </li></ul></ul><ul><ul><li>Each router computes next hop towards different nodes </li></ul></ul><ul><ul><li>Iterative, Asynchronous, Distributed computation </li></ul></ul><ul><li>Link State Routing Protocol </li></ul><ul><ul><li>Each router sends a vector of distances to all the nodes </li></ul></ul><ul><ul><li>Vector contains distances to only the neighbors </li></ul></ul><ul><ul><li>Each router has complete topology information </li></ul></ul><ul><ul><li>Can compute shortest paths to different nodes </li></ul></ul>
  26. 26. Distance vector algorithm - I <ul><li>Basic idea: </li></ul><ul><li>Each node periodically sends its own distance vector estimate to neighbors </li></ul><ul><li>When a node x receives new DV estimate from neighbor, it updates its own DV using Bellman-Ford equation: </li></ul>D x (z) ← min v {c(x,v) + D v (z)} for each node z ∊ N Nexthop x (z) = v <ul><li>Under natural conditions, the estimate D x (z) converges to the actual least cost d x (z) </li></ul>
  27. 27. 2 0 1 from from x y z x y z 0 2 3 from cost to x y z x y z 0 2 3 from cost to x y z x y z ∞ ∞ ∞ ∞ ∞ cost to x y z x y z 0 2 7 from cost to x y z x y z 0 2 3 from cost to x y z x y z 0 2 3 from cost to x y z x y z 0 2 7 from cost to x y z x y z ∞ ∞ ∞ 7 1 0 cost to ∞ ∞ ∞ 2 0 1 7 1 0 2 0 1 7 1 0 2 0 1 3 1 0 2 0 1 3 1 0 2 0 1 3 1 0 2 0 1 3 1 0 time node x table node y table node z table D x (y) = min{c(x,y) + D y (y), c(x,z) + D z (y)} = min{2+0 , 7+1} = 2 D x (z) = min{ c(x,y) + D y (z), c(x,z) + D z (z) } = min{2+1 , 7+0} = 3 ∞ x y z x y z 0 2 7 ∞ ∞ ∞ ∞ ∞ ∞ from cost to x z 1 2 7 y
  28. 28. Distance Vector: link cost changes <ul><li>Link cost changes: </li></ul><ul><li>node detects local link cost change </li></ul><ul><li>updates routing info, recalculates distance vector </li></ul><ul><li>if DV changes, notify neighbors </li></ul>“ good news travels fast” At time t 0 , y detects the link-cost change, updates its DV, and informs its neighbors. At time t 1 , z receives the update from y and updates its table. It computes a new least cost to x and sends its neighbors its DV. At time t 2 , y receives z ’s update and updates its distance table. y ’s least costs do not change and hence y does not send any message to z . x z 1 4 50 y 1
  29. 29. Distance Vector: link cost changes <ul><li>Link cost changes: </li></ul><ul><li>good news travels fast </li></ul><ul><li>bad news travels slow - “count to infinity” problem! </li></ul><ul><li>44 iterations before algorithm stabilizes: see text </li></ul><ul><li>Poisoned reverse: </li></ul><ul><li>If Z routes through Y to get to X : </li></ul><ul><ul><li>Z tells Y its (Z’s) distance to X is infinite (so Y won’t route to X via Z) </li></ul></ul><ul><li>will this completely solve count to infinity problem? </li></ul>x z 1 4 50 y 60
  30. 30. Comparison of LS and DV algorithms <ul><li>Message complexity </li></ul><ul><li>LS: with n nodes, E links, O(nE) msgs sent </li></ul><ul><li>DV: exchange between neighbors only </li></ul><ul><ul><li>convergence time varies </li></ul></ul><ul><li>Speed of Convergence </li></ul><ul><li>LS: O(n 2 ) algorithm requires O(nE) msgs </li></ul><ul><ul><li>may have oscillations </li></ul></ul><ul><li>DV : convergence time varies </li></ul><ul><ul><li>may be routing loops </li></ul></ul><ul><ul><li>count-to-infinity problem </li></ul></ul><ul><li>Robustness: what happens if router malfunctions? </li></ul><ul><li>LS: </li></ul><ul><ul><li>node can receive incorrect link cost </li></ul></ul><ul><ul><li>each node computes only its own table </li></ul></ul><ul><li>DV: </li></ul><ul><ul><li>DV node can advertise incorrect path cost </li></ul></ul><ul><ul><li>each node’s table used by others </li></ul></ul><ul><ul><ul><li>error propagate thru network </li></ul></ul></ul>
  31. 31. Transport Layer
  32. 32. Transport Protocols <ul><li>Protocol implemented entirely at the ends </li></ul><ul><ul><li>Completeness/correctness of function implementations </li></ul></ul><ul><li>User Datagram Protocol (UDP) provides just integrity and demultiplexing </li></ul><ul><li>Transmission Control Protocol (TCP) adds… </li></ul><ul><ul><li>Connection-orientedness (point-to-point) </li></ul></ul><ul><ul><li>Reliability </li></ul></ul><ul><ul><li>In-Order delivery </li></ul></ul><ul><ul><li>Byte-stream </li></ul></ul><ul><ul><li>Full duplex </li></ul></ul><ul><ul><li>Flow and congestion control </li></ul></ul>
  33. 33. UDP: User Datagram Protocol [RFC 768] <ul><li>“ No frills”, “bare bones” Internet transport protocol </li></ul><ul><li>“ best effort” service, UDP segments may be: </li></ul><ul><ul><li>lost </li></ul></ul><ul><ul><li>delivered out of order to the application </li></ul></ul><ul><li>connectionless: </li></ul><ul><ul><li>no handshaking between UDP sender, receiver </li></ul></ul><ul><ul><li>each UDP datagram handled independently of others </li></ul></ul><ul><li>Why is there a UDP? </li></ul><ul><li>No connection establishment => Faster communication </li></ul><ul><li>simple: no connection state at sender, receiver </li></ul><ul><li>small 8-byte header (lower overheads) </li></ul><ul><li>no congestion control: UDP can blast away as fast as desired </li></ul><ul><li>Streaming Multimedia apps, DNS, SNMP benefit from UDP </li></ul>0 16 32 Source Port Destination Port Length Checksum Application Layer Data…
  34. 34. TCP Header 0 Source Port Destination Port Sequence Number Acknowledgement Number Data Offset Window Reserved ACK URG EOL RST SYN FIN Checksum Urgent Pointer Padding Options 4 8 16 32 Application Layer Data…
  35. 35. Connection: Three-Way Handshake <ul><li>TCP connection-establishment: 3-way-handshake necessary and sufficient for unambiguous setup/teardown even under conditions of loss, duplication, and delay </li></ul>
  36. 36. TCP Connection Setup: FSM CLIENT SERVER
  37. 37. TCP – Streams-based Host A Seq=100, 20 bytes data ACK=100 Host B Seq=92, 8 bytes data ACK=120 SendBase = 120 Sendbase = 100 time
  38. 38. TCP is Network-friendly <ul><li>Reliable transmission </li></ul><ul><ul><li>Sliding window concept </li></ul></ul><ul><li>Flow control </li></ul><ul><ul><li>Regulated by the receiver </li></ul></ul><ul><li>Congestion Control </li></ul><ul><ul><li>Regulated by the sender </li></ul></ul><ul><ul><li>Additive Increase, Multiplicative Decrease </li></ul></ul><ul><ul><li>Fairness of TCP streams </li></ul></ul>
  39. 39. Stop-and-Wait operation first packet bit transmitted, t = 0 sender receiver RTT last packet bit transmitted, t = L / R first packet bit arrives last packet bit arrives, send ACK ACK arrives, send next packet, t = RTT + L / R
  40. 40. Pipelining: increased utilization first packet bit transmitted, t = 0 sender receiver RTT last bit transmitted, t = L / R first packet bit arrives last packet bit arrives, send ACK ACK arrives, send next packet, t = RTT + L / R last bit of 2 nd packet arrives, send ACK last bit of 3 rd packet arrives, send ACK Increase utilization by a factor of 3!
  41. 41. Go-Back-N <ul><li>Sender: </li></ul><ul><li>k-bit seq # in pkt header </li></ul><ul><li>“ window” of up to N, consecutive unack’ed pkts allowed </li></ul><ul><li>ACK(n): ACKs all pkts up to, including seq # n - “cumulative ACK” </li></ul><ul><ul><li>may receive duplicate ACKs (see receiver) </li></ul></ul><ul><li>timer for each in-flight pkt </li></ul><ul><li>timeout(n): retransmit pkt n and all higher seq # pkts in window </li></ul>
  42. 42. Go-Back-N
  43. 43. TCP Flow Control <ul><li>receive side of TCP connection has a receive buffer: </li></ul><ul><li>speed-matching service: matching the send rate to the receiving app’s drain rate </li></ul><ul><li>app process may be slow at reading from buffer </li></ul>sender won’t overflow receiver’s buffer by transmitting too much, too fast flow control
  44. 44. TCP Flow control: how it works <ul><li>(Suppose TCP receiver discards out-of-order segments) </li></ul><ul><li>spare room in buffer </li></ul><ul><li>= RcvWindow </li></ul><ul><li>= RcvBuffer-[LastByteRcvd - LastByteRead] </li></ul><ul><li>Rcvr advertises spare room by including value of RcvWindow in segments </li></ul><ul><li>Sender limits unACKed data to RcvWindow </li></ul><ul><ul><li>guarantees receive buffer doesn’t overflow </li></ul></ul>
  45. 45. TCP congestion control: <ul><li>two “phases” </li></ul><ul><ul><li>slow start </li></ul></ul><ul><ul><li>congestion avoidance </li></ul></ul><ul><li>important variables: </li></ul><ul><ul><li>Congwin </li></ul></ul><ul><ul><li>threshold: defines threshold between two slow start phase, congestion control phase </li></ul></ul><ul><li>“ probing” for usable bandwidth: </li></ul><ul><ul><li>ideally: transmit as fast as possible ( Congwin as large as possible) without loss </li></ul></ul><ul><ul><li>increase Congwin until loss (congestion) </li></ul></ul><ul><ul><li>loss: decrease Congwin , then begin probing (increasing) again </li></ul></ul>
  46. 46. TCP Slowstart <ul><li>exponential increase (per RTT) in window size (not so slow!) </li></ul><ul><li>loss event: timeout (Tahoe TCP) </li></ul>initialize: Congwin = 1 for (each segment ACKed) Congwin++ until (loss event OR CongWin > threshold) Host A one segment RTT Host B two segments four segments Slowstart algorithm time
  47. 47. TCP Congestion Avoidance: Tahoe /* slowstart is over */ /* Congwin > threshold */ Until (loss event) { every w segments ACKed: Congwin++ } threshold = Congwin/2 Congwin = 1 perform slowstart TCP Tahoe Congestion avoidance
  48. 48. Where to from here? <ul><li>IP designed for best-effort service only </li></ul><ul><ul><li>Affecting new applications like media streaming, VoIP </li></ul></ul><ul><ul><li>Should the network become application-aware? </li></ul></ul><ul><ul><li>Should the IP routers look beyond the IP header? </li></ul></ul><ul><li>We are already running short of IP addresses </li></ul><ul><ul><li>Solution: IPv6 – yet to become widespread </li></ul></ul><ul><ul><li>Temporary fix: Network Address Translation (NAT) </li></ul></ul><ul><li>TCP or UDP may not be the best suited for reliable media streaming </li></ul><ul><ul><li>Answer: Stream Control Transmission Protocol (SCTP) </li></ul></ul><ul><ul><li>SCTP combines the datagram orientation of UDP with the sequencing and reliability of TCP </li></ul></ul><ul><ul><li>SCTP uses multi-streaming, message-oriented routing </li></ul></ul>
  49. 49. Outline <ul><li>Session 1 </li></ul><ul><ul><li>7-Layer OSI Model </li></ul></ul><ul><ul><li>Network Layer protocols (Internet Protocol) </li></ul></ul><ul><ul><li>Transport Layer protocols (TCP and UDP) </li></ul></ul><ul><li>Session 2 </li></ul><ul><ul><li>Socket Programming – with focus on BSD Sockets </li></ul></ul><ul><ul><ul><li>Sample codes in C that work on UNIX/Linux systems </li></ul></ul></ul>
  50. 50. Thank You !
  51. 51. BACKUP
  52. 52. TCP retransmission - I <ul><li>Premature Timeout </li></ul>Host A Seq=100, 20 bytes data ACK=100 time Host B Seq=92, 8 bytes data ACK=120 Seq=92, 8 bytes data Seq=92 timeout ACK=120 Seq=92 timeout SendBase = 120 SendBase = 120 Sendbase = 100
  53. 53. TCP retransmission - II <ul><li>Lost ACK packet </li></ul>Host A Seq=92, 8 bytes data ACK=100 loss timeout Host B X Seq=92, 8 bytes data ACK=100 time SendBase = 100
  54. 54. TCP Connection Tear-down Sender Receiver FIN FIN-ACK FIN FIN-ACK Data write Data ack
  55. 55. TCP Connection Tear-down: FSM CLOSING CLOSE WAIT FIN WAIT-1 ESTAB TIME WAIT snd FIN CLOSE send FIN CLOSE rcv ACK of FIN LAST-ACK CLOSED FIN WAIT-2 snd ACK rcv FIN delete TCB Timeout=2msl send FIN CLOSE send ACK rcv FIN snd ACK rcv FIN rcv ACK of FIN snd ACK rcv FIN+ACK
  56. 56. TCP retransmission - III <ul><li>Cumulative ACKs </li></ul>Host A Seq=92, 8 bytes data ACK=100 loss timeout Host B X Seq=100, 20 bytes data ACK=120 time SendBase = 120
  57. 57. Selective Ack
  58. 58. Selective Ack - Example
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×