1
CSE 123: Computer Networks
Chris Kanich
Lecture 17:
Final Review
Last class!!!
Overview
Signaling
Framing
Error detection
Reliable transmission
Flow control
Bridging/Switching
Congestion control
Routing
QoS
Wireless
2 CSE 123: Lecture 17: Final Review
3
Final Mechanics
Bulk of the final covers material after midterm
Routing, QoS, Wireless
Some material on signaing, framing, transport, etc.
MAC, ARQ, TCP, IP
Based upon lecture material, homeworks, and project
May be a question regarding the projects
Closed book, one page of notes
Expect similar style to midterm, just longer
CSE 123: Lecture 17: Final Review
2
TCP/IP Protocol Stack
HTTP
TCP
I
P
Ethernet interface
HTTP
TCP
I
P
Ethernet interface
I
P
I
P
Ethernet interface
Ethernet interface
SONET interface
SONET interface
host host
router router
CSE 123: Lecture 17: Final Review 4
Application Layer
Transport Layer
Network Layer
Link Layer
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
We assume it is periodic with a fixed frequency
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
CSE 123: Lecture 17: Final Review 5
Channel Properties
Bandwidth-limited
Range of frequencies the channel will transmit
Means the channel is slow to react to change in signal
Power attenuates over distance
Signal gets softer (harder to “hear”) the further it travels
Different frequencies have different response (distortion)
Background noise or interference
May add or subtract from original signal
Different physical characteristics
Point-to-point vs. shared media
Very different price points to deploy
CSE 123: Lecture 17: Final Review 6
3
Signaling
Digital modulation
FSK, ASK, PSK
Dealing with noise
Shannon’s law
Sampling at the receiver
Intersymbol Inteference: Nyquist Limit
Synchronous vs. Asynchronous coding
Clock recovery
NRZ, Manchester, 4B/5B
CSE 123: Lecture 17: Final Review 7
(Data) Link Layer
Framing
Break stream of bits up into discrete chunks
Error handling
Detect and/or correct errors in received frames
Media access
Arbitrate which nodes can send frames at any point in time
Not always necessary; e.g. point-to-point duplex links
Multiplexing
Determine appropriate destination for a given frame
Also not always required; again, point-to-point
CSE 123: Lecture 17: Final Review 8
Framing
Framing determines when payload starts/stops
Lots of different ways to do it, various efficiencies
Sentinel-based framing requires stuffing
Increases the size of the packet
Alternatives include fixed size frames
CSE 123: Lecture 17: Final Review 9
Payload Header Trailer
4
CSE 123: Lecture 17: Final Review 10
Error Detection
Error handling through redundancy
Adding extra bits to the frame
Hamming Distance
When we can detect
When we can correct
Checksum
Cyclic Remainder Check (CRC)
Reliable Transmission
Automatic Repeat Request (ARQ)
Acknowledgements (ACKs) and timeouts
Stop-and-Wait
Sliding Window
Forward Error Correction
11 CSE 123: Lecture 17: Final Review
Sliding Window
Single mechanism that supports:
Multiple outstanding packets
Reliable delivery
In-order delivery
Flow control
At the core of all modern ARQ protocols
Go-Back-N is a special case
Receive window size of one
12 CSE 123: Lecture 17: Final Review
5
Media Access Control
Methods to share physical media: multiple access
Fixed partitioning
Random access
Channelizing mechanisms
Contention-based mechanisms
Aloha
Ethernet
13 CSE 123: Lecture 17: Final Review
Partitioning Visualization
FDMA
TDMA
CDMA
po
wer
po
wer
pow
er
Courtesy Takashi Inoue
14 CSE 123: Lecture 17: Final Review
Aloha transmits even if another host is transmitting
Thus guaranteeing a collision
Instead, listen first to make sure channel is idle
Useful only if channel is frequently idle
Why?
If nodes can detect collisions, abort! Requires a minimum frame size (“acquiring the medium”)
Requires a full duplex channel
Binary exponential back-off balances delay w/load
15 CSE 123: Lecture 17: Final Review
Carrier Sense (CSMA) + CD
6
Transport Layer
Provides process naming/demultiplexing
Port numbers
Two main protocols in use on the Internet
User Datagram Protocol (UDP)
» Unreliable, datagram service
Transport Control Protocol (TCP)
» Reliable byte-stream
» Requires connection establishment/three-way handshake
16 CSE 123: Lecture 17: Final Review
Transmission Control Protocol
Reliable bi-directional bytestream between processes
Uses a sliding window protocol for efficient transfer
Connection-oriented
Conversation between two endpoints with beginning and end
Flow control
Prevents sender from over-running receiver buffers
Congestion control
Prevents sender from over-running network capacity
17 CSE 123: Lecture 17: Final Review
How fast should a sending host transmit data?
Not to fast, not to slow, just right…
Should not be faster than the sender’s share
Bandwidth allocation
Should not be faster than the network can process
Congestion control
Congestion control & bandwidth allocation are
separate ideas, but frequently combined
CSE 123: Lecture 17: Final Review 18
Congestion Control
7
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
Complicated with slow start and fast recovery
Ramp up quickly
Avoid backing all the way down on isolated loss events
CSE 123: Lecture 17: Final Review 19
TCP’s Algorithm
Hubs/Repeaters
Physical layer device
One “port” for each LAN
Repeat received bits on one port out all other ports
LAN1 Hub LAN2
LA
N3
20 CSE 123: Lecture 17: Final Review
Store and forward device
Data-link layer device
Buffers entire packet and then rebroadcasts it on other ports
Creates separate collision domains
Uses CSMA/CD for access to each LAN (acts like a host)
Improves throughput
Some bridges can learn topology
Spanning Tree Algorithm
21 CSE 123: Lecture 17: Final Review
Bridges
8
internetworking
Switching still only moves frames on common link layer
MAC addresses are unique but flat
Routers forward packets from source to destination
May cross many separate networks along the way
All packets use a common Internet Protocol
Any underlying data link protocol
Any higher layer transport protocol
22 CSE 123: Lecture 17: Final Review
Routers
A router is a store-and-forward device
Routers are connected to multiple networks
On each network, looks just like another host
A lot like a switch, except at the network layer
Must be explicitly addressed by incoming frames
Not at all like a switch, which is transparent
Removes link-layer header, parses IP header
Looks up next hop, forwards on appropriate network
Each router need only get one step closer to destination
23 CSE 123: Lecture 17: Final Review
IP Addresses
32-bits in an IPv4 address
Dotted decimal format a.b.c.d
Each represent 8 bits of address
Hierarchical: Network part and host part
E.g. IP address 128.54.70.238
128.54 refers to the UCSD campus network
70.238 refers to the host ieng6.ucsd.edu
Subnetting/CIDR aggregation
Network mask/prefix
24 CSE 123: Lecture 17: Final Review
9
Layers of Identifiers
Host name (e.g., www.ucsd.edu)
Used by humans to specify host of interest
Unique, selected by host administrator
Hierarchical, variable-length string of alphanumeric carachters
IP address (e.g., 128.54.70.238)
Used by routers to forward packets
Unique, topologically meaningful locator
Hierarchical namespace of 32 bits
MAC address (e.g., 58:B0:35:F2:3C:D9)
Used by network adaptors to identify interesting frames
Unique, hard-coded identifier burned into network adaptor
Flat name space (of 48 bits in Ethernet)
25 CSE 123: Lecture 17: Final Review
Naming Protocols
Domain Name System Distributed, hierarchical database
Distributed collection of servers
Caching to improve performance
IP to MAC Address mapping
Dynamic Host Configuration Protocol (DHCP)
Address Resolution Protocol (ARP)
CSE 123: Lecture 17: Final Review 26
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
CSE 123: Lecture 17: Final Review 27
Routing
10
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
CSE 123: Lecture 17: Final Review 28
Forwarding Options
Routing within a network/organization A single administrative domain
The administrator can set edge costs
Overall goals Provide intra-network connectivity
Adapt quickly to failures or topology changes
Optimize use of network resources
Non-goals Extreme scalability
Lying, and/or disagreements about edge costs
CSE 123: Lecture 17: Final Review 29
Intra-domain Routing
Static
Type in the right answers and hope they are always true
…So far
Link state
Tell everyone what you know about your neighbors
Dijkstra’s Algorithm
Distance vector
Tell your neighbors when you know about everyone
Bellman-Ford Algorithm
CSE 123: Lecture 17: Final Review 30
Basic Routing Approaches
11
Graph algorithm for single-source shortest path tree
S {}
Q <remaining nodes keyed by distance>
While Q != {}
u extract-min(Q)
S S plus {u}
for each node v adjacent to u
“relax” the cost of v
u is done
CSE 123: Lecture 17: Final Review 31
Dijkstra’s Shortest Path
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
3
2
2
1
1
4
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
CSE 123: Lecture 17: Final Review 32
Message complexity
LS: with n nodes, E links,
O(nE) messages sent
DV: exchange between
neighbors only
Speed of Convergence
LS: relatively fast
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: Node can advertise incorrect
path cost
Each node’s table used by
others (error propagates)
Link-state vs. Distance-vector
CSE 123: Lecture 17: Final Review 33
12
Border routers summarize and
advertise internal 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
R1
Autonomous system 1
R2
R3
Autonomous system 2R4
R5 R6
AS1
AS2
Border router
Border router
Inter-domain Routing
CSE 123: Lecture 17: Final Review 34
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
CSE 123: Lecture 17: Final Review 35
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
CSE 123: Lecture 17: Final Review 36
13
Implement inter-domain routing on the Internet
Used and abused to model business practices
Default decision process for route selection
Highest local pref, shortest AS path, lowest MED, prefer
eBGP over iBGP, lowest IGP cost, router id
Many policies built on default decision process, but…
Possible to create arbitrary policies in principal
» Any criteria: BGP attributes, source address, prime number of
bytes in message,
Border Gateway Protocol
CSE 123: Lecture 17: Final Review 37
QoS
CSE 123: Lecture 17: Final Review 38
Routers manage their own resources
Buffer management may entail marking/dropping
Scheduling discipline determines outgoing packet order
Token bucket and RED
Mechanisms to control traffic flowing through routers
Networks can provide quality of service
Combines per-router traffic policing with network signalling
IntServ and DiffServ are contrasting approaches
Wireless
CSE 123: Lecture 17: Final Review 39
New challenges
Hidden terminal problem
Asymmetric ranges
Half-duplex radios (can’t do CD)
802.11/WiFi
Common technology for local-area wireless
Uses CSMA/CA
RTS/CTS and NAV for virtual carrier sense
14
For next time…
There is no next time!
Study hard, sleep well, don’t be late!
8 AM, 3 hr exam!
It’s been a pleasure teaching you all!
Feel free to contact if you have questions/need advice
If you haven’t already, please complete your CAPE!
40 CSE 123: Lecture 17: Final Review