Title: CS 352 Internet Technology Media Access Protocols
1CS 352Internet TechnologyMedia Access Protocols
- Richard Martin
- Dept. of Computer Science
- Rutgers University
2Medium Access Sublayer
3What is Media
Any resource which requires the parties exclusive
access in order to communicate
Shared Wire
Radio
Ring
4Medium Access Sub layer
Network Layer
Medium Access Sublayer
Data Link Layer
Physical Layer
5Medium Access Sublayer (contd)
- Medium access (MAC) sub-layer is not important on
point-to-point links - The MAC sublayer is only used in broadcast or
shared channel networks - Examples Satellite, Ethernet, Cellular
6Contents
- Error Detection and Correction
- Fixed Assignment Protocols
- Demand Assignment Protocols
- Contention Access Protocols
- IEEE 802 LANs
- Token Ring protocols
7Error Detection and Correction
- Used on many link types
- Can be used anytime you dont trust the media
- Caches and memories
- On disks (e.g. Google)
- Major Algorithmic Strategies
- Parity
- 1 and 2 dimensional
- Hamming codes (Interleaved Parity Codes)
- Checksums
- Cyclic Redundancy Codes (CRC)
8Parity Codes
Two Dimensional Bit Parity Detect and correct
single bit errors
Single Bit Parity Detect single bit errors
0
0
9Hamming Codes
- Want to be able to correct error with less
overhead than 2D parity - Hamming codes correct all single bit errors with
only log(M) extra bits and detect double bit
errors - Uses an interleaved parity scheme
10Calculating a Hamming Code
- Procedure
- Place message bits in their non-power-of-two
Hamming positions - Build a table listing the binary representation
each each of the message bit positions - Calculate the check bits
11Hamming Code Example
1 0 1 1
Message to be sent
1 0 1 1 1 2 3 4 5 6
7 20 21 22
Position
2n check bits
12Hamming Code Example
1 0 1 1
Message to be sent
1 0 1 1 1 2 3 4 5 6
7 20 21 22
Position
2n check bits
Calculate check bits
3 21 20 0 1 1 5 22 20
1 0 1 6 22 21 1 1 0 7
22 21 20 1 1 1
13Hamming Code Example
1 0 1 1
Message to be sent
1 0 1 1 1 2 3 4 5 6
7 20 21 22
1
Starting with the 20 position Look at positions
with 1s in them Count the number of 1s in
the corresponding message bits If even, place a
1 in the 20 check bit, i.e., use odd
parity Otherwise, place a 0
Position
2n check bits
Calculate check bits
3 21 20 0 1 1 5 22 20
1 0 1 6 22 21 1 1 0 7
22 21 20 1 1 1
14Hamming Code Example
1 0 1 1
Message to be sent
1 0 1 1 1 2 3 4 5 6
7 20 21 22
1
0
Repeat with the 21 position Look at positions
those positions with 1s in them Count the
number of 1s in the corresponding message
bits If even, place a 1 in the 21 check
bit Otherwise, place a 0
Position
2n check bits
Calculate check bits
3 21 20 0 1 1 5 22 20
1 0 1 6 22 21 1 1 0 7
22 21 20 1 1 1
15Hamming Code Example
1 0 1 1
Message to be sent
1 0 1 1 1 2 3 4 5 6
7 20 21 22
1
0
1
Repeat with the 22 position Look at positions
those positions with 1s in them Count the
number of 1s in the corresponding message
bits If even, place a 1 in the 22 check
bit Otherwise, place a 0
Position
2n check bits
Calculate check bits
3 21 20 0 1 1 5 22 20
1 0 1 6 22 21 1 1 0 7
22 21 20 1 1 1
16Hamming Code Example
- Original message 1011
- Sent message 1011011
- Now, how do we check for a single-bit error in
the sent message using the Hamming code?
17Using Hamming Codes to Correct Single-Bit Errors
1 0 1 1 0 0 1
Received message
1 0 1 1 0 0 1 1 2 3 4 5 6
7 20 21 22
Position
2n check bits
Calculate check bits
3 21 20 0 1 1 5 22 20
1 0 1 6 22 21 1 1 0 7
22 21 20 1 1 1
18Using Hamming Codes to Correct Single-Bit Errors
1 0 1 1 0 0 1
Received message
1 0 1 1 0 0 1 1 2 3 4 5 6
7 20 21 22
Starting with the 20 position Look at positions
with 1s in them Count the number of 1s in
both the corresponding message bits and the 20
check bit and compute the parity. If even
parity, there is an error in one of the four bits
that were checked.
Position
2n check bits
Calculate check bits
3 21 20 0 1 1 5 22 20
1 0 1 6 22 21 1 1 0 7
22 21 20 1 1 1
Odd parity No error in bits 1, 3, 5, 7
19Using Hamming Codes to Correct Single-Bit Errors
1 0 1 1 0 0 1
Received message
1 0 1 1 0 0 1 1 2 3 4 5 6
7 20 21 22
Repeat with the 21 position Look at positions
with 1s in them Count the number of 1s in
both the corresponding message bits and the 21
check bit and compute the parity. If even
parity, there is an error in one of the four bits
that were checked.
Position
2n check bits
Calculate check bits
3 21 20 0 1 1 5 22 20
1 0 1 6 22 21 1 1 0 7
22 21 20 1 1 1
Even parity ERROR in bit 2, 3, 6 or 7!
20Using Hamming Codes to Correct Single-Bit Errors
1 0 1 1 0 0 1
Received message
1 0 1 1 0 0 1 1 2 3 4 5 6
7 20 21 22
Repeat with the 22 position Look at positions
with 1s in them Count the number of 1s in
both the corresponding message bits and the 22
check bit and compute the parity. If even
parity, there is an error in one of the four bits
that were checked.
Position
2n check bits
Calculate check bits
3 21 20 0 1 1 5 22 20
1 0 1 6 22 21 1 1 0 7
22 21 20 1 1 1
Even parity ERROR in bit 4, 5, 6 or 7!
21Finding the errors location
1 0 1 1 0 0 1 1 2 3 4 5 6
7
Position
22Finding the errors location
1 0 1 1 0 0 1 1 2 3 4 5 6
7
Position
No error in bits 1, 3, 5, 7
23Finding the errors location
erroneous bit, change to 1
1 0 1 1 0 0 1 1 2 3 4 5 6
7
Position
Error must be in bit 6 because bits 3, 5, 7 are
correct, and all the remaining information agrees
on bit 6
ERROR in bit 2, 3, 6 or 7
ERROR in bit 4, 5, 6 or 7
24Finding the errors locationAn Easier
Alternative to the Last Slide
3 21 20 0 1 1 5 22 20
1 0 1 6 22 21 1 1 0 7
22 21 20 1 1 1
E
E
NE
6
1
1
0
E error in column NE no error in column
25Hamming Codes
- Hamming codes can be used to locate and correct a
single-bit error - If more than one bit is in error, then a Hamming
code cannot correct it - Hamming codes, like parity bits, are only useful
on short messages
26CRC Polynomial Codes
- Can detect errors on large chunks of data
- Has low overhead
- More robust than parity bit
- Requires the use of a code polynomial
- Example x2 1
27Cyclic Redundancy Check
- CRC Example of a polynomial code
- Procedure
- 1. Let r be the degree of the code polynomial.
Append r zero bits to the end of the transmitted
bit string. Call the entire bit string S(x) - 2. Divide S(x) by the code polynomial using
modulo 2 division. - 3. Subtract the remainder from S(x) using modulo
2 subtraction. - The result is the checksummed message
28Generating a CRCExample
Message 1011 1 x x3 0 x x2 1 x x 1
x3 x 1 Code Polynomial x2 1
(101)
Step 1 Compute S(x) r 2 S(x) 101100
29Generating a CRCExample (contd)
Step 2 Modulo 2 divide
Remainder
30Generating a CRCExample (contd)
Step 3 Modulo 2 subtract the remainder from S(x)
101100
- 01
101101
Checksummed Message
31Decoding a CRC
- Procedure
- 1. Let n be the length of the checksummed message
in bits - 2. Divide the checksummed message by the code
polynomial using modulo 2 division. If the
remainer is zero, there is no error detected.
32Decoding a CRCExample
101101
Checksummed message (n 6)
1011
Original message (if there are
no errors)
Remainder 0 (No error detected)
33Decoding a CRCAnother Example
- When a bit error occurs, there is a large
probability that it will produce a polynomial
that is not an even multiple of the code
polynomial, and thus errors can usually be
detected.
Remainder 1 (Error detected)
34Choosing a CRC polynomial
- The longer the polynomial, the smaller the
probability of undetected error - Common standard polynomials
- (1) CRC-12 x12 x11 x3 x2 x1 1
- (2) CRC-16 x16 x15 x2 1
- (3) CRC-CCITT x16 x12 x5 1
35Access Protocols
- Who gets to use the channel next?
- Fixed/Static assignment
- Dynamic assignment
- Randomized/Probabilistic
- Turn-Based
36Fixed Assignment Protocols
- Static and predetermined allocation of channel
access independent of user activity - Idle users may be assigned to the channel, in
which case channel capacity is wasted - Examples TDMA, FDMA
37Channel Partitioning MAC protocols TDMA
- TDMA time division multiple access
- 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
38Channel Partitioning MAC protocols FDMA
- FDMA frequency division multiple access
- 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
time
frequency bands
39 Demand Assignment Protocols
- Allocate channel capacity to hosts on a demand
basis (i.e., only to active users) - Requires methods for measuring the demand for the
channel - Polling
- Reservation schemes
40Polling
- A central controller interrogates each host and
allocates channel capacity to those who need it - Good for systems with
- Short propagation delay
- Small polling messages
- Non-bursty traffic
41Reservation Schemes
- Hosts independently reserve the channel for
period of time - Reservations are usually piggybacked on data
messages passing along the channel - Good for systems with
- short propagation delay
- no central controller node
- non-bursty traffic
42Reservation Protocols (contd)
- Reservation protocol examples
- Bit-Map Protocol
- Binary Countdown Protocol
43Bit-Map Protocol
- Contention and data transmission periods
alternate - The contention period is divided into slots, with
1 bit-wide slots for each host in the network. - If a host wants to transmit a packet, it sets its
contention slot equal to 1. Otherwise, it sets
it to 0. - The slots pass all hosts in sequence, so every
host is aware of who will transmit
1
1
1
1
1
1
2
4
5
6
0
4
01234567
01234567
data frame
44Bit-Map Protocol (contd)
- But what if there are a large number of hosts in
the network? - The contention period will have to grow to
include them all - With a large number of hosts, the contention
period may be very long, leading to inefficiency
45 Binary Countdown Protocol
- During contention period,
- each host broadcasts its binary address one bit
at a time, starting with the most significant bit - bits transmitted simultaneously are boolean ORd
together - Arbitration rule
- If a host sent a zero bit but the boolean OR
results in a one bit, the host gives up and stops
sending address bits - Whichever host remains after the entire address
has been broadcast gets access to the medium
46Binary Countdown (contd)
Bit Time
Host Addresses
0 1 2 3
0 0 1 0
0 - - -
0 1 0 1
0 - - -
1 0 0 1
1 0 0 -
1 0 1 0
1 0 1 0
47Binary Countdown Fairness
- Stations with the highest addresses will always
win. - This is good if you want to implement priority,
but bad if you want to give all hosts fair access
to the channel - Used in CAN-bus networks (cars)
- Solution
- Change the address of a host after a successful
transmission
48Binary Countdown Permuting Addresses
- After host A successful transmission, all hosts
with addresses less than host A add one to their
address, improving their priority - Host A changes its address to zero, giving it the
lowest priority
49Contention Access Protocols
- Single channel shared by a large number of hosts
- No coordination between hosts
- Control is completely distributed
- Outcome is probabilistic
- Examples ALOHA, CSMA, CSMA/CD
50Contention Access (contd)
- Advantages
- Short delay for bursty traffic
- Simple (due to distributed control)
- Flexible to fluctuations in the number of hosts
- Fairness
51Contention Access (contd)
- Disadvantages
- Can not be certain who will acquire the
media/channel - Low channel efficiency with a large number of
hosts - Not good for continuous traffic (e.g., voice)
- Cannot support priority traffic
- High variance in transmission delays
52Contention Access Methods
- Pure ALOHA
- Slotted ALOHA
- CSMA
- 1-Persistent CSMA
- Non-Persistent CSMA
- P-Persistent CSMA
- CSMA/CD
53Slotted ALOHA
- Assumptions
- all frames same size
- time is divided into equal size slots, time to
transmit 1 frame - nodes start to transmit frames only at beginning
of slots - nodes are synchronized
- if 2 or more nodes transmit in slot, all nodes
detect collision
- Operation
- when node obtains fresh frame, it transmits in
next slot - no collision, node can send new frame in next
slot - if collision, node retransmits frame in each
subsequent slot with prob. p until success
54Slotted 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
55Slotted Aloha efficiency
- For max efficiency with N nodes, 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 1/e .37
Efficiency is the long-run fraction of
successful slots when there are many nodes, each
with many frames to send
- Suppose N nodes with many frames to send, each
transmits in slot with probability p - prob that node 1 has success in a slot
p(1-p)N-1 - prob that any node has a success Np(1-p)N-1
At best channel used for useful transmissions
37 of time!
56Pure (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 t0-1,t01
57Pure Aloha efficiency
- P(success by given node) P(node transmits) .
- P(no
other node transmits in p0-1,p0 . - P(no
other node transmits in p0-1,p0 - p .
(1-p)N-1 . (1-p)N-1 - p .
(1-p)2(N-1) - choosing optimum
p and then letting n -gt infty ... -
1/(2e) .18
Even worse !
58 Carrier Sense Multiple Access (CSMA)
- We could achieve better throughput if we could
listen to the channel before transmitting a
packet - This way, we would stop avoidable collisions.
- To do this, we need Carrier Sense Multiple
Access, or CSMA, protocols
59Assumptions with CSMA Networks
- 1. Constant length packets
- 2. No errors, except those caused by collisions
- 3. No capture effect
- 4. Each host can sense the transmissions of all
other hosts - 5. The propagation delay is small compared to the
transmission time
60CSMA collisions
spatial layout of nodes
collisions can still occur propagation delay
means two nodes may not hear each others
transmission
collision entire packet transmission time wasted
note role of distance propagation delay in
determining collision probability
61CSMA/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
62CSMA (contd)
- There are several types of CSMA protocols
- 1-Persistent CSMA
- Non-Persistent CSMA
- P-Persistent CSMA
631-Persistent CSMA
- Sense the channel.
- If busy, keep listening to the channel and
transmit immediately when the channel becomes
idle. - If idle, transmit a packet immediately.
- If collision occurs,
- Wait a random amount of time and start over again.
641-Persistent CSMA (contd)
- The protocol is called 1-persistent because the
host transmits with a probability of 1 whenever
it finds the channel idle.
65The Effect of Propagation Delayon CSMA
packet
A
B
carrier sense idle Transmit a packet Collision
66Propagation Delay and CSMA
- Contention (vulnerable) period in Pure ALOHA
- two packet transmission times
- Contention period in Slotted ALOHA
- one packet transmission time
- Contention period in CSMA
- up to 2 x end-to-end propagation delay
Performance of CSMA gt Performance of Slotted
ALOHA gt Performance of Pure ALOHA
671-Persistent CSMA (contd)
- Even if prop. delay is zero, there will be
collisions - Example
- If stations B and C become ready in the middle of
As transmission, B and C will wait until the end
of As transmission and then both will begin
transmitted simultaneously, resulting in a
collision. - If B and C were not so greedy, there would be
fewer collisions
68Non-Persistent CSMA
- Sense the channel.
- If busy, wait a random amount of time and sense
the channel again - If idle, transmit a packet immediately
- If collision occurs
- wait a random amount of time and start all over
again
69Tradeoff between 1- and Non-Persistent CSMA
- If B and C become ready in the middle of As
transmission, - 1-Persistent B and C collide
- Non-Persistent B and C probably do not collide
- If only B becomes ready in the middle of As
transmission, - 1-Persistent B succeeds as soon as A ends
- Non-Persistent B may have to wait
70 P-Persistent CSMA
- Optimal strategy use P-Persistent CSMA
- Assume channels are slotted
- One slot contention period (i.e., one round
trip propagation delay)
71P-Persistent CSMA (contd)
- 1. Sense the channel
- If channel is idle, transmit a packet with
probability p - if a packet was transmitted, go to step 2
- if a packet was not transmitted, wait one slot
and go to step 1 - If channel is busy, wait one slot and go to step
1. - 2. Detect collisions
- If a collision occurs, wait a random amount of
time and go to step 1
72P-Persistent CSMA (contd)
- Consider p-persistent CSMA with p0.5
- When a host senses an idle channel, it will only
send a packet with 50 probability - If it does not send, it tries again in the next
slot.
73Comparison of CSMA and ALOHA Protocols
(Number of Channel Contenders)
74 CSMA/CD
- In CSMA protocols
- If two stations begin transmitting at the same
time, each will transmit its complete packet,
thus wasting the channel for an entire packet
time - In CSMA/CD protocols
- The transmission is terminated immediately upon
the detection of a collision - CD Collision Detect
75CSMA/CD collision detection
76CSMA/CD
- Sense the channel
- If idle, transmit immediately
- If busy, wait until the channel becomes idle
- Collision detection
- Abort a transmission immediately if a collision
is detected - Try again later after waiting a random amount of
time
77CSMA/CD (contd)
- Carrier sense
- reduces the number of collisions
- Collision detection
- reduces the effect of collisions, making the
channel ready to use sooner
78Collision detection time
- How long does it take to realize there has been a
collision? - Worst case 2 x end-to-end prop. delay
packet
A
B
79 IEEE 802 LANs
- LAN Local Area Network
- What is a local area network?
- A LAN is a network that resides in a
geographically restricted area - LANs usually span a building or a campus
80Characteristics of LANs
- Short propagation delays
- Small number of users
- Single shared medium (usually)
- Inexpensive
81Common LANs
- Bus-based LANs
- Ethernet ()
- Token Bus ()
- Ring-based LANs
- Token Ring ()
- Switch-based LANs
- Switched Ethernet
- ATM LANs
() IEEE 802 LANs
82IEEE 802 Standards
- 802.1 Introduction
- 802.2 Logical Link Control (LLC)
- 802.3 CSMA/CD (Ethernet)
- 802.4 Token Bus
- 802.5 Token Ring
- 802.6 DQDB
- 802.11 CSMA/CA (Wireless LAN)
83IEEE 802 Standards (contd)
- 802 standards define
- Physical layer protocol
- Data link layer protocol
- Medium Access (MAC) Sublayer
- Logical Link Control (LLC) Sublayer
84OSI Layers and IEEE 802
IEEE 802 LAN standards
OSI layers
Higher Layers
Higher Layers
802.2 Logical Link Control 802.3 802.4 802.5 Medi
um Access Control
Data Link Layer
CSMA/CD Token-passing Token-passing bus
bus ring
Physical Layer
85IEEE 802 LANs (contd)
86Ethernet (CSMA/CD)
- IEEE 802.3 defines Ethernet
- Layers specified by 802.3
- Ethernet Physical Layer
- Ethernet Medium Access (MAC) Sublayer
87Ethernet (contd)
- Possible Topologies
- 1. Bus
- 2. Branching non-rooted tree for large Ethernets
88Minimal Bus Configuration
Coaxial Cable
Transceiver
Terminator
Transceiver Cable
Host
89Typical Large-Scale Configuration
Repeater
Host
Ethernet segment
90 Ethernet Physical Layer
- Transceiver
- Transceiver Cable
- 4 Twisted Pairs
- 15 Pin Connectors
- Channel Logic
- Manchester Phase Encoding
- 64-bit preamble for synchronization
91Ethernet Physical Configuration(for thick
coaxial cable)
- Segments of 500 meters maximum
- Maximum total cable length of 1500 meters between
any two transceivers - Maximum of 2 repeaters in any path
- Maximum of 100 transceivers per segment
- Transceivers placed only at 2.5 meter marks on
cable
92Manchester Encoding
1 0 1 1 0 0
Data stream Encoded bit pattern
- 1 bit high/low voltage signal
- 0 bit low/high voltage signal
93Manchester Encoding
1 1 1 1 1 1
Data stream Encoded bit pattern
- How to determine data from stuck-at fault?
- Continuous differential
94Ethernet Synchronization
- 64-bit frame preamble used to synchronize
reception - 7 bytes of 10101010 followed by a byte containing
10101011 - Manchester encoded, the preamble appears like a
sine wave
95Ethernet Cabling Options
- 10Base5 Thick Coax
- 10Base2 Thin Coax (cheapernet)
- 10Base-T Twisted Pair
- 10Base-F Fiber optic
- Each cabling option carries with it a different
set of physical layer constraints (e.g., max.
segment size, nodes/segment, etc.)
96 Ethernet MAC Layer
- Data encapsulation
- Frame Format
- Addressing
- Error Detection
- Link Management
- CSMA/CD
- Backoff Algorithm
97MAC Layer Ethernet Frame Format
Multicast bit
Destination (6 bytes)
Source (6 bytes)
Length (2 bytes)
Data (46-1500 bytes)
Pad
Frame Check Seq. (4 bytes)
98Ethernet MAC Frame Address Field
- Destination and Source Addresses
- 6 bytes each
- Two types of destination addresses
- Physical address Unique for each user
- Multicast address Group of users
- First bit of address determines which type of
address is being used - 0 physical address
- 1 multicast address
99Ethernet MAC FrameOther Fields
- Length Field
- 2 bytes in length
- determines length of data payload
- Data Field between 0 and 1500 bytes
- Pad Filled when Length lt 46
- Frame Check Sequence Field
- 4 bytes
- Cyclic Redundancy Check (CRC-32)
100CSMA/CD
- Recall
- CSMA/CD is a carrier sense protocol.
- If channel is idle, transmit immediately
- If busy, wait until the channel becomes idle
- CSMA/CD can detect collections.
- Abort transmission immediately if there is a
collision - Try again later according to a backoff algorithm
101CSMA/CD (contd)
- Carrier sense reduces the number of collisions
- Collision detection reduces the impact of
collisions
102CSMA/CD and Ethernet
- Ethernet
- Short end-to-end propagation delay
- Broadcast channel
- Ethernet access protocol
- 1-Persistent CSMA/CD
- with Binary Exponential Backoff Algorithm
103Ethernet Backoff AlgorithmBinary Exponential
Backoff
- If collision,
- Choose one slot randomly from 2k slots, where k
is the number of collisions the frame has
suffered. - One contention slot length 2 x end-to-end
propagation delay
This algorithm can adapt to changes in network
load.
104Binary Exponential Backoff (contd)
slot length 2 x end-to-end delay 50 ms
A
B
t0ms Assume A and B collide (kA kB
1) A, B choose randomly from 21 slots
0,1 Assume A chooses 1, B chooses
1 t100ms A and B collide (kA kB 2) A, B
choose randomly from 22 slots 0,3 Assume A
chooses 2, B chooses 0 t150ms B transmits
successfully t250ms A transmits successfully
105Binary Exponential Backoff (contd)
- In Ethernet,
- Binary exponential backoff will allow a maximum
of 15 retransmission attempts - If 16 backoffs occur, the transmission of the
frame is considered a failure.
1064.1.4 Ethernet Performance
107Ethernet Features and Advantages
- 1. Passive interface No active element
- 2. Broadcast All users can listen
- 3. Distributed control Each user makes own
decision
Simple Reliable Easy to reconfigure
108Ethernet Disadvantages
- Lack of priority levels
- Cannot perform real-time communication
- Security issues
109Hubs, Bridges, Switches, Routers
- Hub
- Behaves like Ethernet
- Bridge
- Supports multiple collision domains
- A collision domain is a segment
- Switch
- collision domains operate at pairwise level
- Router operates on level-3 packets
110Why Ethernet Switching?
- LANs may grow very large
- The switch has a very fast backplane
- It can forward frames very quickly to the
appropriate subnet - Cheaper than upgrading all host interfaces to use
a faster network
111Ethernet Switching
- Connect many Ethernet through an Ethernet
switch - Each Ethernet is a segment
- Make one large, logical segment
to segment 1
to segment 4
to segment 2
to segment 3
112Collision Domains
D
switch
A
B
E
A,B,C
D,E,F
F
C
Host
Z
Each segment runs a standard CMSA protocol
G
H
Ethernet Hub
113Layer-2 routing tables
D
switch
A
B
E
A,B,C
D,E,F
F
C
Host
Z
Switch must forward packets from A,B,C to the
other segment Switch builds a large table For
each packet, look up in table and maybe forward
the packet
G
H
Ethernet Hub
114Learning MAC addresses
D
switch
A
B
E
A,B,C
D,E,F
F
C
Host
Per-port routing table
Z
G
Switch adds hosts to routing table when it sees
a packet with a given source address
H
Ethernet segment
115Spanning Trees
- Want to allow multiple bridges and switches to
connect together - What If there is a cycle in the graph of switches
connected together? - Cant have packets circulate forever!
- Must break the cycle by restricting routes
116Spanning Trees
D
switches
A
B
E
1
2
F
C
Host
J
Z
G
H
k
3
117Spanning Trees
D
switches
A
B
E
1
2
F
C
Host
J
Z
G
H
k
3
no cycles in the graph of switches
118Spanning Tree Protocol
- Each switch periodically sends a configuration
message out of every port. A message contains
(ID of sender, ID of root, distance from sender
to root). - Initially, every switch claims to be root and
sends a distance field of 0. - A switch keeps sending the same message
(periodically) until it hears a better message. - Better means
- A root with a smaller ID
- A root with equal ID, but with shorter distance
- The root ID and distance are the same as we
already have, but the sending bridge has a
smaller ID. - When a switch hears a better configuration
message, it stops generating its own messages,
and just forwards ones that it receives (adding 1
to the distance). - If the switch realizes that it is not the
designated bridge for a segment, it stops sending
configuration messages to that segment. - Eventually
- Only the root switch generates configuration
messages, - Other switches send configuration messages to
segments for which they are the designated switch
119Bridges vs. Switches
- A bridge connects networks at layer 2
- Work to make a single logical layer 2 address
- Some bridges can connect different 802.X network
types - E.g. Ethernet to Token ring
120Token Ring
- IEEE 802.5 Standard
- Layers specified by 802.5
- Token Ring Physical Layer
- Token Ring MAC Sublayer
121Token Ring (contd)
- Token Ring, unlike Ethernet, requires an active
interface
Host
Ring interface
122Token Ring Physical Layer
- Ring Interfaces
- Listen and Transmit Modes
- Channel Logic
- Differential Manchester Encoding
123Token Ring Interface Modes
Listen Mode
Transmit Mode
one-bit delay
To station
From station
To station
From station
124Differential Manchester Encoding
1 0 0 1 1
- Transitions take place at midpoint of interval
- 1 bit the initial half of the bit interval
carries the same polarity as the second half of
the previous interval - 0 bit a transition takes place at both the
beginning and the middle of the bit interval
125Token Ring MAC Sublayer
- Token passing protocol
- Frame format
- Token format
126Token Passing Protocol
- A token (8 bit pattern) circulates around the
ring - Token state
- Busy 11111111
- Idle 11111110
127Token Passing Protocol (contd)
- General Procedure
- Sending host waits for and captures an idle token
- Sending host changes the token to a frame and
circulates it - Receiving host accepts the frame and continues to
circulate it - Sending host receives its frame, removes it from
the ring, and generates an idle token which it
then circulates on the ring
128Token Ring Frame and Token Formats
1 1 1
Bytes
SD
AC
ED
Token Format
1 1 1 2/6 2/6
unlimited 4 1 1
SC
AC
FC
Destination Address
Source Address
Data
Checksum
ED
FS
Frame Format
129Token Ring Delimiters
SD
AC
ED
SC
AC
FC
Destination Address
Source Address
Data
Checksum
ED
FS
- SD Starting Delimiter
- ED Ending Delimiter
- They contains invalid differential Manchester
codes
130Token Ring Access Control Field
SD
AC
ED
(Note The AC field is also used in frames)
P P P T M R R R
- P Priority bits
- provides up to 8 levels of priority when
accessing the ring - T Token bit
- T0 Token
- T1 Frame
131Token Ring Access Control Field (contd)
SD
AC
ED
P P P T M R R R
- M Monitor Bit
- Prevents tokens and frames from circulating
indefinitely - All frames and tokens are issued with M0
- On passing through the monitor station, M is
set to 1 - All other stations repeat this bit as set
- A token or frame that reaches the monitor station
with M1 is considered invalid and is purged
132Token Ring Access Control Fields (contd)
SD
AC
ED
P P P T M R R R
- R Reservation Bits
- Allows stations with high priority data to
request (in frames and tokens as they are
repeated) that the next token be issued at the
requested priority
133Token Ring Frame Control Field
SC
AC
FC
Destination Address
Source Address
Data
Checksum
ED
FS
- FC Frame Control Field
- Defines the type of frame being sent
- Frames may be either data frames or some type of
control frame. Example control frames - Beacon Used to locate breaks in the ring
- Duplicate address test Used to test if two
stations have the same address
134Token Ring Address Data Fields
SC
AC
FC
Destination Address
Source Address
Data
Checksum
ED
FS
- Address Fields
- Indicate the source and destination hosts
- Broadcast
- Set all destination address bits to 1s.
- Data
- No fixed limit on length
- Caveat Hosts may only hold the token for a
limited amount of time (10 msec)
135Token Ring Checksum and Frame Status
SC
AC
FC
Destination Address
Source Address
Data
Checksum
ED
FS
- Checksum 32-bit CRC
- FS Frame Status
- Contains two bits, A and C
- When the message arrives at the destination, it
sets A1 - When the destination copies the data in the
message, it sets C1
136The Token Ring Monitor Station
- One station on the ring is designated as the
monitor station - The monitor station
- marks the M bit in frames and tokens
- removes marked frames and tokens from the ring
- watches for missing tokens and generates new ones
after a timeout period
137Using Priority in Token Ring
- If a host wants to send data of priority n, it
may only grab a token with priority value n or
lower. - A host may reserve a token of priority n by
marking the reservation bits in the AC field of a
passing token or frame - Caveat The host may not make the reservation if
the token or frames AC field already indicates a
higher priority reservation - The next token generated will have a priority
equal to the highest reserved priority
138Priority Transmission Example
B
A
C
D
Host B has 1 frame of priority 3 to send to
A Host C has 1 frame of priority 2 to send to
A Host D has 1 frame of priority 4 to send to
A Token starts at host A with priority 0 and
circulates clockwise Host C is the monitor
station
139Example (contd)
Event Token/Frame AC Field A
generates a token P0, M0, T0, R0 B
grabs the token and sets the message destination
to A P3, M0, T1, R0 Frame arrives at C,
and C reserves priority level 2. Monitor bit
set. P3, M1, T1, R2 Frame arrives at D,
and D attempts to reserve priority level 4 P3,
M1, T1, R4 Frame arrives at A, and A copies
it P3, M1, T1, R4 Frame returns to B, so B
removes it, and generates a new token P4, M0,
T0, R0 Token arrives at C, but its priority
is too high. C reserves priority 2. M bit. P4,
M1, T0, R2
140Example (contd)
- Event Token/Frame AC Field
- Token arrives at D, and D grabs
- it, sending a message to A P4, M0, T1, R2
- Frame arrives at A, and A
- copies it P4, M0, T1, R2
- Frame arrives at B, which does
- nothing to it P4, M0, T1, R2
- Frame arrives at C, which sets the
- monitor bit P4, M1, T1, R2
- Frame returns to D, so D removes
- it and generates a new token with P2 P2, M0,
T0, R0 - etc Attempt to complete this scenario on your
own.