Sunteți pe pagina 1din 17

Datalink Functions

15-441 Computer
p Networkingg
z Framing: encapsulating a network layer
Lecture 6 datagram into a bit stream.
Data link Layer – Access Control z
» Add header, mark and detect frame boundaries, …
Error control: error detection and correction
to deal with bit errors.
» May also include other reliability support, e.g.
retransmission
t i i
z Flow control: avoid sender overrunning
receiver.
z Media access: controlling which frame should
be sent over the link next.
» Easy for point-to-point links
» Harder for multi-access links: who gets to send?
Based on slides by Peter Steenkiste
Copyright ©, Carnegie Mellon 2007-10 1 2
Lecture 6 15 441 © 2008 2

So far … So far …

Can connect ttwo


o nodes Can connect ttwo
o nodes

• … But what if we want more nodes? • … But what if we want more nodes?

Wires for everybody! Wires for everybody!

P-2-p
P 2p shared

3 switches 4
Lecture 6 15 441 © 2008 3 Lecture 6 15 441 © 2008 4
Datalink Architectures Media Access Control

z How do we transfer packets between two


hosts connected to the same network?
z Switches connected by point
point-to-point
to point links --
store-and-forward.
» Used in WAN, LAN, and for home connections
» Conceptually similar to “routing”
– But at the datalink layer instead of the network layer
z Multiple access networks -- contention based.
» Multiple
p hosts are sharingg the same transmission
medium
z Point-Point with switches z Media access » Used in LANs and wireless
control. » Need to control access to the medium

5 6
Lecture 6 15 441 © 2008 6

Datalink Classification Switching


z Forward units of data based on address in header.
z Many data-link technologies use switching.
Datalink
» Virtual circuits: Frame Relay, ATM, X.25, ..
» Packets: Ethernet, MPLS, …
Switch-based Multiple Access z “Switching” also happens at the network layer.
» Layer 3: Internet protocol
» In
I this
thi case, address
dd is
i an IP address
dd
Virtual Packet Scheduled Random
Circuits Switching Access Access » IP over SONET, IP over ATM, ...
» Otherwise,, operation
p is very
y similar
ATM,
ATM Bridged
B id d Token
T k ring,
i Eh
Ethernet,
z Switching is different from SONET mux/demux.
framerelay LANs FDDI, 802.11 802.11, Aloha
» SONET channels statically configured - no addresses

7 8
Lecture 6 15 441 © 2008 7 Lecture 6 15 441 © 2008 8
A Switch
Switch-based
based Network Switch Architecture
z Switches are connected by point-point links.
z Packets come in one
z Packets are forwarded hop
hop-by-hop
by hop by the i t f
interface, forwarded
f d d to
t output
t t Control
switches towards the destination. interface based on address. Processor
» Forwarding is based on the address » Same idea for bridges, switches,
routers: address look up differs Input
p Output
p
z How does a switch
Ho s itch work?
ork? Port Port
z How do nodes exchange packets over a link? Output Input
Port Port
z How is the destination addressed? z Control processor manages Switch
the switch and executes Fabric
Point-Point higher level protocols. Output Output
Switch link Port Port
» E.g. routing, management, ...
PCs at Input Input
Work PC at z The switch
Th it h fabric
f b i directs
di t the
th P t
Port P t
Port
Home traffic to the right output port.
z The input and output ports
deal with
ith transmission and
reception of packets.
9 10
Lecture 6 15 441 © 2008 9 Lecture 6 15 441 © 2008 10

Connections or Not? Connectionless


z Host can send anytime anywhere
z Two basic approaches to packet forwarding z No idea if resources are available to get to dest
»Connectionless z Forwarding is independent for each packet
»(virtual) Circuit switched z No setup time
z When would y
you use? z Fault tolerant

Destination Port
A 3
B 0
C
D
11 E 12
Lecture 6 15 441 © 2008 11 Lecture 6 F 15 441 © 2008 12
Virtual Circuit Switching Setup assign VCIs
Setup,
z Two stage process
»Setup connection (create VCIs)
»Send packets
p

z RTT introduced before any


y data is sent
z Per packet overhead can be smaller (VCI << adr)
z Switch failures are hard to deal with
z Reserves resources for connection

13 14
Lecture 6 15 441 © 2008 13

Packet Forwarding:
Address Lookup Datalink Classification
Switch
Datalink

Switch-based Multiple Access

A
Address Next Hop Info
f
z Address from header. Virtual Packet Scheduled Random
B31123812508 3 13 Circuits Switching Access Access
» Absolute address (e.g. Ethernet)
38913C3C2137 3 - » (IP address for routers)
» (VC identifier, e.g. ATM))
ATM,
ATM Bridged
B id d Token
T k ring,
i Eh
Ethernet,
A21023C90590 0 - framerelay LANs FDDI, 802.11 802.11, Aloha
z Next hop: output port for packet.
z Info: priority,
priority VC id,
id ..
128.2.15.3 1 (2,34) z Table is filled in by protocol.
15 16
Lecture 6 15 441 © 2008 16
Problem: Sharing a Wire Listen and Talk

Learned ho
how to connect hosts yak yak…

z … But what if we want more hosts?

z Natural scheme – listen before you talk…


»Works well in practice
Switches Wires for everybody!
z Expensive! How can we share a wire?

17 18 18

Listen and Talk Listen and Talk


yyada
yakk yak…
k
yada…
yada yada…

z Natural scheme – listen before y


you talk…
z Natural scheme – listen before you talk…
»Works well in practice
»Works well in practice
z But sometimes this breaks down
»Why? How do we fix/prevent this?

19 19 20 20
Problem: Who is this packet for? Outline

z Aloha

z N d to
Need t putt an address
dd on the
th packet
k t
z What should it look like?
z Ethernet MAC
z How do you determine your own address?
z How do you know what address you want to send it z Collisions
to?

z Ethernet Frames

21 21 22 22

Random Access Protocols Aloha – Basic Technique

z When node has packet to send z First random MAC developed


» Transmit at full channel data rate R
» For radio-based communication in Hawaii (1970)
» No a p
priori coordination among g nodes
z B i idea:
Basic id
z Two or more transmitting nodes Æ “collision”
» When you are ready, transmit
z Random access MAC p protocol specifies:
p
» Receivers
R i send
d ACK ffor d
data
t
» How to detect collisions
» How to recover from collisions (e.g., via delayed » Detect collisions by timing out for ACK
retransmissions) » Recover
R ffrom collision
lli i byb trying
t i after
ft random
d
z Examples of random access MAC protocols: delay
» Slotted ALOHA and ALOHA – Too short Æ large
g number of collisions

» CSMA and CSMA/CD – Too long Æ underutilization


23 23 24 24
Slotted Aloha Pure (Unslotted) ALOHA
z Time is divided into equal size slots z Unslotted Aloha: simpler, no synchronization
» Equal to packet transmission time z Pkt needs transmission:
z Node (w/ packet) transmits at beginning of next slot » Send without awaiting for beginning of slot
z If collision: retransmit pkt in future slots with z C lli i probability
Collision b bilit increases:
i
probability p, until successful » Pkt sent at t0 collide with other pkts sent in [t0-1, t0+1]

Success (S), Collision (C), Empty (E) slots


25 25 26 26

Outline Ethernet
z First practical local area network, built at
X
Xerox PARC ini 70’s
70’
z Aloha
z “Dominant” LAN technology:
» Cheap
Ch
z Ethernet MAC » Kept up with speed race: 10, 100, 1000 Mbps

z Collisions Metcalfe’s Ethernet


sketch
k t h

z Ethernet Frames

27 27 28 28
Ethernet MAC – Collision
Ethernet MAC – Carrier Sense D t ti
Detection
z Basic idea: z But: ALOHA has collision detection also?
» Listen to wire before
Hidden Exposed » That was very slow and inefficient
transmission
» Avoid collision with St Louis
St.Louis z Basic idea:
NY
active transmission » Listen while transmitting
z Whyy didn’t ALOHA Chicago
C cago
» If you notice interference Æ assume collision
have this? CMU
CMU z Why didn’t ALOHA have this?
» In wireless, relevant » Very difficult for radios to listen and transmit
contention at the Chi
Chicago » Signal strength is reduced by distance for radio
receiver, not sender NY
– Much easier to hear “local, powerful” radio station
– Hidden terminal than one in NY
– Exposed terminal – You may not notice any “interference”

29 29 30 30

Ethernet CSMA/CD:
Ethernet MAC (CSMA/CD) Making it word
z Carrier Sense Multiple
p Access/Collision Jam Signal:
g make sure all other transmitters
Detection are aware of collision; 48 bits;
Packet? Exponential Backoff:
No
z If deterministic delay after collision,
Sense Send Detect collision will occur again in lockstep
Carrier Collision
z Why not random delay with fixed mean?
Yes
Discard » Few senders Æ needless waiting
Packet Jam channel
b=CalcBackoff();
» Too
T many senders
d Æ too
t many collisions
lli i
attempts < 16
wait(b); z Goal: adapt retransmission attempts to
attempts++;
attempts == 16
estimated current load
» heavy load: random wait will be longer
31 31 32 32
Ethernet Backoff Calculation Outline

z Exponentially increasing random delay z Aloha


»Infer senders from # of collisions
»More senders Æ increase wait time
z Ethernet MAC
z First collision: choose K from {0,1}; delay is K
x 512 bit transmission times
z After second collision: choose K from z Collisions
{0,1,2,3}…
z After ten or more collisions, choose K from
{0,1,2,3,4,…,1023}
z Ethernet Frames

33 33 34 34

Collisions Minimum Packet Size


A B C
z What if two people
p p
sent really small
packets
» How do you find
collision?
me
Tim

35 35 36 36
Ethernet Collision Detect End to End Delay
z c in cable = 60% * c in vacuum = 1.8 x 10^8
z Min packet length > 2x max prop delay m/s
»If A, B are at opposite sides of link, z Modern 10Mb Ethernet
and B starts one link prop delay after » 2.5km, 10Mbps
A » ~= 12.5us delay
z Jam network for 32-48 bits after collision, » +Introduced repeaters (max 5 segments)
then stop sending » Worst case – 51.2us round trip time!
»Ensures
E that
th t everyone notices
ti z Slot time = 51.2us = 512bits in flight
collision
» After this amount, sender is guaranteed sole
access to link
37 37 » 51.2us = slot time for backoff 38 38

Packet Size 10BaseT and 100BaseT


z 10/100 Mbps rate; latter called “fast ethernet”
z What about scaling? 3Mbit,
3Mbit 100Mbit,
100Mbit
1Gbit... z T stands for Twisted Pair (wiring)

» Original 3Mbit Ethernet did not have minimum z Minimum packet size requirement
packet size » Make network smaller Æ solution for 100BaseT

– Max length = 1Km and No repeaters


» For higher speeds must make network smaller,
minimum packet size larger or both
z What about a maximum packet size?
» Needed to prevent node from hogging the
network
» 1500 bytes in Ethernet
39 39 40 40
Gbit Ethernet Outline

z Minimum packet size requirement


z Aloha
» Make network smaller?
– 512bits @ 1Gbps = 512ns
– 512ns * 1.8 * 10^8 = 92meters = too small !! z Ethernet MAC
» Make min pkt size larger!
– Gigabit Ethernet uses collision extension for small pkts
and backward compatibility z Collisions
z M i
Maximum packet
k t size
i requirement
i t
» 1500 bytes is not really “hogging” the network z Ethernet Frames
» Defines
D fi “j
“jumbo
b frames”
f ” (9000 b
bytes)
t ) for
f higher
hi h
efficiency
41 41 42 42

Ethernet Frame Structure Ethernet Frame Structure (cont.)


(cont )

z Sending adapter encapsulates IP datagram (or other z Preamble: 8 bytes


network layer protocol packet) in Ethernet frame
»101010…1011
»Used to synchronize receiver,
sender clock rates
z CRC: 4 bytes
»Checked at receiver, if error is
detected, the frame is simply
dropped

43 43 44 44
Ethernet Frame Structure (cont.)
(cont ) Addressing Alternatives
z Broadcast Æ all nodes receive all packets
p
z Each protocol layer needs to provide
» Addressing determines which packets are kept and
some hooks to upper layer protocols which are packets are thrown away
» Demultiplexing: identify which upper layer » Packets
P k t can b be sentt tto:
protocol packet belongs to – Unicast – one destination
» E.g.,
g , port
p numbers allow TCP/UDP to identify
y – Multicast – group of nodes (e.g. “everyone playing Quake”)
target application – Broadcast – everybody on wire

» Ethernet uses Type field z Dynamic addresses (e.g. Appletalk)


» Pick an address at random
z Type: 2 bytes
» Broadcast “is anyone using address XX?”
» Indicates the higher layer protocol, mostly IP
» If yes
yes, repeat
but others may be supported such as Novell
IPX and AppleTalk) z Static address (e.g. Ethernet)
45 45 46 46

Ethernet Frame Structure (cont.)


(cont ) Why Did Ethernet Win?
z Failure modes
z Addresses: 6 bytes » Token rings – network unusable
» Each adapter is given a globally unique » Ethernet – node detached
address at manufacturingg time z Good performance in common case
– Address space is allocated to manufacturers » Deals well with bursty traffic
z 24 bits identify manufacturer
» Usually used at low load
z E
E.g., 0 0 15 * Æ 3com
0:0:15:* 3 adapter
d t
– Frame is received by all adapters on a LAN and z Volume Æ lower cost Æ higher volume ….
dropped if address does not match z Adaptable
» Special addresses » To higher bandwidths (vs. FDDI)
– Broadcast – FF:FF:FF:FF:FF:FF is “everybody” » To switching (vs. ATM)
– Range
R off addresses
dd allocated
ll t d to
t multicast
lti t z E
Easy iincremental
t l deployment
d l t
z Adapter maintains list of multicast groups node is
z Cheap cabling, etc
interested in 47 47 48 48
Ethernet Problems:
And .. It is Easy to Manage Unstable at High Load
z You p
plug
g in the host and it basically
y works z Peak throughput worst with
» No configuration at the datalink layer » More hosts – more collisions to identify single
sender
» Today: may need to deal with security
» Smaller packet sizes – more frequent arbitration
z Protocol is fully distributed
» Longer links – collisions take longer to observe,
z Broadcast-based. more wasted bandwidth
» In part explains the easy management z But works well in practice
1/e = 37%
0.4
» Some of the LAN protocols (e.g. ARP) rely on » Can improve
broadcast efficiency by 03
0.3
Slotted Aloha
– Networking would be harder without ARP avoiding 0.2
» Not having natural broadcast capabilities adds above
0.1
l it to
complexity t a LAN conditions Pure Aloha
– Example: ATM 0.5 1.0 1.5 2.0
49 49 G = offered load = N X p 50

Virtual LANs Summary


z Single physical LAN infrastructure that carries multiple
virtual LANs simultaneously
“virtual” simultaneously. z CSMA/CD Æ carrier sense multiple access
z Each virtual LAN has a LAN identifier in the packet. with collision detection
» Switch keeps track of what nodes are on each segment and » Why
y do we need exponential
p backoff?
what their virtual LAN id is
z Can bridge and route appropriately. » Why does collision happen?
z Broadcast p
packets stayy within the virtual LAN. » Why do we need a minimum packet size?
» Limits the collision domain for the packet – How does this scale with speed?
host host host host host host
z Ethernet
» What is the purpose of different header fields?
Switch » What do Ethernet addresses look like?
z What are some alternatives to Ethernet
host host host host host host
51 51 design? 52 52
Outline

z Random Access Analysis

EXTRA SLIDES

53 54 54

Slotted Aloha Efficiency Pure Aloha (cont.)


(cont )
Q: What is max fraction slots successful? P(success by given node) = P(node transmits) X P(no other node
transmits in [p0-1,p
1 p0] X P(no other node transmits in [p0-1,p
1 p0]
A: Suppose N stations have packets to send
= p X (1-p)(N-1) X (1-p)(N-1)
»Each transmits in slot with probability p P(success
( by y of N nodes)) = N p X ((1-p)
y any p)(N-1) X ((1-p)
p)(N-1) = 1/(2e) = .18
»Prob. successful transmission S is: … choosing optimum p as N Æ infty Æ p = 1/2N …
by single node: S = p (1-p)(N-1)
0.4
by any of N nodes
S = Prob (only one transmits) At best: channel protocol constrains 0.3
use for useful effective channel Slotted Aloha
(1-p))(N-1)
= N p (1 (N 1)
transmissions 37%
0.2
throughput!
… choosing optimum p as N -> infty ... of time! 0.1
… p = 1/N Pure Aloha

= 1/e = .37 as N -> infty 0.5 1.0 1.5 2.0


G = offered load = N X p
55 55 56 56
Simple Analysis of Efficiency Ethernet Technologies: 10Base2
z 10: 10Mbps; 2: under 185 (~200) meters cable length
z Key assumptions z Thin coaxial cable in a bus topology

»All packets are same, small size


– Packet size = size of contention slot
»All nodes always have pkt to send
»p is chosen carefully to be related to
N
– p is actually chosen by exponential
backoff
»Takes full slot to detect collision (I.e. z Repeaters used to connect up to multiple segments
no “fast collision detection”) 57 57 z Repeater repeats bits it hears on one interface
58 to its58
other interfaces: physical layer device only!

Gbit Ethernet Datalink Layer Architectures

z Use standard Ethernet frame format


z Allows for p
point-to-point
p links and
shared broadcast channels
z In shared mode, CSMA/CD is used;
short distances between nodes to be
efficient z Packet forwarding. z Media access
z Error and flow control. control.
l
z Uses hubs, called here “Buffered
z Scalability.
Distributors”
z Full-Duplex at 1 Gbps for point-to-point
links 59 59 60
Datalink Classification Multiple Access Protocols

Datalink z Prevent two or more nodes from transmitting


at the same time over a broadcast channel.
» If they do, we have a collision, and receivers will not be
able to interpret the signal
Switch-based Multiple Access
z Several classes of multiple access protocols.
» Partitioning the channel,
channel e.g.
e g frequency-division or time
Virtual Packet Scheduled Random division multiplexing
Circuits Switching Access Access – With fixed partitioning of bandwidth –
– Not flexible;; inefficient for bursty
y traffic
ATM
ATM, Bridged
B id d T k ring,
Token i Eh
Ethernet, » Taking turns, e.g. token-based, reservation-based
framerelay LANs FDDI, 802.11 802.11, Aloha protocols, polling based
» Contention based protocols, e.g. Aloha, Ethernet
– Next lecture

61 61 62

Fiber Distributed Data Interface Other “Taking Turn”


(FDDI) Protocols
z One token holder may send,
with
ith a time
ti limit
li it z Central entity polls stations, inviting them to
» Provides known upper bound on
delay. transmit
» Simple design – no conflicts
z Optical version of 802
802.5
5 token
ring, but multiple packets may » Not very efficient – overhead of polling operation
travel in train: token released » Example: the “Point Control Function” mode for 802.11
at end of frame z Stations reserve a slot for transmission
transmission.
z 100 Mbps, 100km » For example, break up the transmission time in
z Optional dual ring for fault contention-based and reservation based slots
tolerance – Contention based slots can be used for short
messages or to reserve time slots
z Concerns: – Communication in reservation based slots only
» Token overhead allowed after a reservation is made
» Latency » Issues: fairness, efficiency
» Single point of failure
63 64
MAC Protocols - Discussion

z Channel partitioning MAC protocols:


» Share channel efficiently at high load
» Inefficient at low load: delay in channel
access, 1/N bandwidth allocated even if
only 1 active node!
z “Taking
Taking turns
turns” protocols
» More flexible bandwidth allocation, but
» Protocol can introduce unnecessary
overhead and access delay at low load
z Random access MAC protocols (next lecture)
» Efficient at low load: single node can fully
utilize channel
» High load: collision overhead
Copyright (C), CMU 65 65

S-ar putea să vă placă și