Download Sharing a Wire in Computer Networking and more Lecture notes Local Area Network (LAN) in PDF only on Docsity!
15-441 Computer Networking
Lecture 7 - Ethernet
Computer Networks
Problem: Sharing a Wire
… But what if we want more hosts?
! Expensive! How can we share a wire?
Switches
Wires for everybody!
Learned how to connect hosts
Listen and Talk
! Natural scheme – listen before you talk…
»Works well in practice
yak yak…
Listen and Talk
! Natural scheme – listen before you talk…
»Works well in practice
yada yada…
Listen and Talk
Natural scheme – listen before you talk…
»Works well in practice
! But sometimes this breaks down
»Why? How do we fix/prevent this?
yada
yada…
yak yak…
Problem: Who is this packet for?
Need to put an address on the packet
! What should it look like?
! How do you determine your own address?
! How do you know what address you want to send it
to?
Outline
! Aloha
Ethernet MAC
Collisions
! Ethernet Frames
Random Access Protocols
When node has packet to send
» Transmit at full channel data rate R
» No a priori coordination among nodes
Two or more transmitting nodes! “collision”
! Random access MAC protocol specifies:
» How to detect collisions
» How to recover from collisions (e.g., via delayed
retransmissions)
! Examples of random access MAC protocols:
» Slotted ALOHA and ALOHA
» CSMA and CSMA/CD
Ethernet
! First practical local area network, built at
Xerox PARC in 70’s
“Dominant” LAN technology:
» Cheap
» Kept up with speed race: 10, 100, 1000 Mbps
Metcalfe’s Ethernet
sketch
Ethernet MAC – Carrier Sense
Basic idea:
» Listen to wire before
transmission
» Avoid collision with
active transmission
! Why didn’t ALOHA
have this?
» In wireless, relevant
contention at the
receiver, not sender
- Hidden terminal
- Exposed terminal
NY
CMU
Chicago
St.Louis
Chicago
CMU
NY
Hidden Exposed
Ethernet MAC – Collision
Detection
! But: ALOHA has collision detection also?
» That was very slow and inefficient
! Basic idea:
» Listen while transmitting
» If you notice interference! assume collision
! Why didn’t ALOHA have this?
» Very difficult for radios to listen and transmit
» Signal strength is reduced by distance for radio
- Much easier to hear “local, powerful” radio station
than one in NY
- You may not notice any “interference”
Ethernet MAC (CSMA/CD)
Packet?
Sense
Carrier
Discard
Packet
Send
Detect
Collision
Jam channel
b=CalcBackoff();
wait(b);
attempts++;
No
Yes
attempts < 16
attempts == 16
Carrier Sense Multiple Access/Collision
Detection
Ethernet CSMA/CD:
Making it word
Jam Signal: make sure all other transmitters
are aware of collision; 48 bits;
Exponential Backoff:
! If deterministic delay after collision,
collision will occur again in lockstep
! Why not random delay with fixed mean?
» Few senders! needless waiting
» Too many senders! too many collisions
Goal : adapt retransmission attempts to
estimated current load
» heavy load: random wait will be longer
Ethernet Backoff Calculation
! Exponentially increasing random delay
»Infer senders from # of collisions
»More senders! increase wait time
First collision: choose K from {0,1}; delay is K
x 512 bit transmission times
! After second collision: choose K from
After ten or more collisions, choose K from
Outline
! Aloha
Ethernet MAC
Collisions
! Ethernet Frames
Collisions
Time
A B C
10BaseT and 100BaseT
10/100 Mbps rate; latter called “fast ethernet”
T stands for Twisted Pair (wiring)
! Minimum packet size requirement
» Make network smaller! solution for 100BaseT
Gbit Ethernet
! Minimum packet size requirement
» Make network smaller?
- 512bits @ 1Gbps = 512ns
- 512ns * 1.8 * 10^8 = 92meters = too small !!
» Make min pkt size larger!
- Gigabit Ethernet uses collision extension for small pkts
and backward compatibility
! Maximum packet size requirement
» 1500 bytes is not really “hogging” the network
» Defines “jumbo frames” (9000 bytes) for higher
efficiency
Outline
! Aloha
Ethernet MAC
Collisions
! Ethernet Frames
Ethernet Frame Structure
! Sending adapter encapsulates IP datagram (or other
network layer protocol packet) in Ethernet frame
Ethernet Frame Structure (cont.)
! Preamble: 8 bytes
»Used to synchronize receiver, sender
clock rates
! CRC: 4 bytes
»Checked at receiver, if error is
detected, the frame is simply
dropped
Ethernet Frame Structure (cont.)
! Each protocol layer needs to provide
some hooks to upper layer protocols
» Demultiplexing: identify which upper layer
protocol packet belongs to
» E.g., port numbers allow TCP/UDP to identify
target application
» Ethernet uses Type field
! Type: 2 bytes
» Indicates the higher layer protocol, mostly
IP but others may be supported such as
Novell IPX and AppleTalk)
Addressing Alternatives
Broadcast! all nodes receive all packets
» Addressing determines which packets are kept and
which are packets are thrown away
» Packets can be sent to:
- Unicast – one destination
- Multicast – group of nodes (e.g. “everyone playing Quake”)
- Broadcast – everybody on wire
Dynamic addresses (e.g. Appletalk)
» Pick an address at random
» Broadcast “is anyone using address XX?”
» If yes, repeat
! Static address (e.g. Ethernet)
Ethernet Frame Structure (cont.)
! Addresses: 6 bytes
» Each adapter is given a globally unique
address at manufacturing time
- Address space is allocated to manufacturers
! (^) 24 bits identify manufacturer
! (^) E.g., 0:0:15:*! 3com adapter
- Frame is received by all adapters on a LAN and
dropped if address does not match
» Special addresses
- Broadcast – FF:FF:FF:FF:FF:FF is “everybody”
- Range of addresses allocated to multicast
! (^) Adapter maintains list of multicast groups node is
interested in
From Signals to Packets
Analog Signal
“Digital” Signal
Bit Stream^0 0 1 0 1 1 1 0 0 0
Packets
0100010101011100101010101011101110000001111010101110101010101101011010111001
Header/Body Header/Body (^) Header/Body
Sender Receiver
Packet
Transmission
Datalink Functions
Framing: encapsulating a network layer
datagram into a bit stream.
» Add header, mark and detect frame boundaries, …
Media access: controlling which frame should
be sent over the link next.
» Easy for point-to-point links; half versus full duplex
» Harder for multi-access links: who gets to send?
! Error control: error detection and correction
to deal with bit errors.
» May also include other reliability support, e.g.
retransmission
Flow control: avoid that the sender outruns
the receiver.
Datalink Lectures
Framing and error coding.
! Datalink architectures.
! Switch-based networks.
» Packet forwarding
» Flow and error control
Taking turn protocols.
! Contention-based networks: basic Ethernet.
! Ethernet bridging and switching.
! Connectivity to the home.
Circuit-based communication
Framing
! A link layer function, defining which bits have
which function.
Minimal functionality: mark the beginning and
end of packets (or frames).
! Some techniques:
» out of band delimiters (e.g. FDDI 4B/5B control symbols)
» frame delimiter characters with character stuffing
» frame delimiter codes with bit stuffing
» synchronous transmission (e.g. SONET)
Character and Bit Stuffing
Mark frames with special character.
» What happens when the user sends this character?
» Use escape character when controls appear in data:
abcdef -> *abc*def
» Very common on serial lines, in editors, etc.
! Mark frames with special bit sequence
» must ensure data containing this sequence can be
transmitted
» example: suppose 11111111 is a special sequence.
» transmitter inserts a 0 when this appears in the data:
» must stuff a zero any time seven 1s appear:
» receiver unstuffs.
Example: Ethernet Framing
Preamble is 7 bytes of 10101010 (5 MHz
square wave) followed by one byte of
Allows receivers to recognize start of
transmission after idle channel
preamble datagram length more stuff
SONET
! SONET is the Synchronous Optical Network
standard for data transport over optical fiber.
One of the design goals was to be backwards
compatible with many older telco standards.
! Beside minimal framing functionality, it
provides many other functions:
» operation, administration and maintenance (OAM)
communications
» synchronization
» multiplexing of lower rate signals
» multiplexing for higher rates
Standardization History
! Process was started by divestiture in 1984.
» Multiple telephone companies building their own
infrastructure
! SONET concepts originally developed by
Bellcore.
First standardized by ANSI T1X1 group for the
US.
! Later picked up by CCITT and developed its
own version.
! SONET/SDH standards approved in 1988.
How Do We Support
Higher Rates?
! Send multiple frames in a 125
μsec time slot.
! The properties of a channel
using a single byte/ST-
frame are maintained!
» Constant 64 Kbit/second rate
» Nice spacing of the byte samples
! Rates typically go up by a
factor of 4.
! Two ways of doing
interleaving.
» Frame interleaving
» Column interleaving
- concatenated version, i.e.
OC-3c
μ sec
μ sec
μ sec
The SONET Signal Hierarchy
Signal Type
OC-
line rate # of DS
51.84 Mbs 672
OC-3 155 Mbs 2,
OC-12 622 Mbs 8,
STS-48 2.49 Gbs 32,
STS-192 9.95 Gbs 129,
STS-768 39.8 Gbs 516,
DS0 (POTS) 64 Kbs 1
DS1 1.544 Mbs 24
STS-1 carries DS3 44.736 Mbs 672
one DS-3 plus
overhead
Using SONET in Networks
mux
mux
mux
DS
OC-3c
OC-12c
OC-
Add-drop capability allows soft configuration of networks,
usually managed manually.
Self-Healing SONET Rings
mux mux
mux
DS
OC-3c
OC-12c
OC-
mux
SONET as Physical Layer
OC3/
Access
OC3/
Access
OC12/
Metro
OC3/
Access
OC3/
Access
OC12/
Metro
OC3/
Access
WDM Backbone
OC48/
OC12/
Metro
OC3/
Access
OC3/
Access
POP
POP POP
CO CO
CO
CO
CO
CO
CO
Error Coding
! Transmission process may introduce errors
into a message.
» Single bit errors versus burst errors
! Detection:
» Requires a convention that some messages are invalid
» Hence requires extra bits
» An (n,k) code has codewords of n bits with k data bits
and r = (n-k) redundant check bits
Correction
» Forward error correction: many related code words map
to the same data word
» Detect errors and retry transmission
Basic Concept:
Hamming Distance
! Hamming distance of two
bit strings = number of bit
positions in which they
differ.
! If the valid words of a code
have minimum Hamming
distance D, then D-1 bit
errors can be detected.
! If the valid words of a code
have minimum Hamming
distance D, then [(D-1)/2] bit
errors can be corrected.
HD=
HD=
Examples
! A (4,3) parity code has D=2:
(last bit is binary sum of previous 3, inverted - “odd parity”)
! A (7,4) code with D=3 (2ED, 1EC):
! 1001111 corrects to 1001011
! Note the inherent risk in correction; consider
a 2-bit error resulting in 1001011 -> 1111011.
There are formulas to calculate the number of
extra bits that are needed for a certain D.
Switching Introduction
! Idea: forward units of data based on address in
header.
! Many data-link technologies use switching.
» Virtual circuits: Frame Relay, ATM, X.25, ..
» Packets: Ethernet, MPLS, …
“Switching” also happens at the network layer.
» Layer 3: Internet protocol
» In this case, address is an IP address
» IP over SONET, IP over ATM, ..
» Otherwise, operation is very similar
! Switching is different from SONET mux/demux.
» SONET channels statically configured - no addresses
An Inter-network
Ethernet
ATM
Framerelay
IP/SONET
Ethernet
Ethernet
802.X
Wireless
Host
Host
Host
Host
Host
Host
Host
Host Host
Host
Host
Host
Host Host
Host
3 3
7
6
5
7
6
5
7
6
5
7
6
5
7
6
5
7
6
5
7
6
5
7
6
5
Internetworking Options
4
3
2
1
4
3
2
1 1
4
3
2
1
4
3
2
1
2
1 1
4
3
2
1
4
3
2
1
3
repeater Switching/bridging
(e.g. 802 MAC)
router
physical
data link
network 4
3
2
1
4
3
2
1
2 2
gateway
2 2
1 1 1 1
Switch Architecture
! Takes in packets in one
interface and has to forward
them to an output interface
based on the address.
» A big intersection
» Same idea for bridges, switches, routers: address look up differs
! Control processor manages
the switch and executes
higher level protocols.
» E.g. routing, management, ..
!
The switch fabric directs the
traffic to the right output port.
! The input and output ports
deal with transmission and
reception of packets.
Switch
Fabric
Input
Port
Output
Port
Output
Port
Input
Port
Output
Port
Input
Port
Output
Port
Input
Port
Control
Processor
Packet Forwarding:
Address Lookup
! (^) Address from header.
» Absolute address (e.g. Ethernet)
» (IP address for routers)
» (VC identifier, e.g. ATM))
! (^) Next hop: output port for packet.
! (^) Info: priority, VC id, ..
! (^) Table is filled in by routing protocol.
B
Switch
38913C3C
A21023C90590 0
Address Next Hop
Info
Link Flow Control and
Error Control
! Naïve protocol.
! Dealing with receiver overflow: flow control.
! Dealing with packet loss and corruption: error control.
! Meta-comment: these issues are relevant at many
layers.
» Link layer: sender and receiver attached to the same “wire”
» End-to-end: transmission control protocol (TCP) - sender and
receiver are the end points of a connection
! How can we implement flow control?
» “You may send” (windows, stop-and-wait, etc.)
» “Please shut up” (source quench, 802.3x pause frames, etc.)
» Where are each of these appropriate?
A Naïve Protocol
! Sender simply sends to the receiver whenever it has
packets.
! Potential problem: sender can outrun the receiver.
» Receiver too slow, buffer overflow, ..
! Not always a problem: receiver might be fast enough.
Sender Receiver
Adding Flow Control
! Stop and wait flow control: sender waits to send the
next packet until the previous packet has been
acknowledged by the receiver.
» Receiver can pace the receiver
! Drawbacks: adds overheads, slowdown for long links.
Sender Receiver
Datalink Layer Architectures
! Packet forwarding.
! Error and flow control.
! Media access
control.
Scalability.
Datalink Classification
Datalink
Switch-based Multiple Access
Random
Access
Scheduled
Access
Packet
Switching
Virtual
Circuits
ATM,
framerelay
Ethernet,
802.11, Aloha
Token ring,
FDDI, 802.
Bridged
LANs
Multiple Access Protocols
! 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
! Several classes of multiple access protocols.
» Partitioning the channel, e.g. frequency-division or time
division multiplexing
- With fixed partitioning of bandwidth –
- Not flexible; inefficient for bursty traffic
» Taking turns, e.g. token-based, reservation-based
protocols, polling based
» Contention based protocols, e.g. Aloha, Ethernet
Fiber Distributed Data Interface
(FDDI)
! One token holder may send,
with a time limit
» Provides known upper bound on
delay.
Optical version of 802.5 token
ring, but multiple packets may
travel in train: token released
at end of frame
! 100 Mbps, 100km
! Optional dual ring for fault
tolerance
! Concerns:
» Token overhead
» Latency
» Single point of failure
Other “Taking Turn”
Protocols
! Central entity polls stations, inviting them to
transmit
» Simple design – no conflicts
» Not very efficient – overhead of polling operation
» Example: the “Point Control Function” mode for 802.
! Stations reserve a slot for transmission.
» For example, break up the transmission time in
contention-based and reservation based slots
- Contention based slots can be used for short
messages or to reserve time slots
- Communication in reservation based slots only
allowed after a reservation is made
» Issues: fairness, efficiency
Lecture 7: 9-19-06 87 78
MAC Protocols - Discussion
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!
! “Taking turns” protocols
» More flexible bandwidth allocation, but
» Protocol can introduce unnecessary
overhead and access delay at low load
Random access MAC protocols (next lecture)
» Efficient at low load: single node can fully
utilize channel
» High load: collision overhead