56
Layer 2

Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

Embed Size (px)

Citation preview

Page 1: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

Layer 2

Page 2: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

Datalink / Media Access

• This layer is responsible for allowing the devices to access the media.

• Creates connections between devices• If more than one device on the physical link:

– Requires some kind of address– MAC Address, Ethernet– DLCI, Frame Relay– VPI/VCI, ATM– LABEL, MPLS

Page 3: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

Simplest case

• Point to Point link• HDLC – High level data link control • The physical might be T1, FiberChannel, SONET

…• Note the layer 2 data technologies CO-EXIST on

Layer 1 technologies:– Ethernet often runs over a T1 line.– PPP over RS232– Etc.

Page 4: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

Bit oriented (Peterson)

• HDLC, High-Level Data Link Control – Standardized version of SDLC (IBM)

• Also uses the 0x7E control sequence to delineate beginning and end of frames– If 0x7E appears in the body of the message, special provisions

must be made via an “escape sequence”

Page 5: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

Byte Oriented• PPP, Point to Point Protocol

– Follow on from SLIP– Simple method of placing IP in Layer2– Byte oriented– Protocol field determines what’s in the payload.

• Byte oriented means the frame frame contains an integer number of bytes.

• LCP/NCP are sister protocols used for setting up PPP session– Negotiate Frame size, IP address, etc.

Page 6: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

PPP Frame Format (TCP/IP, Stevens)

Page 7: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

Typical layer 2 requirements

• CRC Cylical Redundancy Check – Checks to make sure there are no errors in the frame.

• May include FEC Forward Error Correction – Can detect and correct effort

• Flag telling which Layer 3 protocol should process the frame– Ethernet can carry several protocols simultaneously (IP,

IPX, NetBEUI, etc)

• Sequence numbers– So frames can be ordered and missing ones resent

Page 8: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

CRC vs. FEC

• Simple parity case is similar to (CRC)– 00,01,10,11 possible patterns to be sent

– 000, 011,101,110 actually sent (bit 3 is parity)

– If receiver sees 111, it knows there’s a problem

• Error correction codes are more complicated– When problem is seen, error can be used to determine

proper sequence that was sent

– Will be discussed later this course

Page 9: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

From: Peterson and Davie

If ACK not received in time, frame is retransmitted.

Page 10: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

Flow control

• Need to make sure packets are getting to where they are being sent.

• General concepts:– If message gets there, send another message– If they are getting lost, try again– If trying again and again doesn’t solve the problem

• Give up and notify upper protocol layer

• Continuing to dump duplicate messages degrades the network performance dramatically.– Most protocols “time-out”

Page 11: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

Data

Ack

Ack

Data

tframe

tprop

=tprop

tframe

=Distance/Speed of Signal

Frame size /Bit rate

=Distance Bit rate

Frame size Speed of Signal

=1

2 + 1

U=2tprop+tframe

tframe

U

Light in vacuum = 300 m/sLight in fiber = 200 m/sElectricity = 250 m/s

Stop and wait flow control

Page 12: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

Data

Ack

tframe

tprop

U=Ntframe

2tprop+tframe

=

N

2+1

1 if N>2+1

Window based flow control

Page 13: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

Sharing a Medium

Page 14: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

Pure ALOHA

In pure ALOHA, frames are transmitted at completely arbitrary times.

Page 15: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

Pure ALOHA (2)

Vulnerable period for the shaded frame.

Page 16: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

Pure ALOHA (3)

Throughput versus offered traffic for ALOHA systems.

Best case 18% utilization pure Aloha, 36.8% for slotted Aloha.

Slotted requires a clock source, only transmit at frame boundaries

Page 17: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

Protocols that listen before transmitting

• Station listens to network, if busy– Wait till net available then transmit: if collision then,

• Back off for some time then send again if channel available.

• If the stations always retransmits when the network becomes available– CSMA 1 persistant

• If the station gradually becomes less aggressive about siezing the network when it’s busy:– CSMA nonpersistent

• If the station attempts to retransmit with some probability p less than 1– CSMA p-persistent

Page 18: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

Persistent and Nonpersistent CSMA

Comparison of the channel utilization versus load for various random access protocols.

Page 19: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

CSMA with Collision Detection

CSMA/CD can be in one of three states: contention, transmission, or idle.

Page 20: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

Collision-Free Protocols

• The basic bit-map protocol.– Station asserts the bit in it’s slot if it wants to

transmit. – Stations then transmit in turn.– Reservation based, no chance of collision

Page 21: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

Collision-Free Protocols (2)

• Binary countdown protocol

• More efficient than bit-map protocol– Bits in the stations

addresses determine when they access the channel

– Reduces overhead compared to bit-map

Page 22: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

Limited-Contention ProtocolsAcquisition probability for a symmetric contention

channel.

Page 23: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

Ethernet overview

Page 24: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

Channel Capacity (C)• Bandwidth, Bit Rate, SNR, and BER related

• Channel Capacity defines relationship C = Maximum reliable bit rate C = W*Log2(1 + SNR) bps

Bandwidth sets the maximum Baud rate

Page 25: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

Channel Capacity (C)• Bandwidth, Bit Rate, SNR, and BER related

• Channel Capacity defines relationship C = Maximum reliable bit rate C = W*Log2(1 + SNR) bps

Bandwidth sets the maximum Baud rate

SNR sets the maximum number ofdifferent symbols (the "M" in M-ary)

Page 26: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

Normalized Propagation DelayNormalized Propagation Delay

• NPD = End-to-End Propagation Delay Average time to inject a Packet

• NPD > 1 implies “High Speed Network”1 or more packets can simultaneously be in transit

• NPD < 1 implies “Slow Speed Network”Packet front end hits far side before back end transmitted

Transmitter ReceiverHigh SpeedLow Speed

Page 27: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

Types of Traffic...Types of Traffic...• Computer Data

Bursty Highly sensitive to errors Not as time sensitive as voice or video

• Interactive Voice/Video Fixed Rate (if not compressed)

*Not sensitive to errors Fixed or Variable Rate (if compressed)

*Sensitive to errors Time Sensitive

Page 28: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

IEEE 802.3 Ethernet IEEE 802.3 Ethernet • Based on late 1970’s technology• Covers OSI Layers 1 & 2• 10 Mbps Line Speed• Logical Bus• Designed to move Computer Data

Page 29: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

Serial Bit Stream: NRZ Coding

time

+1

volts

0

-1

T

0 0

LogicOne

LogicZero

Called ‘Non Return to Zero’because voltage never dwellson zero volts.

T Coax Cable

Page 30: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

Ethernet Uses Manchester Coding

time

+1

volts

0

-1

T

0 0

LogicOne

LogicZero

All symbolshave a transitionin the middle.

Page 31: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

Ethernet Uses Manchester Coding

time

+1

volts

0

-1

T

High Pass Filters Emphasize Change

Page 32: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

High Pass Filter Output

time

+1

0

-1

Page 33: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

Rectify (Absolute Value)

time

+1

0

-1T

Result always has pulses T seconds apart.Useful for receiver synchronization.

Page 34: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

What is CSMA/CD?What is CSMA/CD?• Polite Conversation

– One node active at a time– No deliberate interruptions– Collisions sometimes occur after a break

Page 35: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

802.3 Back-Off Algorithm802.3 Back-Off Algorithm

• choose random number1st Collision 0, 12nd Collision 0, 1, 2, 33rd Collision 0, 1, ..., 6, 74th Collision 0, 1, ..., 14, 15

10th Collision 0, 1, ..., 1022, 1023

15th Collision 0, 1, ..., 1022, 102316th Collision Punt

• Wait (Random Number*.0000512) seconds

Page 36: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

802.3 Flow Chart

Packet to Send?

No

Yes

Set Collision Counter= 0

Traffic on Network?

Yes

No

Send Packet Collision?

No

JamYes

Bump CollisionCounter by +1

16th Collision?

Drop Packet.Notify Higher Layer

Yes

Back-Off

No

Page 37: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

Major Drawbacks of CSMA/CD...

Major Drawbacks of CSMA/CD...

• Worst case waiting time equals infinity(No guaranteed Bandwidth)

• No Priorities

These make Ethernet the worst LAN protocol to use for Multimedia Traffic

Page 38: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

802.3 Packet Format802.3 Packet Format

Pre SFD DestinationAddress

SourceAddress

Len

CRCData + Padding

Bytes: 7 1 6 6 2

46-1500 4

Page 39: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

Preamble

time

+1

volts

0

-1

T

0 0

LogicOne

LogicZero Series of pulses

generated atreceiver T secondsapart & in middleof each symbol.

Page 40: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

Transmitting a FileTransmitting a File• Broken into smaller packets• Initial packets from Layer 5

Open Logical Connection• Packets from Layer 7

“Data” Contains Layer 7 traffic“Data” Contains Layer 3-5 info

• Packets from Layer 4Acknowledgements

• Final packets from Layer 5Close Logical Connection

Page 41: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

10Base5 & 10Base2 (Obsolete)

PC PC Printer

Logical & Physical BusAll nodes monitor traffic3 Nodes share 10 Mbps

Coax Cable

Page 42: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

10BaseT & Shared Hub

PC

PC

PC

PC

Hub

Logical Bus & Physical StarShared hub (OSI Level 1) copies input bits to all outputs.

All nodes monitor traffic. 4 nodes share 10 Mbps.

Twisted Pair

Page 43: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

10BaseT & Switched Hub

PC

PC

PC

PC

SwitchedHub

Logical Bus & Physical StarSwitched Hub (OSI Level 1 & 2) copies packet to proper output.

Only the destination monitors traffic.

Page 44: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

10BaseT & Switched Hub

PC

PC

PC

PC

SwitchedHub

Logical Bus & Physical StarThis example system can move up to 20 Mbps

Page 45: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

10BaseT & Switched Hub

PC

PC

PC

PC

SwitchedHub

Logical Bus & Physical Star

Each node shares 10 Mbps with the Switched Hub.

Page 46: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

10BaseT & Switched Hub

PC

PC

PC

PC

SwitchedHub

Using Half Duplex 10BaseT,a collision occurs if PC & Switched Hub

simultaneously transmit.

reception isscrewed up

Page 47: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

IEEE 802.3u 100 Mbps Fast Ethernet

IEEE 802.3u 100 Mbps Fast Ethernet

• Preserves CSMA/CD

• Preserves Packet Format

• Maximum End-to-End Lengths (a.k.a. Collision Domain) reduced to keep Normalized Propagation Delay low

• Sales are pretty good

Page 48: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

Full Duplex System

PC

PC

PC

PC

SwitchedHub

Most 1 Gbps (& many 100 Mbps) systems are Full Duplex.NIC’s are designed to simultaneously transmit & receive.

Line no longer shared. No Collisions. No need for CSMA/CD.

Page 49: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

1995• Two 100 Mbps ‘Ethernets’ introduced• Version A

– CSMA/CD MAC, Ethernet Frames

• Version B– Demand Priority MAC, Ethernet Frames

• IEEE said Version A is Ethernet– IEEE 802.3u Fast Ethernet

• IEEE said Version B is not Ethernet– IEEE 802.12 100VG-AnyLAN

• 802.12 is currently Dead

RIP

Page 50: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

IEEE 802.3z 1 Gbps EthernetIEEE 802.3z

1 Gbps Ethernet• Uses an extended version of CSMA/CD, including

‘Frame Bursting’• Best performance uses full duplex connections &

switched hubs– CSMA/CD included so it can be called Ethernet

• Collision Domain same as Fast Ethernet• Preserves Packet Format• Good Sales• More on GigE later

Page 51: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

IEEE 802.1p Priority Tags

• 8 priorities

• MAC protocols remain unchanged

• Used by 802.1p enabled switches– Allows interactive voice or video to receive

preferential treatment on an Ethernet LAN

Page 52: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

IEEE 802.5 Token Ring IEEE 802.5 Token Ring • Based on early 1980’s technology• Covers OSI Layers 1 & 2• 4 or 16 Mbps Line Speed• Logical Ring• A ‘Token’ is passed around the ring

Node must have the Token to transmit• Guaranteed Bandwidth• Has Priorities

Page 53: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

802.5 Token Format802.5 Token Format

SD AC ED

Bytes: 1 1 1

Starting Delimiter: Token/Frame starts hereAccess Control: Indicates whether Token or Frame, PriorityEnding Delimiter: End of Token/Frame

Page 54: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

802.5 Packet Format802.5 Packet Format

SD AC DestinationAddress

SourceAddress

CRCData

Bytes: 1 1 1 6 6

>0 4 1 1

FC

Modified Tokena.k.a

Starting FrameDelimiter ED FS

Frame Control: Ring StatusFrame Status: Receiver indicates whether received OK

Page 55: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

IEEE 802.5 Token Ring IEEE 802.5 Token Ring • Technically Superior to Ethernet• 2nd most widely used LAN protocol• Similar evolution to Ethernet

– Logical & Physical Ring– Logical Ring, Shared Physical Star– Logical Ring, Switched Physical Star

• 100 Mbps products available since ’98• Sales sharply declining. Heading for LAN graveyard.

RIP

Page 56: Layer 2. Datalink / Media Access This layer is responsible for allowing the devices to access the media. Creates connections between devices If more than

Layer 2 Switching

• Why??

• Bridges

• Spanning Tree Algorithm