Data Link 1
Data Link 1
0 0
Internet checksum
Goal: detect “errors” (e.g., flipped bits) in transmitted
segment (note: used at transport layer only)
Sender: Receiver:
❒ compute checksum of received
❒ treat segment contents
segment
as sequence of 16-bit
❒ check if computed checksum
integers equals checksum field value:
❒ checksum: addition (1’s ❍ NO - error detected
complement sum) of ❍ YES - no error detected. But
segment contents maybe errors nonetheless?
❒ sender puts checksum More later ….
value into UDP checksum
field
Checksumming: Cyclic Redundancy Check
❒ 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)
❍ receiver knows G, divides <D,R> by G. If non-zero remainder:
error detected!
❍ can detect all burst errors less than r+1 bits
❒ widely used in practice (ATM, HDLC)
CRC Example
Want:
D.2r XOR R = nG
equivalently:
D.2r = nG XOR R
equivalently:
if we divide D.2r by
G, want remainder R
D.2r
R = remainder[ ]
G
Chapter: outline
❒ Introduction and ❒ Hubs, bridges, and
services switches
❒ Error detection and ❒ Wireless links and
correction LANs
❒ Multiple access ❒ PPP
protocols ❒ ATM
❒ LAN addresses and ❒ Frame Relay
ARP
❒ Ethernet
Multiple Access Links and Protocols
Two types of “links”:
❒ point-to-point
❍ PPP for dial-up access
❍ point-to-point link between Ethernet switch and host
❒ “Taking turns”
❍ tightly coordinate shared access to avoid collisions
Channel Partitioning MAC protocols: TDMA
Pros Cons
❒ single active node can ❒ collisions, wasting slots
continuously transmit ❒ idle slots
at full rate of channel ❒ nodes may be able to
❒ highly decentralized: detect collision in less
only slots in nodes than time to transmit
need to be in sync packet
❒ simple
Slotted Aloha efficiency
Efficiency is the long-run ❒ For max efficiency
fraction of successful slots with N nodes, find p*
when there’s many nodes, each that maximizes
with many frames to send Np(1-p)N-1
❒ For many nodes, take
❒ Suppose N nodes with limit of Np*(1-p*)N-1
many frames to send, as N goes to infinity,
each transmits in slot gives 1/e = .37
with probability p
❒ prob that 1st node has At best: channel
success in a slot used for useful
= p(1-p)N-1 transmissions 37%
❒ prob that any node has of time!
a success = Np(1-p)N-1
Pure (unslotted) ALOHA
❒ unslotted Aloha: simpler, no synchronization
❒ when frame first arrives
❍ transmit immediately
= 1/(2e) = .18
Even worse !
CSMA (Carrier Sense Multiple Access)
collision:
entire packet transmission
time wasted
note:
role of distance & propagation
delay in determining collision
probability
CSMA/CD (Collision Detection)
CSMA/CD: carrier sensing, deferral as in CSMA
❍ collisions detected within short time
❍ colliding transmissions aborted, reducing channel
wastage
❒ collision detection:
❍ easy in wired LANs: measure signal strengths,
compare transmitted, received signals
❍ difficult in wireless LANs: receiver shut off while
transmitting
❒ human analogy: the polite conversationalist
CSMA/CD collision detection
“Taking Turns” MAC protocols
channel partitioning MAC protocols:
❍ share channel efficiently and fairly at high load
❍ inefficient at low load: delay in channel access,
1/N bandwidth allocated even if only 1 active
node!
Random access MAC protocols
❍ efficient at low load: single node can fully
utilize channel
❍ high load: collision overhead
“taking turns” protocols
look for best of both worlds!
“Taking Turns” MAC protocols
Polling: Token passing:
❒ master node ❒ control token passed from
“invites” slave nodes one node to next
to transmit in turn sequentially.
❒ concerns: ❒ token message
❍ polling overhead ❒ concerns:
❍ latency ❍ token overhead
❍ single point of ❍ latency
failure (master) ❍ single point of failure (token)
Summary of MAC protocols
❒ What do you do with a shared media?
❍ Channel Partitioning, by time, frequency or code
• Time Division,Code Division, Frequency Division
❍ Random partitioning (dynamic),
• ALOHA, S-ALOHA, CSMA, CSMA/CD
• carrier sensing: easy in some technologies (wire), hard
in others (wireless)
• CSMA/CD used in Ethernet
❍ Taking Turns
• polling from a central site, token passing
LAN technologies
Data link layer so far:
❍ services, error detection/correction, multiple
access
Next: LAN technologies
❍ addressing
❍ Ethernet
❍ hubs, bridges, switches
❍ 802.11
❍ PPP
❍ ATM
LAN Addresses and ARP
32-bit IP address:
❒ network-layer address
❒ used to get datagram to destination IP network
(recall IP network definition)
LAN (or MAC or physical or Ethernet) address:
❒ used to get datagram from one interface to another
physically-connected interface (same network)
❒ 48 bit MAC address (for most LANs)
burned in the adapter ROM
LAN Addresses and ARP
Each adapter on LAN has unique LAN address
LAN Address (more)
❒ MAC address allocation administered by IEEE
❒ manufacturer buys portion of MAC address space
(to assure uniqueness)
❒ Analogy:
(a) MAC address: like Social Security Number
(b) IP address: like postal address
❒ MAC flat address => portability
❍ can move LAN card from one LAN to another
❒ IP hierarchical address NOT portable
❍ depends on IP network to which node is attached
Recall earlier routing discussion
Starting at A, given IP A 223.1.1.1
datagram addressed to B:
223.1.2.1
❒ look up net. address of B, find B 223.1.1.2
on same net. as A 223.1.1.4 223.1.2.9
B
❒ link layer send datagram to B 223.1.2.2
E
inside link-layer frame 223.1.1.3 223.1.3.27
223.1.3.1 223.1.3.2
frame source, datagram source,
dest address dest address
datagram
frame
ARP: Address Resolution Protocol
R
B
❒ Two ARP tables in router R, one for each IP
network (LAN)
❒ A creates datagram with source A, destination B
❒ A uses ARP to get R’s MAC address for 111.111.111.110
❒ A creates link-layer frame with R's MAC address as dest,
frame contains A-to-B IP datagram
❒ A’s data link layer sends frame
❒ R’s data link layer receives frame
❒ R removes IP datagram from Ethernet frame, sees its
destined to B
❒ R uses ARP to get B’s physical layer address
❒ R creates frame containing A-to-B IP datagram sends to B
R
B