Download MACs & LANs

Document related concepts

Computer security wikipedia , lookup

Net bias wikipedia , lookup

Asynchronous Transfer Mode wikipedia , lookup

Recursive InterNetwork Architecture (RINA) wikipedia , lookup

IEEE 802.1aq wikipedia , lookup

CAN bus wikipedia , lookup

Point-to-Point Protocol over Ethernet wikipedia , lookup

Distributed firewall wikipedia , lookup

Deep packet inspection wikipedia , lookup

AppleTalk wikipedia , lookup

Piggybacking (Internet access) wikipedia , lookup

IEEE 1355 wikipedia , lookup

Zero-configuration networking wikipedia , lookup

Computer network wikipedia , lookup

Network tap wikipedia , lookup

Airborne Networking wikipedia , lookup

List of wireless community networks by region wikipedia , lookup

Packet switching wikipedia , lookup

Cracking of wireless networks wikipedia , lookup

Wake-on-LAN wikipedia , lookup

Transcript
Computer Networks
(Graduate level)
Lecture 3: Mac protocols and
LANs
University of Tehran
Dept. of EE and Computer Engineering
By:
Dr. Nasser Yazdani
Univ. of Tehran
Computer Network
1
Links



How to share the wire or link
How to extend to multiple segments
Assigned reading



[MB76] ETHERNET: Distributed Packet
Switching for Local Area Networks
[B+88] Measured Capacity of an Ethernet:
Myths and Reality
Chap. 2 of book.
Univ. of Tehran
Computer Network
2
Outline






Sharing links, Mac protocols.
ALOHA
CSMA/CD
Ethernet
Token Ring
Learning Bridges
Univ. of Tehran
Computer Network
3
Main Issues


Local Area Network (LAN) : Three or more
machines are physically connected and
communicating.
Problems:

How to connect them? Topology



How to address each machine? Addressing
How to regulate accessing to the media?




Sharing links
MAC (Media Access method or protocol)
Collision!
Different technology address each problem in
different way.
Problems are not independent
Univ. of Tehran
Computer Network
4
Data link sublayers
Our focus will be on
MAC sublayer.
MAC = “Medium Access Control”
Multiplexing
Media Access (MAC)
Error Detection
Framing
• The link is shared among different sender and receivers.
• Since every frame is simultaneously access by different nodes;
•They are called multiaccess links.
•They are called broadcast links. (important)
•LAN because of limited area.
• We need some type of medium access rules to avoid collision.
• Multicast capability of LANs.
Univ. of Tehran
Computer Network
5
Ideal Multiple Access Protocol
Broadcast channel of rate R bps
1. When one node wants to transmit, it can
send at rate R.
2. When M nodes want to transmit, each can
send at average rate R/M
3. Fully decentralized:


no special node to coordinate transmissions
no synchronization of clocks, slots
4. Simple
Univ. of Tehran
Computer Network
6
Goals of MAC Protocols
MAC Protocols arbitrate access to a
common shared channel among a
population of nodes
Goals:
1. Fair among users
2. High efficiency
3. Low delay
4. Fault tolerant
Univ. of Tehran
Computer Network
7
Multiplexing/Media
Access/Sharing

Partition the channel and give everybody a time/freq
slot

FDMA


CDMA (covered in wireless lecture) (Code Division Multiple
Access)





Different codes
TDMA


Different freq
Different times
Synchronous TDMA
Ok for fixed bandwidth (e.g., voice)
What if traffic is bursty?
Random Access


ALOHA
CSMA, etc
Univ. of Tehran
Computer Network
8
Simple
Random
Examples of MAC Protocols
Packet-Switched Radio Network
Aloha
Carrier Sense Multiple Access/Collision Detection
Complex
Deterministic
Ethernet (IEEE 802.3)
Token Passing
Token Ring (IEEE 802.5)
Fiber Distributed Data Interface (FDDI)
Wireless
Univ. of Tehran
Computer Network
9
Aloha Protocol
All nodes transmit on one freq.
Central Node
Central node relays packets on
the other frequency
f0
f1
If more than one node transmit at the same time
Collision!
If there is a collision, both nodes re-transmit packets
Univ. of Tehran
Computer Network
10
Aloha Protocol





Aloha protocol is very simple, and fairly robust against failure
of a host.
The protocol is distributed among the hosts.
Under low-load, we can expect the delay to be small.
Under high-load, a lot of time is “wasted” sending packets
that collide.
How to improve it?
Improving performance:



Listen for activity before sending a packet.
Detect collisions quickly and stop transmitting.
After a collision, pick the random waiting time so as to
maximize throughput.
Univ. of Tehran
Computer Network
11
Pure (unslotted) ALOHA


unslotted Aloha: simpler, no synchronization
when frame first arrives


transmit immediately
collision probability increases:

frame sent at t0 collides with other frames sent in [t01,t0+1]
Univ. of Tehran
Computer Network
12
Aloha Performance

Assumptions :
m: Length of packets
 λ : arrival rate of each station
 S: Channel utilization
 N: # of stations
By assuming Poisson arrival
S= N λm utilization of channel


G= utilization of channel with retransmission.
λ’ > λ => G = N λ’m
The prob. of no poisson arrival in 2m time e-2Nλ’m
New arrival rate
Channel utilization = S/G => S=Ge-2G => ds/dG = e-2G 2Ge-2G
G=0.5, S=1/2e= 0.18
Univ. of Tehran
Computer Network
13
Slotted Aloha

How to improve Aloha?


Send at the specific point of time. Then, if there is no
collision, the packet will arrive safely.
The same arguments, except the collision time is
exactly m. Then, s= 0.36
Univ. of Tehran
Computer Network
14
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
Univ. of Tehran
Cons




collisions, wasting slots
idle slots
nodes may be able to
detect collision in less
than time to transmit
packet
clock synchronization
Computer Network
15
Slotted ALOHA Performance
What is different for Pure ALOHA?

Collision time is reduced to m, then,
Channel utilization = S/G => S=Ge-G =>
ds/dG = e-G -Ge-G = 0
G=1, S=1/e= 0.34
Univ. of Tehran
Computer Network
16
CSMA/CD Protocol
All hosts transmit & receive on one channel
Packets are of variable size.
When a host has a packet to transmit:
1. Carrier Sense: Check that the line is quiet before transmitting.
2. Collision Detection: Detect collision as soon as possible. If a
collision is detected, stop transmitting; wait a random time,
then return to step 1.
binary exponential backoff
Univ. of Tehran
Computer Network
17
CSMA/CD Network Size Restriction
To ensure that a packet is transmitted without a collision, a host must
be able to detect a collision before it finishes transmitting a packet.
A
B
t=PROP-
t=0
t=2PROP-
t=PROP
PROP
PROP
Events:
t=0:
Host A starts transmitting a packet.
t=PROP--: Just before the first bit reaches Host B,
Host B senses the line to be idle and starts
to transmit a packet.
t=PROP-: A collision takes place near Host B.
Univ. of Tehran
t=PROP: Host B receives data whilst transmitting, and
so detects the collision.
t=2PROP-: Host A receives data whilst transmitting, and
so detects the collision.
Computer Network
18
CSMA/CD Network Size Restriction
“To ensure that a packet is transmitted without a collision, a host must
be able to detect a collision before it finishes transmitting a packet.”
From example on previous slide we can see that for a Host to
detect a collision before it finishes transmitting a packet,
we require:
TRANSP  2  PROP
In other words, there is a minimum length packet for
CSMA/CD networks.
Univ. of Tehran
Computer Network
19
Performance of CSMA/CD
Finding the efficiency
•We’re going to analyze the performance of a CSMA/
•Efficiency, h, is simply the fraction of time spent
sending useful/successful data.
• Therefore, h = Amount of useful data sent
Time taken to send data
TRANSP
TRANSP  wasted _ time _ between _ packets
TRANSP
=
TRANSP  1.5(2  PROP )
hCSMA/ CD =
Univ. of Tehran
Computer Network
20
Performance of CSMA/CD
Maximizing goodput
Find the goodput,  ( p):
Probability that exactly one node transmits in a given slot.
N
 ( p)    p(1  p) N 1
1 
d
= N (1  p) N 1  pN ( N  1)(1  p ) N  2
dp
 max  36%  40%
when :
p = 1/ N
Univ. of Tehran
Computer Network
21
Ethernet Overview

History





developed by Xerox PARC in mid-1970s
roots in Aloha packet-radio network
standardized by Xerox, DEC, and Intel in 1978
similar to IEEE 802.3 standard
CSMA/CD



carrier sense, Check to see if active
transmission.
multiple access
collision detection, in case of collision retry
transmission.
Univ. of Tehran
Computer Network
22
Ethernet (cont)

Addresses







unique, 48-bit unicast address assigned to each adapter
example: 8:0:e4:b1:2
broadcast: all 1s
multicast: first bit is 1
Bandwidth: 10Mbps, 100Mbps, 1Gbps
Length: 2500m (500m segments with 4 repeaters)
Problem: Distributed algorithm that provides fair
access
Univ. of Tehran
Computer Network
23
Ethernet new features

Access control?


Distributed
Efficiency in using media? (compare to
Aloha)



Carrier sense
random back off
collision detection
Univ. of Tehran
Computer Network
24
Ethernet MAC Protocol
Packet?
No
Sense
Carrier
Send
Detect
Collision
Yes
Discard
Packet
attempts < 16
b=CalcBackoff();
wait(b);
attempts++;
attempts == 16
Univ. of Tehran
Computer Network
25
Transmit Algorithm
If line is idle…
send immediately
upper bound message size of 1500 bytes
must wait 9.6us between back-to-back frames
If line is busy…
wait until idle and transmit immediately
called 1-persistent (special case of p-persistent)
Univ. of Tehran
Computer Network
26
Algorithm (cont)
If collision…
jam for 32 bits, then stop transmitting frame
(minimum frame is 64 bytes (header + 46 bytes of
data))
delay and try again
1st time: 0 or 51.2us
2nd time: 0, 51.2, or 102.4us
3rd time51.2, 102.4, or 153.6us
nth time: k x 51.2us, for randomly selected
k=0..2n - 1
give up after several tries (usually 16)
exponential backoff
Univ. of Tehran
Computer Network
27
Ethernet Backoff Calculation


If deterministic delay after collision,
collision will occur again in lockstep
If random delay with fixed mean



Few senders  needless waiting
Too many senders  too many collisions
Exponentially increasing random delay


Infer senders from # of collisions
More senders  increase wait time
Univ. of Tehran
Computer Network
28
Minimum Packet Size

What if two people
sent really small
packets


How do you find
collision?
None in paper –
but is one in reality
Univ. of Tehran
Computer Network
29
Ethernet Collision Detect

Min packet length > 2x max prop delay


If A, B are at opposite sides of link, and B
starts one link prop delay after A
Jam network for 32-48 bits after collision,
then stop sending

Ensures that everyone notices collision
Univ. of Tehran
Computer Network
30
End to End Delay

1Km, c in cable = 60% * c in vacuum =
1.8 x 108 m/s



1000/1.8 x 108 ~= 5 x 10-6 = 5us
5us * 3Mbps = 15bits in flight!
Modern 10Mb Ethernet




2.5km, 10Mbps
~= 12.5us delay
Introduced repeaters (max 5 segments)
worst case – 51.2us round trip time!
Univ. of Tehran
Computer Network
31
Scaling to higher rates?

Slot time = 51.2us = 512bits in flight



After this amount, sender is guaranteed sole access to
link
51.2us = slot time for backoff
What about 100Mbit, 1Gbit...?

CSMA/CD at 100Mb/s over 2500m of cable:
TransP >= 2 prop , prop= 2.5KM/(2.5x108)= 10us,
TransP >= 20us => 2000bits! Or 250 Bytes
What are solutions?

Make network smaller?


Solution for 100BaseT, make it 100 meters
Make min pkt size larger? Solution for Gbit Ethernet



512bits @ 1Gbps = 512ns
512ns * 1.8 * 108 = 92meters/2 maximum size of the net!
Gigabit ethernet uses collision extension for small pkts
Univ. of Tehran
Computer Network
32
Ethernet Frame Format
Bytes:
7
1
6
6
Preamble SFD
DA
SA
2
Type
0-1500
Data
0-46 4
Pad CRC
1. Preamble: trains clock-recovery circuits
2. Start of Frame Delimiter: indicates start of frame
3. Address: 48-bit globally unique address assigned by
manufacturer.
1. It is read in : notation, for example: 8:0:e4:b1:2
2. broadcast: all bits 1.
3. first 24 bits are assigned to manufacturers and the last 24
bits are assigned locally.
4. Type: Indicates protocol of encapsulated data (e.g. IP
= 0x0800)
5. Pad:
used to ensure
minimum
frame length
33
Univ. Zeroes
of Tehran
Computer
Network
Interaction with Layering

TYPE field



Identifies upper layer protocol
Enables the multiplexing of protocols
ARP


Broadcast search for IP address
Destination responds with appropriate 48-bit
Ethernet address
Univ. of Tehran
Computer Network
34
Simple Analysis of Efficiency

If pkt size/link speed = P/C = slot time = T, Q stations
sending with prob. of 1/Q, A prob. to send a packet


Minimum packet size
E = 1/(1+W) = 1/ (1 + (1-A)/A) = A (efficiency)




W: ave. of slots waiting in contention interval Σ i*A (1-A)i
A = (1-(1/Q)) (Q-1) Successful line acquisition.
If Q >>1 the E = A = 1/e = well known Ethernet limit
Assumptions




Single pkt size
Always have pkt to send
Master slot clock, all transmissions start a slot start
Q is estimated well by exponential backoff
Univ. of Tehran
Computer Network
35
Ethernet Problems

Ethernet unstable at high loads


Peak utilization = 1/e = 37%
Peak throughput worse with



More hosts – more collisions needed to
identify single sender
Smaller packet sizes – more frequent
arbitration
Longer links – collisions take longer to
observe, more wasted bandwidth
Univ. of Tehran
Computer Network
36
Source of Myths


Assumptions in various analyses
Static parameters




Workload parameters





Maximum propagation time and slot time
Maximum packet size
1-persistence
Packet length distribution
Number of hosts
Length of cable and placement of hosts
Load
Evaluated under unreasonable high load
Univ. of Tehran
Computer Network
37
Measurement of Real Ethernet


Evaluate performance in some typical scenarios
Scenario 1





Topology: 4 clusters of 6 hosts – similar to office
configuration
Fixed pkt size
Throughput decreases with number of hosts &
increases with pkt size – as expected
Fairness improves with number of hosts – capture
effects less likely
Only linear increase in delay with number of hosts unexpected
Univ. of Tehran
Computer Network
38
Measurement of Real Ethernet

Scenario 2




Topology: 23 hosts on short net
Load: fixed pkt size
Improvement in bit rate over scenario 1
Scenario 3



Topology: 4 clusters
Load: bimodal pkt size
7/1 ratio of small to large pkts is sufficient to
greatly improve total bit rate
Univ. of Tehran
Computer Network
39
How to Improve Performance




No long cables
Fewer hosts per cable
Use large packets
Don't mix real-time w/ bulk-data if
possible

Can’t provide good efficiency/throughput and
good latency
Univ. of Tehran
Computer Network
40
Ethernet Packet Traces

Ethernet traffic is “self-similar” (fractal)


Bursty at every time scale (msecs to
months)
Implication?


On average, low load
Occasional peaks
Univ. of Tehran
Computer Network
41
Token Ring
Listen:
Talk:
Data
l4
l1
l3
l2
Token/Data
PROP = i li / c = TRTmin
TRT=Token Rotation Time
Univ. of Tehran
Computer Network
42
Token Ring (cont)


It is like people talking in a ring in the round
robin manner.
Common features.




Frames flow in one direction: upstream to
downstream
special bit pattern (token) rotates around ring
must capture token before transmitting
release token after done transmitting




immediate release
delayed release
remove your frame when it comes back around
stations get round-robin service
Univ. of Tehran
Computer Network
43
Token Rings


Packets broadcast around ring
Token “right to send” rotates around ring

Fair, real-time bandwidth allocation



Every host holds token for limited time
Higher latency when only one sender
Higher bandwidth

Point to point links electrically simpler than bus
Univ. of Tehran
Computer Network
44
Timed Token Algorithm

Token Holding Time (THT)


Token Rotation Time (TRT)


how long it takes the token to traverse the ring.
ActiveNodes x THT + RingLatency  TRT
Target Token Rotation Time (TTRT) (FDDI)


upper limit on how long a station can hold the token
agreed-upon upper bound on TRT
Each node measures TRT between successive
tokens


if measured-TRT > TTRT: token is late so don’t send
if measured-TRT < TTRT: token is early so OK to send
Univ. of Tehran
Computer Network
45
Token Maintenance

Lost Token



no token when initializing ring
bit error corrupts token pattern
node holding token crashes
Solution- have a monitor

Monitor role in the link



Generating Tokens
Announces its presence periodically
Check for the corrupt or orphaned frames and
remove them from the ring. Orphaned frame are
those whose sending station have died. Sets the
monitor bit to 0 in sending and to 1 when pass
the monitor.
Univ. of Tehran
Computer Network
46
Token Maintenance (cont)


How about when the monitor dies? Or the network
just powered up?
Any station tries to become monitor



send a claim frame that includes the node’s TTRT bid
if your claim frame makes it all the way around the ring:
 Everyone has accepted you as the monitor
 everyone knows TTRT
 you insert new token
How about receiving another monitor claim at the
same time? Break the tie with



The lowest TTRT bid wins.
The highest address wins.
Etc.
Univ. of Tehran
Computer Network
47
Maintenance (cont)

Monitoring for a Valid Token



should periodically see valid transmission
(frame or token)
maximum gap = ring latency + max frame <
= 2.5ms
set timer at 2.5ms and send claim frame if it
fires
Univ. of Tehran
Computer Network
48
Release After Reception (RAR)


Computer captures token, transmits data, waits for
data to successfully travel around ring, then releases
token again.
Allows computer to detect errored frames and
retransmit them.
Example time evolution in which host 1 and host 3 have packets to transmit:
TRANSP
PROP
TRANST
Data
Token
l1/c l2/c
Token arrives
at host 1
Univ. of Tehran
TRANST
lN/c
Data
Token
l1/c
TRANSP
l2/c
Token departs Token arrives
at host 3
from host 1
Token arrives
at host 2
Computer Network
l3/c
time
49
Release After Transmission
(RAT)


Computer captures token, transmits data, then
releases token again.
FDDI uses this technique.
Example time evolution in which host 1 and host 3 have packets to
transmit:
TRANSP
Data
TRANST TRANST
Token
Token
l1/c
Token arrives
at host 1
Univ. of Tehran
Token departs
from host 1
TRANSP
Data
l2/c
Token arrives
at host 3
Token
time
Token arrives
at host 2
Computer Network
50
Token Ring Performance
h = Amount of useful data sent
l4
Time taken to send data
Assumptions:
l3
•There are always packet to send
•Frames are fixed size, 1
•N is # of stations in the ring
•a is the length of ring in terms of packets
Release token after transmission
h = 1/(1+a/N)
Release token after receiving frame
•If a<1 => h = 1/(1+a/N)
•If a>1 => h = 1/(a+a/N)
Univ. of Tehran
Computer Network
l1
l2
51
Other Mac solutions?


Priority base: every node send its address. The
smaller one keep quiet.
Tree based contention resultion



Nodes are the tree leaves.
First everybody sends
If collision, it is repeated for the half of the tree.
Univ. of Tehran
Computer Network
52
Why Did Ethernet Win?

Failure modes





Good performance in common case
Volume  lower cost  higher volume ….
Adaptable





Token rings – network unusable
Ethernet – node detached
To higher bandwidths (vs. FDDI)
To switching (vs. ATM)
Completely distributed, easy to
maintain/administer
Easy incremental deployment
Cheap cabling, etc
Univ. of Tehran
Computer Network
53
LAN Switching


Extend reach of a single shared medium
Connect two or more “segments” by
copying data frames between them
LAN 1
Univ. of Tehran
LAN 2
Computer Network
54
Ethernet Switching


An Ethernet switch is the same as an Ethernet
Bridge.
A Bridge:




Examines the header of each arriving frame.
If the DA is in its table, it forwards the frame to the
correct output port.
If the DA is not in its table, it broadcasts the frame
to all ports (except the one through which it
arrived).
The table is learned by examining the SA of arriving
packets.
Univ. of Tehran
Computer Network
55
Ethernet Switch
Ethernet
Switch/Bridge
Router
• If
only one computer per port, no collisions can take
place (each cable is now a self-contained point-to-point
Ethernet link).
• Capacity is increased: the switch can forward multiple
frames to different computers at the same time.
• An Ethernet switch must contain buffers to hold
56
Univ. of Tehran
Computer Network
frames
during times of congestion.
Ethernet Switch
Ethernet
Switch/Bridge
Router
Ethernet
Hub
• If only one computer per port, no collisions can take place (each cable
is now a self-contained point-to-point Ethernet link).
• Capacity is increased: the switch can forward multiple frames to
different computers at the same time.
• An Ethernet switch must contain buffers to hold frames during times
of congestion.
Univ. of Tehran
Computer Network
57
Switched Network Advantages

Higher link bandwidth


Much greater aggregate bandwidth


Separate segments can send at once
Improved fault tolerance


Point to point electrically simpler than bus
Redundant paths
Challenge


Learning which packets to copy across links
Avoiding forwarding loops
Univ. of Tehran
Computer Network
58
Learning Bridges




Basic idea: build cache of which nodes
are downstream of which ports
Monitor source address on all packets
bridge forwards
Insert reverse path to source into cache
What to do with unknown sources?

Flood network
Univ. of Tehran
Computer Network
59
Bridges with Loops
S
LAN 1
Packet from S on LAN 1
S D Type Data
Cache at B1
Node Port
S
11
Port 11
Cache at B2
Port 21
B1
B2
Port 12
Port 22
Node Port
S
21
LAN 2
Univ. of Tehran
Computer Network
60
Loop Solution: Spanning Tree

Only want a single spanning tree





First step agree on a root
Lowest node ID
Each bridge announces its current root
and distance to root
Lowest distance become responsible for
link
Ties go to lower bridge ID
Univ. of Tehran
Computer Network
61
Next Lecture: Layer
Functionality

How to determine split of functionality



Across protocol layers
Across network nodes
Assigned Reading



[SRC84] End-to-end Arguments in System
Design]
[Cla88] Design Philosophy of the DARPA
Internet Protocols
[CT90] Architectural Consideration for a New
Generation of Protocols
Univ. of Tehran
Computer Network
62