Upload
others
View
4
Download
0
Embed Size (px)
Citation preview
CSE 123: Computer NetworksAlex C. Snoeren
Lecture 26:Final Review
Project 2 due tonight!
Exam Overview● Focus on topics since the midterm
◆ But everything is fair game…
● Roughtly the same style & length as midterm◆ It won’t take the whole time◆ We’ll spend the first few minutes of the exam period awarding
the Espresso Prize
● As with the midterm, you can bring crib sheet◆ One double-sided 8x5.x11” paper that you turn in
2CSE 123 – Lecture 26: Final Review
TCP/IP Protocol Stack
HTTP
TCP
IP
Ethernetinterface
HTTP
TCP
IP
Ethernetinterface
IP
IP
Ethernetinterface
Ethernetinterface
SONETinterface
SONETinterface
host host
router router
3
Application Layer
Transport Layer
Network Layer
Link Layer
CSE 123 – Lecture 26: Final Review
Encapsulation via Headers● Typical Web packet
● Notice that layers add overhead◆ Space (headers), effective bandwidth◆ Time (processing headers, “peeling the onion”), latency
IP Hdr Payload (Web object)TCP Hdr HTTP HdrEthernet Hdr
Start of packet End of packetdatalink network transport application
4CSE 123 – Lecture 26: Final Review
Phy/(MAC)Link layer● Signal encoding
◆ Encode binary data from source node into signals that physical links carry
◆ Signal is decoded back into binary data at receiving node◆ Work performed by network adapter at sender and receiver
● Media access◆ Arbitrate which nodes can send frames at any point in time◆ Not always necessary; e.g. point-to-point duplex links
5CSE 123 – Lecture 26: Final Review
DNS ExampleHost at cis.poly.edu
wants IP address for gaia.cs.umass.edu
requesting hostcis.poly.edu
gaia.cs.umass.edu
root DNS server
local DNS serverdns.poly.edu
1
23
4
5
6
authoritative DNS serverdns.cs.umass.edu
78
TLD DNS server
6CSE 123 – Lecture 26: Final Review
10.0.0.4
10.0.0.2
10.0.0.3
S: 10.0.0.4:3345D: 132.239.8.45:80
110.0.0.1
138.76.29.7
1: host 10.0.0.4 sends packet to 132.239.8.45:80
NAT translation tableWAN side addr LAN side addr
138.76.29.7:5001 10.0.0.4:3345…… ……
S: 132.239.8.45:80 D: 10.0.0.4:3345 4
S: 138.76.29.7:5001D: 132.239.8.45:802
2: NAT routerchanges packetsource addr from10.0.0.1:3345 to138.76.29.7:5001,updates table
S: 132.239.8.45:80 D: 138.76.29.7:5001 3
3: Reply arrivesdest. address:138.76.29.7:5001
4: NAT routerchanges packetdest addr from138.76.29.7:5001 to 10.0.0.4:3345
NA(p)T Example
7CSE 123 – Lecture 26: Final Review
● How to choose best path?◆ Defining “best” can be slippery
● How to scale to millions of users?◆ Minimize control messages and routing table size
● How to adapt to failures or changes?◆ Node and link failures, plus message loss
8
Routing Challenges
CSE 123 – Lecture 26: Final Review
● Source routing◆ Complete path listed in packet
● Virtual circuits◆ Set up path out-of-band and store path identifier in routers◆ Local path identifier in packet
● Destination-based forwarding◆ Router looks up address in forwarding table◆ Forwarding table contains (address, next-hop) tuples
9
Forwarding Options
CSE 123 – Lecture 26: Final Review
● Two phases◆ Reliable flooding
» Tell all routers what you know about your local topology◆ Path calculation (Dijkstra’s algorithm)
» Each router computes best path over complete network
● Motivation◆ Global information allows optimal route computation◆ Straightforward to implement and verify
10
Link-state Routing
CSE 123 – Lecture 26: Final Review
Dijkstra’s Shortest Path Tree● So you have all of these LSPs. Now what?● Graph algorithm for single-source shortest path tree
(find best route to all nodes)
S ß {}Q ß <remaining nodes keyed by distance>While Q != {}
u ß extract-min(Q) u = node with lowest costS ß S plus {u}Within Q:
for each node v adjacent to u“relax” the cost of v is it cheaper to go
through u?
ß u is done
11
Iterative, asynchronous: each local iteration caused by:
● Local link cost change ● Distance vector update message
from neighbor
Distributed:● Each node notifies neighbors
when its DV changes● Neighbors then notify their
neighbors if necessary
wait for (change in local link cost or message from neighbor)
recompute estimates
if distance to any destination has changed, notify neighbors
Each node:
Distance Vector Algorithm
12CSE 123 – Lecture 26: Final Review
● Define distances at each node X◆ dx(y) = cost of least-cost path from X to Y
● Update distances based on neighbors◆ dx(y) = min {c(x,v) + dv(y)} over all neighbors V
32
2
1
14
1
4
5
3
u
v
w
x
y
z
s
t du(z) = min{c(u,v) + dv(z), c(u,w) + dw(z)}
Bellman-Ford Algorithm
13CSE 123 – Lecture 26: Final Review
1A CB
23 2
1A CB3 4
Update 3
1A CB
Update 4
5 4
Etc…
Distance to C
Problem: Counting to Infinity
14CSE 123 – Lecture 26: Final Review
● Hold downs◆ As metric increases, delay propagating information◆ Limitation: Delays convergence
● Loop avoidance◆ Full path information in route advertisement◆ Explicit queries for loops
● Split horizon◆ Never advertise a destination through its next hop
» A doesn’t advertise C to B◆ Poison reverse: Send negative information when advertising a
destination through its next hop» A advertises C to B with a metric of ¥» Limitation: Only works for “loop”s of size 2
Mitigation Strategies
15CSE 123 – Lecture 26: Final Review
● Internet is divided into Autonomous Systems◆ Distinct regions of administrative control◆ Routers/links managed by a single “institution”◆ Service provider, company, university, …
● Hierarchy of Autonomous Systems◆ Large, “tier-1” provider with a nationwide backbone◆ Medium-sized regional provider with smaller backbone◆ Small network run by a single company or university
● Interaction between Autonomous Systems◆ Internal topology is not shared between ASes◆ … but, neighboring ASes interact to coordinate routing
Autonomous Systems
16CSE 123 – Lecture 26: Final Review
● Border routers summarize and advertise their routes to external neighbors and vice-versa
◆ Border routers apply policy
● Internal routers can use notion of default routes
● Core is default-free; routers must have a route to all networks in the world
● But what routing protocol?
R1
Autonomous system 1R2
R3
Autonomous system 2R4
R5 R6
AS1
AS2
Border router
Border router
Inter-domain Routing
17CSE 123 – Lecture 26: Final Review
● Extension of distance-vector routing◆ Support flexible routing policies◆ Avoid count-to-infinity problem
● Key idea: advertise the entire path◆ Distance vector: send distance metric per destination◆ Path vector: send the entire path for each destination
3 2 1
d
“d: path (2,1)” “d: path (1)”
data traffic data traffic
Path-vector Routing
18CSE 123 – Lecture 26: Final Review
● Destination prefix (e.g., 128.112.0.0/16)● Route attributes, including
◆ AS path (e.g., “7018 88”)◆ Next-hop IP address (e.g., 12.127.0.121)
19
AS 88Princeton
128.112.0.0/16AS path = 88Next Hop = 192.0.2.1
AS 7018AT&T
AS 11Harvard
192.0.2.1
128.112.0.0/16AS path = 7018 88Next Hop = 12.127.0.121
12.127.0.121
A Simple BGP Route
● Neighboring ASes have business contracts◆ How much traffic to carry◆ Which destinations to reach◆ How much money to pay
● Common business relationships◆ Customer-provider
» E.g., Princeton is a customer of USLEC» E.g., MIT is a customer of Level3
◆ Peer-peer» E.g., UUNET is a peer of Sprint» E.g., Harvard is a peer of Harvard Business School
Business Relationships
20CSE 123 – Lecture 26: Final Review
Functional architecture Reservation/Admission
Control
Routing Protocols
Routing Table
ClassificationRules
Firewall
PacketClassification Switching
ForwardingTable
OutputScheduling
Control Plane• Complex• Per-control action• May be slow
Data plane• Simple• Per-packet• Must be fast
21
Interconnect architecture● Input & output connected via switch fabric
● Kinds of switch fabric◆ Shared Memory◆ Bus◆ Crossbar
● How to deal with transientcontention?◆ Input queuing◆ Output queuing
Input OutputSwitch
22CSE 123 – Lecture 26: Final Review
IQ + Virtual Output Queuing● Input interfaces buffer packets
in per-output virtual queues
● Pro◆ Solves blocking problem
● Con◆ More resources per port◆ Complex arbiter at switch◆ Still limited by input/output
contention (scheduler)
Input OutputSwitch
23CSE 123 – Lecture 26: Final Review
● Buffer management: which packet to drop when? ◆ We only have finite-length queues
● Scheduling: which packet to transmit next?
1
2
Scheduler
flow 1
flow 2
flow n
Classifier
Buffer management
Key Router Challenges
24CSE 123 – Lecture 26: Final Review
Min threshMax thresh
Average Queue Length
minth maxth
maxP
1.0
Avg queue length
P(drop)
RED Operation
25CSE 123 – Lecture 26: Final Review
● Parameters◆ r – average rate, i.e., rate at which tokens fill the bucket◆ b – bucket depth (limits size of burst)◆ R – maximum link capacity or peak rate (optional parameter)
● A bit can be transmitted only when a token is available
r bps
b bits
≤ R bps
regulatortime
bits
b·R/(R-r)
slope R
slope r
Maximum # of bits sent
b/(R-r)
Token Bucket Basics
CSE 123 – Lecture 26: Final Review
● Rough definition: “When an increase in network load produces a decrease in useful work”
● Why does it happen?◆ Sender sends faster than bottleneck link speed◆ Packets queue until dropped◆ In response to packets being dropped, sender retransmits◆ All hosts repeat in steady state…
27
Congestion Collapse
CSE 123 – Lecture 26: Final Review
Network Load
Thro
ughp
utLa
tenc
y
“Knee”“Cliff”
Congestion collapse
● Congestion avoidance: try to stay to the left of the knee● Congestion control: try to stay to the left of the cliff
28
Proactive vs. Reactive
Loss due toCongestion
CSE 123 – Lecture 26: Final Review
● Window-based congestion control◆ Unified congestion control and flow control mechanism◆ rwin: advertised flow control window from receiver◆ cwnd: congestion control window
» Estimate of how much outstanding data network can deliver in a round-trip time
◆ Sender can only send MIN(rwin,cwnd) at any time
● Idea: decrease cwnd when congestion is encountered; increase cwnd otherwise◆ Question: how much to adjust?
29
Basic TCP Algorithm
CSE 123 – Lecture 26: Final Review
cwnd=1
cwnd=2
cwnd=4
cwnd=8
Sender Receiver
0
50
100
150
200
250
300
0 1 2 3 4 5 6 7 8round-trip times
cwnd
30
TCP Slow Start
CSE 123 – Lecture 26: Final Review
Slow Start + Congestion Avoidance
0
2
4
6
8
10
12
14
16
18
0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40
round-trip times
cwnd
Timeout
ssthresh
Slow start
Congestionavoidance
31
Basic TCP Mechanisms
CSE 123 – Lecture 26: Final Review
● Maintain a queue for each flow◆ What is a flow?
● Implements max-min fairness: each flow receives min(ri, f) , where
◆ ri – flow arrival rate◆ f – link fair rate (see next slide)
● Weighted Fair Queuing (WFQ) – associate a weight with each flow to divvy bandwidth up non-equally
Fair Queuing
32CSE 123 – Lecture 26: Final Review
0 2 104 6 8
0 2 104 6 8
● Select the first packet that finishes in the fluid flow system
Servicein fluid flow
system
Packetsystem
Packet-Based WFQ
33CSE 123 – Lecture 26: Final Review
Signals and Channels● A signal is some form of energy (light, voltage, etc)
◆ Varies with time (on/off, high/low, etc.)◆ Can be continuous or discrete
● A channel is a physical medium that conveys energy◆ Any real channel will distort the input signal as it does so◆ How it distorts the signal depends on the signal
34CSE 123 – Lecture 26: Final Review
Carrier Signals● Baseband modulation: send the “bare” signal
◆ E.g. +5 Volts for 1, -5 Volts for 0◆ All signals fall in the same frequency range
● Broadband modulation◆ Use the signal to modulate a high frequency signal (carrier).◆ Can be viewed as the product of the two signals
35
Ampl
itude
Signal CarrierFrequency
Ampl
itude
ModulatedCarrier
CSE 123 – Lecture 26: Final Review
Forms of Digital Modulation
36
Input Signal
Amplitude Shift Keying(ASK)
Frequency Shift Keying(FSK)
Phase Shift Keying(PSK)
CSE 123 – Lecture 26: Final Review
Shannon’s Law● Shannon considered noisy channels and derived
C = B log (1 + S/N)
● Gives us an upper bound on any channel’s performance regardless of signaling scheme
● Old school modems approached this limit◆ B = 3000Hz, S/N = 30dB = 1000◆ C = 3000 x log(1001) =~ 30kbps◆ 28.8Kbps – anyone remember dialup?
37CSE 123 – Lecture 26: Final Review
Nyquist Sampling Rate● Sampling at the correct rate (2f) yields actual signal
◆ Always assume lowest-frequency wave that fits samples
● Sampling too slowly yields aliases
38CSE 123 – Lecture 26: Final Review
Clock Recovery● Using a training sequence to get receiver lined up
◆ Send a few, known initial training bits◆ Adds inefficiency: only m data bits out of n transmitted
● Need to combat clock drift as signal proceeds◆ Use transitions to keep clocks synched up
● Question is, how often do we do this?◆ Quick and dirty every time: asynchronous coding◆ Spend a lot of effort to get it right, but amortize over lots of
data: synchronous coding
39CSE 123 – Lecture 26: Final Review
Manchester Encoding● Signal to Data
◆ XOR NRZ data with senders clock signal◆ High to low transition ð 1◆ Low to high transition ð 0
● Comments◆ Solves clock recovery problem◆ Only 50% efficient ( ½ bit per transition)◆ Still need preamble (typically 0101010101… trailing 11 in Ethernet)
Bits 0 0 1 0 1 1 1 1 0 1 0 0 0 0 1 0
NRZ
Clock
Manchester
CSE 123 – Lecture 26: Final Review
Fixed PartitioningFDMA
TDMA
CDMA
pow
er
pow
er
pow
er
Courtesy Takashi Inoue
41CSE 123 – Lecture 26: Final Review
Aloha● Designed in 1970 to support wireless data connectivity
◆ Between Hawaiian Islands—rough!
● Goal: distributed access control (no central arbitrator)◆ Over a shared broadcast channel
● Aloha protocol in a nutshell:◆ When you have data send it◆ If data doesn’t get through (receiver sends acknowledgement)
then retransmit after a random delay◆ Why not a fixed delay?
42CSE 123 – Lecture 26: Final Review
Q: What is max fraction slots successful?A: Suppose n stations have packets to send
◆ Each transmits in slot with probability p◆ Prob[successful transmission], S, is:
S = p (1-p)(n-1)
◆ any of n nodes:
S = Prob[one transmits] = np(1-p)(n-1)
(optimal p as n->infinity = 1/n)
= 1/e = .37
At best: channelused for useful transmissions 37%of time!
offered load = n X p0.5 1.0 1.5 2.0
0.1
0.2
0.3
0.4
Pure Aloha
Slotted Aloha
Slotted Aloha Efficiency
43CSE 123 – Lecture 26: Final Review
● How can A know that a collision has taken place?◆ Worst case:
» Latency between nodes A& B is d» A sends a message at time t and B sends a message at t + d – epsilon (just before
receiving A’s message)◆ B knows there is a collision, but not A… A must keep transmitting until it
can tell if a collision occurred◆ How long? 2 * d
● IEEE 802.3 Ethernet specifies max value of 2d to be 51.2us◆ This relates to maximum distance of 2500m between hosts◆ At 10Mbps it takes 0.1us to transmit one bit so 512 bits take 51.2us to send◆ So, Ethernet frames must be at least 64B (512 bits) long
» Padding is used if data is too small● Send jamming signal to insure all hosts see collision
◆ 48 bit signal
44
CSMA/CD
CSE 123 – Lecture 26: Final Review
45
CSMA/CA● Cannot detect collision w/half-duplex radios
● Wireless MAC protocols often use collision avoidance techniques, in conjunction with a (physical or virtual) carrier sense mechanism
● Collision avoidance◆ Nodes negotiate to reserve the channel.◆ Once channel becomes idle, the node waits for a
randomly chosen duration before attempting to transmit.
CSE 123 – Lecture 26: Final Review
46
A B C
● When A wants to send a packet to B, A first sends a Request-to-Send (RTS) to B
● On receiving RTS, B responds by sending Clear-to-Send (CTS), provided that A is able to receive the packet
● When C overhears a CTS, it keeps quiet for the duration of the transfer◆ Transfer duration is included in both RTS and CTS
RTS/CTS (MACA)
CSE 123 – Lecture 26: Final Review
Parting thoughts…
● Good luck finishing up Project 2◆ Don’t use the late days…
● Please complete your CAPE survey online
● Final exam: TUESDAY 3-6 PM
● Good luck and have a great holiday break!
47CSE 123 – Lecture 26: Final Review