CS3201 Ch6
CS3201 Ch6
▪ introduction
Chapter 6
▪ multiple access protocols
▪ error detection and correction
▪ LANs
• addressing, ARP, RARP
• Ethernet
• switches
▪ data center networking
▪ a day in the life of a web request
host bus
• implements link, physical layer controller
(e.g., PCI)
link
1 3 4 1 3 4
frequency bands
FDM cable
t0 - 1 t0 t0 + 1
Link Layer: 6-18
Pure ALOHA: will overlap
with start of
i’s frame
will overlap
with end of
i’s frame
efficiency t0 - 1 t0 t0 + 1
▪ Performance: How to evaluate a coordination rule? A good engineer always seeks good design!
▪ Efficiency (throughput): long-run fraction of successful transmissions among all transmissions (many
nodes, all with many frames to send)
▪ Assumptions: N nodes with many frames to send, each transmits with probability p
▪ Then, Pr(success by a given node) = Pr(one node transmits) ·
Pr(no other node transmits in [t0-1,t0] ·
Pr(no other node transmits in [t0,t0+1])
= p . (1-p)N-1 . (1-p)N-1
= p . (1-p)2(N-1)
▪ Assume that each user is independently transmitting (what pure Aloha does!). Then,
S = E(p)=N P(success by a given node) = Np(1-p)2(N-1)
→ Maximal efficiency S = 1/(2e)=.184 when N → ∞
node 2 2 2 2
C: collision
S: success
node 3 3 3 3
E: empty
C E C S E C E S S
Pros: Cons:
▪ single active node can ▪ collisions, wasting slots
continuously transmit at full rate ▪ idle slots
of channel
▪ nodes may be able to detect collision in
▪ highly decentralized: only slots in less than time to transmit packet
nodes need to be in sync
▪ clock synchronization
▪ simple
Link Layer: 6-22
Slotted ALOHA: efficiency or throughput
efficiency: long-run fraction of successful slots (many nodes, all with many
frames to send)
▪ Assumptions: N nodes with many frames to send, each transmits in slot
with probability p
• prob that a given node has success in a slot = p(1-p)N-1
• prob that any node has a success = Np(1-p)N-1
• maximum efficiency: find p that maximizes Np(1-p)N-1
• → p = 1/N
• for many nodes, take limit of Np(1-p)N-1 as N goes to infinity, gives:
max efficiency = 1/e = .368
▪ at best: channel used for useful transmissions 36.8% of time!
Link Layer: 6-23
Slotted ALOHA: efficiency or throughput
Efficiency E(p)=Np(1-p)N-1
Let us derive the maximum efficiency under the assumption that there are a large number
of nodes and each node has a large number of packets to send.
Slotted Aloha: efficiency or throughput
at best: channel
used for useful
transmissions 36.8%
of time!
CSMA (carrier sense multiple access): listen before talk
▪ Coordination rule: sense before transmit, or listen before you
speak
▪ How to sense: detect whether there is any transmission activity in
the channel
• Energy or voltage or current…
▪ Many operating modes
• non-persistent
• 1-persistent
• p-persistent
goal: choose r CRC bits, R, such that <D,R> exactly divisible by G (mod 2)
• receiver knows G, divides <D,R> by G. If non-zero remainder: error detected!
• can detect all burst errors of up to r bits
• widely used in practice (Ethernet, 802.11 WiFi)
Link Layer: 6-46
Cyclic Redundancy Check (CRC): example
We want: G
D.2r XOR R = nG 1 0 0 1 1 0 1 1 1 0 0 0 0
or equivalently:
D.2r = nG XOR R D * 2r
or equivalently:
if we divide D.2r by G, want R
to satisfy:
D . 2r
R = remainder [ ]
G
r+1
r
Cyclic redundancy check
1 0 1 0
In each step: check the leading
most significant bit
1 0 1 0 1 0 1 0
Clarification: CRC Error Detection
A polynomial representing a divisor (generator)
51
Standard polynomials
137.196.7.78
1A-2F-BB-76-09-AD
LAN
(wired or wireless)
137.196.7/24
71-65-F7-2B-08-53 58-23-D7-FA-20-B0
137.196.7.23 137.196.7.14
0C-C4-11-6F-E3-98
137.196.7.88
D
Link Layer: 6-59
ARP protocol in action
example: A wants to send datagram to B
• B’s MAC address not in A’s ARP table, so A uses ARP to find B’s MAC address
C
ARP table in A
IP addr MAC addr TTL
TTL
137.196.
A B
58-23-D7-FA-20-B0 500
7.14
71-65-F7-2B-08-53 58-23-D7-FA-20-B0
137.196.7.23 137.196.7.14
A B
R
111.111.111.111
74-29-9C-E8-FF-55 222.222.222.222
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
111.111.111.112 111.111.111.110
CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 222.222.222.221
88-B2-2F-54-1A-0F
Link Layer: 6-62
Routing to another subnet: addressing
▪ A creates IP datagram with IP source A, destination B
▪ A creates link-layer frame containing A-to-B IP datagram
• R's MAC address is frame’s destination
MAC src: 74-29-9C-E8-FF-55
MAC dest: E6-E9-00-17-BB-4B
IP src: 111.111.111.111
IP dest: 222.222.222.222
IP
Eth
Phy
A B
R
111.111.111.111
74-29-9C-E8-FF-55 222.222.222.222
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
111.111.111.112 111.111.111.110
CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 222.222.222.221
88-B2-2F-54-1A-0F
Link Layer: 6-63
Routing to another subnet: addressing
▪ frame sent from A to R
▪ frame received at R, datagram removed, passed up to IP
IP src: 111.111.111.111
IP dest: 222.222.222.222
MAC src: 74-29-9C-E8-FF-55
MAC dest: E6-E9-00-17-BB-4B
IP src: 111.111.111.111
IP dest: 222.222.222.222
IP IP
Eth Eth
Phy Phy
A B
R
111.111.111.111
74-29-9C-E8-FF-55 222.222.222.222
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
111.111.111.112 111.111.111.110
CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 222.222.222.221
88-B2-2F-54-1A-0F
Link Layer: 6-64
Routing to another subnet: addressing
▪ R determines outgoing interface, passes datagram with IP source A, destination B
to link layer
▪ R creates link-layer frame containing A-to-B IP datagram. Frame destination
address: B's MAC address
MAC src: 1A-23-F9-CD-06-9B
MAC dest: 49-BD-D2-C7-56-2A
IP src: 111.111.111.111
IP dest: 222.222.222.222
IP
Eth
Phy
A B
R
111.111.111.111
74-29-9C-E8-FF-55 222.222.222.222
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
111.111.111.112 111.111.111.110
CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 222.222.222.221
88-B2-2F-54-1A-0F
Link Layer: 6-65
Routing to another subnet: addressing
▪ R determines outgoing interface, passes datagram with IP source A, destination B
to link layer
▪ R creates link-layer frame containing A-to-B IP datagram. Frame destination
address: B's MAC address
MAC src: 1A-23-F9-CD-06-9B
▪ transmits link-layer frame MAC dest: 49-BD-D2-C7-56-2A
IP src: 111.111.111.111
IP dest: 222.222.222.222
IP
IP Eth
Eth Phy
Phy
A B
R
111.111.111.111
74-29-9C-E8-FF-55 222.222.222.222
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
111.111.111.112 111.111.111.110
CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 222.222.222.221
88-B2-2F-54-1A-0F
Link Layer: 6-66
Routing to another subnet: addressing
▪ B receives frame, extracts IP datagram destination B
▪ B passes datagram up protocol stack to IP
IP src: 111.111.111.111
IP dest: 222.222.222.222
IP
IP Eth
Eth Phy
Phy
A B
R
111.111.111.111
74-29-9C-E8-FF-55 222.222.222.222
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
111.111.111.112 111.111.111.110
CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 222.222.222.221
88-B2-2F-54-1A-0F
Link Layer: 6-67
Link layer, LANs: roadmap
▪ introduction
Chapter 6
▪ multiple access protocols
▪ error detection, correction
▪ LANs
• addressing, ARP
• Ethernet
• switches
▪ data center networking
▪ a day in the life of a web request
Metcalfe’s Ethernet
sketch
https://www.uspto.gov/learning-and-resources/journeys-innovation/audio-stories/defying-doubters Link Layer: 6-70
Ethernet: physical topology
▪ bus: popular through mid 90s
• all nodes in same collision domain (can collide with each other)
▪ switched: prevails today
• active link-layer 2 switch in center
• each “spoke” runs a (separate) Ethernet protocol (nodes do not collide with
each other)
preamble:
▪ used to synchronize receiver, sender clock rates
▪ 7 bytes of 10101010 followed by one byte of 10101011
MAC protocol
application
and frame format
transport
network 100BASE-TX 100BASE-T2 100BASE-FX
link 100BASE-T4 100BASE-SX 100BASE-BX
physical
A A’
can be reached through A
which interfaces C’ B
• when frame received, switch 1 2
6
“learns” location of sender: 3
5
incoming LAN segment 4
B’ C
A’ A A’
S4
S1
S3
A S2
F
D I
B C
G H
E
S1
S3
A S2
F
D I
B C
G H
E
6-846-84
Link Layer:
Small institutional network
mail server
to external
network
router web server
IP subnet
challenges:
▪ multiple applications, each serving
massive numbers of clients/users
▪ reliability
▪ managing/balancing load, avoiding
processing, networking, data
Inside a 40-ft Microsoft container, Chicago data center
bottlenecks
Link Layer: 6-87
Datacenter networks: network elements
Border routers
▪ connections outside datacenter
Tier-1 switches
▪ connecting to ~16 T-2s below
Tier-2 switches
▪ connecting to ~16 TORs below
… … … …
Top of Rack (TOR) switch
… … … … ▪ one per rack
▪ 40-100Gbps Ethernet to blades
Server racks
▪ 20- 40 server blades: hosts
9 10 11 12 13 14 15 16
two disjoint paths highlighted between racks 1 and 11 (red and blue)
Link Layer: 6-89
Datacenter networks: application-layer routing
Internet
load balancer:
application-layer
routing
▪ receives external
Load client requests
balancer
▪ directs workload
within data center
… … … … ▪ returns results to
external client
… … … …
(hiding data center
internals from client)
Sounds
web server
simple!
Google’s network
64.233.169.105 64.233.160.0/19
Comcast network
68.80.0.0/13
▪ IP datagram
▪ IP datagram forwarded from campus
containing DNS query
forwarded via LAN network into Comcast network,
routed (tables created by RIP, OSPF,
switch from client to
1st hop router IS-IS and/or BGP routing protocols)
to DNS server
Link Layer: 6-99
A day in the life…TCP connection carrying HTTP
HTTP
HTTP ▪ to send HTTP request,
SYNACK
SYN TCP
SYNACK
SYN IP client first opens TCP
SYNACK
SYN Eth socket to web server
Phy Comcast network
68.80.0.0/13
▪ TCP SYN segment (step 1 in
TCP 3-way handshake) inter-
domain routed to web server
▪ web server responds with
TCP
SYNACK
SYN
SYNACK
SYN IP
TCP SYNACK (step 2 in TCP 3-
SYNACK
SYN Eth way handshake)
Phy
r+1
r
Cyclic redundancy check
10011 co 1000
cool
靈 如
0000
心
」
。
1. A bit stream 10011101 is transmitted using the standard CRC method. The
generator polynomial is x3+1. Show the actual bit string transmitted. Suppose
the third bit from the left is inverted during transmissions. Explain how this error
is detected at the receiver's end.
Answer:
• Since the polynomial is x3+1, it is 1*x3+0*x2+0*x1+1*x0, the
divisor (i.e. generator) is 1001.
• Thus, the remainder will have 4-1 = 3 bits.
Answer:
• X, Y, or Z needs to send 40*8 K bits/second=0.32M bits/second.
• With TDMA, for a link with 1Mbps bandwidth, each user will be
able to transmit 0.333Mbps.
• Thus, TDMA will allow all users to transmit their data immediately.
It works fine.
2. Three users X, Y and Z use a shared link to connect to the Internet. Only one of
X, Y and Z can use the link at any given time, and the link has a capacity of 1
Mbps. Suppose that TDMA is used. Each time frame is divided into 3 equal time
slots, one for each user. Does the TDMA work for the following two cases?
Justify your answers.
b) X sends 80Kbytes files per sec, while Y and Z send 10 Kbytes files per sec.
Answer:
• X needs to send 640K bits per second, each of Y and Z needs to send 80K
bits per second. The total of 800K (=640K+160K) bits per second is less than
1M (=1,000K) bits per second.
• However, if TDMA is adopted, X will not be able to send 640K bits per
second as it is only allowed to transmit at 1/3 bandwidth per second
(333Kbps). Y and Z will waste some allocated bandwidth as they do not have
much data to transmit.
Answer:
屁啊噩
• E(p) = 6p3 -10p2+4p. z 0 ±
36
• To maximize the value of E(p), we have E’(p)=18p2-20p+4=0,
• when p =(5-sqrt(7))/9 =0.2616, the value of E(p) is maximized. The other
solution p=(5+sqrt(7))/9 that will result in p1 larger than 1 is discarded.
• Thus, p1=0.5232, p2=p3=0.2616, will maximize the efficiency, and the
efficiency is: E(p)=6*0.26163-10*0.26162+4*0.2616 =0.4695
5) Give an example where the two-dimensional parity scheme detects but cannot correct
a double-bit error.
Answer:
• Suppose we begin with the initial two-dimensional parity matrix:
000|0
111|1
010|1
101|0
• With a bit error in row 2, column 3, the parity of row 2 and column 3 is now wrong in the
matrix below, and hence we can detect the error at position (2,3):
000|0
110|1
010|1
101|0
• Now suppose there are bit errors in row 2, column 2, and row 2, column 3, respectively.
• The parity of row 2 is now correct.
• The parity of columns 2 and 3 is wrong. But we can’t detect in which rows the error
occurred.
000|0
100|1
010|1
101|0
• The above example shows that a double bit error can be detected but not corrected.
1. Suppose that the sender uses CRC with general polynomial x4 + x2 + 1 for error
detection over a link. What is the bit string used as divisor (i.e., the generator)
for computing the CRC bits?
Answer:
• Since the polynomial is 1*x4+0*x3+1*x2+0*x1+1*x0, the
divisor (i.e. generator) is 10101.
2) Consider the LAN below consisting of 12 computers connected by two self-
learning Ethernet switches. At t=0, the switch table entries for both switches are
empty. For each of the following frame transmissions (and their replies),
state (1) what information the switches learn, and
(2) to which hosts the frame will be forwarded.
(a) t=1: C -> G, G -> C
(b) t=2: C -> D, D -> C
(c) t=3: B -> G , G -> B
Answer:
• Recall that the polling delay is the amount of time required to notify a
node that it can transmit.
• Each node needs to be invited by the polling node before it can send.
• A round ends once every node has had its turn.
• Thus we need to add the delay dpoll four times in a single round.
• The total time for a round is:
4 * (dpoll + L/R)
• = 4 * (0.1 + 0.25 / 2)
• = 0.9 seconds