Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Layer 2 Protocols

CSCI 363 Computer Networks


Department of Computer Science
Ethernet

Ethernet (IEEE 802.3) Physical Properties


Repeater: Amplifies and forwards
!!!
electric signals. No more than 4
!!!
between any two hosts determines a
maximum reach of 2500m.
!!!

Terminators: Placed at the end of a


!!!
segment to avoid signals from bouncing
Repeater Host back.
Created in 1978 by DEC, Cable: Coax, up to 500m.
Medium: Broadcast.
Intel, and Xerox. Later Taps: At least 2.5m apart. Since the medium is
standardized by the IEEE. shared, all hosts compete Maximum number of hosts:
“Versions”: 10Mbps, Transceiver: Detect idle for the same link, what 1024.
100Mbps (fast Ethernet), line, drive signal on TX, creates the possibility of
1000Mbps (Gigabit receive signal on RX. collisions.
Ethernet).

Frames and Addresses Transmitter Algorithm


The algorithm on the receiver’s end is simple; the complexity
Ethernet frame:
of medium access control (MAC) lies on the sender’s side.
Encoding: Manchester. Sender has frame to Sender has frame to
Framing: Bit-oriented. transmit. transmit.
Sender listens to the Sender listens to the
Addresses: Unique to each adaptor, 48-bit long assigned medium. medium.
by manufacturer. Written as: 8:0:2:b:e4:b:1:2 (MAC If line is busy, wait until free. If line is busy, wait until free.
address). First 24 bits indicate manufacturer. Transmit frame immediately. Transmit frame immediately
When a frame is put on the wire, it is received by all hosts. 1-persistent protocol with probability p, defer to
A host picks up only the frames addressed to itself unless it another host with
is in promiscuous mode. Broadcast address: all bits 1. probability q=1-p.
Multicast address: first bit 1, but not all. The adaptor only p-persistent protocol
passes to hosts the frames it accepts.
Carrier Sense Multiple Access with
Collision Detection (CSMA/CD)
Frame Collisions
Host A listens and
When a host detects a collision, it
finds the bus idle. first transmits a 32-bit jamming
sequence and then stops the
Host A starts TX.
transmission. The shortest
Host B starts TX. transmission in the event of a
Host A detects
collision.
Host A backs off. Host B completes TX. collision is a 96-bit runt frame: 64
bits of preamble plus 32 bits. This
COLLISION!
only happens if the two hosts are
Host B backs off.
close together. When they are
farther apart as many as 512 bits
time may be necessary. Ethernet’s
Host B detects Host B listens and
shortest frame size is chosen to
Host B listens and
finds the bus idle.
Host B starts TX. collision. finds the bus idle. be 512 bits…

Concepts in Radio Communications


Coverage = f(PowerTX)

D
Wireless A
E

B
Interference

Multipath C
Noise
9

Types of Wireless Networks Remember Ethernet?


Fixed Infrastructure: Access Points The problems get worse…
wired backbone
Assume that all wireless devices use the same channel. Arbitration of
access to the medium (Medium Access Control, or MAC, a protocol in
AP AP AP the Data Link layer) is similar to Ethernet’s CSMA/CD.

Most radios in wireless networking can’t transmit and receive at the same
time, so we can’t detect collisions. Instead, we’ll do CSMA/CA
(collision avoidance).
Ad Hoc Collisions are bad because they reduce the effective bandwidth and also
• Easy to deploy. because they cause waste of battery power.
• Good in changing environments.
• Allows for node mobility. Even when two transmissions do not collide, they may still interfere with
• Can be designed for self-configurability. each other causing bit error rates to rise.
• Can be designed for scalability.
The Hidden Node Problem The Hidden Node Problem
Station C can sense stations A and B. Station C can sense stations A and B.
Stations A and C can’t sense each other. Stations A and C can’t sense each other.
• Problem: coordinate transmissions from A and C so as to avoid collisions. • Problem: coordinate transmissions from A and C so as to avoid collisions.

A B C A B C

• Solution: RTS/CTS/DATA/ACK handshake – A sends RTS


to B, B sends CTS to A, C hears CTS and stays quiet, A sends DATA
to B, B replies to A with an ACK.

The Exposed Node Data Link Layer: Medium Access Control


Problem (Coordinated access to a shared resource)

• Power is a scarce resource; so is the RF


A B C D spectrum.

• Collisions lead to wasted battery power and


wasted spectrum.
An exposed node is one that is in range of the transmitter, but outside range of
the receiver. • Need to impose some kind of access
Question: What performance metric is affect by the exposed node problem? discipline so as to avoid collisions.

The MAC Layer Challenge


IEEE 802.11 DCF (CSMA/CA)
start

NAV starts with the Duration field


Maximize throughput: NO value of the last transmission sensed
NAV=0 on the medium and counts down to
– Minimize collisions.
zero.
– Avoid exposed nodes. YES
Sense
An interesting alternative: Medium

– Impose a schedule for medium access.


Random
– Related challenges: Medium NO
Backoff
Idle
• Clock synchronization. Time
• Distributed coordination for constructing the schedule on the YES
fly. Transmit
Frame

YES
Collision?

NO
18
Properties
• The ring is a single, shared medium,
not point to point links in a loop.
• All nodes see all frames.

Token Ring (IEEE 802.5, FDDI) • A distributed algorithm determines


when a node can transmit.
• Data always flows in one direction.
Basic idea: A token circulates around the ring. When a
host has a frame to transmit, it seizes the token and injects
the frame on the medium. The frame is forwarded by
intermediate nodes until arriving at the destination. The
destination puts the frame back after receiving it, but with a
“special mark”. The frame circulates back to the sender.
19

Physical Properties Medium Access Control (MAC)


Question: What happens if a node on the ring fails? network adaptor
Each host holds part of the token (1 bit).
data A designated monitor host may hold
As long as a node provides power TX storage RX more bits than others.
to the relay, the relay stays open.
When the node fails, the relay
closes bypassing the node.
As the token circulates around the ring, a host needing to send data
Multi-Station Access Unit: Several relays drains it off the ring. Each TXed frame contains the receiver’s
packaged together. Multiple MSAUs can be plugged address. Frames are not removed from the ring: they flow through
together to make a larger network. the NIC and the receiver copies it into a buffer. When the frame
Typical token ring data rates go from 4 Mbps gets back to where it started, the sender drains it off the ring.
to 16 Mbps. Number of stations can be as
high as 260. Question: How long should a host hold the token?
04/25/2012 CSCI 363 Computer Networks 21 04/25/2012 CSCI 363 Computer Networks 22

MAC Performance Token Ring Maintenance


Token holding time (THT): How Monitor host: Ensure the “health” of the ring. Periodically announces it’s
long a node is allowed to hold presence; when it fails, another host assumes the role.
the token (indirectly, how much Becoming the monitor: Host circulates special token, if it comes back, it
data a node can transmit). can assume the role of monitor. What if more than one node wants to
become monitor?
Token rotation time (TRT): The
amount of time a token takes to Question: What can cause a token to disappear in a ring?
traverse the ring. Detecting a missing token: Watch for a passing token, count maximum
Early release: Delayed release: rotation time (MRT).
Ring latency: Time for the token to token goes back token goes back
circulate around the whole ring out following after frame has
when no host has data to send. frame. gone around and
been removed. Question: What else should the monitor to do?

Detect and drain corrupted and orphaned frames.


Detect dead hosts: send beacon frame to suspected
failed host, see how far it goes in the ring.
04/25/2012 CSCI 363 Computer Networks 23 04/25/2012 CSCI 363 Computer Networks 24
Basic Features

Network Adaptors
Control and status: Interrupts, DMA, and PIO:
No carrier, missed incoming Why use interrupts with a network
packet, interrupt enable, received adaptor?
packet interrupt, transmitter packet
How does Direct Memory Access
interrupt, memory error, no carrier,
work?
initialization done, RX on, TX on,
start, stop, initialize. How does Programmed I/O work?

04/25/2012 CSCI 363 Computer Networks 25 04/25/2012 CSCI 363 Computer Networks 26

Scatter-read and Gather-write Device Drivers and Memory


Discussion:
Why do we write device
drivers?
What is the relationship
between hardware and device
driver?
Organization of a frame and Discussion:
Scatter-read: separate incoming
the several protocol headers it frames are put in separate buffers, but What is the relationship What can you say about the
contains in addition to a a single frame may be scattered between operating system and performance of the combined
message’s data across multiple buffers. device driver? computer system and
Gather-write: an outgoing frame is networking hardware?
built piece-by-piece by each protocol
layer attaching its header/trailer.
04/25/2012 CSCI 363 Computer Networks 27 04/25/2012 CSCI 363 Computer Networks 28

You might also like