Documente Academic
Documente Profesional
Documente Cultură
Link Layer
5.1 Introduction and 5.6 Link-layer switches services 5.7 PPP (Point-to-Point Protocol) 5.2 Error detection and 5.8 Link virtualization: MPLS correction (Multi-protocol Label Switching) 5.3Multiple access protocols New: WiFi 5.9 A day in the life of a web request (dropped: NOT 5.4 Link-layer Addressing meaningful in bottom/up 5.5 Ethernet approach to understanding networking) 3.4 New: Reliable data transfer + flow control
Data Link Layer 5-3
hosts and routers are nodes communication channels that connect adjacent nodes are links
wired links wireless links LANs
data-link layer has responsibility of transferring datagram from one node to physically adjacent node over a link
Data Link Layer 5-4
transportation analogy
trip from Princeton to Lausanne limo: Princeton to JFK plane: JFK to Geneva train: Geneva to Lausanne
tourist = datagram transport segment = communication link transportation mode = link layer protocol travel agent = routing algorithm
Data Link Layer 5-5
we learned how to do this already (ch. 3)! (Will do it in this ch.) seldom used on low bit-error link (fiber, some twisted pair) wireless links: high error rates
Q.: Why both link-level and end-to-end reliability?
5-6
flow control:
pacing between (adjacent) sending and receiving nodes
error detection:
errors caused by signal attenuation and noise receiver detects presence of errors
error correction:
receiver identifies and corrects bit error(s) without resorting to retransmission receiver signals sender for retransmission
with half duplex, nodes at both ends of link can transmit, but not at the same time
Data Link Layer 5-7
in each and every host link layer implemented in adaptor (aka network interface card NIC)
Ethernet card, PCMCI card, 802.11 card implements link, physical layer
cpu
memory
5-8
Adaptors Communicating
datagram controller datagram controller
sending host
datagram
receiving host
frame
sending side:
encapsulates datagram in frame adds error checking bits, rdt, flow control, etc.
receiving side
looks for errors, rdt, flow control, etc extracts datagram, passes to upper layer at receiving side
Data Link Layer 5-9
Link Layer
5.1 Introduction and services 5.2 Error detection and correction 5.3Multiple access protocols 5.4 Link-layer Addressing 5.5 Ethernet 5.6 Link-layer switches 5.7 PPP 5.8 Link virtualization: MPLS 5.9 A day in the life of a web request
3.4 Reliable data transfer
Error Detection
EDC= Error Detection and Correction bits (redundancy) D = Data protected by error checking, may include header fields
Error detection not 100% reliable! protocol may miss some errors, but rarely larger EDC field yields better detection and correction
otherwise
Parity Checking
Single Bit Parity:
Detect single bit errors
treat segment contents as sequence of 16-bit integers checksum: addition (1s complement sum) of segment contents sender puts checksum value into UDP checksum field
Receiver: compute checksum of received segment check if computed checksum equals checksum field value: NO - error detected YES - no error detected.
view data bits, D, as a binary number choose r+1 bit pattern (generator), G goal: choose r CRC bits, R, such that
<D,R> exactly divisible by G (modulo 2) zero remainder
receiver knows G:
Divides <D,R> by G. If non-zero remainder: error detected!
CRC Example:
Want: D.2r XOR R = nG
D = 101110, r = 3, G = 1001
equivalently: equivalently:
D.2r = nG XOR R
R = remainder[
D.2r G
If the input bit above the leftmost divisor bit is 1, the divisor is XORed into the input. Else (the input bit above the leftmost divisor bit is 0) do nothing. The divisor is then shifted one bit to the right () The process is repeated until the divisor reaches the right-hand end of the input row.
D.2r
1011 10 000 1001 -----------------0 0 1 0 10 0 0 0 1 00 1 -----------------0 0 1 0 10 0 0 0 1 0 01 -----------------0 0 0 0 11 0 0 0 1 00 1 -----------------0 0 0 0 11 0 0 0 10 0 1 -----------------0 0 0 0 01 0 1 0 1 001 -----------------0 0 0 0 00 0 1 1
R
Data Link Layer 5-16
Link Layer
5.1 Introduction and services 5.2 Error detection and correction 5.3Multiple access protocols 5.4 Link-layer Addressing 5.5 Ethernet 5.6 Link-layer switches 5.7 PPP 5.8 Link virtualization: MPLS 5.9 A day in the life of a web request
point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
shared RF (satellite)
single shared broadcast channel two or more simultaneous transmissions by nodes: interference
collision if node receives two or more signals at the same time
distributed algorithm that determines how nodes share channel, i.e., determine when a node can transmit communication about channel sharing must use channel itself!
no separate control channel for coordination
Packet Collision
Link/MAC PHY Rx
+ data Tx
Link/MAC PHY
Link/MAC PHY
data Tx
20
4. simple
Random
Access
Taking turns
nodes take turns
access to channel in "rounds" each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example: 6-station LAN, 1,3,4 have pkt, slots 2,5,6 idle
6-slot frame 1 3
channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example: 6-station LAN, 1,3,4 have pkt, frequency bands 2,5,6 idle
frequency bands
FDM cable
two or more transmitting nodes collision, random access MAC protocol specifies:
how to detect collisions how to recover from collisions (e.g., via delayed retransmissions)
Aloha Protocol
Developed in the 1970s at U of Hawaii To interconnect terminals with mainframes LAN/ WLAN: Possible, but not used GSM: Cell phones use this protocol to request a channel from the base stations Two types
26
Pure Aloha
Exponential backoff
Start: i = 0 Wait TB = R*Tp
R = Random(0,2i-1)
No
i++
Timeout
Error
Slotted ALOHA
Assumptions: all frames same size time divided into equal size slots (time to transmit 1 frame) nodes start to transmit only at slot beginning nodes are synchronized if 2 or more nodes transmit in a slot, all nodes detect collision Operation: when node obtains fresh frame, transmits in next slot if no collision: node can send new frame in next slot if collision: node retransmits frame in each subsequent slot with prob. p until success
Data Link Layer 5-30
Slotted ALOHA
Pros single active node can continuously transmit at full rate of channel highly decentralized: only slots in nodes need to be in sync simple
Cons collisions, wasting slots idle slots nodes may be able to detect collision in less than time to transmit packet clock synchronization
Data Link Layer 5-31
frames to send, each transmits in slot with probability p prob that given node has success in a slot = p(1-p)N-1 prob that any node has a success = Np(1-p)N-1
max efficiency: find p* that maximizes Np(1-p)N-1 for many nodes, take limit of Np*(1-p*)N-1 as N goes to infinity, gives:
At best: channel
CSMA/CD
MAC/ PHY
Data
Tx
Rx
Collision? Carrier?
Medium
34
CSMA collisions
collisions can still occur:
propagation delay means two nodes may not hear each others transmission
collision: note:
entire packet transmission time wasted role of distance & propagation delay in determining collision probability
collision detection:
Exponential backoff
CSMA/CD
Wait TB = R*Tp
Busy
N
Wait
R = Random(0,2i-1)
No
Transmit frame WHILE detecting collision Collision i++ Send jamming signal + Abort Success
37
No collision
Error
CSMA/CD Medium sensing is done for 96 bit-times. Jamming signal length is 48 bits. Jamming signal creates enough energy on the medium for collision detection. Tp is equated with 512 bit-times. i saturates at 10.
38
data
poll
master
data
slaves
(nothing to send) T
data
Data Link Layer 5-42
Wireless LAN
IEEE 802.11/a/b/g
43
WLAN View
C: Computer, AP: Access Point
Basic Service Set (BSS): BSSID = MAC address of AP Independent BSS (IBSS)= BSS - AP Extended Service Set (ESS): A collection of BSS connected by a Distribution System
44
Frequency Band 2.4 GHz 2.4 GHz 5 GHz 2.4 GHz 2.4 GHz 2.4/5 GHz 5 GHz
72 and 150
6.9 Gbps
45
(DCF)
mode
(PCF)
mode
With Hand-shake
Without Hand-shake
46
The AP
Operates as the central controller for all nodes within its range. Decides who transmits and when. Can follow a round-robin policy to allocate slots. Note: There is no contention for medium access.
This mode
Can support real-time traffic due to periodic scheduling. Leads to waste of bandwidth if a scheduled node has no traffic. Is optional <= Spec.
47
An AP
Need not be used.
Computers can directly communicate among themselves <= Ad hoc.
In DCF
All nodes, including the AP, compete for medium access. The AP does not operate as a central controller. Delivery is best effort
48
PCF T1
DCF T2
PCF T3
DCF T4
PCF
DCF Time
49
Sender transmits a Request To Send (RTS) frame Receiver gives permission by sending back a Clear To Send (CTS) frame Used to increase the probability of successful Tx when Packet length is long. ( dotRTSThreshold holds the value.) Incurs additional cost loss of some bandwidth due to hand-shake
50
DCF
PCF
52
Problems in WLAN
Hidden Terminal Problem Exposed Terminal Problem Inability to detect collision (at the receiver)
Assumption
All nodes have identical radio ranges
how far away their signals can be received
Note
The assumption is not the cause of the problems. Without this assumption, the problems become worse.
53
A D
Problem - C is transmitting a frame to B. - A is unaware of Cs Tx. - Now, if A transmits, As Tx will collide with Cs at B The above problem is due to C being hidden from A. Hidden means being far away
54
A D
Tx
Problem - A is transmitting a frame to D. - B knows that someone is transmitting. - If B transmits a frame to C, no problem. However, B does not transmit because it is unaware of Ds location.
The above problem is due to B being exposed to As Tx.
55
No collision detection
Fact: Collision at receiver is more serious than collision at transmitter. In a wired LAN
Collision is indirectly detected after some delay by the sender. In a WLAN, collision detection by sender is not possible.
That is why we have the hidden terminal problem.
56
PHY-level carrier sensing: Done in receiver hardware Virtual carrier sensing: Done by examining frame header
Frame headers of RTS, CTS, DATA A duration field in frame headers indicates for how long the sender of the frame may use the medium. A Network Allocation Vector is managed using duration fields Each node has its own NAV (essentially an integer) NAV > 0: A node had announced its intention to use the medium now. NAV = 0: Nobody had wanted to use the medium now.
57
NAV is the length of time for which the medium is likely to remain busy. Initially: NAV = 0. With each passing s (micro second) NAV is updated using the duration field in a received frame
NAV = Max(NAV, duration) NAV = NAV 1 Stop decrementing if NAV = 0.
58
Frame format
RTS
RA 6
TA 6
FCS 4 bytes
CTS/ ACK
RA 6 4
FCS bytes
CRC
59
DATA Frame
Frame format
Frame Duration/ Control ID A1 A2 A3 Seq. Control A4
Frame Body
FCS
RA
TA
TA
RA
60
Timing Intervals
61
A data
DIFS
RTS
SIFS
DATA
B
C (neighbor of A) D (neighbor of B)
SIFS
CTS
SIFS
ACK
Value of NAV of C
Value of NAV of D
Time
62
End of backoff
Random Backoff
Yes
Send RTS
Start a timer
CTS is received
Cancel timer
Timeout
ACK is received
Timeout
Backoff Mechanism
As time passes, BTC is decremented as follows BTC = BTC -1 if medium is idle for aSlotTime Pause decrementing BTC if medium is busy Resume decrementing BTC if medium is idle for DIFS.
Subsequent decrementing is done for every aSlotTime of idleness of the medium.
64
Backoff Mechanism
Ch. busy due to node A Ch. Busy due to node C
DIFS
DIFS 3 3
Time
X
BTC = 5
B is executing backoff
X = aSlotTime
65
Receive RTS
No
NAV = 0? Yes
No
No
Yes
Send ACK
Send CTS
66
NOTE: A node may broadcast a DATA frame to all Done in DCF without hand-shake Receivers do not send back an ACK.
67
AP senses the medium at the start of a CF (ContentionFree) period for a PIFS (Priority IFS) interval.
SIFS < PIFS < DIFS You know that PIFS = SIFS + aSlotTime DIFS = SIFS + 2*aSlotTime
68
69
AP
User 1
CF Poll SIFS
User 2
AP
User 1
CF Poll SIFS
DATA
ACK
ACK
Time
The polled user sends data to another user. The polled user sends data to the AP.
70
DATA+CF Poll
SIFS ACK
DATA
ACK SIFS
Note 1: If AP does not receive an ACK, it retransmits data after PIFS. Note 2: If User 1 does not receive ACK, it does not retransmit data.
The polled user receives data from the AP and sends data to another user.
71
DATA frame
Contains user data from AP to a specific station. The receiver sends back an ACK after SIFS interval. AP does not receive an ACK
Retransmit the DATA after a PIFS interval
72
CF Poll frame
AP grants permission to another node to transmit DATA to the AP or to a third node. Receiver of DATA frame sends an ACK to the sender. If the polled node has no data to send, it sends a null DATA frame. If the polled station does not receive an ACK, it can not retransmit its data frame until it is polled again.
73
CF End frame
Identifies the end of CF period Sent by an AP under two conditions
AP has no data to send and no node to poll Can happen before the pre-announced CFPMaxDuration Receiving nodes set NAV = 0. Normal end of CF period (Initially: CFPDurRemaining = CFPMaxDuration) CFPDurRemaining time expires
74
Passive scanning
Scan a channel for a Beacon frame If a Beacon frame is received Negotiate Authentication and Association processes
Active Scanning
Transmit a Probe frame If a Probe Response is received Negotiate Authentication and Authorization processes
75
taking turns
Link Layer
5.1 Introduction and services 5.2 Error detection and correction 5.3Multiple access protocols 5.4 Link-Layer Addressing 5.5 Ethernet 5.6 Link-layer switches 5.7 PPP 5.8 Link virtualization: MPLS 5.9 A day in the life of a web request
3.4 Reliable data transfer
Network layer
Routing Table
IP
Link1 Link2 Link3 Link4 PHY1 PHY2 PHY3 PHY4
2 1 3
OSPF: Open Shortest Path First BGP: Border Gateway Protocol RIP: Routing Information Protocol TCP: Transmission Control Protocol UDP: User Datagram Protocol ICMP: Internet Control Message Protocol
79
1A-2F-BB-76-09-AD
71-65-F7-2B-08-53
= adapter
0C-C4-11-6F-E3-98
LAN
Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address space (to assure uniqueness) MAC flat address portability
can move LAN card from one LAN to another
Each IP node (host, router) on LAN has ARP table ARP table: IP/MAC addr. mappings for some LAN nodes
< IP address; MAC address; TTL>
LAN
71-65-F7-2B-08-53 58-23-D7-FA-20-B0
TTL (Time To Live): time after which address mapping will be forgotten (typically 20 min)
137.196.7.88
0C-C4-11-6F-E3-98
A wants to send datagram to B, and Bs MAC address not in As ARP table. A broadcasts ARP query packet, containing B's IP address dest MAC address = FF-FF-FF-FF-FF-FF all machines on LAN receive ARP query B receives ARP query, replies to A with its (B's) MAC address
frame sent to As MAC address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state: information that times out (goes away) unless refreshed
ARP is plug-and-play:
nodes create their ARP tables without intervention
A
111.111.111.111 74-29-9C-E8-FF-55
R
222.222.222.220 1A-23-F9-CD-06-9B 111.111.111.112 CC-49-DE-D0-AB-7D 111.111.111.110 E6-E9-00-17-BB-4B
B
222.222.222.222 49-BD-D2-C7-56-2A
A creates IP datagram with IP source A, destination B A creates link-layer frame with R's MAC address as dest, frame contains A-to-B IP datagram
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
111.111.111.111 74-29-9C-E8-FF-55
R
222.222.222.220 1A-23-F9-CD-06-9B 111.111.111.112 CC-49-DE-D0-AB-7D 111.111.111.110 E6-E9-00-17-BB-4B
B
222.222.222.222 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
A
111.111.111.111 74-29-9C-E8-FF-55
R
222.222.222.220 1A-23-F9-CD-06-9B 111.111.111.112 CC-49-DE-D0-AB-7D 111.111.111.110 E6-E9-00-17-BB-4B
B
222.222.222.222 49-BD-D2-C7-56-2A
R forwards datagram with IP source A, destination B R creates link-layer frame with B's MAC address as dest, frame contains A-to-B IP datagram
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
IP Eth Phy
A
111.111.111.111 74-29-9C-E8-FF-55
R
222.222.222.220 1A-23-F9-CD-06-9B 111.111.111.112 CC-49-DE-D0-AB-7D 111.111.111.110 E6-E9-00-17-BB-4B
B
222.222.222.222 49-BD-D2-C7-56-2A
R forwards datagram with IP source A, destination B R creates link-layer frame with B's MAC address as dest, frame contains A-to-B IP datagram
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
IP Eth Phy
A
111.111.111.111 74-29-9C-E8-FF-55
R
222.222.222.220 1A-23-F9-CD-06-9B 111.111.111.112 CC-49-DE-D0-AB-7D 111.111.111.110 E6-E9-00-17-BB-4B
B
222.222.222.222 49-BD-D2-C7-56-2A
R forwards datagram with IP source A, destination B R creates link-layer frame with B's MAC address as dest, frame contains A-to-B IP datagram
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
111.111.111.111 74-29-9C-E8-FF-55
R
222.222.222.220 1A-23-F9-CD-06-9B 111.111.111.112 CC-49-DE-D0-AB-7D 111.111.111.110 E6-E9-00-17-BB-4B
B
222.222.222.222 49-BD-D2-C7-56-2A
Link Layer
5.1 Introduction and services 5.2 Error detection and correction 5.3Multiple access protocols 5.4 Link-Layer Addressing 5.5 Ethernet 5.6 Link-layer switches 5.7 PPP 5.8 Link virtualization: MPLS 5.9 A day in the life of a web request
Ethernet
dominant wired LAN technology: cheap $20 for NIC first widely used LAN technology simpler, cheaper than token LANs and ATM kept up with speed race: 10 Mbps 10 Gbps
Star topology
all nodes in same collision domain (can collide with each other) active switch in center each spoke runs a (separate) Ethernet protocol (nodes do not collide with each other)
switch
star
Data Link Layer 5-92
Preamble: 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 used to synchronize receiver, sender clock rates
Addresses: 6 bytes
if adapter receives frame with matching destination address, or with broadcast address (e.g. ARP packet), it passes data in frame to network layer protocol otherwise, adapter discards frame
Type: indicates higher layer protocol (mostly IP but others possible, e.g., Novell IPX, AppleTalk) CRC: checked at receiver, if error is detected, frame is dropped
connectionless: No handshaking between sending and receiving NICs unreliable: receiving NIC doesnt send acks or nacks to sending NIC
stream of datagrams passed to network layer can have gaps (missing datagrams) gaps will be filled if app is using TCP otherwise, app will see gaps
CSMA/CD efficiency
Tprop = max prop delay between 2 nodes in LAN ttrans = time to transmit max-size frame
efficiency
1 1 5t prop/ttrans
efficiency goes to 1 better performance than ALOHA: and simple, cheap, decentralized!
Data Link Layer 5-98
common MAC protocol and frame format different speeds: 2 Mbps, 10 Mbps, 100 Mbps, 1Gbps, 10G bps different physical layer media: fiber, cable
Manchester encoding
used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized, global clock among nodes!
Link Layer
5.1 Introduction and services 5.2 Error detection and correction 5.3 Multiple access protocols 5.4 Link-layer Addressing 5.5 Ethernet 5.6 Link-layer switches, LANs, VLANs 5.7 PPP 5.8 Link virtualization: MPLS 5.9 A day in the life of a web request
Hubs
physical-layer (dumb) repeaters: bits coming in on one link go out all other links at same rate all nodes connected to hub can collide with one another no frame buffering no CSMA/CD at hub: host NICs detect collisions
twisted pair
hub
Switch
transparent
plug-and-play, self-learning
hosts have dedicated, direct connection to switch switches buffer packets Ethernet protocol used on each incoming link, but no collisions; full duplex
C 1 5 2 4
B 3
C B
Switch Table
A C 1 5 2 4 C B B 3
Switch: self-learning
Source: A Dest: A
A A A C 1 5 2 4 C B B 3
60
Source: A Dest: A
A A A C 1 2 4 C B 3
6 A A
selective send
5 A A
A A
1 4
60 60
Interconnecting switches
forward frame destined to F via S4 and S3? A: self learning! (works exactly the same as in single-switch case!)
Data Link Layer5-109
Institutional network
to external network mail server
router
web server
IP subnet
routers maintain routing tables, implement routing algorithms switches maintain switch tables, implement filtering, learning algorithms
routers: network-layer devices (examine network-layer headers) switches are link-layer devices (examine linklayer headers)
switch network datagram link frame physical application transport network link physical
Data Link Layer 5-112
VLANs: motivation
Whats wrong with this picture?
CS user moves office to EE, but wants connect to CS switch? single broadcast domain:
all layer-2 broadcast traffic (ARP, DHCP) crosses entire LAN (security/privacy, efficiency issues)
Computer Science
Electrical Engineering
Computer Engineering
VLANs
Virtual Local Area Network Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure.
Port-based VLAN: switch ports grouped (by switch management software) so that single physical switch
1 2 7 8 9 10 15 16
Port-based VLAN
router
1 2
7 8
9 10
15 16
dynamic membership:
7
8
9
10
15 16
1 2
3 4
5 6
7 8
Computer Science (VLAN ports 9-15) Ports 2,3,5 belong to EE VLAN Ports 4,6,7,8 belong to CS VLAN
802.1 frame
802.1Q frame
Recomputed CRC
Tag Control Information (12 bit VLAN ID field, 3 bit priority field like IP TOS)
Link Layer
5.1 Introduction and services 5.2 Error detection and correction 5.3Multiple access protocols 5.4 Link-Layer Addressing 5.5 Ethernet 5.6 Link-layer switches 5.7 PPP 5.8 Link virtualization: MPLS 5.9 A day in the life of a web request
one sender, one receiver, one link: easier than broadcast link: no Media Access Control no need for explicit MAC addressing e.g., dialup link, ISDN line popular point-to-point DLC protocols: PPP (point-to-point protocol) HDLC: High level data link control (Data link used to be considered high layer in protocol stack!
packet framing: encapsulation of network-layer datagram in data link frame carry network layer data of any network layer protocol (not just IP) at same time ability to demultiplex upwards bit transparency: must carry any bit pattern in the data field error detection (no correction) connection liveness: detect, signal link failure to network layer network layer address negotiation: endpoint can learn/configure each others network address
Data Link Layer5-120
PPP non-requirements
no error correction/recovery no flow control out of order delivery OK no need to support multipoint links (e.g., polling)
Error recovery, flow control, data re-ordering all relegated to higher layers!
Flag: delimiter (framing) Address: does nothing (only one option) Control: does nothing; in the future possible multiple control fields Protocol: upper layer protocol to which frame delivered (e.g., PPP-LCP, IP, IPCP, etc)
info: upper layer data being carried check: cyclic redundancy check for error detection
Byte Stuffing
data transparency requirement: data field must
Sender: adds (stuffs) extra < 01111110> byte after each < 01111110> data byte Receiver: two 01111110 bytes in a row: discard first byte, continue data reception single 01111110: flag byte
Data Link Layer5-124
Byte Stuffing
flag byte pattern in data to send
learn/configure network layer information for IP: carry IP Control Protocol (IPCP) msgs (protocol field: 8021) to configure/learn IP address
Link Layer
5.1 Introduction and services 5.2 Error detection and correction 5.3Multiple access protocols 5.4 Link-Layer Addressing 5.5 Ethernet
5.6 Link-layer switches 5.7 PPP 5.8 Link virtualization: MPLS 5.9 A day in the life of a web request
3.4 Reliable data transfer
Virtualization of networks
Virtualization of resources: a powerful abstraction in systems engineering: computing examples: virtual memory, virtual devices Virtual machines: e.g., java IBM VM OS from 1960s/70s
layering of abstractions: dont sweat the details of the lower layer, only deal with lower layers abstractly
differing in:
addressing conventions packet formats error recovery routing
ARPAnet
"A Protocol for Packet Network Intercommunication", V. Cerf, R. Kahn, IEEE Transactions on Communications, May, 1974, pp. 637-648.
satellite net
Data Link Layer5-129
gateway
ARPAnet
satellite net
Data Link Layer5-130
1990s/00 standard for high-speed (155Mbps to 622 Mbps and higher) Broadband Integrated Service Digital Network architecture Goal: integrated, end-end transport of carry voice,
video, data
meeting timing/QoS requirements of voice, video (versus Internet best-effort model) next generation telephony: technical roots in telephone world packet-switching (fixed length packets, called cells) using virtual circuits
initial goal: speed up IP forwarding by using fixed length label (instead of IP address) to do forwarding
borrowing ideas from Virtual Circuit (VC) approach but IP datagram still keeps IP address!
MPLS header
IP header
label
20
Exp S TTL
3
5
Data Link Layer5-134
MPLS forwarding table distinct from IP forwarding tables RSVP-TE forwarding possible along paths that IP alone would not allow (e.g., source-specific routing) !! use MPLS for traffic engineering
10 12 8
A D A
0 0 1
in label
out interface
10 12
6 9
A D
1 0
R6
0 0 1
R4
R3
0 0
R5
A
out interface
R2
in label out label dest out interface
in label
0
Data Link Layer5-136
Link Layer
5.1 Introduction and services 5.2 Error detection and correction 5.3Multiple access protocols 5.4 Link-Layer Addressing 5.5 Ethernet 5.6 Link-layer switches 5.7 PPP 5.8 Link virtualization: MPLS 5.9 A day in the life of a web request
putting-it-all-together: synthesis!
goal: identify, review, understand protocols (at all layers) involved in seemingly simple scenario: requesting www page scenario: student attaches laptop to campus network, requests/receives www.google.com
connecting laptop needs to get its own IP address, addr of first-hop router, addr of DNS server: use
DHCP
Ethernet frame broadcast (dest: FFFFFFFFFFFF) on LAN, received at router running DHCP server
Ethernet demuxed to IP demuxed, UDP demuxed to DHCP
Data Link Layer5-140
DHCP server formulates DHCP ACK containing clients IP address, IP address of first-hop router for client, name & IP address of DNS server encapsulation at DHCP server, frame forwarded (switch learning) through LAN, demultiplexing at client DHCP client receives DHCP ACK reply
Client now has IP address, knows name & addr of DNS server, IP address of its first-hop router
Data Link Layer5-141
Eth Phy
DNS query created, encapsulated in UDP, encapsulated in IP, encapsulated in Eth. In order to send frame to router, need MAC address of router interface: ARP
DNS
client now knows MAC address of first hop router, so can now send frame containing DNS query
Data Link Layer5-142
DNS
DNS DNS DNS
DNS DNS
DNS server
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network, routed (tables created by RIP, OSPF, IS-IS and/or BGP routing protocols) to DNS server demuxed to DNS server DNS server replies to client with IP address of www.google.com
Data Link Layer5-143
to send HTTP request, client first opens TCP socket to web server TCP SYN segment (step 1 in 3-way handshake) interdomain routed to web server web server responds with TCP SYNACK (step 2 in 3way handshake) TCP connection established!
Data Link Layer5-144
Chapter 5: Summary
instantiation and implementation of various link layer technologies Ethernet switched LANS, VLANs PPP virtualized networks as a link layer: MPLS synthesis: a day in the life of a web request
Data Link Layer5-146
Link layer
Network
characteristics of unreliable channel will determine complexity of reliable data transfer protocol (rdt)
Transport Layer3-148
important in app., transport, link layers top-10 list of important networking topics!
Link layer
Network
characteristics of unreliable channel will determine complexity of reliable data transfer protocol (rdt)
Transport Layer3-149
important in app., transport, link layers top-10 list of important networking topics!
Link layer
Network
characteristics of unreliable channel will determine complexity of reliable data transfer protocol (rdt)
Transport Layer3-150
send side
receive side
state: when in this state next state uniquely determined by next event
event actions
state 2
Transport Layer3-152
sender
receiver
Transport Layer3-153
acknowledgements (ACKs): receiver explicitly tells sender that pkt received OK How doacknowledgements (NAKs): receiver explicitly humans recover from errors negative during conversation? tells sender that pkt had errors sender retransmits pkt on receipt of NAK
error detection receiver feedback: control msgs (ACK,NAK) rcvr->sender
Transport Layer3-154
acknowledgements (ACKs): receiver explicitly tells sender that pkt received OK negative acknowledgements (NAKs): receiver explicitly tells sender that pkt had errors sender retransmits pkt on receipt of NAK
error detection receiver feedback: control msgs (ACK,NAK) rcvr->sender
Transport Layer3-155
receiver
rdt_rcv(rcvpkt) && corrupt(rcvpkt)
udt_send(sndpkt)
udt_send(NAK)
sender
Transport Layer3-158
Handling duplicates:
sender doesnt know what happened at receiver! cant just retransmit: possible duplicate
sender retransmits current pkt if ACK/NAK garbled sender adds sequence number to each pkt receiver discards (doesnt deliver up) duplicate pkt
stop and wait Sender sends one packet, then waits for receiver response
Transport Layer3-159
L
rdt_rcv(rcvpkt) && ( corrupt(rcvpkt) || isNAK(rcvpkt) ) udt_send(sndpkt)
Wait for ACK or NAK 1 Wait for call 1 from above
Transport Layer3-160
rdt_rcv(rcvpkt) && (corrupt(rcvpkt) sndpkt = make_pkt(NAK, chksum) udt_send(sndpkt) rdt_rcv(rcvpkt) && not corrupt(rcvpkt) && has_seq1(rcvpkt)
rdt_rcv(rcvpkt) && notcorrupt(rcvpkt) && has_seq1(rcvpkt) extract(rcvpkt,data) deliver_data(data) sndpkt = make_pkt(ACK, chksum) udt_send(sndpkt)
Transport Layer3-161
rdt2.1: discussion
Sender: seq # added to pkt two seq. #s (0,1) will suffice. Why? must check if received ACK/NAK corrupted twice as many states
state must remember whether current pkt has 0 or 1 seq. #
note: receiver can not know if its last ACK/NAK received OK at sender
Transport Layer3-162
same functionality as rdt2.1, using ACKs only instead of NAK, receiver sends ACK for last pkt received OK
duplicate ACK at sender results in same action as NAK: retransmit current pkt
Transport Layer3-163
(corrupt(rcvpkt) || isACK(rcvpkt,1))
L
Wait for 0 from below
Transport Layer3-164
retransmits if no ACK received in this time if pkt (or ACK) just delayed (not lost): retransmission will be duplicate, but use of seq. #s already handles this receiver must specify seq # of pkt being ACKed requires countdown timer
Transport Layer3-165
rdt3.0 sender
rdt_send(data) sndpkt = make_pkt(0, data, checksum) udt_send(sndpkt) start_timer Wait for call 0from above Wait for ACK0 rdt_rcv(rcvpkt) && ( corrupt(rcvpkt) || isACK(rcvpkt,1) ) rdt_rcv(rcvpkt)
stop_timer
Wait for ACK1 Wait for call 1 from above
rdt_rcv(rcvpkt)
rdt_send(data)
sndpkt = make_pkt(1, data, checksum) udt_send(sndpkt) start_timer
Transport Layer3-166
rdt3.0 in action
Transport Layer3-167
rdt3.0 in action
Transport Layer3-168
Performance of rdt3.0
rdt3.0 works, but performance stinks ex: 1 Gbps link, 15 ms prop. delay, 8000 bit packet:
sender
L/R RTT + L / R
.008
30.008
= 0.00027
microsec onds
Transport Layer3-169
first packet bit arrives last packet bit arrives, send ACK
= sender
L/R RTT + L / R
.008
30.008
= 0.00027
microsec onds
Transport Layer3-170
Pipelined protocols
pipelining: sender allows multiple, in-flight, yet-tobe-acknowledged pkts
range of sequence numbers must be increased buffering at sender and/or receiver
selective repeat
Transport Layer3-171
receiver
first packet bit arrives last packet bit arrives, send ACK last bit of 2nd pkt arrives, send ACK last bit of 3rd pkt arrives, send ACK
sender
RTT + L / R
= 0.0008
microsecon ds
Transport Layer3-172
Pipelined Protocols
Go-back-N: big picture: Selective Repeat: big pic sender can have up to N sender can have up to N unacked packets in unacked packets in pipeline pipeline rcvr only sends rcvr sends individual ack cumulative acks for each packet
Transport Layer3-173
Go-Back-N
Sender:
ACK(n): ACKs all pkts up to, including seq # n - cumulative ACK may receive duplicate ACKs (see receiver) timer for each in-flight pkt timeout(n): retransmit pkt n and all higher seq # pkts in window
Transport Layer3-174
L
base=1 nextseqnum=1
if (nextseqnum < base+N) { sndpkt[nextseqnum] = make_pkt(nextseqnum,data,chksum) udt_send(sndpkt[nextseqnum]) if (base == nextseqnum) start_timer nextseqnum++ } else refuse_data(data)
Wait
rdt_rcv(rcvpkt) && corrupt(rcvpkt)
rdt_rcv(rcvpkt) && notcorrupt(rcvpkt) base = getacknum(rcvpkt)+1 If (base == nextseqnum) stop_timer else start_timer
Transport Layer3-175
ACK-only: always send ACK for correctly-received pkt with highest in-order seq #
may generate duplicate ACKs need only remember expectedseqnum
out-of-order pkt:
discard (dont buffer) -> no receiver buffering! Re-ACK pkt with highest in-order seq #
Transport Layer3-176
GBN in action
Transport Layer3-177
Selective Repeat
sender window
N consecutive seq #s again limits seq #s of sent, unACKed pkts
Transport Layer3-178
Transport Layer3-179
Selective repeat
data from above :
sender
timeout(n):
ACK(n) in [sendbase,sendbase+N]:
pkt n in [rcvbase-N,rcvbase-1]
send ACK(n) out-of-order: buffer in-order: deliver (also deliver buffered, in-order pkts), advance window to next not-yet-received pkt ACK(n) ignore
otherwise:
Transport Layer3-180
Transport Layer3-181
receiver sees no difference in two scenarios! incorrectly passes duplicate data as new in (a)