600 likes | 699 Views
IT 347 Midterm 2 Review. Vocab Review. ATM CBR ABR VBR UBR MSS MTU AIMD. Host A. Host B. Seq=92, 8 bytes data. ACK=100. Seq=92 timeout. timeout. X. loss. Seq=92, 8 bytes data. ACK=100. time. time. lost ACK scenario. TCP: retransmission scenarios. Host A. Host B.
E N D
Vocab Review • ATM • CBR • ABR • VBR • UBR • MSS • MTU • AIMD
Host A Host B Seq=92, 8 bytes data ACK=100 Seq=92 timeout timeout X loss Seq=92, 8 bytes data ACK=100 time time lost ACK scenario TCP: retransmission scenarios Host A Host B Seq=92, 8 bytes data Seq=100, 20 bytes data ACK=100 ACK=120 Seq=92, 8 bytes data Sendbase = 100 SendBase = 120 ACK=120 Seq=92 timeout SendBase = 100 SendBase = 120 premature timeout Transport Layer
Host A Host B Seq=92, 8 bytes data ACK=100 Seq=100, 20 bytes data timeout X loss ACK=120 time Cumulative ACK scenario TCP retransmission scenarios (more) SendBase = 120 Transport Layer
TCP ACK generation[RFC 1122, RFC 2581] TCP Receiver action Delayed ACK. Wait up to 500ms for next segment. If no next segment, send ACK Immediately send single cumulative ACK, ACKing both in-order segments Immediately send duplicate ACK, indicating seq. # of next expected byte Immediate send ACK, provided that segment starts at lower end of gap Event at Receiver Arrival of in-order segment with expected seq #. All data up to expected seq # already ACKed Arrival of in-order segment with expected seq #. One other segment has ACK pending Arrival of out-of-order segment higher-than-expect seq. # . Gap detected Arrival of segment that partially or completely fills gap Transport Layer
time-out period often relatively long: long delay before resending lost packet detect lost segments via duplicate ACKs. sender often sends many segments back-to-back if segment is lost, there will likely be many duplicate ACKs for that segment If sender receives 3 ACKs for same data, it assumes that segment after ACKed data was lost: fast retransmit:resend segment before timer expires Fast Retransmit Transport Layer
Host A Host B seq # x1 seq # x2 seq # x3 ACK x1 X seq # x4 seq # x5 ACK x1 ACK x1 ACK x1 triple duplicate ACKs resend seq X2 timeout time Transport Layer
Fast retransmit algorithm: event: ACK received, with ACK field value of y if (y > SendBase) { SendBase = y if (there are currently not-yet-acknowledged segments) start timer } else { increment count of dup ACKs received for y if (count of dup ACKs received for y = 3) { resend segment with sequence number y } a duplicate ACK for already ACKed segment fast retransmit Transport Layer
receive side of TCP connection has a receive buffer: speed-matching service: matching send rate to receiving application’s drain rate flow control sender won’t overflow receiver’s buffer by transmitting too much, too fast (currently) unused buffer space application process IP datagrams TCP data (in buffer) TCP Flow Control • app process may be slow at reading from buffer Transport Layer
(suppose TCP receiver discards out-of-order segments) unused buffer space: = rwnd = RcvBuffer-[LastByteRcvd - LastByteRead] receiver: advertises unused buffer space by including rwnd value in segment header sender: limits # of unACKed bytes to rwnd guarantees receiver’s buffer doesn’t overflow (currently) unused buffer space application process IP datagrams TCP data (in buffer) rwnd RcvBuffer TCP Flow control: how it works Transport Layer
loss, so decrease rate X TCP congestion control: bandwidth probing • “probing for bandwidth”: increase transmission rate on receipt of ACK, until eventually loss occurs, then decrease transmission rate • continue to increase on ACK, decrease on loss (since available bandwidth is changing, depending on other connections in network) ACKs being received, so increase rate X X X TCP’s “sawtooth” behavior X sending rate time • Q: how fast to increase/decrease? • details to follow Transport Layer
sender limits rate by limiting number of unACKed bytes “in pipeline”: cwnd: differs from rwnd(how, why?) sender limited bymin(cwnd,rwnd) roughly, cwndis dynamic, function of perceived network congestion ACK(s) cwnd rate = bytes/sec RTT TCP Congestion Control: details LastByteSent-LastByteAcked cwnd cwnd bytes RTT Transport Layer
segment loss event: reducing cwnd timeout: no response from receiver cut cwnd to 1 3 duplicate ACKs: at least some segments getting through (recall fast retransmit) cut cwnd in half, less aggressively than on timeout TCP Congestion Control: more details ACK received: increase cwnd • slowstart phase: • increase exponentially fast (despite name) at connection start, or following timeout • congestion avoidance: • increase linearly Transport Layer
when connection begins, cwnd = 1 MSS example: MSS = 500 bytes & RTT = 200 msec initial rate = 20 kbps available bandwidth may be >> MSS/RTT desirable to quickly ramp up to respectable rate increase rate exponentially until first loss event or when threshold reached double cwnd every RTT done by incrementing cwnd by 1 for every ACK received time TCP Slow Start Host A Host B one segment RTT two segments four segments Transport Layer
ssthresh:cwnd threshold maintained by TCP on loss event: set ssthreshto cwnd/2 remember (half of) TCP rate when congestion last occurred when cwnd >= ssthresh: transition from slowstart to congestion avoidance phase new ACK cwnd = cwnd+MSS dupACKcount = 0 transmit new segment(s),as allowed L cwnd = 1 MSS ssthresh = 64 KB dupACKcount = 0 cwnd > ssthresh timeout ssthresh = cwnd/2 cwnd = 1 MSS dupACKcount = 0 retransmit missing segment slow start congestion avoidance timeout ssthresh = cwnd/2 cwnd = 1 MSS dupACKcount = 0 retransmit missing segment duplicate ACK dupACKcount++ Transitioning into/out of slowstart L Transport Layer
TCP: congestion avoidance AIMD • when cwnd > ssthresh grow cwnd linearly • increase cwnd by 1 MSS per RTT • approach possible congestion slower than in slowstart • implementation: cwnd = cwnd + MSS/cwnd for each ACK received • ACKs: increase cwnd by 1 MSS per RTT: additive increase • loss: cut cwnd in half (non-timeout-detected loss ): multiplicative decrease AIMD: Additive Increase Multiplicative Decrease Transport Layer
loss: timeout loss: timeout loss: timeout cwnd > ssthresh slow start congestion avoidance fast recovery TCP congestion control FSM: overview new ACK loss: 3dupACK loss: 3dupACK Transport Layer
new ACK . cwnd = cwnd+MSS dupACKcount = 0 transmit new segment(s),as allowed new ACK L cwnd = cwnd + MSS (MSS/cwnd) dupACKcount = 0 transmit new segment(s),as allowed cwnd = 1 MSS ssthresh = 64 KB dupACKcount = 0 cwnd > ssthresh timeout ssthresh = cwnd/2 cwnd = 1 MSS dupACKcount = 0 retransmit missing segment slow start congestion avoidance timeout dupACKcount == 3 dupACKcount == 3 ssthresh = cwnd/2 cwnd = 1 MSS dupACKcount = 0 retransmit missing segment timeout ssthresh= cwnd/2 cwnd = ssthresh + 3 retransmit missing segment duplicate ACK duplicate ACK ssthresh= cwnd/2 cwnd = ssthresh + 3 retransmit missing segment ssthresh = cwnd/2 cwnd = 1 dupACKcount = 0 retransmit missing segment dupACKcount++ dupACKcount++ fast recovery New ACK duplicate ACK cwnd = cwnd + MSS transmit new segment(s), as allowed cwnd = ssthresh dupACKcount = 0 TCP congestion control FSM: details L Transport Layer
Popular “flavors” of TCP TCP Reno ssthresh cwnd window size (in segments) ssthresh TCP Tahoe Transmission round Transport Layer
Summary: TCP Congestion Control • when cwnd < ssthresh, sender in slow-start phase, window grows exponentially. • when cwnd >= ssthresh, sender is in congestion-avoidance phase, window grows linearly. • when triple duplicate ACK occurs, ssthresh set to cwnd/2, cwnd set to ~ ssthresh • when timeout occurs, ssthresh set to cwnd/2, cwnd set to 1 MSS. Transport Layer
TCP Futures: TCP over “long, fat pipes” • example: 1500 byte segments, 100ms RTT, want 10 Gbps throughput • requires window size W = 83,333 in-flight segments • throughput in terms of loss rate: • ➜ L = 2·10-10 Wow • new versions of TCP for high-speed Transport Layer
fairness goal: if K TCP sessions share same bottleneck link of bandwidth R, each should have average rate of R/K TCP connection 1 bottleneck router capacity R TCP connection 2 TCP Fairness Transport Layer
Two competing sessions: Additive increase gives slope of 1, as throughout increases multiplicative decrease decreases throughput proportionally Why is TCP fair? equal bandwidth share R loss: decrease window by factor of 2 congestion avoidance: additive increase Connection 2 throughput loss: decrease window by factor of 2 congestion avoidance: additive increase Connection 1 throughput R Transport Layer
Fairness and UDP multimedia apps often do not use TCP do not want rate throttled by congestion control instead use UDP: pump audio/video at constant rate, tolerate packet loss Fairness and parallel TCP connections nothing prevents app from opening parallel connections between 2 hosts. web browsers do this example: link of rate R supporting 9 connections; new app asks for 1 TCP, gets rate R/10 new app asks for 11 TCPs, gets R/2 ! Fairness (more) Transport Layer
principles behind transport layer services: multiplexing, demultiplexing reliable data transfer flow control congestion control instantiation and implementation in the Internet UDP TCP Next: leaving the network “edge” (application, transport layers) into the network “core” Chapter 3: Summary Transport Layer
routing algorithm local forwarding table header value output link 0100 0101 0111 1001 3 2 2 1 value in arriving packet’s header 1 0111 2 3 Interplay between routing and forwarding Network Layer
Connection setup • 3rd important function in some network architectures: • ATM, frame relay, X.25 • before datagrams flow, two end hosts and intervening routers establish virtual connection • routers get involved • network vs transport layer connection service: • network: between two hosts (may also involve intervening routers in case of VCs) • transport: between two processes Network Layer
example services for individual datagrams: guaranteed delivery guaranteed delivery with less than 40 msec delay example services for a flow of datagrams: in-order datagram delivery guaranteed minimum bandwidth to flow restrictions on changes in inter-packet spacing Network service model Q: What service model for “channel” transporting datagrams from sender to receiver? Network Layer
Network layer service models: Guarantees ? Network Architecture Internet ATM ATM ATM ATM Service Model best effort CBR VBR ABR UBR Congestion feedback no (inferred via loss) no congestion no congestion yes no Bandwidth none constant rate guaranteed rate guaranteed minimum none Loss no yes yes no no Order no yes yes yes yes Timing no yes yes no no Network Layer
VC implementation a VC consists of: • path from source to destination • VC numbers, one number for each link along path • entries in forwarding tables in routers along path • packet belonging to VC carries VC number (rather than dest address) • VC number can be changed on each link. • New VC number comes from forwarding table Network Layer
VC number 22 32 12 3 1 2 interface number Incoming interface Incoming VC # Outgoing interface Outgoing VC # 1 12 3 22 2 63 1 18 3 7 2 17 1 97 3 87 … … … … VC Forwarding table Forwarding table in northwest router: Routers maintain connection state information! Network Layer
used to setup, maintain teardown VC used in ATM, frame-relay, X.25 not used in today’s Internet application transport network data link physical application transport network data link physical Virtual circuits: signaling protocols 6. Receive data 5. Data flow begins 4. Call connected 3. Accept call 1. Initiate call 2. incoming call Network Layer
no call setup at network layer routers: no state about end-to-end connections no network-level concept of “connection” packets forwarded using destination host address packets between same source-dest pair may take different paths application transport network data link physical application transport network data link physical Datagram networks 1. Send data 2. Receive data Network Layer
4 billion IP addresses, so rather than list individual destination address list range of addresses (aggregate table entries) Datagram Forwarding table routing algorithm local forwarding table dest address output link address-range 1 address-range 2 address-range 3 address-range 4 3 2 2 1 IP destination address in arriving packet’s header 1 2 3 Network Layer
Datagram Forwarding table Destination Address Range 11001000 00010111 00010000 00000000 through 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 through 11001000 00010111 00011000 11111111 11001000 00010111 00011001 00000000 through 11001000 00010111 00011111 11111111 otherwise Link Interface 0 1 2 3 Q: but what happens if ranges don’t divide up so nicely? Network Layer
Longest prefix matching Longest prefix matching when looking for forwarding table entry for given destination address, use longest address prefix that matches destination address. Link interface 0 1 2 3 Destination Address Range 11001000 00010111 00010*** ********* 11001000 00010111 00011000 ********* 11001000 00010111 00011*** ********* otherwise Examples: DA: 11001000 00010111 00010110 10100001 Which interface? Which interface? DA: 11001000 00010111 00011000 10101010 Network Layer
Internet (datagram) data exchange among computers “elastic” service, no strict timing req. “smart” end systems (computers) can adapt, perform control, error recovery simple inside network, complexity at “edge” many link types different characteristics uniform service difficult ATM (VC) evolved from telephony human conversation: strict timing, reliability requirements need for guaranteed service “dumb” end systems telephones complexity inside network Datagram or VC network: why? Network Layer
length =1500 length =1040 length =1500 length =4000 ID =x ID =x ID =x ID =x fragflag =0 fragflag =0 fragflag =1 fragflag =1 offset =0 offset =185 offset =0 offset =370 One large datagram becomes several smaller datagrams IP Fragmentation and Reassembly Example • 4000 byte datagram • MTU = 1500 bytes 1480 bytes in data field offset = 1480/8 Network Layer
How many? Subnets 223.1.1.2 223.1.1.1 223.1.1.4 223.1.1.3 223.1.7.0 223.1.9.2 223.1.9.1 223.1.7.1 223.1.8.1 223.1.8.0 223.1.2.6 223.1.3.27 223.1.2.1 223.1.2.2 223.1.3.1 223.1.3.2 Network Layer
IP addressing: CIDR CIDR:Classless InterDomain Routing • subnet portion of address of arbitrary length • address format: a.b.c.d/x, where x is # bits in subnet portion of address host part subnet part 11001000 0001011100010000 00000000 200.23.16.0/23 Network Layer
E B A DHCP client-server scenario 223.1.2.1 DHCP 223.1.1.1 server 223.1.1.2 223.1.2.9 223.1.1.4 223.1.2.2 arriving DHCP client needs address in this network 223.1.1.3 223.1.3.27 223.1.3.2 223.1.3.1 Network Layer
DHCP UDP IP Eth Phy DHCP UDP IP Eth Phy DHCP DHCP DHCP DHCP DHCP DHCP DHCP DHCP DHCP DHCP DHCP: example • connecting laptop needs its IP address, addr of first-hop router, addr of DNS server: use DHCP • DHCP request encapsulated in UDP, encapsulated in IP, encapsulated in 802.1 Ethernet 168.1.1.1 • Ethernet frame broadcast (dest: FFFFFFFFFFFF) on LAN, received at router running DHCP server router (runs DHCP) • Ethernet demuxed to IP demuxed, UDP demuxed to DHCP Network Layer
DHCP UDP IP Eth Phy DHCP UDP IP Eth Phy DHCP DHCP DHCP DHCP DHCP DHCP DHCP DHCP DHCP DHCP: example • DCP server formulates DHCP ACK containing client’s IP address, IP address of first-hop router for client, name & IP address of DNS server • encapsulation of DHCP server, frame forwarded to client, demuxing up to DHCP at client • client now knows its IP address, name and IP address of DSN server, IP address of its first-hop router router (runs DHCP) Network Layer
200.23.16.0/23 200.23.18.0/23 200.23.30.0/23 200.23.20.0/23 . . . . . . Hierarchical addressing: more specific routes ISPs-R-Us has a more specific route to Organization 1 Organization 0 “Send me anything with addresses beginning 200.23.16.0/20” Organization 2 Fly-By-Night-ISP Internet Organization 7 “Send me anything with addresses beginning 199.31.0.0/16 or 200.23.18.0/23” ISPs-R-Us Organization 1 Network Layer
2 4 1 3 S: 138.76.29.7, 5001 D: 128.119.40.186, 80 S: 10.0.0.1, 3345 D: 128.119.40.186, 80 1: host 10.0.0.1 sends datagram to 128.119.40.186, 80 2: NAT router changes datagram source addr from 10.0.0.1, 3345 to 138.76.29.7, 5001, updates table S: 128.119.40.186, 80 D: 10.0.0.1, 3345 S: 128.119.40.186, 80 D: 138.76.29.7, 5001 NAT: Network Address Translation NAT translation table WAN side addr LAN side addr 138.76.29.7, 5001 10.0.0.1, 3345 …… …… 10.0.0.1 10.0.0.4 10.0.0.2 138.76.29.7 10.0.0.3 4: NAT router changes datagram dest addr from 138.76.29.7, 5001 to 10.0.0.1, 3345 3: Reply arrives dest. address: 138.76.29.7, 5001 Network Layer
Message complexity LS: with n nodes, E links, O(nE) msgs sent DV: exchange between neighbors only convergence time varies Speed of Convergence LS: O(n2) algorithm requires O(nE) msgs may have oscillations DV: convergence time varies may be routing loops count-to-infinity problem Robustness: what happens if router malfunctions? LS: node can advertise incorrect link cost each node computes only its own table DV: DV node can advertise incorrect path cost each node’s table used by others error propagate thru network Comparison of LS and DV algorithms Network Layer
forwarding table configured by both intra- and inter-AS routing algorithm intra-AS sets entries for internal dests inter-AS & intra-As sets entries for external dests 3a 3b 2a AS3 AS2 1a 2c AS1 2b 3c 1b 1d 1c Inter-AS Routing algorithm Intra-AS Routing algorithm Forwarding table Interconnected ASes Network Layer
suppose router in AS1 receives datagram destined outside of AS1: router should forward packet to gateway router, but which one? AS1 must: learn which dests are reachable through AS2, which through AS3 propagate this reachability info to all routers in AS1 job of inter-AS routing! 2c 2b 3c 1b 1d 1c 3a 3b 2a 1a AS1 Inter-AS tasks AS3 other networks other networks AS2 Network Layer
2c 2b 3c 1b 1d 1c 3a 3b 2a 1a AS1 Example: Setting forwarding table in router 1d • suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2. • inter-AS protocol propagates reachability info to all internal routers • router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1c. • installs forwarding table entry (x,I) … x AS3 other networks other networks AS2 Network Layer
2c 2b 3c 1b 1d 1c 3a 3b 2a 1a AS1 Example: Choosing among multiple ASes • now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2. • to configure forwarding table, router 1d must determine which gateway it should forward packets towards for dest x • this is also job of inter-AS routing protocol! … x …… AS3 other networks other networks AS2 ? Network Layer