the data-link layer: ethernet, arp and lanshbinsky/intro comp comm/5_data link layer.pdflayer-2...

4
INTEREST NEWS OF SFG FAMILY OF FUNDS WINTER 2015 SFG INCOME FUNDS THE BIOLOGY OF AN SFG-APPROVED LOAN SFG FIRST PRIORITY EQUITY LOANS COMPRISE AN ELITE PORTFOLIO – THE BEST IN THE BUSINESS What does it take to be approved as an SFG loan? It’s difficult. For every 10,000 loan requests, we approve 100 hundred loans. Another way to look at it – only one in a hundred makes the cut. How does Seattle Funding Group obtain so many loan choices to filter from? e answer: decades of consistent marketing, substantial brand recognition within the markets we serve, and proven performance, all leading to strategic relationships formed over many years. Today, our mortgage audience is deeper than ever before. Our competitive advantage strengthened. Our choices richer. As an industry leader in the private money real estate lending field, our platform to ensure enduring fund performance is at its best. Still, we invest time, effort and capital daily to maintain our market leadership position and to provide our underwriting team with a plethora of terrific choices to further vet. Our methods lead to superior portfolio performance for the SFG Income Funds. Let’s take a look at some of the numbers, and machine, behind the refinement of an “SFG-approved” loan. Marketing and Enduring Relationships Seattle Funding Group spends many times the industry average towards marketing and building strategic relationships, leading to new loan opportunities. We believe it is an investment in the future performance of the portfolio. Since we have many opportunities to choose from, we choose the best. Quite frankly, we have seen SFG Income Fund managers Greg Elderkin (left) and John Odegard (right).

Upload: others

Post on 02-Apr-2020

10 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

1

The Data-Link Layer

Ethernet ARP and LANs

Based on slides from the Computer Networking A Top Down Approach Featuring the Internet by Kurose and Ross

The Data Link Layer

Our goals

Understand principles behind data link layer services

Sharing a broadcast channel multiple access

Link layer addressing

Interconnection of different LAN segments

Instantiation and implementation of various link layer

technologies

2

2

Link Layer Introduction

Some terminology

hosts and routers are nodes

communication channels that

connect adjacent nodes along

communication path are links

wired links

wireless links

LANs

layer-2 packet is a frame

encapsulates datagram

ldquolinkrdquo

data-link layer has responsibility of transferring datagram from one node to adjacent node over a link

3

Link layer context

Datagram transferred by

different link protocols over

different links

eg Ethernet on first link

frame relay on intermediate

links 80211 on last link

Each link protocol provides

different services

eg may or may not provide

rdt over link

transportation analogy

trip from Princeton to Lausanne

limo Princeton to JFK

plane JFK to Geneva

train Geneva to Lausanne

tourist = datagram

transport segment = communication link

transportation mode = link layer protocol

travel agent = routing algorithm

4

3

Physical Media

physical link

Transmitted data bit propagates across link

guided media

signals propagate in solid media (eg copper fiber)

unguided media

signals propagate freely (eg radio bands)

The physical Layer defines the ldquorepresentationrdquo of bits

It‟s also provides protection by both detecting and correcting

corrupted bits (See how it works)

5

Physical Media (Examples)

Twisted Pair (TP)

Two insulated copper wires May be shielded or not

Category 3

Traditional phone wires Supports 10-Mbps Ethernet

Category 5

Supports 100Mbps Ethernet (ldquoFast-Ethernetrdquo)

6

4

Physical Media (Examples)

Coaxial cable

Two concentric shielded wires

Baseband

single channel on cable

broadband

multiple channel on cable

common uses for 10-Mbps Ethernet and TV cables

7

Physical Media (Examples)

Fiber

Glass fiber carrying light pulses

Single mode or multi mode

High point-to-point speed

Very low error rate (caused by low fiber‟s attenuation)

Secured

Common used for 100-Mbps Ethernet and 1000-Mbps

Ethernet (ldquoGigabit Ethernetrdquo)

8

5

Physical Media (Examples)

Many more

Radio bands (WiFi high bit error rate)

Microwave (Requires hosts in light of sight)

Satellite (very slow RTT)

9

Link Layer Services

Recall that were actually considering the MAC layer in the IEEE

802 model

Framing (Frame structure)

encapsulate datagram into frame adding header trailer

Link Access (The protocol)

Addressing

Introduces ldquoMACrdquo addresses used in frame headers to identify hosts

(actually NICs) who are part of the network

Different for IP addresses

Channel Access

Defines the set of rules which allows the hosts to use the (possibly

shared) medium

10

6

Link Layer Services

Flow Control

pacing between adjacent sending and receiving nodes

Error Detection

errors caused by signal attenuation noise

receiver detects presence of errors

signals sender for retransmission or drops frame

Error Correction

receiver identifies and corrects bit error(s) without resorting to

retransmission

Half-duplex and full-duplex

with half duplex nodes at both ends of link can transmit but not at same

time

RDT

Offers some reliability between the hosts (Why is this redundant)

11

Link Layer Services

link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card

80211 card

sending side encapsulates datagram in a

frame

adds error checking bits rdt flow control etc

receiving side looks for errors rdt flow

control etc

extracts datagram passes to rcving node

adapter is semi-autonomous

link amp physical layers

sendingnode

frame

rcvingnode

datagram

frame

adapter adapter

link layer protocol

12

7

Link Types

Three types of ldquolinksrdquo

point-to-point (P2P)

PPP for dial-up access

Point-to-point link between

Ethernet switch and host

Switched Networks

ATM (used for WAN)

Broadcast

Traditional Ethernet and its

predecessors

Upstream HFC

80211 wireless LAN

We‟ll focus on Broadcast

media

13

Multiple Access protocols

Ossi Mokryn - Data link layer

single shared broadcast channel

two or more simultaneous transmissions by nodes interference

collision if node receives two or more signals at the same

time

Multiple ACcess (MAC) Protocol

distributed algorithm that determines how nodes share channel

ie determine when node can transmit

communication about channel sharing must use channel itself

no out-of-band channel for coordination

14

8

Human Analogy

15

Rules for bdquoparty conversation‟

Give everyone a chance to speak

Dont speak until you are spoken to

Dont monopolize the conversation

Raise your hand if you have a question

Dont interrupt when someone is speaking

Dont fall asleep when someone else is talking

MAC Protocols measures

Assume a shared medium with a channel rate of R [bpsec]

Efficient

When one node wants to transmit it ca send at rate R

Fair

When N users want to transmit each can send at average rate RN

Decentralized

No special node uses to coordinate transmission (no ldquoleaderrdquo)

No synchronization of clocks or slots

Fault tolerant

Simple

Should be very fast and implemented in NICs firmware

16

9

MAC Protocol Types

Three broad classes

Channel Partitioning

Divide channel into smaller ldquopiecesrdquo (Time-Slots Frequancy-Bands

or by code)

allocate piece to a node for exclusive its use

Random Access

Channel not divided allow collisions

ldquoRecoverrdquo from collisions

ldquoTaking turnsrdquo

Nodes take turns but nodes with more to send can take longer

turns

Might uses a leader to coordinate the turns

17

Channel Partitioning MAC protocols TDMA

TDMA (Time Division Multiple Access)

Access the channel in roundsldquo

Each station gets fixed length slot (length = packets trans time) in each

round Each slot called a Time-Slot

Unused slots go idle

Example 6-station LAN 134 have packtes slots 256 idle

18

10

Channel 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 134 have packets frequency bands 256 idle

frequ

ency

ban

ds

19

TDM FDM summary

FDM Enables the division of a channel with capacity C

bits per seconds to N sub-channels each gets a different

frequency range and capacity of CN

TDM The division of channel to N sub-channels each

gets CN capacity by giving the entire channel to each of

the N stations for 1N of the time

The division makes each sub channel less busy but the

overall waiting time is bigger by a factor of N compared

to having one channel (Little theorem)

20

11

Channel Partitioning MAC protocols CDMA

Code Division Multiple Access (CDMA)

used in several wireless broadcast channels (cellular satellite etc) standards

unique ldquocoderdquo assigned to each user ie code set partitioning

all users share same frequency but each user has own ldquochippingrdquo sequence (ie code) to encode data

encoded signal = (original data) X (chipping sequence)

decoding inner-product of encoded signal and chipping sequence

allows multiple users to ldquocoexistrdquo and transmit simultaneously with minimal interference (if codes are ldquoorthogonalrdquo)21

Random Access MAC Protocols

From here on we‟ll focus on Random Access MAC 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 ldquocollisionrdquo

Random access MAC protocol specifies

How to detect collisions

How to recover from collisions

Examples of random access MAC protocols

ALOHA

slotted ALOHA

CSMACD (Ethernet)

CSMACA (Wireless)

22

12

Aloha Protocol

Invented at the ‟70s in Hawaii

Intended for Radio networks but suitable for every

network where the station can listen to the channel while

broadcasting and determine whether others also transmit

Basic idea every station may transmit when it wants to If

collision is detected between frames back off and try

again later

If two frames are broadcast at the same time on the channel a

collision occurs and the both need to retransmit

23

Aloha Protocol

All hosts

Transmit on one frequency (fT)

Receive on other frequency (fR)

There is a central node which repeats whatever it receives

from fT frequency on the other fR frequency

The central node used as a repeater

Collisions are detected by the hosts

Receiving corrupted data (host knows what should be

received)

24

13

Aloha Protocol

1 Accept a new frame arrives

2 Transmit immediately and listen

If a collision occurred wait a random time and

repeat to stage 2

Otherwise go back to stage 1 to handle a new frame

25

Aloha Protocol

Simple

Robust against failure of a host

Distributed (excluding the central node which uses as a

repeater)

High load implicates low utilization of the channel and high

delays

26

14

Aloha - efficiency

Only 18

Suppose there are n stations and the probability that a

station starts transmitting in a time unit is p

Then The probability that exactly one node transmits

in a time unit is

27

Efficiency is the long-run fraction of successful transmissions when there are many nodes each with many frames to send

Aloha - efficiency

Only 18

Maximize the utilization function by differentiation

yields maximum point at with utilization

of

Trivial improvement

Why be vulnerable for 2 time units

Synchronize and use slotted time May transmit only

at integer times

28

Efficiency is the long-run fraction of successful transmissions when there are many nodes each with many frames to send

15

Slotted 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

29

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

Cons

collisions wasting slots

idle slots

nodes may be able to detect collision in less than time to transmit packet

clock synchronization

30

16

Slotted Aloha - efficiency

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

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 1e = 37

Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send

At best channelused for useful transmissions 37of time

31

Aloha - Summary

Very popular at the beginning of time (ie 70s to 80s)

Very simple to handle

Lots and lots of basic probabilities calculations for

students

Major problem Nodes don‟t check what‟s going on in the

channel each acting on its own No manners

32

17

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

Protocol

1 Listen to the channel

2 If channel sensed idle transmit entire frame

3 If channel sensed busy defer transmission by

1-Persistent CSMA

Wait until channel is quiet and transmit immediately If collision

occurs wait a random time and listen again (go to 1)

Non-Persistent CSMA

Wait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission

CSMA human analogy don‟t interrupt others

33

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMA

When transmitting try to sense if there is a collision

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

34

18

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots

adapter doesn‟t transmit if it

senses that some other

adapter is transmitting that is

carrier sense

transmitting adapter aborts

when it senses that another

adapter is transmitting that is

collision detection

Before attempting a

retransmission adapter

waits a random time that

is random access

36

19

Unreliable connectionless service

Connectionless No handshaking between sending and

receiving adapter

Unreliable receiving adapter doesn‟t send acks or nacks to

sending adapter

stream of datagrams passed to network layer can have gaps

gaps will be filled if app is using TCP

otherwise app will see the gaps

37

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other

transmitters are aware of

collision 48 bits

Bit time 1 microsec for 10 Mbps

Ethernet

for K=1023 wait time is about

50 msec

Exponential Backoff

Goal adapt retransmission

attempts to estimated current

load

heavy load random wait will be

longer

first collision choose K from

01 delay is K 512 bit

transmission times

after second collision choose K

from 0123hellip

after ten collisions choose K

from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

38

20

8023 CSMACD (Ethernet) Algorithm

39

Ethernet CSMACD algorithm

1 Adaptor receives datagram

from net layer amp creates frame

2 If adapter senses channel idle it

starts to transmit frame If it

senses channel busy waits until

channel idle and then transmits

3 If adapter transmits entire

frame without detecting

another transmission the

adapter is done with frame

4 If adapter detects another

transmission while transmitting

aborts and sends jam signal

5 After aborting adapter enters

exponential backoff after

the mth collision adapter

chooses a K at random from

012hellip2m-1 Adapter waits

K512 bit times and returns to

Step 2

40

21

Ethernet Minimum Packet Size

41

Summary of MAC protocols

What do you do with a shared media

Channel Partitioning by time frequency or code

Time Division Frequency Division Code Division

Random partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACD

carrier sensing easy in some technologies (wire) hard in

others (wireless)

CSMACD used in Ethernet

CSMACA used in 80211 (Wireless)

42

22

LAN technologies

Data link layer so far

MAC protocols The random protocol approach

Next LAN technologies

Addressing

Ethernet

Hubs bridges and switches

43

MAC Addresses and ARP

32-bit IP address network-layer address

used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet)

address used to get datagram from one interface to another physically-

connected interface (same network)

48 bit MAC address (for most LANs)

burned in the adapter ROM but can be modified

44

23

LAN Addresses and ARP

Each adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN(wired orwireless)

45

LAN Address (more)

MAC address allocation administered by IEEE

manufacturer buys portion of MAC address space (to assure

uniqueness)

Analogy

(a) MAC address like Social Security Number

(b) IP address like postal address

MAC flat address portability

can move LAN card from one LAN to another

IP hierarchical address NOT portable

depends on IP subnet to which node is attached

46

24

ARP Address Resolution Protocol

Each IP node (Host Router)

on LAN has ARP table

ARP Table IPMAC address

mappings for some LAN

nodes

lt IP address MAC address TTLgt

TTL (Time To Live) time after

which address mapping will be

forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

237196723

237196778

237196714

237196788

47

ARP protocol Same LAN (network)

A wants to send datagram to B

and B‟s MAC address not in A‟s

ARP table

A broadcasts ARP query packet

containing Bs IP address

Dest MAC address = FF-FF-

FF-FF-FF-FF

all machines on LAN receive

ARP query

B receives ARP packet replies to

A with its (Bs) MAC address

frame sent to A‟s MAC address

(unicast)

A caches (saves) IP-to-MAC

address pair in its ARP table until

information becomes old (times

out)

soft state information that

times out (goes away) unless

refreshed

ARP is ldquoplug-and-playrdquo

nodes create their ARP tables

without intervention from net

administrator

48

25

Routing to another LANwalkthrough send datagram from A to B via R

assume A know‟s B IP address

Two ARP tables in router R one for each IP network (LAN)

In routing table at source Host find router 111111111110

In ARP table at source find MAC address E6-E9-00-17-BB-4B etc

A

RB

49

Ossi Mokryn - Data link layer

A creates datagram with source A destination B

A uses ARP to get R‟s MAC address for 111111111110

A creates link-layer frame with Rs MAC address as dest frame

contains A-to-B IP datagram

A‟s adapter sends frame

R‟s adapter receives frame

R removes IP datagram from Ethernet frame sees its destined to B

R uses ARP to get B‟s MAC address

R creates frame containing A-to-B IP datagram sends to B

A

RB

50

26

Ethernet

ldquodominantrdquo wired LAN technology developed at the 70s

cheap $20 for 100Mbs

first widely used LAN technology

Simple cheap

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

51

Ethernet topology Through the Years

Classic Ethernet Now star topology prevails

Connection choices hub or switch (more later)

Fast Ethernet 100 Mbs

Gigabit Ethernet 1Gbps

52

hub orswitch

bull Shared Bus with CSMACDbull Bus maximal length 500 mbullTransmission rate 10Mbs

Through the years the only common is The Frame

27

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network

layer protocol packet) in Ethernet frame

Preamble

7 bytes with pattern 10101010 followed by one byte with

pattern 10101011

used to synchronize receiver sender clock rates what is

the length in clock ticks of one bit

53

Type length length or type of frame

Ethernet Frame Structure (more)

Ossi Mokryn - Data link layer

Addresses 6 bytes

if adapter receives frame with matching destination address or with

broadcast address (eg ARP packet) it passes data in frame to net-layer

protocol

otherwise adapter discards frame

MAC addresses also called Physical addresses

Type indicates the higher layer protocol (mostly IP but others

may be supported such as Novell IPX and AppleTalk)

CRC checked at receiver if error is detected the frame is

simply dropped Before CRC there is a padding field for the

CRC to pad to 64 bytes

54

28

55

Ethernet Technology 10Base2

10 10Mbps 2 under 200 meters max cable length

thin coaxial cable in a bus topology

repeaters used to connect up to multiple segments

repeater repeats bits it hears on one interface to its other

interfaces physical layer device only

Ethernet technology 100BaseT

10100 Mbps rate latter called ldquofast ethernetrdquo

T stands for Twisted Pair

Nodes connect to a hub ldquostar topologyrdquo 100 m max

distance between nodes and hub

twisted pair

hub

56

29

Ethernet technology 100BaseT

Problem must keep minimal packet size when bandwidth

increases

With fixed cable length and propagation speed must

increase minimal size proportionally to bandwidth

increase

Eg 100Mbs 1500m of cable prop remains 6μs minimal

size becomes 1200 bits

Solutions

Cable length limited to 100m

Prevent collisions by ldquoEthernet Switchesrdquo (later)

Max distance from node to Hub is 100 meters

57

58

Gbit Ethernet

use standard Ethernet frame format

allows for point-to-point links and shared broadcast channels

in shared mode CSMACD is used short distances between

nodes to be efficiency

uses hubs called here ldquoBuffered Distributorsrdquo

Full-Duplex at 1 Gbps for point-to-point links

10 Gbpsec now

30

Hubs

QWhy not just one big LAN

Limited amount of supportable traffic on single LAN

all stations must share bandwidth

limited length 8023 (Ethernet) specifies maximum

cable length

large ldquocollision domainrdquo (can collide with many

stations)

limited number of stations 8025 (token ring) have

token passing delays at each station

59

Lecture 360

Hubs (Multiport repeaters Bus in a box)

Physical Layer devices essentially repeaters operating at bit

levels repeat received bits on one interface to all other

interfaces

Can‟t interconnect 10BaseT amp 100BaseT (because

segments don‟t share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design)

with backbone hub at its top

31

61

Hubs (Multiport repeaters Bus in a box)

Each connected LAN referred to as LAN segment

Hubs do not isolate collision domains node may collide with any

node residing at any segment in LAN

Extends max distance between nodes but all the segments become

one large collision domain

Hub Advantages

simple inexpensive device

Multi-tier provides graceful degradation portions of the LAN

continue to operate if one hub malfunctions

extends maximum distance between node pairs (100m per Hub)

62

Bridges

Link Layer devices operate on Ethernet frames examining

frame header and selectively forwarding frame based on its

destination

Bridge isolates collision domains since it buffers frames

When frame is to be forwarded on segment bridge uses

CSMACD to access segment and transmit

Store and forward element So different types of Ethernet

types can be connected

Transparent no need for any change to hosts LAN adapters

Forwarding is selective do not always flood All connected

segments can work independently in parallel

32

63

Bridge Filtering

bridges learn which hosts can be reached through which

interfaces maintain filtering tables

when frame received bridge ldquolearnsrdquo location of sender

incoming LAN segment

records sender location in filtering table

filtering table entry

(Node LAN Address Bridge Interface Time Stamp)

stale entries in Filtering Table dropped (TTL can be 60 minutes)

64

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_port

if (out_port not valid) no entry found for destination

then flood forward on all but the interface on which the frame arrived

if (in_port = out_port) destination is on LAN on which frame was received

then drop the frame

Otherwise (out_port is valid) entry found for destination then forward the frame on interface indicated

33

65

Bridge Learning example

Suppose C sends frame to D and D replies back with frame

to C

C sends frame bridge has no info about D so floods to both LANs bridge notes that C is on port 1

frame ignored on upper LAN

frame received by D

66

Bridge Learning example

D generates reply to C sends

bridge sees frame from D

bridge notes that D is on interface 2

bridge knows C on interface 1 so selectivelyforwards frame out via interface 1

C 1

34

67

What will happen with loops

Incorrect learning

A

B

1 1

22

A 1 A 122

68

What will happen with loops

Frame looping

A

C

1 1

22

C C

35

69

What will happen with loops

Frame looping

A

B

1 1

22

B2 B1

70

Introducing Spanning Tree

Allow a path between every LAN without causing loops

(loop-free environment)

Bridges communicate with special configuration

messages (BPDUs)

Standardized by IEEE 8021D

Note redundant paths are good active redundant paths are bad (they cause

loops)

36

How to Construct a Spanning Tree

Bridges run a distributed spanning tree

Algorithm

Select what ports (and bridges) should actively forward

frames

Finding the root flooding

Building a tree Bellman-Ford Algorithm

Can combine efficiently

Standardized in IEEE 8021 specification

71

72

Spanning Tree Requirements

Each bridge is assigned a unique identifier

A broadcast address for bridges on a LAN

A unique port identifier for all ports on all bridges

MAC address

Bridge id + port number

37

73

Spanning Tree Concepts

Root Bridge The bridge with the lowest bridge ID value is elected the

root bridge

One root bridge chosen among all bridges

Every other bridge calculates a path to the root bridge

74

Spanning Tree Concepts

Path Cost A cost associated with each port on each bridge

default is 1

The cost associated with transmission onto the LAN

connected to the port

Can be manually or automatically assigned

Can be used to alter the path to the root bridge

38

75

Spanning Tree Concepts

Root Port The port on each bridge that is on the path towards the

root bridge

The root port is part of the lowest cost path towards

the root bridge

If port costs are equal on a bridge the port with the

lowest ID becomes root port

76

Spanning Tree Concepts

Root Path Cost The minimum cost path to the root bridge

The cost starts at the root bridge

Each bridge computes root path cost independently

based on their view of the network

39

77

Spanning Tree Concepts Designated

Bridge Only one bridge on a LAN at one time is chosen the

designated bridge

This bridge provides the minimum cost path to the root

bridge for the LAN

Only the designated bridge passes frames towards the

root bridge

78

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Protocol operation1 Picks a root2 For each LAN

picks a designated bridgethat is closest to the root

3 All bridges on a LANsend packets towards the root via the designatedbridge

B8

40

79

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

80

Spanning Tree Algorithm

An Overview 1 Determine the root bridge among all bridges

2 Each bridge determines its root port

The port in the direction of the root bridge

3 Determine the designated bridge on each LAN

The bridge which accepts frames to forward towards the root bridge

The frames are sent on the root port of the designated bridge

41

81

Spanning Tree Algorithm

Selecting Root Bridge Initially each bridge considers itself to be the root bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

Best one wins

(lowest root IDcostpriority)

82

Spanning Tree Algorithm

Selecting Root Ports Each bridge selects one of its ports which has the

minimal cost to the root bridge

In case of a tie the lowest uplink (transmitter) bridge ID is

used

In case of another tie the lowest port ID is used

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 2: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

2

Link Layer Introduction

Some terminology

hosts and routers are nodes

communication channels that

connect adjacent nodes along

communication path are links

wired links

wireless links

LANs

layer-2 packet is a frame

encapsulates datagram

ldquolinkrdquo

data-link layer has responsibility of transferring datagram from one node to adjacent node over a link

3

Link layer context

Datagram transferred by

different link protocols over

different links

eg Ethernet on first link

frame relay on intermediate

links 80211 on last link

Each link protocol provides

different services

eg may or may not provide

rdt over link

transportation analogy

trip from Princeton to Lausanne

limo Princeton to JFK

plane JFK to Geneva

train Geneva to Lausanne

tourist = datagram

transport segment = communication link

transportation mode = link layer protocol

travel agent = routing algorithm

4

3

Physical Media

physical link

Transmitted data bit propagates across link

guided media

signals propagate in solid media (eg copper fiber)

unguided media

signals propagate freely (eg radio bands)

The physical Layer defines the ldquorepresentationrdquo of bits

It‟s also provides protection by both detecting and correcting

corrupted bits (See how it works)

5

Physical Media (Examples)

Twisted Pair (TP)

Two insulated copper wires May be shielded or not

Category 3

Traditional phone wires Supports 10-Mbps Ethernet

Category 5

Supports 100Mbps Ethernet (ldquoFast-Ethernetrdquo)

6

4

Physical Media (Examples)

Coaxial cable

Two concentric shielded wires

Baseband

single channel on cable

broadband

multiple channel on cable

common uses for 10-Mbps Ethernet and TV cables

7

Physical Media (Examples)

Fiber

Glass fiber carrying light pulses

Single mode or multi mode

High point-to-point speed

Very low error rate (caused by low fiber‟s attenuation)

Secured

Common used for 100-Mbps Ethernet and 1000-Mbps

Ethernet (ldquoGigabit Ethernetrdquo)

8

5

Physical Media (Examples)

Many more

Radio bands (WiFi high bit error rate)

Microwave (Requires hosts in light of sight)

Satellite (very slow RTT)

9

Link Layer Services

Recall that were actually considering the MAC layer in the IEEE

802 model

Framing (Frame structure)

encapsulate datagram into frame adding header trailer

Link Access (The protocol)

Addressing

Introduces ldquoMACrdquo addresses used in frame headers to identify hosts

(actually NICs) who are part of the network

Different for IP addresses

Channel Access

Defines the set of rules which allows the hosts to use the (possibly

shared) medium

10

6

Link Layer Services

Flow Control

pacing between adjacent sending and receiving nodes

Error Detection

errors caused by signal attenuation noise

receiver detects presence of errors

signals sender for retransmission or drops frame

Error Correction

receiver identifies and corrects bit error(s) without resorting to

retransmission

Half-duplex and full-duplex

with half duplex nodes at both ends of link can transmit but not at same

time

RDT

Offers some reliability between the hosts (Why is this redundant)

11

Link Layer Services

link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card

80211 card

sending side encapsulates datagram in a

frame

adds error checking bits rdt flow control etc

receiving side looks for errors rdt flow

control etc

extracts datagram passes to rcving node

adapter is semi-autonomous

link amp physical layers

sendingnode

frame

rcvingnode

datagram

frame

adapter adapter

link layer protocol

12

7

Link Types

Three types of ldquolinksrdquo

point-to-point (P2P)

PPP for dial-up access

Point-to-point link between

Ethernet switch and host

Switched Networks

ATM (used for WAN)

Broadcast

Traditional Ethernet and its

predecessors

Upstream HFC

80211 wireless LAN

We‟ll focus on Broadcast

media

13

Multiple Access protocols

Ossi Mokryn - Data link layer

single shared broadcast channel

two or more simultaneous transmissions by nodes interference

collision if node receives two or more signals at the same

time

Multiple ACcess (MAC) Protocol

distributed algorithm that determines how nodes share channel

ie determine when node can transmit

communication about channel sharing must use channel itself

no out-of-band channel for coordination

14

8

Human Analogy

15

Rules for bdquoparty conversation‟

Give everyone a chance to speak

Dont speak until you are spoken to

Dont monopolize the conversation

Raise your hand if you have a question

Dont interrupt when someone is speaking

Dont fall asleep when someone else is talking

MAC Protocols measures

Assume a shared medium with a channel rate of R [bpsec]

Efficient

When one node wants to transmit it ca send at rate R

Fair

When N users want to transmit each can send at average rate RN

Decentralized

No special node uses to coordinate transmission (no ldquoleaderrdquo)

No synchronization of clocks or slots

Fault tolerant

Simple

Should be very fast and implemented in NICs firmware

16

9

MAC Protocol Types

Three broad classes

Channel Partitioning

Divide channel into smaller ldquopiecesrdquo (Time-Slots Frequancy-Bands

or by code)

allocate piece to a node for exclusive its use

Random Access

Channel not divided allow collisions

ldquoRecoverrdquo from collisions

ldquoTaking turnsrdquo

Nodes take turns but nodes with more to send can take longer

turns

Might uses a leader to coordinate the turns

17

Channel Partitioning MAC protocols TDMA

TDMA (Time Division Multiple Access)

Access the channel in roundsldquo

Each station gets fixed length slot (length = packets trans time) in each

round Each slot called a Time-Slot

Unused slots go idle

Example 6-station LAN 134 have packtes slots 256 idle

18

10

Channel 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 134 have packets frequency bands 256 idle

frequ

ency

ban

ds

19

TDM FDM summary

FDM Enables the division of a channel with capacity C

bits per seconds to N sub-channels each gets a different

frequency range and capacity of CN

TDM The division of channel to N sub-channels each

gets CN capacity by giving the entire channel to each of

the N stations for 1N of the time

The division makes each sub channel less busy but the

overall waiting time is bigger by a factor of N compared

to having one channel (Little theorem)

20

11

Channel Partitioning MAC protocols CDMA

Code Division Multiple Access (CDMA)

used in several wireless broadcast channels (cellular satellite etc) standards

unique ldquocoderdquo assigned to each user ie code set partitioning

all users share same frequency but each user has own ldquochippingrdquo sequence (ie code) to encode data

encoded signal = (original data) X (chipping sequence)

decoding inner-product of encoded signal and chipping sequence

allows multiple users to ldquocoexistrdquo and transmit simultaneously with minimal interference (if codes are ldquoorthogonalrdquo)21

Random Access MAC Protocols

From here on we‟ll focus on Random Access MAC 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 ldquocollisionrdquo

Random access MAC protocol specifies

How to detect collisions

How to recover from collisions

Examples of random access MAC protocols

ALOHA

slotted ALOHA

CSMACD (Ethernet)

CSMACA (Wireless)

22

12

Aloha Protocol

Invented at the ‟70s in Hawaii

Intended for Radio networks but suitable for every

network where the station can listen to the channel while

broadcasting and determine whether others also transmit

Basic idea every station may transmit when it wants to If

collision is detected between frames back off and try

again later

If two frames are broadcast at the same time on the channel a

collision occurs and the both need to retransmit

23

Aloha Protocol

All hosts

Transmit on one frequency (fT)

Receive on other frequency (fR)

There is a central node which repeats whatever it receives

from fT frequency on the other fR frequency

The central node used as a repeater

Collisions are detected by the hosts

Receiving corrupted data (host knows what should be

received)

24

13

Aloha Protocol

1 Accept a new frame arrives

2 Transmit immediately and listen

If a collision occurred wait a random time and

repeat to stage 2

Otherwise go back to stage 1 to handle a new frame

25

Aloha Protocol

Simple

Robust against failure of a host

Distributed (excluding the central node which uses as a

repeater)

High load implicates low utilization of the channel and high

delays

26

14

Aloha - efficiency

Only 18

Suppose there are n stations and the probability that a

station starts transmitting in a time unit is p

Then The probability that exactly one node transmits

in a time unit is

27

Efficiency is the long-run fraction of successful transmissions when there are many nodes each with many frames to send

Aloha - efficiency

Only 18

Maximize the utilization function by differentiation

yields maximum point at with utilization

of

Trivial improvement

Why be vulnerable for 2 time units

Synchronize and use slotted time May transmit only

at integer times

28

Efficiency is the long-run fraction of successful transmissions when there are many nodes each with many frames to send

15

Slotted 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

29

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

Cons

collisions wasting slots

idle slots

nodes may be able to detect collision in less than time to transmit packet

clock synchronization

30

16

Slotted Aloha - efficiency

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

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 1e = 37

Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send

At best channelused for useful transmissions 37of time

31

Aloha - Summary

Very popular at the beginning of time (ie 70s to 80s)

Very simple to handle

Lots and lots of basic probabilities calculations for

students

Major problem Nodes don‟t check what‟s going on in the

channel each acting on its own No manners

32

17

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

Protocol

1 Listen to the channel

2 If channel sensed idle transmit entire frame

3 If channel sensed busy defer transmission by

1-Persistent CSMA

Wait until channel is quiet and transmit immediately If collision

occurs wait a random time and listen again (go to 1)

Non-Persistent CSMA

Wait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission

CSMA human analogy don‟t interrupt others

33

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMA

When transmitting try to sense if there is a collision

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

34

18

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots

adapter doesn‟t transmit if it

senses that some other

adapter is transmitting that is

carrier sense

transmitting adapter aborts

when it senses that another

adapter is transmitting that is

collision detection

Before attempting a

retransmission adapter

waits a random time that

is random access

36

19

Unreliable connectionless service

Connectionless No handshaking between sending and

receiving adapter

Unreliable receiving adapter doesn‟t send acks or nacks to

sending adapter

stream of datagrams passed to network layer can have gaps

gaps will be filled if app is using TCP

otherwise app will see the gaps

37

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other

transmitters are aware of

collision 48 bits

Bit time 1 microsec for 10 Mbps

Ethernet

for K=1023 wait time is about

50 msec

Exponential Backoff

Goal adapt retransmission

attempts to estimated current

load

heavy load random wait will be

longer

first collision choose K from

01 delay is K 512 bit

transmission times

after second collision choose K

from 0123hellip

after ten collisions choose K

from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

38

20

8023 CSMACD (Ethernet) Algorithm

39

Ethernet CSMACD algorithm

1 Adaptor receives datagram

from net layer amp creates frame

2 If adapter senses channel idle it

starts to transmit frame If it

senses channel busy waits until

channel idle and then transmits

3 If adapter transmits entire

frame without detecting

another transmission the

adapter is done with frame

4 If adapter detects another

transmission while transmitting

aborts and sends jam signal

5 After aborting adapter enters

exponential backoff after

the mth collision adapter

chooses a K at random from

012hellip2m-1 Adapter waits

K512 bit times and returns to

Step 2

40

21

Ethernet Minimum Packet Size

41

Summary of MAC protocols

What do you do with a shared media

Channel Partitioning by time frequency or code

Time Division Frequency Division Code Division

Random partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACD

carrier sensing easy in some technologies (wire) hard in

others (wireless)

CSMACD used in Ethernet

CSMACA used in 80211 (Wireless)

42

22

LAN technologies

Data link layer so far

MAC protocols The random protocol approach

Next LAN technologies

Addressing

Ethernet

Hubs bridges and switches

43

MAC Addresses and ARP

32-bit IP address network-layer address

used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet)

address used to get datagram from one interface to another physically-

connected interface (same network)

48 bit MAC address (for most LANs)

burned in the adapter ROM but can be modified

44

23

LAN Addresses and ARP

Each adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN(wired orwireless)

45

LAN Address (more)

MAC address allocation administered by IEEE

manufacturer buys portion of MAC address space (to assure

uniqueness)

Analogy

(a) MAC address like Social Security Number

(b) IP address like postal address

MAC flat address portability

can move LAN card from one LAN to another

IP hierarchical address NOT portable

depends on IP subnet to which node is attached

46

24

ARP Address Resolution Protocol

Each IP node (Host Router)

on LAN has ARP table

ARP Table IPMAC address

mappings for some LAN

nodes

lt IP address MAC address TTLgt

TTL (Time To Live) time after

which address mapping will be

forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

237196723

237196778

237196714

237196788

47

ARP protocol Same LAN (network)

A wants to send datagram to B

and B‟s MAC address not in A‟s

ARP table

A broadcasts ARP query packet

containing Bs IP address

Dest MAC address = FF-FF-

FF-FF-FF-FF

all machines on LAN receive

ARP query

B receives ARP packet replies to

A with its (Bs) MAC address

frame sent to A‟s MAC address

(unicast)

A caches (saves) IP-to-MAC

address pair in its ARP table until

information becomes old (times

out)

soft state information that

times out (goes away) unless

refreshed

ARP is ldquoplug-and-playrdquo

nodes create their ARP tables

without intervention from net

administrator

48

25

Routing to another LANwalkthrough send datagram from A to B via R

assume A know‟s B IP address

Two ARP tables in router R one for each IP network (LAN)

In routing table at source Host find router 111111111110

In ARP table at source find MAC address E6-E9-00-17-BB-4B etc

A

RB

49

Ossi Mokryn - Data link layer

A creates datagram with source A destination B

A uses ARP to get R‟s MAC address for 111111111110

A creates link-layer frame with Rs MAC address as dest frame

contains A-to-B IP datagram

A‟s adapter sends frame

R‟s adapter receives frame

R removes IP datagram from Ethernet frame sees its destined to B

R uses ARP to get B‟s MAC address

R creates frame containing A-to-B IP datagram sends to B

A

RB

50

26

Ethernet

ldquodominantrdquo wired LAN technology developed at the 70s

cheap $20 for 100Mbs

first widely used LAN technology

Simple cheap

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

51

Ethernet topology Through the Years

Classic Ethernet Now star topology prevails

Connection choices hub or switch (more later)

Fast Ethernet 100 Mbs

Gigabit Ethernet 1Gbps

52

hub orswitch

bull Shared Bus with CSMACDbull Bus maximal length 500 mbullTransmission rate 10Mbs

Through the years the only common is The Frame

27

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network

layer protocol packet) in Ethernet frame

Preamble

7 bytes with pattern 10101010 followed by one byte with

pattern 10101011

used to synchronize receiver sender clock rates what is

the length in clock ticks of one bit

53

Type length length or type of frame

Ethernet Frame Structure (more)

Ossi Mokryn - Data link layer

Addresses 6 bytes

if adapter receives frame with matching destination address or with

broadcast address (eg ARP packet) it passes data in frame to net-layer

protocol

otherwise adapter discards frame

MAC addresses also called Physical addresses

Type indicates the higher layer protocol (mostly IP but others

may be supported such as Novell IPX and AppleTalk)

CRC checked at receiver if error is detected the frame is

simply dropped Before CRC there is a padding field for the

CRC to pad to 64 bytes

54

28

55

Ethernet Technology 10Base2

10 10Mbps 2 under 200 meters max cable length

thin coaxial cable in a bus topology

repeaters used to connect up to multiple segments

repeater repeats bits it hears on one interface to its other

interfaces physical layer device only

Ethernet technology 100BaseT

10100 Mbps rate latter called ldquofast ethernetrdquo

T stands for Twisted Pair

Nodes connect to a hub ldquostar topologyrdquo 100 m max

distance between nodes and hub

twisted pair

hub

56

29

Ethernet technology 100BaseT

Problem must keep minimal packet size when bandwidth

increases

With fixed cable length and propagation speed must

increase minimal size proportionally to bandwidth

increase

Eg 100Mbs 1500m of cable prop remains 6μs minimal

size becomes 1200 bits

Solutions

Cable length limited to 100m

Prevent collisions by ldquoEthernet Switchesrdquo (later)

Max distance from node to Hub is 100 meters

57

58

Gbit Ethernet

use standard Ethernet frame format

allows for point-to-point links and shared broadcast channels

in shared mode CSMACD is used short distances between

nodes to be efficiency

uses hubs called here ldquoBuffered Distributorsrdquo

Full-Duplex at 1 Gbps for point-to-point links

10 Gbpsec now

30

Hubs

QWhy not just one big LAN

Limited amount of supportable traffic on single LAN

all stations must share bandwidth

limited length 8023 (Ethernet) specifies maximum

cable length

large ldquocollision domainrdquo (can collide with many

stations)

limited number of stations 8025 (token ring) have

token passing delays at each station

59

Lecture 360

Hubs (Multiport repeaters Bus in a box)

Physical Layer devices essentially repeaters operating at bit

levels repeat received bits on one interface to all other

interfaces

Can‟t interconnect 10BaseT amp 100BaseT (because

segments don‟t share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design)

with backbone hub at its top

31

61

Hubs (Multiport repeaters Bus in a box)

Each connected LAN referred to as LAN segment

Hubs do not isolate collision domains node may collide with any

node residing at any segment in LAN

Extends max distance between nodes but all the segments become

one large collision domain

Hub Advantages

simple inexpensive device

Multi-tier provides graceful degradation portions of the LAN

continue to operate if one hub malfunctions

extends maximum distance between node pairs (100m per Hub)

62

Bridges

Link Layer devices operate on Ethernet frames examining

frame header and selectively forwarding frame based on its

destination

Bridge isolates collision domains since it buffers frames

When frame is to be forwarded on segment bridge uses

CSMACD to access segment and transmit

Store and forward element So different types of Ethernet

types can be connected

Transparent no need for any change to hosts LAN adapters

Forwarding is selective do not always flood All connected

segments can work independently in parallel

32

63

Bridge Filtering

bridges learn which hosts can be reached through which

interfaces maintain filtering tables

when frame received bridge ldquolearnsrdquo location of sender

incoming LAN segment

records sender location in filtering table

filtering table entry

(Node LAN Address Bridge Interface Time Stamp)

stale entries in Filtering Table dropped (TTL can be 60 minutes)

64

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_port

if (out_port not valid) no entry found for destination

then flood forward on all but the interface on which the frame arrived

if (in_port = out_port) destination is on LAN on which frame was received

then drop the frame

Otherwise (out_port is valid) entry found for destination then forward the frame on interface indicated

33

65

Bridge Learning example

Suppose C sends frame to D and D replies back with frame

to C

C sends frame bridge has no info about D so floods to both LANs bridge notes that C is on port 1

frame ignored on upper LAN

frame received by D

66

Bridge Learning example

D generates reply to C sends

bridge sees frame from D

bridge notes that D is on interface 2

bridge knows C on interface 1 so selectivelyforwards frame out via interface 1

C 1

34

67

What will happen with loops

Incorrect learning

A

B

1 1

22

A 1 A 122

68

What will happen with loops

Frame looping

A

C

1 1

22

C C

35

69

What will happen with loops

Frame looping

A

B

1 1

22

B2 B1

70

Introducing Spanning Tree

Allow a path between every LAN without causing loops

(loop-free environment)

Bridges communicate with special configuration

messages (BPDUs)

Standardized by IEEE 8021D

Note redundant paths are good active redundant paths are bad (they cause

loops)

36

How to Construct a Spanning Tree

Bridges run a distributed spanning tree

Algorithm

Select what ports (and bridges) should actively forward

frames

Finding the root flooding

Building a tree Bellman-Ford Algorithm

Can combine efficiently

Standardized in IEEE 8021 specification

71

72

Spanning Tree Requirements

Each bridge is assigned a unique identifier

A broadcast address for bridges on a LAN

A unique port identifier for all ports on all bridges

MAC address

Bridge id + port number

37

73

Spanning Tree Concepts

Root Bridge The bridge with the lowest bridge ID value is elected the

root bridge

One root bridge chosen among all bridges

Every other bridge calculates a path to the root bridge

74

Spanning Tree Concepts

Path Cost A cost associated with each port on each bridge

default is 1

The cost associated with transmission onto the LAN

connected to the port

Can be manually or automatically assigned

Can be used to alter the path to the root bridge

38

75

Spanning Tree Concepts

Root Port The port on each bridge that is on the path towards the

root bridge

The root port is part of the lowest cost path towards

the root bridge

If port costs are equal on a bridge the port with the

lowest ID becomes root port

76

Spanning Tree Concepts

Root Path Cost The minimum cost path to the root bridge

The cost starts at the root bridge

Each bridge computes root path cost independently

based on their view of the network

39

77

Spanning Tree Concepts Designated

Bridge Only one bridge on a LAN at one time is chosen the

designated bridge

This bridge provides the minimum cost path to the root

bridge for the LAN

Only the designated bridge passes frames towards the

root bridge

78

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Protocol operation1 Picks a root2 For each LAN

picks a designated bridgethat is closest to the root

3 All bridges on a LANsend packets towards the root via the designatedbridge

B8

40

79

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

80

Spanning Tree Algorithm

An Overview 1 Determine the root bridge among all bridges

2 Each bridge determines its root port

The port in the direction of the root bridge

3 Determine the designated bridge on each LAN

The bridge which accepts frames to forward towards the root bridge

The frames are sent on the root port of the designated bridge

41

81

Spanning Tree Algorithm

Selecting Root Bridge Initially each bridge considers itself to be the root bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

Best one wins

(lowest root IDcostpriority)

82

Spanning Tree Algorithm

Selecting Root Ports Each bridge selects one of its ports which has the

minimal cost to the root bridge

In case of a tie the lowest uplink (transmitter) bridge ID is

used

In case of another tie the lowest port ID is used

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 3: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

3

Physical Media

physical link

Transmitted data bit propagates across link

guided media

signals propagate in solid media (eg copper fiber)

unguided media

signals propagate freely (eg radio bands)

The physical Layer defines the ldquorepresentationrdquo of bits

It‟s also provides protection by both detecting and correcting

corrupted bits (See how it works)

5

Physical Media (Examples)

Twisted Pair (TP)

Two insulated copper wires May be shielded or not

Category 3

Traditional phone wires Supports 10-Mbps Ethernet

Category 5

Supports 100Mbps Ethernet (ldquoFast-Ethernetrdquo)

6

4

Physical Media (Examples)

Coaxial cable

Two concentric shielded wires

Baseband

single channel on cable

broadband

multiple channel on cable

common uses for 10-Mbps Ethernet and TV cables

7

Physical Media (Examples)

Fiber

Glass fiber carrying light pulses

Single mode or multi mode

High point-to-point speed

Very low error rate (caused by low fiber‟s attenuation)

Secured

Common used for 100-Mbps Ethernet and 1000-Mbps

Ethernet (ldquoGigabit Ethernetrdquo)

8

5

Physical Media (Examples)

Many more

Radio bands (WiFi high bit error rate)

Microwave (Requires hosts in light of sight)

Satellite (very slow RTT)

9

Link Layer Services

Recall that were actually considering the MAC layer in the IEEE

802 model

Framing (Frame structure)

encapsulate datagram into frame adding header trailer

Link Access (The protocol)

Addressing

Introduces ldquoMACrdquo addresses used in frame headers to identify hosts

(actually NICs) who are part of the network

Different for IP addresses

Channel Access

Defines the set of rules which allows the hosts to use the (possibly

shared) medium

10

6

Link Layer Services

Flow Control

pacing between adjacent sending and receiving nodes

Error Detection

errors caused by signal attenuation noise

receiver detects presence of errors

signals sender for retransmission or drops frame

Error Correction

receiver identifies and corrects bit error(s) without resorting to

retransmission

Half-duplex and full-duplex

with half duplex nodes at both ends of link can transmit but not at same

time

RDT

Offers some reliability between the hosts (Why is this redundant)

11

Link Layer Services

link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card

80211 card

sending side encapsulates datagram in a

frame

adds error checking bits rdt flow control etc

receiving side looks for errors rdt flow

control etc

extracts datagram passes to rcving node

adapter is semi-autonomous

link amp physical layers

sendingnode

frame

rcvingnode

datagram

frame

adapter adapter

link layer protocol

12

7

Link Types

Three types of ldquolinksrdquo

point-to-point (P2P)

PPP for dial-up access

Point-to-point link between

Ethernet switch and host

Switched Networks

ATM (used for WAN)

Broadcast

Traditional Ethernet and its

predecessors

Upstream HFC

80211 wireless LAN

We‟ll focus on Broadcast

media

13

Multiple Access protocols

Ossi Mokryn - Data link layer

single shared broadcast channel

two or more simultaneous transmissions by nodes interference

collision if node receives two or more signals at the same

time

Multiple ACcess (MAC) Protocol

distributed algorithm that determines how nodes share channel

ie determine when node can transmit

communication about channel sharing must use channel itself

no out-of-band channel for coordination

14

8

Human Analogy

15

Rules for bdquoparty conversation‟

Give everyone a chance to speak

Dont speak until you are spoken to

Dont monopolize the conversation

Raise your hand if you have a question

Dont interrupt when someone is speaking

Dont fall asleep when someone else is talking

MAC Protocols measures

Assume a shared medium with a channel rate of R [bpsec]

Efficient

When one node wants to transmit it ca send at rate R

Fair

When N users want to transmit each can send at average rate RN

Decentralized

No special node uses to coordinate transmission (no ldquoleaderrdquo)

No synchronization of clocks or slots

Fault tolerant

Simple

Should be very fast and implemented in NICs firmware

16

9

MAC Protocol Types

Three broad classes

Channel Partitioning

Divide channel into smaller ldquopiecesrdquo (Time-Slots Frequancy-Bands

or by code)

allocate piece to a node for exclusive its use

Random Access

Channel not divided allow collisions

ldquoRecoverrdquo from collisions

ldquoTaking turnsrdquo

Nodes take turns but nodes with more to send can take longer

turns

Might uses a leader to coordinate the turns

17

Channel Partitioning MAC protocols TDMA

TDMA (Time Division Multiple Access)

Access the channel in roundsldquo

Each station gets fixed length slot (length = packets trans time) in each

round Each slot called a Time-Slot

Unused slots go idle

Example 6-station LAN 134 have packtes slots 256 idle

18

10

Channel 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 134 have packets frequency bands 256 idle

frequ

ency

ban

ds

19

TDM FDM summary

FDM Enables the division of a channel with capacity C

bits per seconds to N sub-channels each gets a different

frequency range and capacity of CN

TDM The division of channel to N sub-channels each

gets CN capacity by giving the entire channel to each of

the N stations for 1N of the time

The division makes each sub channel less busy but the

overall waiting time is bigger by a factor of N compared

to having one channel (Little theorem)

20

11

Channel Partitioning MAC protocols CDMA

Code Division Multiple Access (CDMA)

used in several wireless broadcast channels (cellular satellite etc) standards

unique ldquocoderdquo assigned to each user ie code set partitioning

all users share same frequency but each user has own ldquochippingrdquo sequence (ie code) to encode data

encoded signal = (original data) X (chipping sequence)

decoding inner-product of encoded signal and chipping sequence

allows multiple users to ldquocoexistrdquo and transmit simultaneously with minimal interference (if codes are ldquoorthogonalrdquo)21

Random Access MAC Protocols

From here on we‟ll focus on Random Access MAC 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 ldquocollisionrdquo

Random access MAC protocol specifies

How to detect collisions

How to recover from collisions

Examples of random access MAC protocols

ALOHA

slotted ALOHA

CSMACD (Ethernet)

CSMACA (Wireless)

22

12

Aloha Protocol

Invented at the ‟70s in Hawaii

Intended for Radio networks but suitable for every

network where the station can listen to the channel while

broadcasting and determine whether others also transmit

Basic idea every station may transmit when it wants to If

collision is detected between frames back off and try

again later

If two frames are broadcast at the same time on the channel a

collision occurs and the both need to retransmit

23

Aloha Protocol

All hosts

Transmit on one frequency (fT)

Receive on other frequency (fR)

There is a central node which repeats whatever it receives

from fT frequency on the other fR frequency

The central node used as a repeater

Collisions are detected by the hosts

Receiving corrupted data (host knows what should be

received)

24

13

Aloha Protocol

1 Accept a new frame arrives

2 Transmit immediately and listen

If a collision occurred wait a random time and

repeat to stage 2

Otherwise go back to stage 1 to handle a new frame

25

Aloha Protocol

Simple

Robust against failure of a host

Distributed (excluding the central node which uses as a

repeater)

High load implicates low utilization of the channel and high

delays

26

14

Aloha - efficiency

Only 18

Suppose there are n stations and the probability that a

station starts transmitting in a time unit is p

Then The probability that exactly one node transmits

in a time unit is

27

Efficiency is the long-run fraction of successful transmissions when there are many nodes each with many frames to send

Aloha - efficiency

Only 18

Maximize the utilization function by differentiation

yields maximum point at with utilization

of

Trivial improvement

Why be vulnerable for 2 time units

Synchronize and use slotted time May transmit only

at integer times

28

Efficiency is the long-run fraction of successful transmissions when there are many nodes each with many frames to send

15

Slotted 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

29

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

Cons

collisions wasting slots

idle slots

nodes may be able to detect collision in less than time to transmit packet

clock synchronization

30

16

Slotted Aloha - efficiency

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

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 1e = 37

Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send

At best channelused for useful transmissions 37of time

31

Aloha - Summary

Very popular at the beginning of time (ie 70s to 80s)

Very simple to handle

Lots and lots of basic probabilities calculations for

students

Major problem Nodes don‟t check what‟s going on in the

channel each acting on its own No manners

32

17

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

Protocol

1 Listen to the channel

2 If channel sensed idle transmit entire frame

3 If channel sensed busy defer transmission by

1-Persistent CSMA

Wait until channel is quiet and transmit immediately If collision

occurs wait a random time and listen again (go to 1)

Non-Persistent CSMA

Wait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission

CSMA human analogy don‟t interrupt others

33

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMA

When transmitting try to sense if there is a collision

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

34

18

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots

adapter doesn‟t transmit if it

senses that some other

adapter is transmitting that is

carrier sense

transmitting adapter aborts

when it senses that another

adapter is transmitting that is

collision detection

Before attempting a

retransmission adapter

waits a random time that

is random access

36

19

Unreliable connectionless service

Connectionless No handshaking between sending and

receiving adapter

Unreliable receiving adapter doesn‟t send acks or nacks to

sending adapter

stream of datagrams passed to network layer can have gaps

gaps will be filled if app is using TCP

otherwise app will see the gaps

37

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other

transmitters are aware of

collision 48 bits

Bit time 1 microsec for 10 Mbps

Ethernet

for K=1023 wait time is about

50 msec

Exponential Backoff

Goal adapt retransmission

attempts to estimated current

load

heavy load random wait will be

longer

first collision choose K from

01 delay is K 512 bit

transmission times

after second collision choose K

from 0123hellip

after ten collisions choose K

from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

38

20

8023 CSMACD (Ethernet) Algorithm

39

Ethernet CSMACD algorithm

1 Adaptor receives datagram

from net layer amp creates frame

2 If adapter senses channel idle it

starts to transmit frame If it

senses channel busy waits until

channel idle and then transmits

3 If adapter transmits entire

frame without detecting

another transmission the

adapter is done with frame

4 If adapter detects another

transmission while transmitting

aborts and sends jam signal

5 After aborting adapter enters

exponential backoff after

the mth collision adapter

chooses a K at random from

012hellip2m-1 Adapter waits

K512 bit times and returns to

Step 2

40

21

Ethernet Minimum Packet Size

41

Summary of MAC protocols

What do you do with a shared media

Channel Partitioning by time frequency or code

Time Division Frequency Division Code Division

Random partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACD

carrier sensing easy in some technologies (wire) hard in

others (wireless)

CSMACD used in Ethernet

CSMACA used in 80211 (Wireless)

42

22

LAN technologies

Data link layer so far

MAC protocols The random protocol approach

Next LAN technologies

Addressing

Ethernet

Hubs bridges and switches

43

MAC Addresses and ARP

32-bit IP address network-layer address

used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet)

address used to get datagram from one interface to another physically-

connected interface (same network)

48 bit MAC address (for most LANs)

burned in the adapter ROM but can be modified

44

23

LAN Addresses and ARP

Each adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN(wired orwireless)

45

LAN Address (more)

MAC address allocation administered by IEEE

manufacturer buys portion of MAC address space (to assure

uniqueness)

Analogy

(a) MAC address like Social Security Number

(b) IP address like postal address

MAC flat address portability

can move LAN card from one LAN to another

IP hierarchical address NOT portable

depends on IP subnet to which node is attached

46

24

ARP Address Resolution Protocol

Each IP node (Host Router)

on LAN has ARP table

ARP Table IPMAC address

mappings for some LAN

nodes

lt IP address MAC address TTLgt

TTL (Time To Live) time after

which address mapping will be

forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

237196723

237196778

237196714

237196788

47

ARP protocol Same LAN (network)

A wants to send datagram to B

and B‟s MAC address not in A‟s

ARP table

A broadcasts ARP query packet

containing Bs IP address

Dest MAC address = FF-FF-

FF-FF-FF-FF

all machines on LAN receive

ARP query

B receives ARP packet replies to

A with its (Bs) MAC address

frame sent to A‟s MAC address

(unicast)

A caches (saves) IP-to-MAC

address pair in its ARP table until

information becomes old (times

out)

soft state information that

times out (goes away) unless

refreshed

ARP is ldquoplug-and-playrdquo

nodes create their ARP tables

without intervention from net

administrator

48

25

Routing to another LANwalkthrough send datagram from A to B via R

assume A know‟s B IP address

Two ARP tables in router R one for each IP network (LAN)

In routing table at source Host find router 111111111110

In ARP table at source find MAC address E6-E9-00-17-BB-4B etc

A

RB

49

Ossi Mokryn - Data link layer

A creates datagram with source A destination B

A uses ARP to get R‟s MAC address for 111111111110

A creates link-layer frame with Rs MAC address as dest frame

contains A-to-B IP datagram

A‟s adapter sends frame

R‟s adapter receives frame

R removes IP datagram from Ethernet frame sees its destined to B

R uses ARP to get B‟s MAC address

R creates frame containing A-to-B IP datagram sends to B

A

RB

50

26

Ethernet

ldquodominantrdquo wired LAN technology developed at the 70s

cheap $20 for 100Mbs

first widely used LAN technology

Simple cheap

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

51

Ethernet topology Through the Years

Classic Ethernet Now star topology prevails

Connection choices hub or switch (more later)

Fast Ethernet 100 Mbs

Gigabit Ethernet 1Gbps

52

hub orswitch

bull Shared Bus with CSMACDbull Bus maximal length 500 mbullTransmission rate 10Mbs

Through the years the only common is The Frame

27

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network

layer protocol packet) in Ethernet frame

Preamble

7 bytes with pattern 10101010 followed by one byte with

pattern 10101011

used to synchronize receiver sender clock rates what is

the length in clock ticks of one bit

53

Type length length or type of frame

Ethernet Frame Structure (more)

Ossi Mokryn - Data link layer

Addresses 6 bytes

if adapter receives frame with matching destination address or with

broadcast address (eg ARP packet) it passes data in frame to net-layer

protocol

otherwise adapter discards frame

MAC addresses also called Physical addresses

Type indicates the higher layer protocol (mostly IP but others

may be supported such as Novell IPX and AppleTalk)

CRC checked at receiver if error is detected the frame is

simply dropped Before CRC there is a padding field for the

CRC to pad to 64 bytes

54

28

55

Ethernet Technology 10Base2

10 10Mbps 2 under 200 meters max cable length

thin coaxial cable in a bus topology

repeaters used to connect up to multiple segments

repeater repeats bits it hears on one interface to its other

interfaces physical layer device only

Ethernet technology 100BaseT

10100 Mbps rate latter called ldquofast ethernetrdquo

T stands for Twisted Pair

Nodes connect to a hub ldquostar topologyrdquo 100 m max

distance between nodes and hub

twisted pair

hub

56

29

Ethernet technology 100BaseT

Problem must keep minimal packet size when bandwidth

increases

With fixed cable length and propagation speed must

increase minimal size proportionally to bandwidth

increase

Eg 100Mbs 1500m of cable prop remains 6μs minimal

size becomes 1200 bits

Solutions

Cable length limited to 100m

Prevent collisions by ldquoEthernet Switchesrdquo (later)

Max distance from node to Hub is 100 meters

57

58

Gbit Ethernet

use standard Ethernet frame format

allows for point-to-point links and shared broadcast channels

in shared mode CSMACD is used short distances between

nodes to be efficiency

uses hubs called here ldquoBuffered Distributorsrdquo

Full-Duplex at 1 Gbps for point-to-point links

10 Gbpsec now

30

Hubs

QWhy not just one big LAN

Limited amount of supportable traffic on single LAN

all stations must share bandwidth

limited length 8023 (Ethernet) specifies maximum

cable length

large ldquocollision domainrdquo (can collide with many

stations)

limited number of stations 8025 (token ring) have

token passing delays at each station

59

Lecture 360

Hubs (Multiport repeaters Bus in a box)

Physical Layer devices essentially repeaters operating at bit

levels repeat received bits on one interface to all other

interfaces

Can‟t interconnect 10BaseT amp 100BaseT (because

segments don‟t share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design)

with backbone hub at its top

31

61

Hubs (Multiport repeaters Bus in a box)

Each connected LAN referred to as LAN segment

Hubs do not isolate collision domains node may collide with any

node residing at any segment in LAN

Extends max distance between nodes but all the segments become

one large collision domain

Hub Advantages

simple inexpensive device

Multi-tier provides graceful degradation portions of the LAN

continue to operate if one hub malfunctions

extends maximum distance between node pairs (100m per Hub)

62

Bridges

Link Layer devices operate on Ethernet frames examining

frame header and selectively forwarding frame based on its

destination

Bridge isolates collision domains since it buffers frames

When frame is to be forwarded on segment bridge uses

CSMACD to access segment and transmit

Store and forward element So different types of Ethernet

types can be connected

Transparent no need for any change to hosts LAN adapters

Forwarding is selective do not always flood All connected

segments can work independently in parallel

32

63

Bridge Filtering

bridges learn which hosts can be reached through which

interfaces maintain filtering tables

when frame received bridge ldquolearnsrdquo location of sender

incoming LAN segment

records sender location in filtering table

filtering table entry

(Node LAN Address Bridge Interface Time Stamp)

stale entries in Filtering Table dropped (TTL can be 60 minutes)

64

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_port

if (out_port not valid) no entry found for destination

then flood forward on all but the interface on which the frame arrived

if (in_port = out_port) destination is on LAN on which frame was received

then drop the frame

Otherwise (out_port is valid) entry found for destination then forward the frame on interface indicated

33

65

Bridge Learning example

Suppose C sends frame to D and D replies back with frame

to C

C sends frame bridge has no info about D so floods to both LANs bridge notes that C is on port 1

frame ignored on upper LAN

frame received by D

66

Bridge Learning example

D generates reply to C sends

bridge sees frame from D

bridge notes that D is on interface 2

bridge knows C on interface 1 so selectivelyforwards frame out via interface 1

C 1

34

67

What will happen with loops

Incorrect learning

A

B

1 1

22

A 1 A 122

68

What will happen with loops

Frame looping

A

C

1 1

22

C C

35

69

What will happen with loops

Frame looping

A

B

1 1

22

B2 B1

70

Introducing Spanning Tree

Allow a path between every LAN without causing loops

(loop-free environment)

Bridges communicate with special configuration

messages (BPDUs)

Standardized by IEEE 8021D

Note redundant paths are good active redundant paths are bad (they cause

loops)

36

How to Construct a Spanning Tree

Bridges run a distributed spanning tree

Algorithm

Select what ports (and bridges) should actively forward

frames

Finding the root flooding

Building a tree Bellman-Ford Algorithm

Can combine efficiently

Standardized in IEEE 8021 specification

71

72

Spanning Tree Requirements

Each bridge is assigned a unique identifier

A broadcast address for bridges on a LAN

A unique port identifier for all ports on all bridges

MAC address

Bridge id + port number

37

73

Spanning Tree Concepts

Root Bridge The bridge with the lowest bridge ID value is elected the

root bridge

One root bridge chosen among all bridges

Every other bridge calculates a path to the root bridge

74

Spanning Tree Concepts

Path Cost A cost associated with each port on each bridge

default is 1

The cost associated with transmission onto the LAN

connected to the port

Can be manually or automatically assigned

Can be used to alter the path to the root bridge

38

75

Spanning Tree Concepts

Root Port The port on each bridge that is on the path towards the

root bridge

The root port is part of the lowest cost path towards

the root bridge

If port costs are equal on a bridge the port with the

lowest ID becomes root port

76

Spanning Tree Concepts

Root Path Cost The minimum cost path to the root bridge

The cost starts at the root bridge

Each bridge computes root path cost independently

based on their view of the network

39

77

Spanning Tree Concepts Designated

Bridge Only one bridge on a LAN at one time is chosen the

designated bridge

This bridge provides the minimum cost path to the root

bridge for the LAN

Only the designated bridge passes frames towards the

root bridge

78

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Protocol operation1 Picks a root2 For each LAN

picks a designated bridgethat is closest to the root

3 All bridges on a LANsend packets towards the root via the designatedbridge

B8

40

79

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

80

Spanning Tree Algorithm

An Overview 1 Determine the root bridge among all bridges

2 Each bridge determines its root port

The port in the direction of the root bridge

3 Determine the designated bridge on each LAN

The bridge which accepts frames to forward towards the root bridge

The frames are sent on the root port of the designated bridge

41

81

Spanning Tree Algorithm

Selecting Root Bridge Initially each bridge considers itself to be the root bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

Best one wins

(lowest root IDcostpriority)

82

Spanning Tree Algorithm

Selecting Root Ports Each bridge selects one of its ports which has the

minimal cost to the root bridge

In case of a tie the lowest uplink (transmitter) bridge ID is

used

In case of another tie the lowest port ID is used

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 4: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

4

Physical Media (Examples)

Coaxial cable

Two concentric shielded wires

Baseband

single channel on cable

broadband

multiple channel on cable

common uses for 10-Mbps Ethernet and TV cables

7

Physical Media (Examples)

Fiber

Glass fiber carrying light pulses

Single mode or multi mode

High point-to-point speed

Very low error rate (caused by low fiber‟s attenuation)

Secured

Common used for 100-Mbps Ethernet and 1000-Mbps

Ethernet (ldquoGigabit Ethernetrdquo)

8

5

Physical Media (Examples)

Many more

Radio bands (WiFi high bit error rate)

Microwave (Requires hosts in light of sight)

Satellite (very slow RTT)

9

Link Layer Services

Recall that were actually considering the MAC layer in the IEEE

802 model

Framing (Frame structure)

encapsulate datagram into frame adding header trailer

Link Access (The protocol)

Addressing

Introduces ldquoMACrdquo addresses used in frame headers to identify hosts

(actually NICs) who are part of the network

Different for IP addresses

Channel Access

Defines the set of rules which allows the hosts to use the (possibly

shared) medium

10

6

Link Layer Services

Flow Control

pacing between adjacent sending and receiving nodes

Error Detection

errors caused by signal attenuation noise

receiver detects presence of errors

signals sender for retransmission or drops frame

Error Correction

receiver identifies and corrects bit error(s) without resorting to

retransmission

Half-duplex and full-duplex

with half duplex nodes at both ends of link can transmit but not at same

time

RDT

Offers some reliability between the hosts (Why is this redundant)

11

Link Layer Services

link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card

80211 card

sending side encapsulates datagram in a

frame

adds error checking bits rdt flow control etc

receiving side looks for errors rdt flow

control etc

extracts datagram passes to rcving node

adapter is semi-autonomous

link amp physical layers

sendingnode

frame

rcvingnode

datagram

frame

adapter adapter

link layer protocol

12

7

Link Types

Three types of ldquolinksrdquo

point-to-point (P2P)

PPP for dial-up access

Point-to-point link between

Ethernet switch and host

Switched Networks

ATM (used for WAN)

Broadcast

Traditional Ethernet and its

predecessors

Upstream HFC

80211 wireless LAN

We‟ll focus on Broadcast

media

13

Multiple Access protocols

Ossi Mokryn - Data link layer

single shared broadcast channel

two or more simultaneous transmissions by nodes interference

collision if node receives two or more signals at the same

time

Multiple ACcess (MAC) Protocol

distributed algorithm that determines how nodes share channel

ie determine when node can transmit

communication about channel sharing must use channel itself

no out-of-band channel for coordination

14

8

Human Analogy

15

Rules for bdquoparty conversation‟

Give everyone a chance to speak

Dont speak until you are spoken to

Dont monopolize the conversation

Raise your hand if you have a question

Dont interrupt when someone is speaking

Dont fall asleep when someone else is talking

MAC Protocols measures

Assume a shared medium with a channel rate of R [bpsec]

Efficient

When one node wants to transmit it ca send at rate R

Fair

When N users want to transmit each can send at average rate RN

Decentralized

No special node uses to coordinate transmission (no ldquoleaderrdquo)

No synchronization of clocks or slots

Fault tolerant

Simple

Should be very fast and implemented in NICs firmware

16

9

MAC Protocol Types

Three broad classes

Channel Partitioning

Divide channel into smaller ldquopiecesrdquo (Time-Slots Frequancy-Bands

or by code)

allocate piece to a node for exclusive its use

Random Access

Channel not divided allow collisions

ldquoRecoverrdquo from collisions

ldquoTaking turnsrdquo

Nodes take turns but nodes with more to send can take longer

turns

Might uses a leader to coordinate the turns

17

Channel Partitioning MAC protocols TDMA

TDMA (Time Division Multiple Access)

Access the channel in roundsldquo

Each station gets fixed length slot (length = packets trans time) in each

round Each slot called a Time-Slot

Unused slots go idle

Example 6-station LAN 134 have packtes slots 256 idle

18

10

Channel 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 134 have packets frequency bands 256 idle

frequ

ency

ban

ds

19

TDM FDM summary

FDM Enables the division of a channel with capacity C

bits per seconds to N sub-channels each gets a different

frequency range and capacity of CN

TDM The division of channel to N sub-channels each

gets CN capacity by giving the entire channel to each of

the N stations for 1N of the time

The division makes each sub channel less busy but the

overall waiting time is bigger by a factor of N compared

to having one channel (Little theorem)

20

11

Channel Partitioning MAC protocols CDMA

Code Division Multiple Access (CDMA)

used in several wireless broadcast channels (cellular satellite etc) standards

unique ldquocoderdquo assigned to each user ie code set partitioning

all users share same frequency but each user has own ldquochippingrdquo sequence (ie code) to encode data

encoded signal = (original data) X (chipping sequence)

decoding inner-product of encoded signal and chipping sequence

allows multiple users to ldquocoexistrdquo and transmit simultaneously with minimal interference (if codes are ldquoorthogonalrdquo)21

Random Access MAC Protocols

From here on we‟ll focus on Random Access MAC 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 ldquocollisionrdquo

Random access MAC protocol specifies

How to detect collisions

How to recover from collisions

Examples of random access MAC protocols

ALOHA

slotted ALOHA

CSMACD (Ethernet)

CSMACA (Wireless)

22

12

Aloha Protocol

Invented at the ‟70s in Hawaii

Intended for Radio networks but suitable for every

network where the station can listen to the channel while

broadcasting and determine whether others also transmit

Basic idea every station may transmit when it wants to If

collision is detected between frames back off and try

again later

If two frames are broadcast at the same time on the channel a

collision occurs and the both need to retransmit

23

Aloha Protocol

All hosts

Transmit on one frequency (fT)

Receive on other frequency (fR)

There is a central node which repeats whatever it receives

from fT frequency on the other fR frequency

The central node used as a repeater

Collisions are detected by the hosts

Receiving corrupted data (host knows what should be

received)

24

13

Aloha Protocol

1 Accept a new frame arrives

2 Transmit immediately and listen

If a collision occurred wait a random time and

repeat to stage 2

Otherwise go back to stage 1 to handle a new frame

25

Aloha Protocol

Simple

Robust against failure of a host

Distributed (excluding the central node which uses as a

repeater)

High load implicates low utilization of the channel and high

delays

26

14

Aloha - efficiency

Only 18

Suppose there are n stations and the probability that a

station starts transmitting in a time unit is p

Then The probability that exactly one node transmits

in a time unit is

27

Efficiency is the long-run fraction of successful transmissions when there are many nodes each with many frames to send

Aloha - efficiency

Only 18

Maximize the utilization function by differentiation

yields maximum point at with utilization

of

Trivial improvement

Why be vulnerable for 2 time units

Synchronize and use slotted time May transmit only

at integer times

28

Efficiency is the long-run fraction of successful transmissions when there are many nodes each with many frames to send

15

Slotted 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

29

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

Cons

collisions wasting slots

idle slots

nodes may be able to detect collision in less than time to transmit packet

clock synchronization

30

16

Slotted Aloha - efficiency

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

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 1e = 37

Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send

At best channelused for useful transmissions 37of time

31

Aloha - Summary

Very popular at the beginning of time (ie 70s to 80s)

Very simple to handle

Lots and lots of basic probabilities calculations for

students

Major problem Nodes don‟t check what‟s going on in the

channel each acting on its own No manners

32

17

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

Protocol

1 Listen to the channel

2 If channel sensed idle transmit entire frame

3 If channel sensed busy defer transmission by

1-Persistent CSMA

Wait until channel is quiet and transmit immediately If collision

occurs wait a random time and listen again (go to 1)

Non-Persistent CSMA

Wait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission

CSMA human analogy don‟t interrupt others

33

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMA

When transmitting try to sense if there is a collision

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

34

18

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots

adapter doesn‟t transmit if it

senses that some other

adapter is transmitting that is

carrier sense

transmitting adapter aborts

when it senses that another

adapter is transmitting that is

collision detection

Before attempting a

retransmission adapter

waits a random time that

is random access

36

19

Unreliable connectionless service

Connectionless No handshaking between sending and

receiving adapter

Unreliable receiving adapter doesn‟t send acks or nacks to

sending adapter

stream of datagrams passed to network layer can have gaps

gaps will be filled if app is using TCP

otherwise app will see the gaps

37

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other

transmitters are aware of

collision 48 bits

Bit time 1 microsec for 10 Mbps

Ethernet

for K=1023 wait time is about

50 msec

Exponential Backoff

Goal adapt retransmission

attempts to estimated current

load

heavy load random wait will be

longer

first collision choose K from

01 delay is K 512 bit

transmission times

after second collision choose K

from 0123hellip

after ten collisions choose K

from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

38

20

8023 CSMACD (Ethernet) Algorithm

39

Ethernet CSMACD algorithm

1 Adaptor receives datagram

from net layer amp creates frame

2 If adapter senses channel idle it

starts to transmit frame If it

senses channel busy waits until

channel idle and then transmits

3 If adapter transmits entire

frame without detecting

another transmission the

adapter is done with frame

4 If adapter detects another

transmission while transmitting

aborts and sends jam signal

5 After aborting adapter enters

exponential backoff after

the mth collision adapter

chooses a K at random from

012hellip2m-1 Adapter waits

K512 bit times and returns to

Step 2

40

21

Ethernet Minimum Packet Size

41

Summary of MAC protocols

What do you do with a shared media

Channel Partitioning by time frequency or code

Time Division Frequency Division Code Division

Random partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACD

carrier sensing easy in some technologies (wire) hard in

others (wireless)

CSMACD used in Ethernet

CSMACA used in 80211 (Wireless)

42

22

LAN technologies

Data link layer so far

MAC protocols The random protocol approach

Next LAN technologies

Addressing

Ethernet

Hubs bridges and switches

43

MAC Addresses and ARP

32-bit IP address network-layer address

used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet)

address used to get datagram from one interface to another physically-

connected interface (same network)

48 bit MAC address (for most LANs)

burned in the adapter ROM but can be modified

44

23

LAN Addresses and ARP

Each adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN(wired orwireless)

45

LAN Address (more)

MAC address allocation administered by IEEE

manufacturer buys portion of MAC address space (to assure

uniqueness)

Analogy

(a) MAC address like Social Security Number

(b) IP address like postal address

MAC flat address portability

can move LAN card from one LAN to another

IP hierarchical address NOT portable

depends on IP subnet to which node is attached

46

24

ARP Address Resolution Protocol

Each IP node (Host Router)

on LAN has ARP table

ARP Table IPMAC address

mappings for some LAN

nodes

lt IP address MAC address TTLgt

TTL (Time To Live) time after

which address mapping will be

forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

237196723

237196778

237196714

237196788

47

ARP protocol Same LAN (network)

A wants to send datagram to B

and B‟s MAC address not in A‟s

ARP table

A broadcasts ARP query packet

containing Bs IP address

Dest MAC address = FF-FF-

FF-FF-FF-FF

all machines on LAN receive

ARP query

B receives ARP packet replies to

A with its (Bs) MAC address

frame sent to A‟s MAC address

(unicast)

A caches (saves) IP-to-MAC

address pair in its ARP table until

information becomes old (times

out)

soft state information that

times out (goes away) unless

refreshed

ARP is ldquoplug-and-playrdquo

nodes create their ARP tables

without intervention from net

administrator

48

25

Routing to another LANwalkthrough send datagram from A to B via R

assume A know‟s B IP address

Two ARP tables in router R one for each IP network (LAN)

In routing table at source Host find router 111111111110

In ARP table at source find MAC address E6-E9-00-17-BB-4B etc

A

RB

49

Ossi Mokryn - Data link layer

A creates datagram with source A destination B

A uses ARP to get R‟s MAC address for 111111111110

A creates link-layer frame with Rs MAC address as dest frame

contains A-to-B IP datagram

A‟s adapter sends frame

R‟s adapter receives frame

R removes IP datagram from Ethernet frame sees its destined to B

R uses ARP to get B‟s MAC address

R creates frame containing A-to-B IP datagram sends to B

A

RB

50

26

Ethernet

ldquodominantrdquo wired LAN technology developed at the 70s

cheap $20 for 100Mbs

first widely used LAN technology

Simple cheap

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

51

Ethernet topology Through the Years

Classic Ethernet Now star topology prevails

Connection choices hub or switch (more later)

Fast Ethernet 100 Mbs

Gigabit Ethernet 1Gbps

52

hub orswitch

bull Shared Bus with CSMACDbull Bus maximal length 500 mbullTransmission rate 10Mbs

Through the years the only common is The Frame

27

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network

layer protocol packet) in Ethernet frame

Preamble

7 bytes with pattern 10101010 followed by one byte with

pattern 10101011

used to synchronize receiver sender clock rates what is

the length in clock ticks of one bit

53

Type length length or type of frame

Ethernet Frame Structure (more)

Ossi Mokryn - Data link layer

Addresses 6 bytes

if adapter receives frame with matching destination address or with

broadcast address (eg ARP packet) it passes data in frame to net-layer

protocol

otherwise adapter discards frame

MAC addresses also called Physical addresses

Type indicates the higher layer protocol (mostly IP but others

may be supported such as Novell IPX and AppleTalk)

CRC checked at receiver if error is detected the frame is

simply dropped Before CRC there is a padding field for the

CRC to pad to 64 bytes

54

28

55

Ethernet Technology 10Base2

10 10Mbps 2 under 200 meters max cable length

thin coaxial cable in a bus topology

repeaters used to connect up to multiple segments

repeater repeats bits it hears on one interface to its other

interfaces physical layer device only

Ethernet technology 100BaseT

10100 Mbps rate latter called ldquofast ethernetrdquo

T stands for Twisted Pair

Nodes connect to a hub ldquostar topologyrdquo 100 m max

distance between nodes and hub

twisted pair

hub

56

29

Ethernet technology 100BaseT

Problem must keep minimal packet size when bandwidth

increases

With fixed cable length and propagation speed must

increase minimal size proportionally to bandwidth

increase

Eg 100Mbs 1500m of cable prop remains 6μs minimal

size becomes 1200 bits

Solutions

Cable length limited to 100m

Prevent collisions by ldquoEthernet Switchesrdquo (later)

Max distance from node to Hub is 100 meters

57

58

Gbit Ethernet

use standard Ethernet frame format

allows for point-to-point links and shared broadcast channels

in shared mode CSMACD is used short distances between

nodes to be efficiency

uses hubs called here ldquoBuffered Distributorsrdquo

Full-Duplex at 1 Gbps for point-to-point links

10 Gbpsec now

30

Hubs

QWhy not just one big LAN

Limited amount of supportable traffic on single LAN

all stations must share bandwidth

limited length 8023 (Ethernet) specifies maximum

cable length

large ldquocollision domainrdquo (can collide with many

stations)

limited number of stations 8025 (token ring) have

token passing delays at each station

59

Lecture 360

Hubs (Multiport repeaters Bus in a box)

Physical Layer devices essentially repeaters operating at bit

levels repeat received bits on one interface to all other

interfaces

Can‟t interconnect 10BaseT amp 100BaseT (because

segments don‟t share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design)

with backbone hub at its top

31

61

Hubs (Multiport repeaters Bus in a box)

Each connected LAN referred to as LAN segment

Hubs do not isolate collision domains node may collide with any

node residing at any segment in LAN

Extends max distance between nodes but all the segments become

one large collision domain

Hub Advantages

simple inexpensive device

Multi-tier provides graceful degradation portions of the LAN

continue to operate if one hub malfunctions

extends maximum distance between node pairs (100m per Hub)

62

Bridges

Link Layer devices operate on Ethernet frames examining

frame header and selectively forwarding frame based on its

destination

Bridge isolates collision domains since it buffers frames

When frame is to be forwarded on segment bridge uses

CSMACD to access segment and transmit

Store and forward element So different types of Ethernet

types can be connected

Transparent no need for any change to hosts LAN adapters

Forwarding is selective do not always flood All connected

segments can work independently in parallel

32

63

Bridge Filtering

bridges learn which hosts can be reached through which

interfaces maintain filtering tables

when frame received bridge ldquolearnsrdquo location of sender

incoming LAN segment

records sender location in filtering table

filtering table entry

(Node LAN Address Bridge Interface Time Stamp)

stale entries in Filtering Table dropped (TTL can be 60 minutes)

64

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_port

if (out_port not valid) no entry found for destination

then flood forward on all but the interface on which the frame arrived

if (in_port = out_port) destination is on LAN on which frame was received

then drop the frame

Otherwise (out_port is valid) entry found for destination then forward the frame on interface indicated

33

65

Bridge Learning example

Suppose C sends frame to D and D replies back with frame

to C

C sends frame bridge has no info about D so floods to both LANs bridge notes that C is on port 1

frame ignored on upper LAN

frame received by D

66

Bridge Learning example

D generates reply to C sends

bridge sees frame from D

bridge notes that D is on interface 2

bridge knows C on interface 1 so selectivelyforwards frame out via interface 1

C 1

34

67

What will happen with loops

Incorrect learning

A

B

1 1

22

A 1 A 122

68

What will happen with loops

Frame looping

A

C

1 1

22

C C

35

69

What will happen with loops

Frame looping

A

B

1 1

22

B2 B1

70

Introducing Spanning Tree

Allow a path between every LAN without causing loops

(loop-free environment)

Bridges communicate with special configuration

messages (BPDUs)

Standardized by IEEE 8021D

Note redundant paths are good active redundant paths are bad (they cause

loops)

36

How to Construct a Spanning Tree

Bridges run a distributed spanning tree

Algorithm

Select what ports (and bridges) should actively forward

frames

Finding the root flooding

Building a tree Bellman-Ford Algorithm

Can combine efficiently

Standardized in IEEE 8021 specification

71

72

Spanning Tree Requirements

Each bridge is assigned a unique identifier

A broadcast address for bridges on a LAN

A unique port identifier for all ports on all bridges

MAC address

Bridge id + port number

37

73

Spanning Tree Concepts

Root Bridge The bridge with the lowest bridge ID value is elected the

root bridge

One root bridge chosen among all bridges

Every other bridge calculates a path to the root bridge

74

Spanning Tree Concepts

Path Cost A cost associated with each port on each bridge

default is 1

The cost associated with transmission onto the LAN

connected to the port

Can be manually or automatically assigned

Can be used to alter the path to the root bridge

38

75

Spanning Tree Concepts

Root Port The port on each bridge that is on the path towards the

root bridge

The root port is part of the lowest cost path towards

the root bridge

If port costs are equal on a bridge the port with the

lowest ID becomes root port

76

Spanning Tree Concepts

Root Path Cost The minimum cost path to the root bridge

The cost starts at the root bridge

Each bridge computes root path cost independently

based on their view of the network

39

77

Spanning Tree Concepts Designated

Bridge Only one bridge on a LAN at one time is chosen the

designated bridge

This bridge provides the minimum cost path to the root

bridge for the LAN

Only the designated bridge passes frames towards the

root bridge

78

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Protocol operation1 Picks a root2 For each LAN

picks a designated bridgethat is closest to the root

3 All bridges on a LANsend packets towards the root via the designatedbridge

B8

40

79

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

80

Spanning Tree Algorithm

An Overview 1 Determine the root bridge among all bridges

2 Each bridge determines its root port

The port in the direction of the root bridge

3 Determine the designated bridge on each LAN

The bridge which accepts frames to forward towards the root bridge

The frames are sent on the root port of the designated bridge

41

81

Spanning Tree Algorithm

Selecting Root Bridge Initially each bridge considers itself to be the root bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

Best one wins

(lowest root IDcostpriority)

82

Spanning Tree Algorithm

Selecting Root Ports Each bridge selects one of its ports which has the

minimal cost to the root bridge

In case of a tie the lowest uplink (transmitter) bridge ID is

used

In case of another tie the lowest port ID is used

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 5: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

5

Physical Media (Examples)

Many more

Radio bands (WiFi high bit error rate)

Microwave (Requires hosts in light of sight)

Satellite (very slow RTT)

9

Link Layer Services

Recall that were actually considering the MAC layer in the IEEE

802 model

Framing (Frame structure)

encapsulate datagram into frame adding header trailer

Link Access (The protocol)

Addressing

Introduces ldquoMACrdquo addresses used in frame headers to identify hosts

(actually NICs) who are part of the network

Different for IP addresses

Channel Access

Defines the set of rules which allows the hosts to use the (possibly

shared) medium

10

6

Link Layer Services

Flow Control

pacing between adjacent sending and receiving nodes

Error Detection

errors caused by signal attenuation noise

receiver detects presence of errors

signals sender for retransmission or drops frame

Error Correction

receiver identifies and corrects bit error(s) without resorting to

retransmission

Half-duplex and full-duplex

with half duplex nodes at both ends of link can transmit but not at same

time

RDT

Offers some reliability between the hosts (Why is this redundant)

11

Link Layer Services

link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card

80211 card

sending side encapsulates datagram in a

frame

adds error checking bits rdt flow control etc

receiving side looks for errors rdt flow

control etc

extracts datagram passes to rcving node

adapter is semi-autonomous

link amp physical layers

sendingnode

frame

rcvingnode

datagram

frame

adapter adapter

link layer protocol

12

7

Link Types

Three types of ldquolinksrdquo

point-to-point (P2P)

PPP for dial-up access

Point-to-point link between

Ethernet switch and host

Switched Networks

ATM (used for WAN)

Broadcast

Traditional Ethernet and its

predecessors

Upstream HFC

80211 wireless LAN

We‟ll focus on Broadcast

media

13

Multiple Access protocols

Ossi Mokryn - Data link layer

single shared broadcast channel

two or more simultaneous transmissions by nodes interference

collision if node receives two or more signals at the same

time

Multiple ACcess (MAC) Protocol

distributed algorithm that determines how nodes share channel

ie determine when node can transmit

communication about channel sharing must use channel itself

no out-of-band channel for coordination

14

8

Human Analogy

15

Rules for bdquoparty conversation‟

Give everyone a chance to speak

Dont speak until you are spoken to

Dont monopolize the conversation

Raise your hand if you have a question

Dont interrupt when someone is speaking

Dont fall asleep when someone else is talking

MAC Protocols measures

Assume a shared medium with a channel rate of R [bpsec]

Efficient

When one node wants to transmit it ca send at rate R

Fair

When N users want to transmit each can send at average rate RN

Decentralized

No special node uses to coordinate transmission (no ldquoleaderrdquo)

No synchronization of clocks or slots

Fault tolerant

Simple

Should be very fast and implemented in NICs firmware

16

9

MAC Protocol Types

Three broad classes

Channel Partitioning

Divide channel into smaller ldquopiecesrdquo (Time-Slots Frequancy-Bands

or by code)

allocate piece to a node for exclusive its use

Random Access

Channel not divided allow collisions

ldquoRecoverrdquo from collisions

ldquoTaking turnsrdquo

Nodes take turns but nodes with more to send can take longer

turns

Might uses a leader to coordinate the turns

17

Channel Partitioning MAC protocols TDMA

TDMA (Time Division Multiple Access)

Access the channel in roundsldquo

Each station gets fixed length slot (length = packets trans time) in each

round Each slot called a Time-Slot

Unused slots go idle

Example 6-station LAN 134 have packtes slots 256 idle

18

10

Channel 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 134 have packets frequency bands 256 idle

frequ

ency

ban

ds

19

TDM FDM summary

FDM Enables the division of a channel with capacity C

bits per seconds to N sub-channels each gets a different

frequency range and capacity of CN

TDM The division of channel to N sub-channels each

gets CN capacity by giving the entire channel to each of

the N stations for 1N of the time

The division makes each sub channel less busy but the

overall waiting time is bigger by a factor of N compared

to having one channel (Little theorem)

20

11

Channel Partitioning MAC protocols CDMA

Code Division Multiple Access (CDMA)

used in several wireless broadcast channels (cellular satellite etc) standards

unique ldquocoderdquo assigned to each user ie code set partitioning

all users share same frequency but each user has own ldquochippingrdquo sequence (ie code) to encode data

encoded signal = (original data) X (chipping sequence)

decoding inner-product of encoded signal and chipping sequence

allows multiple users to ldquocoexistrdquo and transmit simultaneously with minimal interference (if codes are ldquoorthogonalrdquo)21

Random Access MAC Protocols

From here on we‟ll focus on Random Access MAC 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 ldquocollisionrdquo

Random access MAC protocol specifies

How to detect collisions

How to recover from collisions

Examples of random access MAC protocols

ALOHA

slotted ALOHA

CSMACD (Ethernet)

CSMACA (Wireless)

22

12

Aloha Protocol

Invented at the ‟70s in Hawaii

Intended for Radio networks but suitable for every

network where the station can listen to the channel while

broadcasting and determine whether others also transmit

Basic idea every station may transmit when it wants to If

collision is detected between frames back off and try

again later

If two frames are broadcast at the same time on the channel a

collision occurs and the both need to retransmit

23

Aloha Protocol

All hosts

Transmit on one frequency (fT)

Receive on other frequency (fR)

There is a central node which repeats whatever it receives

from fT frequency on the other fR frequency

The central node used as a repeater

Collisions are detected by the hosts

Receiving corrupted data (host knows what should be

received)

24

13

Aloha Protocol

1 Accept a new frame arrives

2 Transmit immediately and listen

If a collision occurred wait a random time and

repeat to stage 2

Otherwise go back to stage 1 to handle a new frame

25

Aloha Protocol

Simple

Robust against failure of a host

Distributed (excluding the central node which uses as a

repeater)

High load implicates low utilization of the channel and high

delays

26

14

Aloha - efficiency

Only 18

Suppose there are n stations and the probability that a

station starts transmitting in a time unit is p

Then The probability that exactly one node transmits

in a time unit is

27

Efficiency is the long-run fraction of successful transmissions when there are many nodes each with many frames to send

Aloha - efficiency

Only 18

Maximize the utilization function by differentiation

yields maximum point at with utilization

of

Trivial improvement

Why be vulnerable for 2 time units

Synchronize and use slotted time May transmit only

at integer times

28

Efficiency is the long-run fraction of successful transmissions when there are many nodes each with many frames to send

15

Slotted 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

29

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

Cons

collisions wasting slots

idle slots

nodes may be able to detect collision in less than time to transmit packet

clock synchronization

30

16

Slotted Aloha - efficiency

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

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 1e = 37

Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send

At best channelused for useful transmissions 37of time

31

Aloha - Summary

Very popular at the beginning of time (ie 70s to 80s)

Very simple to handle

Lots and lots of basic probabilities calculations for

students

Major problem Nodes don‟t check what‟s going on in the

channel each acting on its own No manners

32

17

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

Protocol

1 Listen to the channel

2 If channel sensed idle transmit entire frame

3 If channel sensed busy defer transmission by

1-Persistent CSMA

Wait until channel is quiet and transmit immediately If collision

occurs wait a random time and listen again (go to 1)

Non-Persistent CSMA

Wait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission

CSMA human analogy don‟t interrupt others

33

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMA

When transmitting try to sense if there is a collision

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

34

18

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots

adapter doesn‟t transmit if it

senses that some other

adapter is transmitting that is

carrier sense

transmitting adapter aborts

when it senses that another

adapter is transmitting that is

collision detection

Before attempting a

retransmission adapter

waits a random time that

is random access

36

19

Unreliable connectionless service

Connectionless No handshaking between sending and

receiving adapter

Unreliable receiving adapter doesn‟t send acks or nacks to

sending adapter

stream of datagrams passed to network layer can have gaps

gaps will be filled if app is using TCP

otherwise app will see the gaps

37

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other

transmitters are aware of

collision 48 bits

Bit time 1 microsec for 10 Mbps

Ethernet

for K=1023 wait time is about

50 msec

Exponential Backoff

Goal adapt retransmission

attempts to estimated current

load

heavy load random wait will be

longer

first collision choose K from

01 delay is K 512 bit

transmission times

after second collision choose K

from 0123hellip

after ten collisions choose K

from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

38

20

8023 CSMACD (Ethernet) Algorithm

39

Ethernet CSMACD algorithm

1 Adaptor receives datagram

from net layer amp creates frame

2 If adapter senses channel idle it

starts to transmit frame If it

senses channel busy waits until

channel idle and then transmits

3 If adapter transmits entire

frame without detecting

another transmission the

adapter is done with frame

4 If adapter detects another

transmission while transmitting

aborts and sends jam signal

5 After aborting adapter enters

exponential backoff after

the mth collision adapter

chooses a K at random from

012hellip2m-1 Adapter waits

K512 bit times and returns to

Step 2

40

21

Ethernet Minimum Packet Size

41

Summary of MAC protocols

What do you do with a shared media

Channel Partitioning by time frequency or code

Time Division Frequency Division Code Division

Random partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACD

carrier sensing easy in some technologies (wire) hard in

others (wireless)

CSMACD used in Ethernet

CSMACA used in 80211 (Wireless)

42

22

LAN technologies

Data link layer so far

MAC protocols The random protocol approach

Next LAN technologies

Addressing

Ethernet

Hubs bridges and switches

43

MAC Addresses and ARP

32-bit IP address network-layer address

used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet)

address used to get datagram from one interface to another physically-

connected interface (same network)

48 bit MAC address (for most LANs)

burned in the adapter ROM but can be modified

44

23

LAN Addresses and ARP

Each adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN(wired orwireless)

45

LAN Address (more)

MAC address allocation administered by IEEE

manufacturer buys portion of MAC address space (to assure

uniqueness)

Analogy

(a) MAC address like Social Security Number

(b) IP address like postal address

MAC flat address portability

can move LAN card from one LAN to another

IP hierarchical address NOT portable

depends on IP subnet to which node is attached

46

24

ARP Address Resolution Protocol

Each IP node (Host Router)

on LAN has ARP table

ARP Table IPMAC address

mappings for some LAN

nodes

lt IP address MAC address TTLgt

TTL (Time To Live) time after

which address mapping will be

forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

237196723

237196778

237196714

237196788

47

ARP protocol Same LAN (network)

A wants to send datagram to B

and B‟s MAC address not in A‟s

ARP table

A broadcasts ARP query packet

containing Bs IP address

Dest MAC address = FF-FF-

FF-FF-FF-FF

all machines on LAN receive

ARP query

B receives ARP packet replies to

A with its (Bs) MAC address

frame sent to A‟s MAC address

(unicast)

A caches (saves) IP-to-MAC

address pair in its ARP table until

information becomes old (times

out)

soft state information that

times out (goes away) unless

refreshed

ARP is ldquoplug-and-playrdquo

nodes create their ARP tables

without intervention from net

administrator

48

25

Routing to another LANwalkthrough send datagram from A to B via R

assume A know‟s B IP address

Two ARP tables in router R one for each IP network (LAN)

In routing table at source Host find router 111111111110

In ARP table at source find MAC address E6-E9-00-17-BB-4B etc

A

RB

49

Ossi Mokryn - Data link layer

A creates datagram with source A destination B

A uses ARP to get R‟s MAC address for 111111111110

A creates link-layer frame with Rs MAC address as dest frame

contains A-to-B IP datagram

A‟s adapter sends frame

R‟s adapter receives frame

R removes IP datagram from Ethernet frame sees its destined to B

R uses ARP to get B‟s MAC address

R creates frame containing A-to-B IP datagram sends to B

A

RB

50

26

Ethernet

ldquodominantrdquo wired LAN technology developed at the 70s

cheap $20 for 100Mbs

first widely used LAN technology

Simple cheap

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

51

Ethernet topology Through the Years

Classic Ethernet Now star topology prevails

Connection choices hub or switch (more later)

Fast Ethernet 100 Mbs

Gigabit Ethernet 1Gbps

52

hub orswitch

bull Shared Bus with CSMACDbull Bus maximal length 500 mbullTransmission rate 10Mbs

Through the years the only common is The Frame

27

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network

layer protocol packet) in Ethernet frame

Preamble

7 bytes with pattern 10101010 followed by one byte with

pattern 10101011

used to synchronize receiver sender clock rates what is

the length in clock ticks of one bit

53

Type length length or type of frame

Ethernet Frame Structure (more)

Ossi Mokryn - Data link layer

Addresses 6 bytes

if adapter receives frame with matching destination address or with

broadcast address (eg ARP packet) it passes data in frame to net-layer

protocol

otherwise adapter discards frame

MAC addresses also called Physical addresses

Type indicates the higher layer protocol (mostly IP but others

may be supported such as Novell IPX and AppleTalk)

CRC checked at receiver if error is detected the frame is

simply dropped Before CRC there is a padding field for the

CRC to pad to 64 bytes

54

28

55

Ethernet Technology 10Base2

10 10Mbps 2 under 200 meters max cable length

thin coaxial cable in a bus topology

repeaters used to connect up to multiple segments

repeater repeats bits it hears on one interface to its other

interfaces physical layer device only

Ethernet technology 100BaseT

10100 Mbps rate latter called ldquofast ethernetrdquo

T stands for Twisted Pair

Nodes connect to a hub ldquostar topologyrdquo 100 m max

distance between nodes and hub

twisted pair

hub

56

29

Ethernet technology 100BaseT

Problem must keep minimal packet size when bandwidth

increases

With fixed cable length and propagation speed must

increase minimal size proportionally to bandwidth

increase

Eg 100Mbs 1500m of cable prop remains 6μs minimal

size becomes 1200 bits

Solutions

Cable length limited to 100m

Prevent collisions by ldquoEthernet Switchesrdquo (later)

Max distance from node to Hub is 100 meters

57

58

Gbit Ethernet

use standard Ethernet frame format

allows for point-to-point links and shared broadcast channels

in shared mode CSMACD is used short distances between

nodes to be efficiency

uses hubs called here ldquoBuffered Distributorsrdquo

Full-Duplex at 1 Gbps for point-to-point links

10 Gbpsec now

30

Hubs

QWhy not just one big LAN

Limited amount of supportable traffic on single LAN

all stations must share bandwidth

limited length 8023 (Ethernet) specifies maximum

cable length

large ldquocollision domainrdquo (can collide with many

stations)

limited number of stations 8025 (token ring) have

token passing delays at each station

59

Lecture 360

Hubs (Multiport repeaters Bus in a box)

Physical Layer devices essentially repeaters operating at bit

levels repeat received bits on one interface to all other

interfaces

Can‟t interconnect 10BaseT amp 100BaseT (because

segments don‟t share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design)

with backbone hub at its top

31

61

Hubs (Multiport repeaters Bus in a box)

Each connected LAN referred to as LAN segment

Hubs do not isolate collision domains node may collide with any

node residing at any segment in LAN

Extends max distance between nodes but all the segments become

one large collision domain

Hub Advantages

simple inexpensive device

Multi-tier provides graceful degradation portions of the LAN

continue to operate if one hub malfunctions

extends maximum distance between node pairs (100m per Hub)

62

Bridges

Link Layer devices operate on Ethernet frames examining

frame header and selectively forwarding frame based on its

destination

Bridge isolates collision domains since it buffers frames

When frame is to be forwarded on segment bridge uses

CSMACD to access segment and transmit

Store and forward element So different types of Ethernet

types can be connected

Transparent no need for any change to hosts LAN adapters

Forwarding is selective do not always flood All connected

segments can work independently in parallel

32

63

Bridge Filtering

bridges learn which hosts can be reached through which

interfaces maintain filtering tables

when frame received bridge ldquolearnsrdquo location of sender

incoming LAN segment

records sender location in filtering table

filtering table entry

(Node LAN Address Bridge Interface Time Stamp)

stale entries in Filtering Table dropped (TTL can be 60 minutes)

64

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_port

if (out_port not valid) no entry found for destination

then flood forward on all but the interface on which the frame arrived

if (in_port = out_port) destination is on LAN on which frame was received

then drop the frame

Otherwise (out_port is valid) entry found for destination then forward the frame on interface indicated

33

65

Bridge Learning example

Suppose C sends frame to D and D replies back with frame

to C

C sends frame bridge has no info about D so floods to both LANs bridge notes that C is on port 1

frame ignored on upper LAN

frame received by D

66

Bridge Learning example

D generates reply to C sends

bridge sees frame from D

bridge notes that D is on interface 2

bridge knows C on interface 1 so selectivelyforwards frame out via interface 1

C 1

34

67

What will happen with loops

Incorrect learning

A

B

1 1

22

A 1 A 122

68

What will happen with loops

Frame looping

A

C

1 1

22

C C

35

69

What will happen with loops

Frame looping

A

B

1 1

22

B2 B1

70

Introducing Spanning Tree

Allow a path between every LAN without causing loops

(loop-free environment)

Bridges communicate with special configuration

messages (BPDUs)

Standardized by IEEE 8021D

Note redundant paths are good active redundant paths are bad (they cause

loops)

36

How to Construct a Spanning Tree

Bridges run a distributed spanning tree

Algorithm

Select what ports (and bridges) should actively forward

frames

Finding the root flooding

Building a tree Bellman-Ford Algorithm

Can combine efficiently

Standardized in IEEE 8021 specification

71

72

Spanning Tree Requirements

Each bridge is assigned a unique identifier

A broadcast address for bridges on a LAN

A unique port identifier for all ports on all bridges

MAC address

Bridge id + port number

37

73

Spanning Tree Concepts

Root Bridge The bridge with the lowest bridge ID value is elected the

root bridge

One root bridge chosen among all bridges

Every other bridge calculates a path to the root bridge

74

Spanning Tree Concepts

Path Cost A cost associated with each port on each bridge

default is 1

The cost associated with transmission onto the LAN

connected to the port

Can be manually or automatically assigned

Can be used to alter the path to the root bridge

38

75

Spanning Tree Concepts

Root Port The port on each bridge that is on the path towards the

root bridge

The root port is part of the lowest cost path towards

the root bridge

If port costs are equal on a bridge the port with the

lowest ID becomes root port

76

Spanning Tree Concepts

Root Path Cost The minimum cost path to the root bridge

The cost starts at the root bridge

Each bridge computes root path cost independently

based on their view of the network

39

77

Spanning Tree Concepts Designated

Bridge Only one bridge on a LAN at one time is chosen the

designated bridge

This bridge provides the minimum cost path to the root

bridge for the LAN

Only the designated bridge passes frames towards the

root bridge

78

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Protocol operation1 Picks a root2 For each LAN

picks a designated bridgethat is closest to the root

3 All bridges on a LANsend packets towards the root via the designatedbridge

B8

40

79

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

80

Spanning Tree Algorithm

An Overview 1 Determine the root bridge among all bridges

2 Each bridge determines its root port

The port in the direction of the root bridge

3 Determine the designated bridge on each LAN

The bridge which accepts frames to forward towards the root bridge

The frames are sent on the root port of the designated bridge

41

81

Spanning Tree Algorithm

Selecting Root Bridge Initially each bridge considers itself to be the root bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

Best one wins

(lowest root IDcostpriority)

82

Spanning Tree Algorithm

Selecting Root Ports Each bridge selects one of its ports which has the

minimal cost to the root bridge

In case of a tie the lowest uplink (transmitter) bridge ID is

used

In case of another tie the lowest port ID is used

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 6: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

6

Link Layer Services

Flow Control

pacing between adjacent sending and receiving nodes

Error Detection

errors caused by signal attenuation noise

receiver detects presence of errors

signals sender for retransmission or drops frame

Error Correction

receiver identifies and corrects bit error(s) without resorting to

retransmission

Half-duplex and full-duplex

with half duplex nodes at both ends of link can transmit but not at same

time

RDT

Offers some reliability between the hosts (Why is this redundant)

11

Link Layer Services

link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card

80211 card

sending side encapsulates datagram in a

frame

adds error checking bits rdt flow control etc

receiving side looks for errors rdt flow

control etc

extracts datagram passes to rcving node

adapter is semi-autonomous

link amp physical layers

sendingnode

frame

rcvingnode

datagram

frame

adapter adapter

link layer protocol

12

7

Link Types

Three types of ldquolinksrdquo

point-to-point (P2P)

PPP for dial-up access

Point-to-point link between

Ethernet switch and host

Switched Networks

ATM (used for WAN)

Broadcast

Traditional Ethernet and its

predecessors

Upstream HFC

80211 wireless LAN

We‟ll focus on Broadcast

media

13

Multiple Access protocols

Ossi Mokryn - Data link layer

single shared broadcast channel

two or more simultaneous transmissions by nodes interference

collision if node receives two or more signals at the same

time

Multiple ACcess (MAC) Protocol

distributed algorithm that determines how nodes share channel

ie determine when node can transmit

communication about channel sharing must use channel itself

no out-of-band channel for coordination

14

8

Human Analogy

15

Rules for bdquoparty conversation‟

Give everyone a chance to speak

Dont speak until you are spoken to

Dont monopolize the conversation

Raise your hand if you have a question

Dont interrupt when someone is speaking

Dont fall asleep when someone else is talking

MAC Protocols measures

Assume a shared medium with a channel rate of R [bpsec]

Efficient

When one node wants to transmit it ca send at rate R

Fair

When N users want to transmit each can send at average rate RN

Decentralized

No special node uses to coordinate transmission (no ldquoleaderrdquo)

No synchronization of clocks or slots

Fault tolerant

Simple

Should be very fast and implemented in NICs firmware

16

9

MAC Protocol Types

Three broad classes

Channel Partitioning

Divide channel into smaller ldquopiecesrdquo (Time-Slots Frequancy-Bands

or by code)

allocate piece to a node for exclusive its use

Random Access

Channel not divided allow collisions

ldquoRecoverrdquo from collisions

ldquoTaking turnsrdquo

Nodes take turns but nodes with more to send can take longer

turns

Might uses a leader to coordinate the turns

17

Channel Partitioning MAC protocols TDMA

TDMA (Time Division Multiple Access)

Access the channel in roundsldquo

Each station gets fixed length slot (length = packets trans time) in each

round Each slot called a Time-Slot

Unused slots go idle

Example 6-station LAN 134 have packtes slots 256 idle

18

10

Channel 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 134 have packets frequency bands 256 idle

frequ

ency

ban

ds

19

TDM FDM summary

FDM Enables the division of a channel with capacity C

bits per seconds to N sub-channels each gets a different

frequency range and capacity of CN

TDM The division of channel to N sub-channels each

gets CN capacity by giving the entire channel to each of

the N stations for 1N of the time

The division makes each sub channel less busy but the

overall waiting time is bigger by a factor of N compared

to having one channel (Little theorem)

20

11

Channel Partitioning MAC protocols CDMA

Code Division Multiple Access (CDMA)

used in several wireless broadcast channels (cellular satellite etc) standards

unique ldquocoderdquo assigned to each user ie code set partitioning

all users share same frequency but each user has own ldquochippingrdquo sequence (ie code) to encode data

encoded signal = (original data) X (chipping sequence)

decoding inner-product of encoded signal and chipping sequence

allows multiple users to ldquocoexistrdquo and transmit simultaneously with minimal interference (if codes are ldquoorthogonalrdquo)21

Random Access MAC Protocols

From here on we‟ll focus on Random Access MAC 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 ldquocollisionrdquo

Random access MAC protocol specifies

How to detect collisions

How to recover from collisions

Examples of random access MAC protocols

ALOHA

slotted ALOHA

CSMACD (Ethernet)

CSMACA (Wireless)

22

12

Aloha Protocol

Invented at the ‟70s in Hawaii

Intended for Radio networks but suitable for every

network where the station can listen to the channel while

broadcasting and determine whether others also transmit

Basic idea every station may transmit when it wants to If

collision is detected between frames back off and try

again later

If two frames are broadcast at the same time on the channel a

collision occurs and the both need to retransmit

23

Aloha Protocol

All hosts

Transmit on one frequency (fT)

Receive on other frequency (fR)

There is a central node which repeats whatever it receives

from fT frequency on the other fR frequency

The central node used as a repeater

Collisions are detected by the hosts

Receiving corrupted data (host knows what should be

received)

24

13

Aloha Protocol

1 Accept a new frame arrives

2 Transmit immediately and listen

If a collision occurred wait a random time and

repeat to stage 2

Otherwise go back to stage 1 to handle a new frame

25

Aloha Protocol

Simple

Robust against failure of a host

Distributed (excluding the central node which uses as a

repeater)

High load implicates low utilization of the channel and high

delays

26

14

Aloha - efficiency

Only 18

Suppose there are n stations and the probability that a

station starts transmitting in a time unit is p

Then The probability that exactly one node transmits

in a time unit is

27

Efficiency is the long-run fraction of successful transmissions when there are many nodes each with many frames to send

Aloha - efficiency

Only 18

Maximize the utilization function by differentiation

yields maximum point at with utilization

of

Trivial improvement

Why be vulnerable for 2 time units

Synchronize and use slotted time May transmit only

at integer times

28

Efficiency is the long-run fraction of successful transmissions when there are many nodes each with many frames to send

15

Slotted 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

29

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

Cons

collisions wasting slots

idle slots

nodes may be able to detect collision in less than time to transmit packet

clock synchronization

30

16

Slotted Aloha - efficiency

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

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 1e = 37

Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send

At best channelused for useful transmissions 37of time

31

Aloha - Summary

Very popular at the beginning of time (ie 70s to 80s)

Very simple to handle

Lots and lots of basic probabilities calculations for

students

Major problem Nodes don‟t check what‟s going on in the

channel each acting on its own No manners

32

17

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

Protocol

1 Listen to the channel

2 If channel sensed idle transmit entire frame

3 If channel sensed busy defer transmission by

1-Persistent CSMA

Wait until channel is quiet and transmit immediately If collision

occurs wait a random time and listen again (go to 1)

Non-Persistent CSMA

Wait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission

CSMA human analogy don‟t interrupt others

33

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMA

When transmitting try to sense if there is a collision

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

34

18

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots

adapter doesn‟t transmit if it

senses that some other

adapter is transmitting that is

carrier sense

transmitting adapter aborts

when it senses that another

adapter is transmitting that is

collision detection

Before attempting a

retransmission adapter

waits a random time that

is random access

36

19

Unreliable connectionless service

Connectionless No handshaking between sending and

receiving adapter

Unreliable receiving adapter doesn‟t send acks or nacks to

sending adapter

stream of datagrams passed to network layer can have gaps

gaps will be filled if app is using TCP

otherwise app will see the gaps

37

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other

transmitters are aware of

collision 48 bits

Bit time 1 microsec for 10 Mbps

Ethernet

for K=1023 wait time is about

50 msec

Exponential Backoff

Goal adapt retransmission

attempts to estimated current

load

heavy load random wait will be

longer

first collision choose K from

01 delay is K 512 bit

transmission times

after second collision choose K

from 0123hellip

after ten collisions choose K

from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

38

20

8023 CSMACD (Ethernet) Algorithm

39

Ethernet CSMACD algorithm

1 Adaptor receives datagram

from net layer amp creates frame

2 If adapter senses channel idle it

starts to transmit frame If it

senses channel busy waits until

channel idle and then transmits

3 If adapter transmits entire

frame without detecting

another transmission the

adapter is done with frame

4 If adapter detects another

transmission while transmitting

aborts and sends jam signal

5 After aborting adapter enters

exponential backoff after

the mth collision adapter

chooses a K at random from

012hellip2m-1 Adapter waits

K512 bit times and returns to

Step 2

40

21

Ethernet Minimum Packet Size

41

Summary of MAC protocols

What do you do with a shared media

Channel Partitioning by time frequency or code

Time Division Frequency Division Code Division

Random partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACD

carrier sensing easy in some technologies (wire) hard in

others (wireless)

CSMACD used in Ethernet

CSMACA used in 80211 (Wireless)

42

22

LAN technologies

Data link layer so far

MAC protocols The random protocol approach

Next LAN technologies

Addressing

Ethernet

Hubs bridges and switches

43

MAC Addresses and ARP

32-bit IP address network-layer address

used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet)

address used to get datagram from one interface to another physically-

connected interface (same network)

48 bit MAC address (for most LANs)

burned in the adapter ROM but can be modified

44

23

LAN Addresses and ARP

Each adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN(wired orwireless)

45

LAN Address (more)

MAC address allocation administered by IEEE

manufacturer buys portion of MAC address space (to assure

uniqueness)

Analogy

(a) MAC address like Social Security Number

(b) IP address like postal address

MAC flat address portability

can move LAN card from one LAN to another

IP hierarchical address NOT portable

depends on IP subnet to which node is attached

46

24

ARP Address Resolution Protocol

Each IP node (Host Router)

on LAN has ARP table

ARP Table IPMAC address

mappings for some LAN

nodes

lt IP address MAC address TTLgt

TTL (Time To Live) time after

which address mapping will be

forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

237196723

237196778

237196714

237196788

47

ARP protocol Same LAN (network)

A wants to send datagram to B

and B‟s MAC address not in A‟s

ARP table

A broadcasts ARP query packet

containing Bs IP address

Dest MAC address = FF-FF-

FF-FF-FF-FF

all machines on LAN receive

ARP query

B receives ARP packet replies to

A with its (Bs) MAC address

frame sent to A‟s MAC address

(unicast)

A caches (saves) IP-to-MAC

address pair in its ARP table until

information becomes old (times

out)

soft state information that

times out (goes away) unless

refreshed

ARP is ldquoplug-and-playrdquo

nodes create their ARP tables

without intervention from net

administrator

48

25

Routing to another LANwalkthrough send datagram from A to B via R

assume A know‟s B IP address

Two ARP tables in router R one for each IP network (LAN)

In routing table at source Host find router 111111111110

In ARP table at source find MAC address E6-E9-00-17-BB-4B etc

A

RB

49

Ossi Mokryn - Data link layer

A creates datagram with source A destination B

A uses ARP to get R‟s MAC address for 111111111110

A creates link-layer frame with Rs MAC address as dest frame

contains A-to-B IP datagram

A‟s adapter sends frame

R‟s adapter receives frame

R removes IP datagram from Ethernet frame sees its destined to B

R uses ARP to get B‟s MAC address

R creates frame containing A-to-B IP datagram sends to B

A

RB

50

26

Ethernet

ldquodominantrdquo wired LAN technology developed at the 70s

cheap $20 for 100Mbs

first widely used LAN technology

Simple cheap

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

51

Ethernet topology Through the Years

Classic Ethernet Now star topology prevails

Connection choices hub or switch (more later)

Fast Ethernet 100 Mbs

Gigabit Ethernet 1Gbps

52

hub orswitch

bull Shared Bus with CSMACDbull Bus maximal length 500 mbullTransmission rate 10Mbs

Through the years the only common is The Frame

27

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network

layer protocol packet) in Ethernet frame

Preamble

7 bytes with pattern 10101010 followed by one byte with

pattern 10101011

used to synchronize receiver sender clock rates what is

the length in clock ticks of one bit

53

Type length length or type of frame

Ethernet Frame Structure (more)

Ossi Mokryn - Data link layer

Addresses 6 bytes

if adapter receives frame with matching destination address or with

broadcast address (eg ARP packet) it passes data in frame to net-layer

protocol

otherwise adapter discards frame

MAC addresses also called Physical addresses

Type indicates the higher layer protocol (mostly IP but others

may be supported such as Novell IPX and AppleTalk)

CRC checked at receiver if error is detected the frame is

simply dropped Before CRC there is a padding field for the

CRC to pad to 64 bytes

54

28

55

Ethernet Technology 10Base2

10 10Mbps 2 under 200 meters max cable length

thin coaxial cable in a bus topology

repeaters used to connect up to multiple segments

repeater repeats bits it hears on one interface to its other

interfaces physical layer device only

Ethernet technology 100BaseT

10100 Mbps rate latter called ldquofast ethernetrdquo

T stands for Twisted Pair

Nodes connect to a hub ldquostar topologyrdquo 100 m max

distance between nodes and hub

twisted pair

hub

56

29

Ethernet technology 100BaseT

Problem must keep minimal packet size when bandwidth

increases

With fixed cable length and propagation speed must

increase minimal size proportionally to bandwidth

increase

Eg 100Mbs 1500m of cable prop remains 6μs minimal

size becomes 1200 bits

Solutions

Cable length limited to 100m

Prevent collisions by ldquoEthernet Switchesrdquo (later)

Max distance from node to Hub is 100 meters

57

58

Gbit Ethernet

use standard Ethernet frame format

allows for point-to-point links and shared broadcast channels

in shared mode CSMACD is used short distances between

nodes to be efficiency

uses hubs called here ldquoBuffered Distributorsrdquo

Full-Duplex at 1 Gbps for point-to-point links

10 Gbpsec now

30

Hubs

QWhy not just one big LAN

Limited amount of supportable traffic on single LAN

all stations must share bandwidth

limited length 8023 (Ethernet) specifies maximum

cable length

large ldquocollision domainrdquo (can collide with many

stations)

limited number of stations 8025 (token ring) have

token passing delays at each station

59

Lecture 360

Hubs (Multiport repeaters Bus in a box)

Physical Layer devices essentially repeaters operating at bit

levels repeat received bits on one interface to all other

interfaces

Can‟t interconnect 10BaseT amp 100BaseT (because

segments don‟t share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design)

with backbone hub at its top

31

61

Hubs (Multiport repeaters Bus in a box)

Each connected LAN referred to as LAN segment

Hubs do not isolate collision domains node may collide with any

node residing at any segment in LAN

Extends max distance between nodes but all the segments become

one large collision domain

Hub Advantages

simple inexpensive device

Multi-tier provides graceful degradation portions of the LAN

continue to operate if one hub malfunctions

extends maximum distance between node pairs (100m per Hub)

62

Bridges

Link Layer devices operate on Ethernet frames examining

frame header and selectively forwarding frame based on its

destination

Bridge isolates collision domains since it buffers frames

When frame is to be forwarded on segment bridge uses

CSMACD to access segment and transmit

Store and forward element So different types of Ethernet

types can be connected

Transparent no need for any change to hosts LAN adapters

Forwarding is selective do not always flood All connected

segments can work independently in parallel

32

63

Bridge Filtering

bridges learn which hosts can be reached through which

interfaces maintain filtering tables

when frame received bridge ldquolearnsrdquo location of sender

incoming LAN segment

records sender location in filtering table

filtering table entry

(Node LAN Address Bridge Interface Time Stamp)

stale entries in Filtering Table dropped (TTL can be 60 minutes)

64

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_port

if (out_port not valid) no entry found for destination

then flood forward on all but the interface on which the frame arrived

if (in_port = out_port) destination is on LAN on which frame was received

then drop the frame

Otherwise (out_port is valid) entry found for destination then forward the frame on interface indicated

33

65

Bridge Learning example

Suppose C sends frame to D and D replies back with frame

to C

C sends frame bridge has no info about D so floods to both LANs bridge notes that C is on port 1

frame ignored on upper LAN

frame received by D

66

Bridge Learning example

D generates reply to C sends

bridge sees frame from D

bridge notes that D is on interface 2

bridge knows C on interface 1 so selectivelyforwards frame out via interface 1

C 1

34

67

What will happen with loops

Incorrect learning

A

B

1 1

22

A 1 A 122

68

What will happen with loops

Frame looping

A

C

1 1

22

C C

35

69

What will happen with loops

Frame looping

A

B

1 1

22

B2 B1

70

Introducing Spanning Tree

Allow a path between every LAN without causing loops

(loop-free environment)

Bridges communicate with special configuration

messages (BPDUs)

Standardized by IEEE 8021D

Note redundant paths are good active redundant paths are bad (they cause

loops)

36

How to Construct a Spanning Tree

Bridges run a distributed spanning tree

Algorithm

Select what ports (and bridges) should actively forward

frames

Finding the root flooding

Building a tree Bellman-Ford Algorithm

Can combine efficiently

Standardized in IEEE 8021 specification

71

72

Spanning Tree Requirements

Each bridge is assigned a unique identifier

A broadcast address for bridges on a LAN

A unique port identifier for all ports on all bridges

MAC address

Bridge id + port number

37

73

Spanning Tree Concepts

Root Bridge The bridge with the lowest bridge ID value is elected the

root bridge

One root bridge chosen among all bridges

Every other bridge calculates a path to the root bridge

74

Spanning Tree Concepts

Path Cost A cost associated with each port on each bridge

default is 1

The cost associated with transmission onto the LAN

connected to the port

Can be manually or automatically assigned

Can be used to alter the path to the root bridge

38

75

Spanning Tree Concepts

Root Port The port on each bridge that is on the path towards the

root bridge

The root port is part of the lowest cost path towards

the root bridge

If port costs are equal on a bridge the port with the

lowest ID becomes root port

76

Spanning Tree Concepts

Root Path Cost The minimum cost path to the root bridge

The cost starts at the root bridge

Each bridge computes root path cost independently

based on their view of the network

39

77

Spanning Tree Concepts Designated

Bridge Only one bridge on a LAN at one time is chosen the

designated bridge

This bridge provides the minimum cost path to the root

bridge for the LAN

Only the designated bridge passes frames towards the

root bridge

78

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Protocol operation1 Picks a root2 For each LAN

picks a designated bridgethat is closest to the root

3 All bridges on a LANsend packets towards the root via the designatedbridge

B8

40

79

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

80

Spanning Tree Algorithm

An Overview 1 Determine the root bridge among all bridges

2 Each bridge determines its root port

The port in the direction of the root bridge

3 Determine the designated bridge on each LAN

The bridge which accepts frames to forward towards the root bridge

The frames are sent on the root port of the designated bridge

41

81

Spanning Tree Algorithm

Selecting Root Bridge Initially each bridge considers itself to be the root bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

Best one wins

(lowest root IDcostpriority)

82

Spanning Tree Algorithm

Selecting Root Ports Each bridge selects one of its ports which has the

minimal cost to the root bridge

In case of a tie the lowest uplink (transmitter) bridge ID is

used

In case of another tie the lowest port ID is used

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 7: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

7

Link Types

Three types of ldquolinksrdquo

point-to-point (P2P)

PPP for dial-up access

Point-to-point link between

Ethernet switch and host

Switched Networks

ATM (used for WAN)

Broadcast

Traditional Ethernet and its

predecessors

Upstream HFC

80211 wireless LAN

We‟ll focus on Broadcast

media

13

Multiple Access protocols

Ossi Mokryn - Data link layer

single shared broadcast channel

two or more simultaneous transmissions by nodes interference

collision if node receives two or more signals at the same

time

Multiple ACcess (MAC) Protocol

distributed algorithm that determines how nodes share channel

ie determine when node can transmit

communication about channel sharing must use channel itself

no out-of-band channel for coordination

14

8

Human Analogy

15

Rules for bdquoparty conversation‟

Give everyone a chance to speak

Dont speak until you are spoken to

Dont monopolize the conversation

Raise your hand if you have a question

Dont interrupt when someone is speaking

Dont fall asleep when someone else is talking

MAC Protocols measures

Assume a shared medium with a channel rate of R [bpsec]

Efficient

When one node wants to transmit it ca send at rate R

Fair

When N users want to transmit each can send at average rate RN

Decentralized

No special node uses to coordinate transmission (no ldquoleaderrdquo)

No synchronization of clocks or slots

Fault tolerant

Simple

Should be very fast and implemented in NICs firmware

16

9

MAC Protocol Types

Three broad classes

Channel Partitioning

Divide channel into smaller ldquopiecesrdquo (Time-Slots Frequancy-Bands

or by code)

allocate piece to a node for exclusive its use

Random Access

Channel not divided allow collisions

ldquoRecoverrdquo from collisions

ldquoTaking turnsrdquo

Nodes take turns but nodes with more to send can take longer

turns

Might uses a leader to coordinate the turns

17

Channel Partitioning MAC protocols TDMA

TDMA (Time Division Multiple Access)

Access the channel in roundsldquo

Each station gets fixed length slot (length = packets trans time) in each

round Each slot called a Time-Slot

Unused slots go idle

Example 6-station LAN 134 have packtes slots 256 idle

18

10

Channel 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 134 have packets frequency bands 256 idle

frequ

ency

ban

ds

19

TDM FDM summary

FDM Enables the division of a channel with capacity C

bits per seconds to N sub-channels each gets a different

frequency range and capacity of CN

TDM The division of channel to N sub-channels each

gets CN capacity by giving the entire channel to each of

the N stations for 1N of the time

The division makes each sub channel less busy but the

overall waiting time is bigger by a factor of N compared

to having one channel (Little theorem)

20

11

Channel Partitioning MAC protocols CDMA

Code Division Multiple Access (CDMA)

used in several wireless broadcast channels (cellular satellite etc) standards

unique ldquocoderdquo assigned to each user ie code set partitioning

all users share same frequency but each user has own ldquochippingrdquo sequence (ie code) to encode data

encoded signal = (original data) X (chipping sequence)

decoding inner-product of encoded signal and chipping sequence

allows multiple users to ldquocoexistrdquo and transmit simultaneously with minimal interference (if codes are ldquoorthogonalrdquo)21

Random Access MAC Protocols

From here on we‟ll focus on Random Access MAC 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 ldquocollisionrdquo

Random access MAC protocol specifies

How to detect collisions

How to recover from collisions

Examples of random access MAC protocols

ALOHA

slotted ALOHA

CSMACD (Ethernet)

CSMACA (Wireless)

22

12

Aloha Protocol

Invented at the ‟70s in Hawaii

Intended for Radio networks but suitable for every

network where the station can listen to the channel while

broadcasting and determine whether others also transmit

Basic idea every station may transmit when it wants to If

collision is detected between frames back off and try

again later

If two frames are broadcast at the same time on the channel a

collision occurs and the both need to retransmit

23

Aloha Protocol

All hosts

Transmit on one frequency (fT)

Receive on other frequency (fR)

There is a central node which repeats whatever it receives

from fT frequency on the other fR frequency

The central node used as a repeater

Collisions are detected by the hosts

Receiving corrupted data (host knows what should be

received)

24

13

Aloha Protocol

1 Accept a new frame arrives

2 Transmit immediately and listen

If a collision occurred wait a random time and

repeat to stage 2

Otherwise go back to stage 1 to handle a new frame

25

Aloha Protocol

Simple

Robust against failure of a host

Distributed (excluding the central node which uses as a

repeater)

High load implicates low utilization of the channel and high

delays

26

14

Aloha - efficiency

Only 18

Suppose there are n stations and the probability that a

station starts transmitting in a time unit is p

Then The probability that exactly one node transmits

in a time unit is

27

Efficiency is the long-run fraction of successful transmissions when there are many nodes each with many frames to send

Aloha - efficiency

Only 18

Maximize the utilization function by differentiation

yields maximum point at with utilization

of

Trivial improvement

Why be vulnerable for 2 time units

Synchronize and use slotted time May transmit only

at integer times

28

Efficiency is the long-run fraction of successful transmissions when there are many nodes each with many frames to send

15

Slotted 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

29

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

Cons

collisions wasting slots

idle slots

nodes may be able to detect collision in less than time to transmit packet

clock synchronization

30

16

Slotted Aloha - efficiency

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

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 1e = 37

Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send

At best channelused for useful transmissions 37of time

31

Aloha - Summary

Very popular at the beginning of time (ie 70s to 80s)

Very simple to handle

Lots and lots of basic probabilities calculations for

students

Major problem Nodes don‟t check what‟s going on in the

channel each acting on its own No manners

32

17

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

Protocol

1 Listen to the channel

2 If channel sensed idle transmit entire frame

3 If channel sensed busy defer transmission by

1-Persistent CSMA

Wait until channel is quiet and transmit immediately If collision

occurs wait a random time and listen again (go to 1)

Non-Persistent CSMA

Wait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission

CSMA human analogy don‟t interrupt others

33

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMA

When transmitting try to sense if there is a collision

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

34

18

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots

adapter doesn‟t transmit if it

senses that some other

adapter is transmitting that is

carrier sense

transmitting adapter aborts

when it senses that another

adapter is transmitting that is

collision detection

Before attempting a

retransmission adapter

waits a random time that

is random access

36

19

Unreliable connectionless service

Connectionless No handshaking between sending and

receiving adapter

Unreliable receiving adapter doesn‟t send acks or nacks to

sending adapter

stream of datagrams passed to network layer can have gaps

gaps will be filled if app is using TCP

otherwise app will see the gaps

37

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other

transmitters are aware of

collision 48 bits

Bit time 1 microsec for 10 Mbps

Ethernet

for K=1023 wait time is about

50 msec

Exponential Backoff

Goal adapt retransmission

attempts to estimated current

load

heavy load random wait will be

longer

first collision choose K from

01 delay is K 512 bit

transmission times

after second collision choose K

from 0123hellip

after ten collisions choose K

from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

38

20

8023 CSMACD (Ethernet) Algorithm

39

Ethernet CSMACD algorithm

1 Adaptor receives datagram

from net layer amp creates frame

2 If adapter senses channel idle it

starts to transmit frame If it

senses channel busy waits until

channel idle and then transmits

3 If adapter transmits entire

frame without detecting

another transmission the

adapter is done with frame

4 If adapter detects another

transmission while transmitting

aborts and sends jam signal

5 After aborting adapter enters

exponential backoff after

the mth collision adapter

chooses a K at random from

012hellip2m-1 Adapter waits

K512 bit times and returns to

Step 2

40

21

Ethernet Minimum Packet Size

41

Summary of MAC protocols

What do you do with a shared media

Channel Partitioning by time frequency or code

Time Division Frequency Division Code Division

Random partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACD

carrier sensing easy in some technologies (wire) hard in

others (wireless)

CSMACD used in Ethernet

CSMACA used in 80211 (Wireless)

42

22

LAN technologies

Data link layer so far

MAC protocols The random protocol approach

Next LAN technologies

Addressing

Ethernet

Hubs bridges and switches

43

MAC Addresses and ARP

32-bit IP address network-layer address

used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet)

address used to get datagram from one interface to another physically-

connected interface (same network)

48 bit MAC address (for most LANs)

burned in the adapter ROM but can be modified

44

23

LAN Addresses and ARP

Each adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN(wired orwireless)

45

LAN Address (more)

MAC address allocation administered by IEEE

manufacturer buys portion of MAC address space (to assure

uniqueness)

Analogy

(a) MAC address like Social Security Number

(b) IP address like postal address

MAC flat address portability

can move LAN card from one LAN to another

IP hierarchical address NOT portable

depends on IP subnet to which node is attached

46

24

ARP Address Resolution Protocol

Each IP node (Host Router)

on LAN has ARP table

ARP Table IPMAC address

mappings for some LAN

nodes

lt IP address MAC address TTLgt

TTL (Time To Live) time after

which address mapping will be

forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

237196723

237196778

237196714

237196788

47

ARP protocol Same LAN (network)

A wants to send datagram to B

and B‟s MAC address not in A‟s

ARP table

A broadcasts ARP query packet

containing Bs IP address

Dest MAC address = FF-FF-

FF-FF-FF-FF

all machines on LAN receive

ARP query

B receives ARP packet replies to

A with its (Bs) MAC address

frame sent to A‟s MAC address

(unicast)

A caches (saves) IP-to-MAC

address pair in its ARP table until

information becomes old (times

out)

soft state information that

times out (goes away) unless

refreshed

ARP is ldquoplug-and-playrdquo

nodes create their ARP tables

without intervention from net

administrator

48

25

Routing to another LANwalkthrough send datagram from A to B via R

assume A know‟s B IP address

Two ARP tables in router R one for each IP network (LAN)

In routing table at source Host find router 111111111110

In ARP table at source find MAC address E6-E9-00-17-BB-4B etc

A

RB

49

Ossi Mokryn - Data link layer

A creates datagram with source A destination B

A uses ARP to get R‟s MAC address for 111111111110

A creates link-layer frame with Rs MAC address as dest frame

contains A-to-B IP datagram

A‟s adapter sends frame

R‟s adapter receives frame

R removes IP datagram from Ethernet frame sees its destined to B

R uses ARP to get B‟s MAC address

R creates frame containing A-to-B IP datagram sends to B

A

RB

50

26

Ethernet

ldquodominantrdquo wired LAN technology developed at the 70s

cheap $20 for 100Mbs

first widely used LAN technology

Simple cheap

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

51

Ethernet topology Through the Years

Classic Ethernet Now star topology prevails

Connection choices hub or switch (more later)

Fast Ethernet 100 Mbs

Gigabit Ethernet 1Gbps

52

hub orswitch

bull Shared Bus with CSMACDbull Bus maximal length 500 mbullTransmission rate 10Mbs

Through the years the only common is The Frame

27

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network

layer protocol packet) in Ethernet frame

Preamble

7 bytes with pattern 10101010 followed by one byte with

pattern 10101011

used to synchronize receiver sender clock rates what is

the length in clock ticks of one bit

53

Type length length or type of frame

Ethernet Frame Structure (more)

Ossi Mokryn - Data link layer

Addresses 6 bytes

if adapter receives frame with matching destination address or with

broadcast address (eg ARP packet) it passes data in frame to net-layer

protocol

otherwise adapter discards frame

MAC addresses also called Physical addresses

Type indicates the higher layer protocol (mostly IP but others

may be supported such as Novell IPX and AppleTalk)

CRC checked at receiver if error is detected the frame is

simply dropped Before CRC there is a padding field for the

CRC to pad to 64 bytes

54

28

55

Ethernet Technology 10Base2

10 10Mbps 2 under 200 meters max cable length

thin coaxial cable in a bus topology

repeaters used to connect up to multiple segments

repeater repeats bits it hears on one interface to its other

interfaces physical layer device only

Ethernet technology 100BaseT

10100 Mbps rate latter called ldquofast ethernetrdquo

T stands for Twisted Pair

Nodes connect to a hub ldquostar topologyrdquo 100 m max

distance between nodes and hub

twisted pair

hub

56

29

Ethernet technology 100BaseT

Problem must keep minimal packet size when bandwidth

increases

With fixed cable length and propagation speed must

increase minimal size proportionally to bandwidth

increase

Eg 100Mbs 1500m of cable prop remains 6μs minimal

size becomes 1200 bits

Solutions

Cable length limited to 100m

Prevent collisions by ldquoEthernet Switchesrdquo (later)

Max distance from node to Hub is 100 meters

57

58

Gbit Ethernet

use standard Ethernet frame format

allows for point-to-point links and shared broadcast channels

in shared mode CSMACD is used short distances between

nodes to be efficiency

uses hubs called here ldquoBuffered Distributorsrdquo

Full-Duplex at 1 Gbps for point-to-point links

10 Gbpsec now

30

Hubs

QWhy not just one big LAN

Limited amount of supportable traffic on single LAN

all stations must share bandwidth

limited length 8023 (Ethernet) specifies maximum

cable length

large ldquocollision domainrdquo (can collide with many

stations)

limited number of stations 8025 (token ring) have

token passing delays at each station

59

Lecture 360

Hubs (Multiport repeaters Bus in a box)

Physical Layer devices essentially repeaters operating at bit

levels repeat received bits on one interface to all other

interfaces

Can‟t interconnect 10BaseT amp 100BaseT (because

segments don‟t share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design)

with backbone hub at its top

31

61

Hubs (Multiport repeaters Bus in a box)

Each connected LAN referred to as LAN segment

Hubs do not isolate collision domains node may collide with any

node residing at any segment in LAN

Extends max distance between nodes but all the segments become

one large collision domain

Hub Advantages

simple inexpensive device

Multi-tier provides graceful degradation portions of the LAN

continue to operate if one hub malfunctions

extends maximum distance between node pairs (100m per Hub)

62

Bridges

Link Layer devices operate on Ethernet frames examining

frame header and selectively forwarding frame based on its

destination

Bridge isolates collision domains since it buffers frames

When frame is to be forwarded on segment bridge uses

CSMACD to access segment and transmit

Store and forward element So different types of Ethernet

types can be connected

Transparent no need for any change to hosts LAN adapters

Forwarding is selective do not always flood All connected

segments can work independently in parallel

32

63

Bridge Filtering

bridges learn which hosts can be reached through which

interfaces maintain filtering tables

when frame received bridge ldquolearnsrdquo location of sender

incoming LAN segment

records sender location in filtering table

filtering table entry

(Node LAN Address Bridge Interface Time Stamp)

stale entries in Filtering Table dropped (TTL can be 60 minutes)

64

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_port

if (out_port not valid) no entry found for destination

then flood forward on all but the interface on which the frame arrived

if (in_port = out_port) destination is on LAN on which frame was received

then drop the frame

Otherwise (out_port is valid) entry found for destination then forward the frame on interface indicated

33

65

Bridge Learning example

Suppose C sends frame to D and D replies back with frame

to C

C sends frame bridge has no info about D so floods to both LANs bridge notes that C is on port 1

frame ignored on upper LAN

frame received by D

66

Bridge Learning example

D generates reply to C sends

bridge sees frame from D

bridge notes that D is on interface 2

bridge knows C on interface 1 so selectivelyforwards frame out via interface 1

C 1

34

67

What will happen with loops

Incorrect learning

A

B

1 1

22

A 1 A 122

68

What will happen with loops

Frame looping

A

C

1 1

22

C C

35

69

What will happen with loops

Frame looping

A

B

1 1

22

B2 B1

70

Introducing Spanning Tree

Allow a path between every LAN without causing loops

(loop-free environment)

Bridges communicate with special configuration

messages (BPDUs)

Standardized by IEEE 8021D

Note redundant paths are good active redundant paths are bad (they cause

loops)

36

How to Construct a Spanning Tree

Bridges run a distributed spanning tree

Algorithm

Select what ports (and bridges) should actively forward

frames

Finding the root flooding

Building a tree Bellman-Ford Algorithm

Can combine efficiently

Standardized in IEEE 8021 specification

71

72

Spanning Tree Requirements

Each bridge is assigned a unique identifier

A broadcast address for bridges on a LAN

A unique port identifier for all ports on all bridges

MAC address

Bridge id + port number

37

73

Spanning Tree Concepts

Root Bridge The bridge with the lowest bridge ID value is elected the

root bridge

One root bridge chosen among all bridges

Every other bridge calculates a path to the root bridge

74

Spanning Tree Concepts

Path Cost A cost associated with each port on each bridge

default is 1

The cost associated with transmission onto the LAN

connected to the port

Can be manually or automatically assigned

Can be used to alter the path to the root bridge

38

75

Spanning Tree Concepts

Root Port The port on each bridge that is on the path towards the

root bridge

The root port is part of the lowest cost path towards

the root bridge

If port costs are equal on a bridge the port with the

lowest ID becomes root port

76

Spanning Tree Concepts

Root Path Cost The minimum cost path to the root bridge

The cost starts at the root bridge

Each bridge computes root path cost independently

based on their view of the network

39

77

Spanning Tree Concepts Designated

Bridge Only one bridge on a LAN at one time is chosen the

designated bridge

This bridge provides the minimum cost path to the root

bridge for the LAN

Only the designated bridge passes frames towards the

root bridge

78

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Protocol operation1 Picks a root2 For each LAN

picks a designated bridgethat is closest to the root

3 All bridges on a LANsend packets towards the root via the designatedbridge

B8

40

79

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

80

Spanning Tree Algorithm

An Overview 1 Determine the root bridge among all bridges

2 Each bridge determines its root port

The port in the direction of the root bridge

3 Determine the designated bridge on each LAN

The bridge which accepts frames to forward towards the root bridge

The frames are sent on the root port of the designated bridge

41

81

Spanning Tree Algorithm

Selecting Root Bridge Initially each bridge considers itself to be the root bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

Best one wins

(lowest root IDcostpriority)

82

Spanning Tree Algorithm

Selecting Root Ports Each bridge selects one of its ports which has the

minimal cost to the root bridge

In case of a tie the lowest uplink (transmitter) bridge ID is

used

In case of another tie the lowest port ID is used

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 8: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

8

Human Analogy

15

Rules for bdquoparty conversation‟

Give everyone a chance to speak

Dont speak until you are spoken to

Dont monopolize the conversation

Raise your hand if you have a question

Dont interrupt when someone is speaking

Dont fall asleep when someone else is talking

MAC Protocols measures

Assume a shared medium with a channel rate of R [bpsec]

Efficient

When one node wants to transmit it ca send at rate R

Fair

When N users want to transmit each can send at average rate RN

Decentralized

No special node uses to coordinate transmission (no ldquoleaderrdquo)

No synchronization of clocks or slots

Fault tolerant

Simple

Should be very fast and implemented in NICs firmware

16

9

MAC Protocol Types

Three broad classes

Channel Partitioning

Divide channel into smaller ldquopiecesrdquo (Time-Slots Frequancy-Bands

or by code)

allocate piece to a node for exclusive its use

Random Access

Channel not divided allow collisions

ldquoRecoverrdquo from collisions

ldquoTaking turnsrdquo

Nodes take turns but nodes with more to send can take longer

turns

Might uses a leader to coordinate the turns

17

Channel Partitioning MAC protocols TDMA

TDMA (Time Division Multiple Access)

Access the channel in roundsldquo

Each station gets fixed length slot (length = packets trans time) in each

round Each slot called a Time-Slot

Unused slots go idle

Example 6-station LAN 134 have packtes slots 256 idle

18

10

Channel 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 134 have packets frequency bands 256 idle

frequ

ency

ban

ds

19

TDM FDM summary

FDM Enables the division of a channel with capacity C

bits per seconds to N sub-channels each gets a different

frequency range and capacity of CN

TDM The division of channel to N sub-channels each

gets CN capacity by giving the entire channel to each of

the N stations for 1N of the time

The division makes each sub channel less busy but the

overall waiting time is bigger by a factor of N compared

to having one channel (Little theorem)

20

11

Channel Partitioning MAC protocols CDMA

Code Division Multiple Access (CDMA)

used in several wireless broadcast channels (cellular satellite etc) standards

unique ldquocoderdquo assigned to each user ie code set partitioning

all users share same frequency but each user has own ldquochippingrdquo sequence (ie code) to encode data

encoded signal = (original data) X (chipping sequence)

decoding inner-product of encoded signal and chipping sequence

allows multiple users to ldquocoexistrdquo and transmit simultaneously with minimal interference (if codes are ldquoorthogonalrdquo)21

Random Access MAC Protocols

From here on we‟ll focus on Random Access MAC 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 ldquocollisionrdquo

Random access MAC protocol specifies

How to detect collisions

How to recover from collisions

Examples of random access MAC protocols

ALOHA

slotted ALOHA

CSMACD (Ethernet)

CSMACA (Wireless)

22

12

Aloha Protocol

Invented at the ‟70s in Hawaii

Intended for Radio networks but suitable for every

network where the station can listen to the channel while

broadcasting and determine whether others also transmit

Basic idea every station may transmit when it wants to If

collision is detected between frames back off and try

again later

If two frames are broadcast at the same time on the channel a

collision occurs and the both need to retransmit

23

Aloha Protocol

All hosts

Transmit on one frequency (fT)

Receive on other frequency (fR)

There is a central node which repeats whatever it receives

from fT frequency on the other fR frequency

The central node used as a repeater

Collisions are detected by the hosts

Receiving corrupted data (host knows what should be

received)

24

13

Aloha Protocol

1 Accept a new frame arrives

2 Transmit immediately and listen

If a collision occurred wait a random time and

repeat to stage 2

Otherwise go back to stage 1 to handle a new frame

25

Aloha Protocol

Simple

Robust against failure of a host

Distributed (excluding the central node which uses as a

repeater)

High load implicates low utilization of the channel and high

delays

26

14

Aloha - efficiency

Only 18

Suppose there are n stations and the probability that a

station starts transmitting in a time unit is p

Then The probability that exactly one node transmits

in a time unit is

27

Efficiency is the long-run fraction of successful transmissions when there are many nodes each with many frames to send

Aloha - efficiency

Only 18

Maximize the utilization function by differentiation

yields maximum point at with utilization

of

Trivial improvement

Why be vulnerable for 2 time units

Synchronize and use slotted time May transmit only

at integer times

28

Efficiency is the long-run fraction of successful transmissions when there are many nodes each with many frames to send

15

Slotted 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

29

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

Cons

collisions wasting slots

idle slots

nodes may be able to detect collision in less than time to transmit packet

clock synchronization

30

16

Slotted Aloha - efficiency

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

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 1e = 37

Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send

At best channelused for useful transmissions 37of time

31

Aloha - Summary

Very popular at the beginning of time (ie 70s to 80s)

Very simple to handle

Lots and lots of basic probabilities calculations for

students

Major problem Nodes don‟t check what‟s going on in the

channel each acting on its own No manners

32

17

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

Protocol

1 Listen to the channel

2 If channel sensed idle transmit entire frame

3 If channel sensed busy defer transmission by

1-Persistent CSMA

Wait until channel is quiet and transmit immediately If collision

occurs wait a random time and listen again (go to 1)

Non-Persistent CSMA

Wait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission

CSMA human analogy don‟t interrupt others

33

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMA

When transmitting try to sense if there is a collision

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

34

18

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots

adapter doesn‟t transmit if it

senses that some other

adapter is transmitting that is

carrier sense

transmitting adapter aborts

when it senses that another

adapter is transmitting that is

collision detection

Before attempting a

retransmission adapter

waits a random time that

is random access

36

19

Unreliable connectionless service

Connectionless No handshaking between sending and

receiving adapter

Unreliable receiving adapter doesn‟t send acks or nacks to

sending adapter

stream of datagrams passed to network layer can have gaps

gaps will be filled if app is using TCP

otherwise app will see the gaps

37

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other

transmitters are aware of

collision 48 bits

Bit time 1 microsec for 10 Mbps

Ethernet

for K=1023 wait time is about

50 msec

Exponential Backoff

Goal adapt retransmission

attempts to estimated current

load

heavy load random wait will be

longer

first collision choose K from

01 delay is K 512 bit

transmission times

after second collision choose K

from 0123hellip

after ten collisions choose K

from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

38

20

8023 CSMACD (Ethernet) Algorithm

39

Ethernet CSMACD algorithm

1 Adaptor receives datagram

from net layer amp creates frame

2 If adapter senses channel idle it

starts to transmit frame If it

senses channel busy waits until

channel idle and then transmits

3 If adapter transmits entire

frame without detecting

another transmission the

adapter is done with frame

4 If adapter detects another

transmission while transmitting

aborts and sends jam signal

5 After aborting adapter enters

exponential backoff after

the mth collision adapter

chooses a K at random from

012hellip2m-1 Adapter waits

K512 bit times and returns to

Step 2

40

21

Ethernet Minimum Packet Size

41

Summary of MAC protocols

What do you do with a shared media

Channel Partitioning by time frequency or code

Time Division Frequency Division Code Division

Random partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACD

carrier sensing easy in some technologies (wire) hard in

others (wireless)

CSMACD used in Ethernet

CSMACA used in 80211 (Wireless)

42

22

LAN technologies

Data link layer so far

MAC protocols The random protocol approach

Next LAN technologies

Addressing

Ethernet

Hubs bridges and switches

43

MAC Addresses and ARP

32-bit IP address network-layer address

used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet)

address used to get datagram from one interface to another physically-

connected interface (same network)

48 bit MAC address (for most LANs)

burned in the adapter ROM but can be modified

44

23

LAN Addresses and ARP

Each adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN(wired orwireless)

45

LAN Address (more)

MAC address allocation administered by IEEE

manufacturer buys portion of MAC address space (to assure

uniqueness)

Analogy

(a) MAC address like Social Security Number

(b) IP address like postal address

MAC flat address portability

can move LAN card from one LAN to another

IP hierarchical address NOT portable

depends on IP subnet to which node is attached

46

24

ARP Address Resolution Protocol

Each IP node (Host Router)

on LAN has ARP table

ARP Table IPMAC address

mappings for some LAN

nodes

lt IP address MAC address TTLgt

TTL (Time To Live) time after

which address mapping will be

forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

237196723

237196778

237196714

237196788

47

ARP protocol Same LAN (network)

A wants to send datagram to B

and B‟s MAC address not in A‟s

ARP table

A broadcasts ARP query packet

containing Bs IP address

Dest MAC address = FF-FF-

FF-FF-FF-FF

all machines on LAN receive

ARP query

B receives ARP packet replies to

A with its (Bs) MAC address

frame sent to A‟s MAC address

(unicast)

A caches (saves) IP-to-MAC

address pair in its ARP table until

information becomes old (times

out)

soft state information that

times out (goes away) unless

refreshed

ARP is ldquoplug-and-playrdquo

nodes create their ARP tables

without intervention from net

administrator

48

25

Routing to another LANwalkthrough send datagram from A to B via R

assume A know‟s B IP address

Two ARP tables in router R one for each IP network (LAN)

In routing table at source Host find router 111111111110

In ARP table at source find MAC address E6-E9-00-17-BB-4B etc

A

RB

49

Ossi Mokryn - Data link layer

A creates datagram with source A destination B

A uses ARP to get R‟s MAC address for 111111111110

A creates link-layer frame with Rs MAC address as dest frame

contains A-to-B IP datagram

A‟s adapter sends frame

R‟s adapter receives frame

R removes IP datagram from Ethernet frame sees its destined to B

R uses ARP to get B‟s MAC address

R creates frame containing A-to-B IP datagram sends to B

A

RB

50

26

Ethernet

ldquodominantrdquo wired LAN technology developed at the 70s

cheap $20 for 100Mbs

first widely used LAN technology

Simple cheap

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

51

Ethernet topology Through the Years

Classic Ethernet Now star topology prevails

Connection choices hub or switch (more later)

Fast Ethernet 100 Mbs

Gigabit Ethernet 1Gbps

52

hub orswitch

bull Shared Bus with CSMACDbull Bus maximal length 500 mbullTransmission rate 10Mbs

Through the years the only common is The Frame

27

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network

layer protocol packet) in Ethernet frame

Preamble

7 bytes with pattern 10101010 followed by one byte with

pattern 10101011

used to synchronize receiver sender clock rates what is

the length in clock ticks of one bit

53

Type length length or type of frame

Ethernet Frame Structure (more)

Ossi Mokryn - Data link layer

Addresses 6 bytes

if adapter receives frame with matching destination address or with

broadcast address (eg ARP packet) it passes data in frame to net-layer

protocol

otherwise adapter discards frame

MAC addresses also called Physical addresses

Type indicates the higher layer protocol (mostly IP but others

may be supported such as Novell IPX and AppleTalk)

CRC checked at receiver if error is detected the frame is

simply dropped Before CRC there is a padding field for the

CRC to pad to 64 bytes

54

28

55

Ethernet Technology 10Base2

10 10Mbps 2 under 200 meters max cable length

thin coaxial cable in a bus topology

repeaters used to connect up to multiple segments

repeater repeats bits it hears on one interface to its other

interfaces physical layer device only

Ethernet technology 100BaseT

10100 Mbps rate latter called ldquofast ethernetrdquo

T stands for Twisted Pair

Nodes connect to a hub ldquostar topologyrdquo 100 m max

distance between nodes and hub

twisted pair

hub

56

29

Ethernet technology 100BaseT

Problem must keep minimal packet size when bandwidth

increases

With fixed cable length and propagation speed must

increase minimal size proportionally to bandwidth

increase

Eg 100Mbs 1500m of cable prop remains 6μs minimal

size becomes 1200 bits

Solutions

Cable length limited to 100m

Prevent collisions by ldquoEthernet Switchesrdquo (later)

Max distance from node to Hub is 100 meters

57

58

Gbit Ethernet

use standard Ethernet frame format

allows for point-to-point links and shared broadcast channels

in shared mode CSMACD is used short distances between

nodes to be efficiency

uses hubs called here ldquoBuffered Distributorsrdquo

Full-Duplex at 1 Gbps for point-to-point links

10 Gbpsec now

30

Hubs

QWhy not just one big LAN

Limited amount of supportable traffic on single LAN

all stations must share bandwidth

limited length 8023 (Ethernet) specifies maximum

cable length

large ldquocollision domainrdquo (can collide with many

stations)

limited number of stations 8025 (token ring) have

token passing delays at each station

59

Lecture 360

Hubs (Multiport repeaters Bus in a box)

Physical Layer devices essentially repeaters operating at bit

levels repeat received bits on one interface to all other

interfaces

Can‟t interconnect 10BaseT amp 100BaseT (because

segments don‟t share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design)

with backbone hub at its top

31

61

Hubs (Multiport repeaters Bus in a box)

Each connected LAN referred to as LAN segment

Hubs do not isolate collision domains node may collide with any

node residing at any segment in LAN

Extends max distance between nodes but all the segments become

one large collision domain

Hub Advantages

simple inexpensive device

Multi-tier provides graceful degradation portions of the LAN

continue to operate if one hub malfunctions

extends maximum distance between node pairs (100m per Hub)

62

Bridges

Link Layer devices operate on Ethernet frames examining

frame header and selectively forwarding frame based on its

destination

Bridge isolates collision domains since it buffers frames

When frame is to be forwarded on segment bridge uses

CSMACD to access segment and transmit

Store and forward element So different types of Ethernet

types can be connected

Transparent no need for any change to hosts LAN adapters

Forwarding is selective do not always flood All connected

segments can work independently in parallel

32

63

Bridge Filtering

bridges learn which hosts can be reached through which

interfaces maintain filtering tables

when frame received bridge ldquolearnsrdquo location of sender

incoming LAN segment

records sender location in filtering table

filtering table entry

(Node LAN Address Bridge Interface Time Stamp)

stale entries in Filtering Table dropped (TTL can be 60 minutes)

64

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_port

if (out_port not valid) no entry found for destination

then flood forward on all but the interface on which the frame arrived

if (in_port = out_port) destination is on LAN on which frame was received

then drop the frame

Otherwise (out_port is valid) entry found for destination then forward the frame on interface indicated

33

65

Bridge Learning example

Suppose C sends frame to D and D replies back with frame

to C

C sends frame bridge has no info about D so floods to both LANs bridge notes that C is on port 1

frame ignored on upper LAN

frame received by D

66

Bridge Learning example

D generates reply to C sends

bridge sees frame from D

bridge notes that D is on interface 2

bridge knows C on interface 1 so selectivelyforwards frame out via interface 1

C 1

34

67

What will happen with loops

Incorrect learning

A

B

1 1

22

A 1 A 122

68

What will happen with loops

Frame looping

A

C

1 1

22

C C

35

69

What will happen with loops

Frame looping

A

B

1 1

22

B2 B1

70

Introducing Spanning Tree

Allow a path between every LAN without causing loops

(loop-free environment)

Bridges communicate with special configuration

messages (BPDUs)

Standardized by IEEE 8021D

Note redundant paths are good active redundant paths are bad (they cause

loops)

36

How to Construct a Spanning Tree

Bridges run a distributed spanning tree

Algorithm

Select what ports (and bridges) should actively forward

frames

Finding the root flooding

Building a tree Bellman-Ford Algorithm

Can combine efficiently

Standardized in IEEE 8021 specification

71

72

Spanning Tree Requirements

Each bridge is assigned a unique identifier

A broadcast address for bridges on a LAN

A unique port identifier for all ports on all bridges

MAC address

Bridge id + port number

37

73

Spanning Tree Concepts

Root Bridge The bridge with the lowest bridge ID value is elected the

root bridge

One root bridge chosen among all bridges

Every other bridge calculates a path to the root bridge

74

Spanning Tree Concepts

Path Cost A cost associated with each port on each bridge

default is 1

The cost associated with transmission onto the LAN

connected to the port

Can be manually or automatically assigned

Can be used to alter the path to the root bridge

38

75

Spanning Tree Concepts

Root Port The port on each bridge that is on the path towards the

root bridge

The root port is part of the lowest cost path towards

the root bridge

If port costs are equal on a bridge the port with the

lowest ID becomes root port

76

Spanning Tree Concepts

Root Path Cost The minimum cost path to the root bridge

The cost starts at the root bridge

Each bridge computes root path cost independently

based on their view of the network

39

77

Spanning Tree Concepts Designated

Bridge Only one bridge on a LAN at one time is chosen the

designated bridge

This bridge provides the minimum cost path to the root

bridge for the LAN

Only the designated bridge passes frames towards the

root bridge

78

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Protocol operation1 Picks a root2 For each LAN

picks a designated bridgethat is closest to the root

3 All bridges on a LANsend packets towards the root via the designatedbridge

B8

40

79

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

80

Spanning Tree Algorithm

An Overview 1 Determine the root bridge among all bridges

2 Each bridge determines its root port

The port in the direction of the root bridge

3 Determine the designated bridge on each LAN

The bridge which accepts frames to forward towards the root bridge

The frames are sent on the root port of the designated bridge

41

81

Spanning Tree Algorithm

Selecting Root Bridge Initially each bridge considers itself to be the root bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

Best one wins

(lowest root IDcostpriority)

82

Spanning Tree Algorithm

Selecting Root Ports Each bridge selects one of its ports which has the

minimal cost to the root bridge

In case of a tie the lowest uplink (transmitter) bridge ID is

used

In case of another tie the lowest port ID is used

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 9: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

9

MAC Protocol Types

Three broad classes

Channel Partitioning

Divide channel into smaller ldquopiecesrdquo (Time-Slots Frequancy-Bands

or by code)

allocate piece to a node for exclusive its use

Random Access

Channel not divided allow collisions

ldquoRecoverrdquo from collisions

ldquoTaking turnsrdquo

Nodes take turns but nodes with more to send can take longer

turns

Might uses a leader to coordinate the turns

17

Channel Partitioning MAC protocols TDMA

TDMA (Time Division Multiple Access)

Access the channel in roundsldquo

Each station gets fixed length slot (length = packets trans time) in each

round Each slot called a Time-Slot

Unused slots go idle

Example 6-station LAN 134 have packtes slots 256 idle

18

10

Channel 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 134 have packets frequency bands 256 idle

frequ

ency

ban

ds

19

TDM FDM summary

FDM Enables the division of a channel with capacity C

bits per seconds to N sub-channels each gets a different

frequency range and capacity of CN

TDM The division of channel to N sub-channels each

gets CN capacity by giving the entire channel to each of

the N stations for 1N of the time

The division makes each sub channel less busy but the

overall waiting time is bigger by a factor of N compared

to having one channel (Little theorem)

20

11

Channel Partitioning MAC protocols CDMA

Code Division Multiple Access (CDMA)

used in several wireless broadcast channels (cellular satellite etc) standards

unique ldquocoderdquo assigned to each user ie code set partitioning

all users share same frequency but each user has own ldquochippingrdquo sequence (ie code) to encode data

encoded signal = (original data) X (chipping sequence)

decoding inner-product of encoded signal and chipping sequence

allows multiple users to ldquocoexistrdquo and transmit simultaneously with minimal interference (if codes are ldquoorthogonalrdquo)21

Random Access MAC Protocols

From here on we‟ll focus on Random Access MAC 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 ldquocollisionrdquo

Random access MAC protocol specifies

How to detect collisions

How to recover from collisions

Examples of random access MAC protocols

ALOHA

slotted ALOHA

CSMACD (Ethernet)

CSMACA (Wireless)

22

12

Aloha Protocol

Invented at the ‟70s in Hawaii

Intended for Radio networks but suitable for every

network where the station can listen to the channel while

broadcasting and determine whether others also transmit

Basic idea every station may transmit when it wants to If

collision is detected between frames back off and try

again later

If two frames are broadcast at the same time on the channel a

collision occurs and the both need to retransmit

23

Aloha Protocol

All hosts

Transmit on one frequency (fT)

Receive on other frequency (fR)

There is a central node which repeats whatever it receives

from fT frequency on the other fR frequency

The central node used as a repeater

Collisions are detected by the hosts

Receiving corrupted data (host knows what should be

received)

24

13

Aloha Protocol

1 Accept a new frame arrives

2 Transmit immediately and listen

If a collision occurred wait a random time and

repeat to stage 2

Otherwise go back to stage 1 to handle a new frame

25

Aloha Protocol

Simple

Robust against failure of a host

Distributed (excluding the central node which uses as a

repeater)

High load implicates low utilization of the channel and high

delays

26

14

Aloha - efficiency

Only 18

Suppose there are n stations and the probability that a

station starts transmitting in a time unit is p

Then The probability that exactly one node transmits

in a time unit is

27

Efficiency is the long-run fraction of successful transmissions when there are many nodes each with many frames to send

Aloha - efficiency

Only 18

Maximize the utilization function by differentiation

yields maximum point at with utilization

of

Trivial improvement

Why be vulnerable for 2 time units

Synchronize and use slotted time May transmit only

at integer times

28

Efficiency is the long-run fraction of successful transmissions when there are many nodes each with many frames to send

15

Slotted 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

29

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

Cons

collisions wasting slots

idle slots

nodes may be able to detect collision in less than time to transmit packet

clock synchronization

30

16

Slotted Aloha - efficiency

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

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 1e = 37

Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send

At best channelused for useful transmissions 37of time

31

Aloha - Summary

Very popular at the beginning of time (ie 70s to 80s)

Very simple to handle

Lots and lots of basic probabilities calculations for

students

Major problem Nodes don‟t check what‟s going on in the

channel each acting on its own No manners

32

17

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

Protocol

1 Listen to the channel

2 If channel sensed idle transmit entire frame

3 If channel sensed busy defer transmission by

1-Persistent CSMA

Wait until channel is quiet and transmit immediately If collision

occurs wait a random time and listen again (go to 1)

Non-Persistent CSMA

Wait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission

CSMA human analogy don‟t interrupt others

33

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMA

When transmitting try to sense if there is a collision

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

34

18

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots

adapter doesn‟t transmit if it

senses that some other

adapter is transmitting that is

carrier sense

transmitting adapter aborts

when it senses that another

adapter is transmitting that is

collision detection

Before attempting a

retransmission adapter

waits a random time that

is random access

36

19

Unreliable connectionless service

Connectionless No handshaking between sending and

receiving adapter

Unreliable receiving adapter doesn‟t send acks or nacks to

sending adapter

stream of datagrams passed to network layer can have gaps

gaps will be filled if app is using TCP

otherwise app will see the gaps

37

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other

transmitters are aware of

collision 48 bits

Bit time 1 microsec for 10 Mbps

Ethernet

for K=1023 wait time is about

50 msec

Exponential Backoff

Goal adapt retransmission

attempts to estimated current

load

heavy load random wait will be

longer

first collision choose K from

01 delay is K 512 bit

transmission times

after second collision choose K

from 0123hellip

after ten collisions choose K

from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

38

20

8023 CSMACD (Ethernet) Algorithm

39

Ethernet CSMACD algorithm

1 Adaptor receives datagram

from net layer amp creates frame

2 If adapter senses channel idle it

starts to transmit frame If it

senses channel busy waits until

channel idle and then transmits

3 If adapter transmits entire

frame without detecting

another transmission the

adapter is done with frame

4 If adapter detects another

transmission while transmitting

aborts and sends jam signal

5 After aborting adapter enters

exponential backoff after

the mth collision adapter

chooses a K at random from

012hellip2m-1 Adapter waits

K512 bit times and returns to

Step 2

40

21

Ethernet Minimum Packet Size

41

Summary of MAC protocols

What do you do with a shared media

Channel Partitioning by time frequency or code

Time Division Frequency Division Code Division

Random partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACD

carrier sensing easy in some technologies (wire) hard in

others (wireless)

CSMACD used in Ethernet

CSMACA used in 80211 (Wireless)

42

22

LAN technologies

Data link layer so far

MAC protocols The random protocol approach

Next LAN technologies

Addressing

Ethernet

Hubs bridges and switches

43

MAC Addresses and ARP

32-bit IP address network-layer address

used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet)

address used to get datagram from one interface to another physically-

connected interface (same network)

48 bit MAC address (for most LANs)

burned in the adapter ROM but can be modified

44

23

LAN Addresses and ARP

Each adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN(wired orwireless)

45

LAN Address (more)

MAC address allocation administered by IEEE

manufacturer buys portion of MAC address space (to assure

uniqueness)

Analogy

(a) MAC address like Social Security Number

(b) IP address like postal address

MAC flat address portability

can move LAN card from one LAN to another

IP hierarchical address NOT portable

depends on IP subnet to which node is attached

46

24

ARP Address Resolution Protocol

Each IP node (Host Router)

on LAN has ARP table

ARP Table IPMAC address

mappings for some LAN

nodes

lt IP address MAC address TTLgt

TTL (Time To Live) time after

which address mapping will be

forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

237196723

237196778

237196714

237196788

47

ARP protocol Same LAN (network)

A wants to send datagram to B

and B‟s MAC address not in A‟s

ARP table

A broadcasts ARP query packet

containing Bs IP address

Dest MAC address = FF-FF-

FF-FF-FF-FF

all machines on LAN receive

ARP query

B receives ARP packet replies to

A with its (Bs) MAC address

frame sent to A‟s MAC address

(unicast)

A caches (saves) IP-to-MAC

address pair in its ARP table until

information becomes old (times

out)

soft state information that

times out (goes away) unless

refreshed

ARP is ldquoplug-and-playrdquo

nodes create their ARP tables

without intervention from net

administrator

48

25

Routing to another LANwalkthrough send datagram from A to B via R

assume A know‟s B IP address

Two ARP tables in router R one for each IP network (LAN)

In routing table at source Host find router 111111111110

In ARP table at source find MAC address E6-E9-00-17-BB-4B etc

A

RB

49

Ossi Mokryn - Data link layer

A creates datagram with source A destination B

A uses ARP to get R‟s MAC address for 111111111110

A creates link-layer frame with Rs MAC address as dest frame

contains A-to-B IP datagram

A‟s adapter sends frame

R‟s adapter receives frame

R removes IP datagram from Ethernet frame sees its destined to B

R uses ARP to get B‟s MAC address

R creates frame containing A-to-B IP datagram sends to B

A

RB

50

26

Ethernet

ldquodominantrdquo wired LAN technology developed at the 70s

cheap $20 for 100Mbs

first widely used LAN technology

Simple cheap

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

51

Ethernet topology Through the Years

Classic Ethernet Now star topology prevails

Connection choices hub or switch (more later)

Fast Ethernet 100 Mbs

Gigabit Ethernet 1Gbps

52

hub orswitch

bull Shared Bus with CSMACDbull Bus maximal length 500 mbullTransmission rate 10Mbs

Through the years the only common is The Frame

27

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network

layer protocol packet) in Ethernet frame

Preamble

7 bytes with pattern 10101010 followed by one byte with

pattern 10101011

used to synchronize receiver sender clock rates what is

the length in clock ticks of one bit

53

Type length length or type of frame

Ethernet Frame Structure (more)

Ossi Mokryn - Data link layer

Addresses 6 bytes

if adapter receives frame with matching destination address or with

broadcast address (eg ARP packet) it passes data in frame to net-layer

protocol

otherwise adapter discards frame

MAC addresses also called Physical addresses

Type indicates the higher layer protocol (mostly IP but others

may be supported such as Novell IPX and AppleTalk)

CRC checked at receiver if error is detected the frame is

simply dropped Before CRC there is a padding field for the

CRC to pad to 64 bytes

54

28

55

Ethernet Technology 10Base2

10 10Mbps 2 under 200 meters max cable length

thin coaxial cable in a bus topology

repeaters used to connect up to multiple segments

repeater repeats bits it hears on one interface to its other

interfaces physical layer device only

Ethernet technology 100BaseT

10100 Mbps rate latter called ldquofast ethernetrdquo

T stands for Twisted Pair

Nodes connect to a hub ldquostar topologyrdquo 100 m max

distance between nodes and hub

twisted pair

hub

56

29

Ethernet technology 100BaseT

Problem must keep minimal packet size when bandwidth

increases

With fixed cable length and propagation speed must

increase minimal size proportionally to bandwidth

increase

Eg 100Mbs 1500m of cable prop remains 6μs minimal

size becomes 1200 bits

Solutions

Cable length limited to 100m

Prevent collisions by ldquoEthernet Switchesrdquo (later)

Max distance from node to Hub is 100 meters

57

58

Gbit Ethernet

use standard Ethernet frame format

allows for point-to-point links and shared broadcast channels

in shared mode CSMACD is used short distances between

nodes to be efficiency

uses hubs called here ldquoBuffered Distributorsrdquo

Full-Duplex at 1 Gbps for point-to-point links

10 Gbpsec now

30

Hubs

QWhy not just one big LAN

Limited amount of supportable traffic on single LAN

all stations must share bandwidth

limited length 8023 (Ethernet) specifies maximum

cable length

large ldquocollision domainrdquo (can collide with many

stations)

limited number of stations 8025 (token ring) have

token passing delays at each station

59

Lecture 360

Hubs (Multiport repeaters Bus in a box)

Physical Layer devices essentially repeaters operating at bit

levels repeat received bits on one interface to all other

interfaces

Can‟t interconnect 10BaseT amp 100BaseT (because

segments don‟t share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design)

with backbone hub at its top

31

61

Hubs (Multiport repeaters Bus in a box)

Each connected LAN referred to as LAN segment

Hubs do not isolate collision domains node may collide with any

node residing at any segment in LAN

Extends max distance between nodes but all the segments become

one large collision domain

Hub Advantages

simple inexpensive device

Multi-tier provides graceful degradation portions of the LAN

continue to operate if one hub malfunctions

extends maximum distance between node pairs (100m per Hub)

62

Bridges

Link Layer devices operate on Ethernet frames examining

frame header and selectively forwarding frame based on its

destination

Bridge isolates collision domains since it buffers frames

When frame is to be forwarded on segment bridge uses

CSMACD to access segment and transmit

Store and forward element So different types of Ethernet

types can be connected

Transparent no need for any change to hosts LAN adapters

Forwarding is selective do not always flood All connected

segments can work independently in parallel

32

63

Bridge Filtering

bridges learn which hosts can be reached through which

interfaces maintain filtering tables

when frame received bridge ldquolearnsrdquo location of sender

incoming LAN segment

records sender location in filtering table

filtering table entry

(Node LAN Address Bridge Interface Time Stamp)

stale entries in Filtering Table dropped (TTL can be 60 minutes)

64

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_port

if (out_port not valid) no entry found for destination

then flood forward on all but the interface on which the frame arrived

if (in_port = out_port) destination is on LAN on which frame was received

then drop the frame

Otherwise (out_port is valid) entry found for destination then forward the frame on interface indicated

33

65

Bridge Learning example

Suppose C sends frame to D and D replies back with frame

to C

C sends frame bridge has no info about D so floods to both LANs bridge notes that C is on port 1

frame ignored on upper LAN

frame received by D

66

Bridge Learning example

D generates reply to C sends

bridge sees frame from D

bridge notes that D is on interface 2

bridge knows C on interface 1 so selectivelyforwards frame out via interface 1

C 1

34

67

What will happen with loops

Incorrect learning

A

B

1 1

22

A 1 A 122

68

What will happen with loops

Frame looping

A

C

1 1

22

C C

35

69

What will happen with loops

Frame looping

A

B

1 1

22

B2 B1

70

Introducing Spanning Tree

Allow a path between every LAN without causing loops

(loop-free environment)

Bridges communicate with special configuration

messages (BPDUs)

Standardized by IEEE 8021D

Note redundant paths are good active redundant paths are bad (they cause

loops)

36

How to Construct a Spanning Tree

Bridges run a distributed spanning tree

Algorithm

Select what ports (and bridges) should actively forward

frames

Finding the root flooding

Building a tree Bellman-Ford Algorithm

Can combine efficiently

Standardized in IEEE 8021 specification

71

72

Spanning Tree Requirements

Each bridge is assigned a unique identifier

A broadcast address for bridges on a LAN

A unique port identifier for all ports on all bridges

MAC address

Bridge id + port number

37

73

Spanning Tree Concepts

Root Bridge The bridge with the lowest bridge ID value is elected the

root bridge

One root bridge chosen among all bridges

Every other bridge calculates a path to the root bridge

74

Spanning Tree Concepts

Path Cost A cost associated with each port on each bridge

default is 1

The cost associated with transmission onto the LAN

connected to the port

Can be manually or automatically assigned

Can be used to alter the path to the root bridge

38

75

Spanning Tree Concepts

Root Port The port on each bridge that is on the path towards the

root bridge

The root port is part of the lowest cost path towards

the root bridge

If port costs are equal on a bridge the port with the

lowest ID becomes root port

76

Spanning Tree Concepts

Root Path Cost The minimum cost path to the root bridge

The cost starts at the root bridge

Each bridge computes root path cost independently

based on their view of the network

39

77

Spanning Tree Concepts Designated

Bridge Only one bridge on a LAN at one time is chosen the

designated bridge

This bridge provides the minimum cost path to the root

bridge for the LAN

Only the designated bridge passes frames towards the

root bridge

78

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Protocol operation1 Picks a root2 For each LAN

picks a designated bridgethat is closest to the root

3 All bridges on a LANsend packets towards the root via the designatedbridge

B8

40

79

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

80

Spanning Tree Algorithm

An Overview 1 Determine the root bridge among all bridges

2 Each bridge determines its root port

The port in the direction of the root bridge

3 Determine the designated bridge on each LAN

The bridge which accepts frames to forward towards the root bridge

The frames are sent on the root port of the designated bridge

41

81

Spanning Tree Algorithm

Selecting Root Bridge Initially each bridge considers itself to be the root bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

Best one wins

(lowest root IDcostpriority)

82

Spanning Tree Algorithm

Selecting Root Ports Each bridge selects one of its ports which has the

minimal cost to the root bridge

In case of a tie the lowest uplink (transmitter) bridge ID is

used

In case of another tie the lowest port ID is used

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 10: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

10

Channel 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 134 have packets frequency bands 256 idle

frequ

ency

ban

ds

19

TDM FDM summary

FDM Enables the division of a channel with capacity C

bits per seconds to N sub-channels each gets a different

frequency range and capacity of CN

TDM The division of channel to N sub-channels each

gets CN capacity by giving the entire channel to each of

the N stations for 1N of the time

The division makes each sub channel less busy but the

overall waiting time is bigger by a factor of N compared

to having one channel (Little theorem)

20

11

Channel Partitioning MAC protocols CDMA

Code Division Multiple Access (CDMA)

used in several wireless broadcast channels (cellular satellite etc) standards

unique ldquocoderdquo assigned to each user ie code set partitioning

all users share same frequency but each user has own ldquochippingrdquo sequence (ie code) to encode data

encoded signal = (original data) X (chipping sequence)

decoding inner-product of encoded signal and chipping sequence

allows multiple users to ldquocoexistrdquo and transmit simultaneously with minimal interference (if codes are ldquoorthogonalrdquo)21

Random Access MAC Protocols

From here on we‟ll focus on Random Access MAC 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 ldquocollisionrdquo

Random access MAC protocol specifies

How to detect collisions

How to recover from collisions

Examples of random access MAC protocols

ALOHA

slotted ALOHA

CSMACD (Ethernet)

CSMACA (Wireless)

22

12

Aloha Protocol

Invented at the ‟70s in Hawaii

Intended for Radio networks but suitable for every

network where the station can listen to the channel while

broadcasting and determine whether others also transmit

Basic idea every station may transmit when it wants to If

collision is detected between frames back off and try

again later

If two frames are broadcast at the same time on the channel a

collision occurs and the both need to retransmit

23

Aloha Protocol

All hosts

Transmit on one frequency (fT)

Receive on other frequency (fR)

There is a central node which repeats whatever it receives

from fT frequency on the other fR frequency

The central node used as a repeater

Collisions are detected by the hosts

Receiving corrupted data (host knows what should be

received)

24

13

Aloha Protocol

1 Accept a new frame arrives

2 Transmit immediately and listen

If a collision occurred wait a random time and

repeat to stage 2

Otherwise go back to stage 1 to handle a new frame

25

Aloha Protocol

Simple

Robust against failure of a host

Distributed (excluding the central node which uses as a

repeater)

High load implicates low utilization of the channel and high

delays

26

14

Aloha - efficiency

Only 18

Suppose there are n stations and the probability that a

station starts transmitting in a time unit is p

Then The probability that exactly one node transmits

in a time unit is

27

Efficiency is the long-run fraction of successful transmissions when there are many nodes each with many frames to send

Aloha - efficiency

Only 18

Maximize the utilization function by differentiation

yields maximum point at with utilization

of

Trivial improvement

Why be vulnerable for 2 time units

Synchronize and use slotted time May transmit only

at integer times

28

Efficiency is the long-run fraction of successful transmissions when there are many nodes each with many frames to send

15

Slotted 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

29

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

Cons

collisions wasting slots

idle slots

nodes may be able to detect collision in less than time to transmit packet

clock synchronization

30

16

Slotted Aloha - efficiency

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

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 1e = 37

Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send

At best channelused for useful transmissions 37of time

31

Aloha - Summary

Very popular at the beginning of time (ie 70s to 80s)

Very simple to handle

Lots and lots of basic probabilities calculations for

students

Major problem Nodes don‟t check what‟s going on in the

channel each acting on its own No manners

32

17

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

Protocol

1 Listen to the channel

2 If channel sensed idle transmit entire frame

3 If channel sensed busy defer transmission by

1-Persistent CSMA

Wait until channel is quiet and transmit immediately If collision

occurs wait a random time and listen again (go to 1)

Non-Persistent CSMA

Wait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission

CSMA human analogy don‟t interrupt others

33

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMA

When transmitting try to sense if there is a collision

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

34

18

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots

adapter doesn‟t transmit if it

senses that some other

adapter is transmitting that is

carrier sense

transmitting adapter aborts

when it senses that another

adapter is transmitting that is

collision detection

Before attempting a

retransmission adapter

waits a random time that

is random access

36

19

Unreliable connectionless service

Connectionless No handshaking between sending and

receiving adapter

Unreliable receiving adapter doesn‟t send acks or nacks to

sending adapter

stream of datagrams passed to network layer can have gaps

gaps will be filled if app is using TCP

otherwise app will see the gaps

37

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other

transmitters are aware of

collision 48 bits

Bit time 1 microsec for 10 Mbps

Ethernet

for K=1023 wait time is about

50 msec

Exponential Backoff

Goal adapt retransmission

attempts to estimated current

load

heavy load random wait will be

longer

first collision choose K from

01 delay is K 512 bit

transmission times

after second collision choose K

from 0123hellip

after ten collisions choose K

from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

38

20

8023 CSMACD (Ethernet) Algorithm

39

Ethernet CSMACD algorithm

1 Adaptor receives datagram

from net layer amp creates frame

2 If adapter senses channel idle it

starts to transmit frame If it

senses channel busy waits until

channel idle and then transmits

3 If adapter transmits entire

frame without detecting

another transmission the

adapter is done with frame

4 If adapter detects another

transmission while transmitting

aborts and sends jam signal

5 After aborting adapter enters

exponential backoff after

the mth collision adapter

chooses a K at random from

012hellip2m-1 Adapter waits

K512 bit times and returns to

Step 2

40

21

Ethernet Minimum Packet Size

41

Summary of MAC protocols

What do you do with a shared media

Channel Partitioning by time frequency or code

Time Division Frequency Division Code Division

Random partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACD

carrier sensing easy in some technologies (wire) hard in

others (wireless)

CSMACD used in Ethernet

CSMACA used in 80211 (Wireless)

42

22

LAN technologies

Data link layer so far

MAC protocols The random protocol approach

Next LAN technologies

Addressing

Ethernet

Hubs bridges and switches

43

MAC Addresses and ARP

32-bit IP address network-layer address

used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet)

address used to get datagram from one interface to another physically-

connected interface (same network)

48 bit MAC address (for most LANs)

burned in the adapter ROM but can be modified

44

23

LAN Addresses and ARP

Each adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN(wired orwireless)

45

LAN Address (more)

MAC address allocation administered by IEEE

manufacturer buys portion of MAC address space (to assure

uniqueness)

Analogy

(a) MAC address like Social Security Number

(b) IP address like postal address

MAC flat address portability

can move LAN card from one LAN to another

IP hierarchical address NOT portable

depends on IP subnet to which node is attached

46

24

ARP Address Resolution Protocol

Each IP node (Host Router)

on LAN has ARP table

ARP Table IPMAC address

mappings for some LAN

nodes

lt IP address MAC address TTLgt

TTL (Time To Live) time after

which address mapping will be

forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

237196723

237196778

237196714

237196788

47

ARP protocol Same LAN (network)

A wants to send datagram to B

and B‟s MAC address not in A‟s

ARP table

A broadcasts ARP query packet

containing Bs IP address

Dest MAC address = FF-FF-

FF-FF-FF-FF

all machines on LAN receive

ARP query

B receives ARP packet replies to

A with its (Bs) MAC address

frame sent to A‟s MAC address

(unicast)

A caches (saves) IP-to-MAC

address pair in its ARP table until

information becomes old (times

out)

soft state information that

times out (goes away) unless

refreshed

ARP is ldquoplug-and-playrdquo

nodes create their ARP tables

without intervention from net

administrator

48

25

Routing to another LANwalkthrough send datagram from A to B via R

assume A know‟s B IP address

Two ARP tables in router R one for each IP network (LAN)

In routing table at source Host find router 111111111110

In ARP table at source find MAC address E6-E9-00-17-BB-4B etc

A

RB

49

Ossi Mokryn - Data link layer

A creates datagram with source A destination B

A uses ARP to get R‟s MAC address for 111111111110

A creates link-layer frame with Rs MAC address as dest frame

contains A-to-B IP datagram

A‟s adapter sends frame

R‟s adapter receives frame

R removes IP datagram from Ethernet frame sees its destined to B

R uses ARP to get B‟s MAC address

R creates frame containing A-to-B IP datagram sends to B

A

RB

50

26

Ethernet

ldquodominantrdquo wired LAN technology developed at the 70s

cheap $20 for 100Mbs

first widely used LAN technology

Simple cheap

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

51

Ethernet topology Through the Years

Classic Ethernet Now star topology prevails

Connection choices hub or switch (more later)

Fast Ethernet 100 Mbs

Gigabit Ethernet 1Gbps

52

hub orswitch

bull Shared Bus with CSMACDbull Bus maximal length 500 mbullTransmission rate 10Mbs

Through the years the only common is The Frame

27

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network

layer protocol packet) in Ethernet frame

Preamble

7 bytes with pattern 10101010 followed by one byte with

pattern 10101011

used to synchronize receiver sender clock rates what is

the length in clock ticks of one bit

53

Type length length or type of frame

Ethernet Frame Structure (more)

Ossi Mokryn - Data link layer

Addresses 6 bytes

if adapter receives frame with matching destination address or with

broadcast address (eg ARP packet) it passes data in frame to net-layer

protocol

otherwise adapter discards frame

MAC addresses also called Physical addresses

Type indicates the higher layer protocol (mostly IP but others

may be supported such as Novell IPX and AppleTalk)

CRC checked at receiver if error is detected the frame is

simply dropped Before CRC there is a padding field for the

CRC to pad to 64 bytes

54

28

55

Ethernet Technology 10Base2

10 10Mbps 2 under 200 meters max cable length

thin coaxial cable in a bus topology

repeaters used to connect up to multiple segments

repeater repeats bits it hears on one interface to its other

interfaces physical layer device only

Ethernet technology 100BaseT

10100 Mbps rate latter called ldquofast ethernetrdquo

T stands for Twisted Pair

Nodes connect to a hub ldquostar topologyrdquo 100 m max

distance between nodes and hub

twisted pair

hub

56

29

Ethernet technology 100BaseT

Problem must keep minimal packet size when bandwidth

increases

With fixed cable length and propagation speed must

increase minimal size proportionally to bandwidth

increase

Eg 100Mbs 1500m of cable prop remains 6μs minimal

size becomes 1200 bits

Solutions

Cable length limited to 100m

Prevent collisions by ldquoEthernet Switchesrdquo (later)

Max distance from node to Hub is 100 meters

57

58

Gbit Ethernet

use standard Ethernet frame format

allows for point-to-point links and shared broadcast channels

in shared mode CSMACD is used short distances between

nodes to be efficiency

uses hubs called here ldquoBuffered Distributorsrdquo

Full-Duplex at 1 Gbps for point-to-point links

10 Gbpsec now

30

Hubs

QWhy not just one big LAN

Limited amount of supportable traffic on single LAN

all stations must share bandwidth

limited length 8023 (Ethernet) specifies maximum

cable length

large ldquocollision domainrdquo (can collide with many

stations)

limited number of stations 8025 (token ring) have

token passing delays at each station

59

Lecture 360

Hubs (Multiport repeaters Bus in a box)

Physical Layer devices essentially repeaters operating at bit

levels repeat received bits on one interface to all other

interfaces

Can‟t interconnect 10BaseT amp 100BaseT (because

segments don‟t share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design)

with backbone hub at its top

31

61

Hubs (Multiport repeaters Bus in a box)

Each connected LAN referred to as LAN segment

Hubs do not isolate collision domains node may collide with any

node residing at any segment in LAN

Extends max distance between nodes but all the segments become

one large collision domain

Hub Advantages

simple inexpensive device

Multi-tier provides graceful degradation portions of the LAN

continue to operate if one hub malfunctions

extends maximum distance between node pairs (100m per Hub)

62

Bridges

Link Layer devices operate on Ethernet frames examining

frame header and selectively forwarding frame based on its

destination

Bridge isolates collision domains since it buffers frames

When frame is to be forwarded on segment bridge uses

CSMACD to access segment and transmit

Store and forward element So different types of Ethernet

types can be connected

Transparent no need for any change to hosts LAN adapters

Forwarding is selective do not always flood All connected

segments can work independently in parallel

32

63

Bridge Filtering

bridges learn which hosts can be reached through which

interfaces maintain filtering tables

when frame received bridge ldquolearnsrdquo location of sender

incoming LAN segment

records sender location in filtering table

filtering table entry

(Node LAN Address Bridge Interface Time Stamp)

stale entries in Filtering Table dropped (TTL can be 60 minutes)

64

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_port

if (out_port not valid) no entry found for destination

then flood forward on all but the interface on which the frame arrived

if (in_port = out_port) destination is on LAN on which frame was received

then drop the frame

Otherwise (out_port is valid) entry found for destination then forward the frame on interface indicated

33

65

Bridge Learning example

Suppose C sends frame to D and D replies back with frame

to C

C sends frame bridge has no info about D so floods to both LANs bridge notes that C is on port 1

frame ignored on upper LAN

frame received by D

66

Bridge Learning example

D generates reply to C sends

bridge sees frame from D

bridge notes that D is on interface 2

bridge knows C on interface 1 so selectivelyforwards frame out via interface 1

C 1

34

67

What will happen with loops

Incorrect learning

A

B

1 1

22

A 1 A 122

68

What will happen with loops

Frame looping

A

C

1 1

22

C C

35

69

What will happen with loops

Frame looping

A

B

1 1

22

B2 B1

70

Introducing Spanning Tree

Allow a path between every LAN without causing loops

(loop-free environment)

Bridges communicate with special configuration

messages (BPDUs)

Standardized by IEEE 8021D

Note redundant paths are good active redundant paths are bad (they cause

loops)

36

How to Construct a Spanning Tree

Bridges run a distributed spanning tree

Algorithm

Select what ports (and bridges) should actively forward

frames

Finding the root flooding

Building a tree Bellman-Ford Algorithm

Can combine efficiently

Standardized in IEEE 8021 specification

71

72

Spanning Tree Requirements

Each bridge is assigned a unique identifier

A broadcast address for bridges on a LAN

A unique port identifier for all ports on all bridges

MAC address

Bridge id + port number

37

73

Spanning Tree Concepts

Root Bridge The bridge with the lowest bridge ID value is elected the

root bridge

One root bridge chosen among all bridges

Every other bridge calculates a path to the root bridge

74

Spanning Tree Concepts

Path Cost A cost associated with each port on each bridge

default is 1

The cost associated with transmission onto the LAN

connected to the port

Can be manually or automatically assigned

Can be used to alter the path to the root bridge

38

75

Spanning Tree Concepts

Root Port The port on each bridge that is on the path towards the

root bridge

The root port is part of the lowest cost path towards

the root bridge

If port costs are equal on a bridge the port with the

lowest ID becomes root port

76

Spanning Tree Concepts

Root Path Cost The minimum cost path to the root bridge

The cost starts at the root bridge

Each bridge computes root path cost independently

based on their view of the network

39

77

Spanning Tree Concepts Designated

Bridge Only one bridge on a LAN at one time is chosen the

designated bridge

This bridge provides the minimum cost path to the root

bridge for the LAN

Only the designated bridge passes frames towards the

root bridge

78

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Protocol operation1 Picks a root2 For each LAN

picks a designated bridgethat is closest to the root

3 All bridges on a LANsend packets towards the root via the designatedbridge

B8

40

79

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

80

Spanning Tree Algorithm

An Overview 1 Determine the root bridge among all bridges

2 Each bridge determines its root port

The port in the direction of the root bridge

3 Determine the designated bridge on each LAN

The bridge which accepts frames to forward towards the root bridge

The frames are sent on the root port of the designated bridge

41

81

Spanning Tree Algorithm

Selecting Root Bridge Initially each bridge considers itself to be the root bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

Best one wins

(lowest root IDcostpriority)

82

Spanning Tree Algorithm

Selecting Root Ports Each bridge selects one of its ports which has the

minimal cost to the root bridge

In case of a tie the lowest uplink (transmitter) bridge ID is

used

In case of another tie the lowest port ID is used

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 11: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

11

Channel Partitioning MAC protocols CDMA

Code Division Multiple Access (CDMA)

used in several wireless broadcast channels (cellular satellite etc) standards

unique ldquocoderdquo assigned to each user ie code set partitioning

all users share same frequency but each user has own ldquochippingrdquo sequence (ie code) to encode data

encoded signal = (original data) X (chipping sequence)

decoding inner-product of encoded signal and chipping sequence

allows multiple users to ldquocoexistrdquo and transmit simultaneously with minimal interference (if codes are ldquoorthogonalrdquo)21

Random Access MAC Protocols

From here on we‟ll focus on Random Access MAC 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 ldquocollisionrdquo

Random access MAC protocol specifies

How to detect collisions

How to recover from collisions

Examples of random access MAC protocols

ALOHA

slotted ALOHA

CSMACD (Ethernet)

CSMACA (Wireless)

22

12

Aloha Protocol

Invented at the ‟70s in Hawaii

Intended for Radio networks but suitable for every

network where the station can listen to the channel while

broadcasting and determine whether others also transmit

Basic idea every station may transmit when it wants to If

collision is detected between frames back off and try

again later

If two frames are broadcast at the same time on the channel a

collision occurs and the both need to retransmit

23

Aloha Protocol

All hosts

Transmit on one frequency (fT)

Receive on other frequency (fR)

There is a central node which repeats whatever it receives

from fT frequency on the other fR frequency

The central node used as a repeater

Collisions are detected by the hosts

Receiving corrupted data (host knows what should be

received)

24

13

Aloha Protocol

1 Accept a new frame arrives

2 Transmit immediately and listen

If a collision occurred wait a random time and

repeat to stage 2

Otherwise go back to stage 1 to handle a new frame

25

Aloha Protocol

Simple

Robust against failure of a host

Distributed (excluding the central node which uses as a

repeater)

High load implicates low utilization of the channel and high

delays

26

14

Aloha - efficiency

Only 18

Suppose there are n stations and the probability that a

station starts transmitting in a time unit is p

Then The probability that exactly one node transmits

in a time unit is

27

Efficiency is the long-run fraction of successful transmissions when there are many nodes each with many frames to send

Aloha - efficiency

Only 18

Maximize the utilization function by differentiation

yields maximum point at with utilization

of

Trivial improvement

Why be vulnerable for 2 time units

Synchronize and use slotted time May transmit only

at integer times

28

Efficiency is the long-run fraction of successful transmissions when there are many nodes each with many frames to send

15

Slotted 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

29

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

Cons

collisions wasting slots

idle slots

nodes may be able to detect collision in less than time to transmit packet

clock synchronization

30

16

Slotted Aloha - efficiency

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

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 1e = 37

Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send

At best channelused for useful transmissions 37of time

31

Aloha - Summary

Very popular at the beginning of time (ie 70s to 80s)

Very simple to handle

Lots and lots of basic probabilities calculations for

students

Major problem Nodes don‟t check what‟s going on in the

channel each acting on its own No manners

32

17

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

Protocol

1 Listen to the channel

2 If channel sensed idle transmit entire frame

3 If channel sensed busy defer transmission by

1-Persistent CSMA

Wait until channel is quiet and transmit immediately If collision

occurs wait a random time and listen again (go to 1)

Non-Persistent CSMA

Wait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission

CSMA human analogy don‟t interrupt others

33

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMA

When transmitting try to sense if there is a collision

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

34

18

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots

adapter doesn‟t transmit if it

senses that some other

adapter is transmitting that is

carrier sense

transmitting adapter aborts

when it senses that another

adapter is transmitting that is

collision detection

Before attempting a

retransmission adapter

waits a random time that

is random access

36

19

Unreliable connectionless service

Connectionless No handshaking between sending and

receiving adapter

Unreliable receiving adapter doesn‟t send acks or nacks to

sending adapter

stream of datagrams passed to network layer can have gaps

gaps will be filled if app is using TCP

otherwise app will see the gaps

37

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other

transmitters are aware of

collision 48 bits

Bit time 1 microsec for 10 Mbps

Ethernet

for K=1023 wait time is about

50 msec

Exponential Backoff

Goal adapt retransmission

attempts to estimated current

load

heavy load random wait will be

longer

first collision choose K from

01 delay is K 512 bit

transmission times

after second collision choose K

from 0123hellip

after ten collisions choose K

from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

38

20

8023 CSMACD (Ethernet) Algorithm

39

Ethernet CSMACD algorithm

1 Adaptor receives datagram

from net layer amp creates frame

2 If adapter senses channel idle it

starts to transmit frame If it

senses channel busy waits until

channel idle and then transmits

3 If adapter transmits entire

frame without detecting

another transmission the

adapter is done with frame

4 If adapter detects another

transmission while transmitting

aborts and sends jam signal

5 After aborting adapter enters

exponential backoff after

the mth collision adapter

chooses a K at random from

012hellip2m-1 Adapter waits

K512 bit times and returns to

Step 2

40

21

Ethernet Minimum Packet Size

41

Summary of MAC protocols

What do you do with a shared media

Channel Partitioning by time frequency or code

Time Division Frequency Division Code Division

Random partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACD

carrier sensing easy in some technologies (wire) hard in

others (wireless)

CSMACD used in Ethernet

CSMACA used in 80211 (Wireless)

42

22

LAN technologies

Data link layer so far

MAC protocols The random protocol approach

Next LAN technologies

Addressing

Ethernet

Hubs bridges and switches

43

MAC Addresses and ARP

32-bit IP address network-layer address

used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet)

address used to get datagram from one interface to another physically-

connected interface (same network)

48 bit MAC address (for most LANs)

burned in the adapter ROM but can be modified

44

23

LAN Addresses and ARP

Each adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN(wired orwireless)

45

LAN Address (more)

MAC address allocation administered by IEEE

manufacturer buys portion of MAC address space (to assure

uniqueness)

Analogy

(a) MAC address like Social Security Number

(b) IP address like postal address

MAC flat address portability

can move LAN card from one LAN to another

IP hierarchical address NOT portable

depends on IP subnet to which node is attached

46

24

ARP Address Resolution Protocol

Each IP node (Host Router)

on LAN has ARP table

ARP Table IPMAC address

mappings for some LAN

nodes

lt IP address MAC address TTLgt

TTL (Time To Live) time after

which address mapping will be

forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

237196723

237196778

237196714

237196788

47

ARP protocol Same LAN (network)

A wants to send datagram to B

and B‟s MAC address not in A‟s

ARP table

A broadcasts ARP query packet

containing Bs IP address

Dest MAC address = FF-FF-

FF-FF-FF-FF

all machines on LAN receive

ARP query

B receives ARP packet replies to

A with its (Bs) MAC address

frame sent to A‟s MAC address

(unicast)

A caches (saves) IP-to-MAC

address pair in its ARP table until

information becomes old (times

out)

soft state information that

times out (goes away) unless

refreshed

ARP is ldquoplug-and-playrdquo

nodes create their ARP tables

without intervention from net

administrator

48

25

Routing to another LANwalkthrough send datagram from A to B via R

assume A know‟s B IP address

Two ARP tables in router R one for each IP network (LAN)

In routing table at source Host find router 111111111110

In ARP table at source find MAC address E6-E9-00-17-BB-4B etc

A

RB

49

Ossi Mokryn - Data link layer

A creates datagram with source A destination B

A uses ARP to get R‟s MAC address for 111111111110

A creates link-layer frame with Rs MAC address as dest frame

contains A-to-B IP datagram

A‟s adapter sends frame

R‟s adapter receives frame

R removes IP datagram from Ethernet frame sees its destined to B

R uses ARP to get B‟s MAC address

R creates frame containing A-to-B IP datagram sends to B

A

RB

50

26

Ethernet

ldquodominantrdquo wired LAN technology developed at the 70s

cheap $20 for 100Mbs

first widely used LAN technology

Simple cheap

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

51

Ethernet topology Through the Years

Classic Ethernet Now star topology prevails

Connection choices hub or switch (more later)

Fast Ethernet 100 Mbs

Gigabit Ethernet 1Gbps

52

hub orswitch

bull Shared Bus with CSMACDbull Bus maximal length 500 mbullTransmission rate 10Mbs

Through the years the only common is The Frame

27

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network

layer protocol packet) in Ethernet frame

Preamble

7 bytes with pattern 10101010 followed by one byte with

pattern 10101011

used to synchronize receiver sender clock rates what is

the length in clock ticks of one bit

53

Type length length or type of frame

Ethernet Frame Structure (more)

Ossi Mokryn - Data link layer

Addresses 6 bytes

if adapter receives frame with matching destination address or with

broadcast address (eg ARP packet) it passes data in frame to net-layer

protocol

otherwise adapter discards frame

MAC addresses also called Physical addresses

Type indicates the higher layer protocol (mostly IP but others

may be supported such as Novell IPX and AppleTalk)

CRC checked at receiver if error is detected the frame is

simply dropped Before CRC there is a padding field for the

CRC to pad to 64 bytes

54

28

55

Ethernet Technology 10Base2

10 10Mbps 2 under 200 meters max cable length

thin coaxial cable in a bus topology

repeaters used to connect up to multiple segments

repeater repeats bits it hears on one interface to its other

interfaces physical layer device only

Ethernet technology 100BaseT

10100 Mbps rate latter called ldquofast ethernetrdquo

T stands for Twisted Pair

Nodes connect to a hub ldquostar topologyrdquo 100 m max

distance between nodes and hub

twisted pair

hub

56

29

Ethernet technology 100BaseT

Problem must keep minimal packet size when bandwidth

increases

With fixed cable length and propagation speed must

increase minimal size proportionally to bandwidth

increase

Eg 100Mbs 1500m of cable prop remains 6μs minimal

size becomes 1200 bits

Solutions

Cable length limited to 100m

Prevent collisions by ldquoEthernet Switchesrdquo (later)

Max distance from node to Hub is 100 meters

57

58

Gbit Ethernet

use standard Ethernet frame format

allows for point-to-point links and shared broadcast channels

in shared mode CSMACD is used short distances between

nodes to be efficiency

uses hubs called here ldquoBuffered Distributorsrdquo

Full-Duplex at 1 Gbps for point-to-point links

10 Gbpsec now

30

Hubs

QWhy not just one big LAN

Limited amount of supportable traffic on single LAN

all stations must share bandwidth

limited length 8023 (Ethernet) specifies maximum

cable length

large ldquocollision domainrdquo (can collide with many

stations)

limited number of stations 8025 (token ring) have

token passing delays at each station

59

Lecture 360

Hubs (Multiport repeaters Bus in a box)

Physical Layer devices essentially repeaters operating at bit

levels repeat received bits on one interface to all other

interfaces

Can‟t interconnect 10BaseT amp 100BaseT (because

segments don‟t share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design)

with backbone hub at its top

31

61

Hubs (Multiport repeaters Bus in a box)

Each connected LAN referred to as LAN segment

Hubs do not isolate collision domains node may collide with any

node residing at any segment in LAN

Extends max distance between nodes but all the segments become

one large collision domain

Hub Advantages

simple inexpensive device

Multi-tier provides graceful degradation portions of the LAN

continue to operate if one hub malfunctions

extends maximum distance between node pairs (100m per Hub)

62

Bridges

Link Layer devices operate on Ethernet frames examining

frame header and selectively forwarding frame based on its

destination

Bridge isolates collision domains since it buffers frames

When frame is to be forwarded on segment bridge uses

CSMACD to access segment and transmit

Store and forward element So different types of Ethernet

types can be connected

Transparent no need for any change to hosts LAN adapters

Forwarding is selective do not always flood All connected

segments can work independently in parallel

32

63

Bridge Filtering

bridges learn which hosts can be reached through which

interfaces maintain filtering tables

when frame received bridge ldquolearnsrdquo location of sender

incoming LAN segment

records sender location in filtering table

filtering table entry

(Node LAN Address Bridge Interface Time Stamp)

stale entries in Filtering Table dropped (TTL can be 60 minutes)

64

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_port

if (out_port not valid) no entry found for destination

then flood forward on all but the interface on which the frame arrived

if (in_port = out_port) destination is on LAN on which frame was received

then drop the frame

Otherwise (out_port is valid) entry found for destination then forward the frame on interface indicated

33

65

Bridge Learning example

Suppose C sends frame to D and D replies back with frame

to C

C sends frame bridge has no info about D so floods to both LANs bridge notes that C is on port 1

frame ignored on upper LAN

frame received by D

66

Bridge Learning example

D generates reply to C sends

bridge sees frame from D

bridge notes that D is on interface 2

bridge knows C on interface 1 so selectivelyforwards frame out via interface 1

C 1

34

67

What will happen with loops

Incorrect learning

A

B

1 1

22

A 1 A 122

68

What will happen with loops

Frame looping

A

C

1 1

22

C C

35

69

What will happen with loops

Frame looping

A

B

1 1

22

B2 B1

70

Introducing Spanning Tree

Allow a path between every LAN without causing loops

(loop-free environment)

Bridges communicate with special configuration

messages (BPDUs)

Standardized by IEEE 8021D

Note redundant paths are good active redundant paths are bad (they cause

loops)

36

How to Construct a Spanning Tree

Bridges run a distributed spanning tree

Algorithm

Select what ports (and bridges) should actively forward

frames

Finding the root flooding

Building a tree Bellman-Ford Algorithm

Can combine efficiently

Standardized in IEEE 8021 specification

71

72

Spanning Tree Requirements

Each bridge is assigned a unique identifier

A broadcast address for bridges on a LAN

A unique port identifier for all ports on all bridges

MAC address

Bridge id + port number

37

73

Spanning Tree Concepts

Root Bridge The bridge with the lowest bridge ID value is elected the

root bridge

One root bridge chosen among all bridges

Every other bridge calculates a path to the root bridge

74

Spanning Tree Concepts

Path Cost A cost associated with each port on each bridge

default is 1

The cost associated with transmission onto the LAN

connected to the port

Can be manually or automatically assigned

Can be used to alter the path to the root bridge

38

75

Spanning Tree Concepts

Root Port The port on each bridge that is on the path towards the

root bridge

The root port is part of the lowest cost path towards

the root bridge

If port costs are equal on a bridge the port with the

lowest ID becomes root port

76

Spanning Tree Concepts

Root Path Cost The minimum cost path to the root bridge

The cost starts at the root bridge

Each bridge computes root path cost independently

based on their view of the network

39

77

Spanning Tree Concepts Designated

Bridge Only one bridge on a LAN at one time is chosen the

designated bridge

This bridge provides the minimum cost path to the root

bridge for the LAN

Only the designated bridge passes frames towards the

root bridge

78

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Protocol operation1 Picks a root2 For each LAN

picks a designated bridgethat is closest to the root

3 All bridges on a LANsend packets towards the root via the designatedbridge

B8

40

79

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

80

Spanning Tree Algorithm

An Overview 1 Determine the root bridge among all bridges

2 Each bridge determines its root port

The port in the direction of the root bridge

3 Determine the designated bridge on each LAN

The bridge which accepts frames to forward towards the root bridge

The frames are sent on the root port of the designated bridge

41

81

Spanning Tree Algorithm

Selecting Root Bridge Initially each bridge considers itself to be the root bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

Best one wins

(lowest root IDcostpriority)

82

Spanning Tree Algorithm

Selecting Root Ports Each bridge selects one of its ports which has the

minimal cost to the root bridge

In case of a tie the lowest uplink (transmitter) bridge ID is

used

In case of another tie the lowest port ID is used

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 12: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

12

Aloha Protocol

Invented at the ‟70s in Hawaii

Intended for Radio networks but suitable for every

network where the station can listen to the channel while

broadcasting and determine whether others also transmit

Basic idea every station may transmit when it wants to If

collision is detected between frames back off and try

again later

If two frames are broadcast at the same time on the channel a

collision occurs and the both need to retransmit

23

Aloha Protocol

All hosts

Transmit on one frequency (fT)

Receive on other frequency (fR)

There is a central node which repeats whatever it receives

from fT frequency on the other fR frequency

The central node used as a repeater

Collisions are detected by the hosts

Receiving corrupted data (host knows what should be

received)

24

13

Aloha Protocol

1 Accept a new frame arrives

2 Transmit immediately and listen

If a collision occurred wait a random time and

repeat to stage 2

Otherwise go back to stage 1 to handle a new frame

25

Aloha Protocol

Simple

Robust against failure of a host

Distributed (excluding the central node which uses as a

repeater)

High load implicates low utilization of the channel and high

delays

26

14

Aloha - efficiency

Only 18

Suppose there are n stations and the probability that a

station starts transmitting in a time unit is p

Then The probability that exactly one node transmits

in a time unit is

27

Efficiency is the long-run fraction of successful transmissions when there are many nodes each with many frames to send

Aloha - efficiency

Only 18

Maximize the utilization function by differentiation

yields maximum point at with utilization

of

Trivial improvement

Why be vulnerable for 2 time units

Synchronize and use slotted time May transmit only

at integer times

28

Efficiency is the long-run fraction of successful transmissions when there are many nodes each with many frames to send

15

Slotted 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

29

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

Cons

collisions wasting slots

idle slots

nodes may be able to detect collision in less than time to transmit packet

clock synchronization

30

16

Slotted Aloha - efficiency

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

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 1e = 37

Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send

At best channelused for useful transmissions 37of time

31

Aloha - Summary

Very popular at the beginning of time (ie 70s to 80s)

Very simple to handle

Lots and lots of basic probabilities calculations for

students

Major problem Nodes don‟t check what‟s going on in the

channel each acting on its own No manners

32

17

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

Protocol

1 Listen to the channel

2 If channel sensed idle transmit entire frame

3 If channel sensed busy defer transmission by

1-Persistent CSMA

Wait until channel is quiet and transmit immediately If collision

occurs wait a random time and listen again (go to 1)

Non-Persistent CSMA

Wait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission

CSMA human analogy don‟t interrupt others

33

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMA

When transmitting try to sense if there is a collision

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

34

18

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots

adapter doesn‟t transmit if it

senses that some other

adapter is transmitting that is

carrier sense

transmitting adapter aborts

when it senses that another

adapter is transmitting that is

collision detection

Before attempting a

retransmission adapter

waits a random time that

is random access

36

19

Unreliable connectionless service

Connectionless No handshaking between sending and

receiving adapter

Unreliable receiving adapter doesn‟t send acks or nacks to

sending adapter

stream of datagrams passed to network layer can have gaps

gaps will be filled if app is using TCP

otherwise app will see the gaps

37

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other

transmitters are aware of

collision 48 bits

Bit time 1 microsec for 10 Mbps

Ethernet

for K=1023 wait time is about

50 msec

Exponential Backoff

Goal adapt retransmission

attempts to estimated current

load

heavy load random wait will be

longer

first collision choose K from

01 delay is K 512 bit

transmission times

after second collision choose K

from 0123hellip

after ten collisions choose K

from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

38

20

8023 CSMACD (Ethernet) Algorithm

39

Ethernet CSMACD algorithm

1 Adaptor receives datagram

from net layer amp creates frame

2 If adapter senses channel idle it

starts to transmit frame If it

senses channel busy waits until

channel idle and then transmits

3 If adapter transmits entire

frame without detecting

another transmission the

adapter is done with frame

4 If adapter detects another

transmission while transmitting

aborts and sends jam signal

5 After aborting adapter enters

exponential backoff after

the mth collision adapter

chooses a K at random from

012hellip2m-1 Adapter waits

K512 bit times and returns to

Step 2

40

21

Ethernet Minimum Packet Size

41

Summary of MAC protocols

What do you do with a shared media

Channel Partitioning by time frequency or code

Time Division Frequency Division Code Division

Random partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACD

carrier sensing easy in some technologies (wire) hard in

others (wireless)

CSMACD used in Ethernet

CSMACA used in 80211 (Wireless)

42

22

LAN technologies

Data link layer so far

MAC protocols The random protocol approach

Next LAN technologies

Addressing

Ethernet

Hubs bridges and switches

43

MAC Addresses and ARP

32-bit IP address network-layer address

used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet)

address used to get datagram from one interface to another physically-

connected interface (same network)

48 bit MAC address (for most LANs)

burned in the adapter ROM but can be modified

44

23

LAN Addresses and ARP

Each adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN(wired orwireless)

45

LAN Address (more)

MAC address allocation administered by IEEE

manufacturer buys portion of MAC address space (to assure

uniqueness)

Analogy

(a) MAC address like Social Security Number

(b) IP address like postal address

MAC flat address portability

can move LAN card from one LAN to another

IP hierarchical address NOT portable

depends on IP subnet to which node is attached

46

24

ARP Address Resolution Protocol

Each IP node (Host Router)

on LAN has ARP table

ARP Table IPMAC address

mappings for some LAN

nodes

lt IP address MAC address TTLgt

TTL (Time To Live) time after

which address mapping will be

forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

237196723

237196778

237196714

237196788

47

ARP protocol Same LAN (network)

A wants to send datagram to B

and B‟s MAC address not in A‟s

ARP table

A broadcasts ARP query packet

containing Bs IP address

Dest MAC address = FF-FF-

FF-FF-FF-FF

all machines on LAN receive

ARP query

B receives ARP packet replies to

A with its (Bs) MAC address

frame sent to A‟s MAC address

(unicast)

A caches (saves) IP-to-MAC

address pair in its ARP table until

information becomes old (times

out)

soft state information that

times out (goes away) unless

refreshed

ARP is ldquoplug-and-playrdquo

nodes create their ARP tables

without intervention from net

administrator

48

25

Routing to another LANwalkthrough send datagram from A to B via R

assume A know‟s B IP address

Two ARP tables in router R one for each IP network (LAN)

In routing table at source Host find router 111111111110

In ARP table at source find MAC address E6-E9-00-17-BB-4B etc

A

RB

49

Ossi Mokryn - Data link layer

A creates datagram with source A destination B

A uses ARP to get R‟s MAC address for 111111111110

A creates link-layer frame with Rs MAC address as dest frame

contains A-to-B IP datagram

A‟s adapter sends frame

R‟s adapter receives frame

R removes IP datagram from Ethernet frame sees its destined to B

R uses ARP to get B‟s MAC address

R creates frame containing A-to-B IP datagram sends to B

A

RB

50

26

Ethernet

ldquodominantrdquo wired LAN technology developed at the 70s

cheap $20 for 100Mbs

first widely used LAN technology

Simple cheap

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

51

Ethernet topology Through the Years

Classic Ethernet Now star topology prevails

Connection choices hub or switch (more later)

Fast Ethernet 100 Mbs

Gigabit Ethernet 1Gbps

52

hub orswitch

bull Shared Bus with CSMACDbull Bus maximal length 500 mbullTransmission rate 10Mbs

Through the years the only common is The Frame

27

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network

layer protocol packet) in Ethernet frame

Preamble

7 bytes with pattern 10101010 followed by one byte with

pattern 10101011

used to synchronize receiver sender clock rates what is

the length in clock ticks of one bit

53

Type length length or type of frame

Ethernet Frame Structure (more)

Ossi Mokryn - Data link layer

Addresses 6 bytes

if adapter receives frame with matching destination address or with

broadcast address (eg ARP packet) it passes data in frame to net-layer

protocol

otherwise adapter discards frame

MAC addresses also called Physical addresses

Type indicates the higher layer protocol (mostly IP but others

may be supported such as Novell IPX and AppleTalk)

CRC checked at receiver if error is detected the frame is

simply dropped Before CRC there is a padding field for the

CRC to pad to 64 bytes

54

28

55

Ethernet Technology 10Base2

10 10Mbps 2 under 200 meters max cable length

thin coaxial cable in a bus topology

repeaters used to connect up to multiple segments

repeater repeats bits it hears on one interface to its other

interfaces physical layer device only

Ethernet technology 100BaseT

10100 Mbps rate latter called ldquofast ethernetrdquo

T stands for Twisted Pair

Nodes connect to a hub ldquostar topologyrdquo 100 m max

distance between nodes and hub

twisted pair

hub

56

29

Ethernet technology 100BaseT

Problem must keep minimal packet size when bandwidth

increases

With fixed cable length and propagation speed must

increase minimal size proportionally to bandwidth

increase

Eg 100Mbs 1500m of cable prop remains 6μs minimal

size becomes 1200 bits

Solutions

Cable length limited to 100m

Prevent collisions by ldquoEthernet Switchesrdquo (later)

Max distance from node to Hub is 100 meters

57

58

Gbit Ethernet

use standard Ethernet frame format

allows for point-to-point links and shared broadcast channels

in shared mode CSMACD is used short distances between

nodes to be efficiency

uses hubs called here ldquoBuffered Distributorsrdquo

Full-Duplex at 1 Gbps for point-to-point links

10 Gbpsec now

30

Hubs

QWhy not just one big LAN

Limited amount of supportable traffic on single LAN

all stations must share bandwidth

limited length 8023 (Ethernet) specifies maximum

cable length

large ldquocollision domainrdquo (can collide with many

stations)

limited number of stations 8025 (token ring) have

token passing delays at each station

59

Lecture 360

Hubs (Multiport repeaters Bus in a box)

Physical Layer devices essentially repeaters operating at bit

levels repeat received bits on one interface to all other

interfaces

Can‟t interconnect 10BaseT amp 100BaseT (because

segments don‟t share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design)

with backbone hub at its top

31

61

Hubs (Multiport repeaters Bus in a box)

Each connected LAN referred to as LAN segment

Hubs do not isolate collision domains node may collide with any

node residing at any segment in LAN

Extends max distance between nodes but all the segments become

one large collision domain

Hub Advantages

simple inexpensive device

Multi-tier provides graceful degradation portions of the LAN

continue to operate if one hub malfunctions

extends maximum distance between node pairs (100m per Hub)

62

Bridges

Link Layer devices operate on Ethernet frames examining

frame header and selectively forwarding frame based on its

destination

Bridge isolates collision domains since it buffers frames

When frame is to be forwarded on segment bridge uses

CSMACD to access segment and transmit

Store and forward element So different types of Ethernet

types can be connected

Transparent no need for any change to hosts LAN adapters

Forwarding is selective do not always flood All connected

segments can work independently in parallel

32

63

Bridge Filtering

bridges learn which hosts can be reached through which

interfaces maintain filtering tables

when frame received bridge ldquolearnsrdquo location of sender

incoming LAN segment

records sender location in filtering table

filtering table entry

(Node LAN Address Bridge Interface Time Stamp)

stale entries in Filtering Table dropped (TTL can be 60 minutes)

64

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_port

if (out_port not valid) no entry found for destination

then flood forward on all but the interface on which the frame arrived

if (in_port = out_port) destination is on LAN on which frame was received

then drop the frame

Otherwise (out_port is valid) entry found for destination then forward the frame on interface indicated

33

65

Bridge Learning example

Suppose C sends frame to D and D replies back with frame

to C

C sends frame bridge has no info about D so floods to both LANs bridge notes that C is on port 1

frame ignored on upper LAN

frame received by D

66

Bridge Learning example

D generates reply to C sends

bridge sees frame from D

bridge notes that D is on interface 2

bridge knows C on interface 1 so selectivelyforwards frame out via interface 1

C 1

34

67

What will happen with loops

Incorrect learning

A

B

1 1

22

A 1 A 122

68

What will happen with loops

Frame looping

A

C

1 1

22

C C

35

69

What will happen with loops

Frame looping

A

B

1 1

22

B2 B1

70

Introducing Spanning Tree

Allow a path between every LAN without causing loops

(loop-free environment)

Bridges communicate with special configuration

messages (BPDUs)

Standardized by IEEE 8021D

Note redundant paths are good active redundant paths are bad (they cause

loops)

36

How to Construct a Spanning Tree

Bridges run a distributed spanning tree

Algorithm

Select what ports (and bridges) should actively forward

frames

Finding the root flooding

Building a tree Bellman-Ford Algorithm

Can combine efficiently

Standardized in IEEE 8021 specification

71

72

Spanning Tree Requirements

Each bridge is assigned a unique identifier

A broadcast address for bridges on a LAN

A unique port identifier for all ports on all bridges

MAC address

Bridge id + port number

37

73

Spanning Tree Concepts

Root Bridge The bridge with the lowest bridge ID value is elected the

root bridge

One root bridge chosen among all bridges

Every other bridge calculates a path to the root bridge

74

Spanning Tree Concepts

Path Cost A cost associated with each port on each bridge

default is 1

The cost associated with transmission onto the LAN

connected to the port

Can be manually or automatically assigned

Can be used to alter the path to the root bridge

38

75

Spanning Tree Concepts

Root Port The port on each bridge that is on the path towards the

root bridge

The root port is part of the lowest cost path towards

the root bridge

If port costs are equal on a bridge the port with the

lowest ID becomes root port

76

Spanning Tree Concepts

Root Path Cost The minimum cost path to the root bridge

The cost starts at the root bridge

Each bridge computes root path cost independently

based on their view of the network

39

77

Spanning Tree Concepts Designated

Bridge Only one bridge on a LAN at one time is chosen the

designated bridge

This bridge provides the minimum cost path to the root

bridge for the LAN

Only the designated bridge passes frames towards the

root bridge

78

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Protocol operation1 Picks a root2 For each LAN

picks a designated bridgethat is closest to the root

3 All bridges on a LANsend packets towards the root via the designatedbridge

B8

40

79

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

80

Spanning Tree Algorithm

An Overview 1 Determine the root bridge among all bridges

2 Each bridge determines its root port

The port in the direction of the root bridge

3 Determine the designated bridge on each LAN

The bridge which accepts frames to forward towards the root bridge

The frames are sent on the root port of the designated bridge

41

81

Spanning Tree Algorithm

Selecting Root Bridge Initially each bridge considers itself to be the root bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

Best one wins

(lowest root IDcostpriority)

82

Spanning Tree Algorithm

Selecting Root Ports Each bridge selects one of its ports which has the

minimal cost to the root bridge

In case of a tie the lowest uplink (transmitter) bridge ID is

used

In case of another tie the lowest port ID is used

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 13: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

13

Aloha Protocol

1 Accept a new frame arrives

2 Transmit immediately and listen

If a collision occurred wait a random time and

repeat to stage 2

Otherwise go back to stage 1 to handle a new frame

25

Aloha Protocol

Simple

Robust against failure of a host

Distributed (excluding the central node which uses as a

repeater)

High load implicates low utilization of the channel and high

delays

26

14

Aloha - efficiency

Only 18

Suppose there are n stations and the probability that a

station starts transmitting in a time unit is p

Then The probability that exactly one node transmits

in a time unit is

27

Efficiency is the long-run fraction of successful transmissions when there are many nodes each with many frames to send

Aloha - efficiency

Only 18

Maximize the utilization function by differentiation

yields maximum point at with utilization

of

Trivial improvement

Why be vulnerable for 2 time units

Synchronize and use slotted time May transmit only

at integer times

28

Efficiency is the long-run fraction of successful transmissions when there are many nodes each with many frames to send

15

Slotted 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

29

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

Cons

collisions wasting slots

idle slots

nodes may be able to detect collision in less than time to transmit packet

clock synchronization

30

16

Slotted Aloha - efficiency

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

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 1e = 37

Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send

At best channelused for useful transmissions 37of time

31

Aloha - Summary

Very popular at the beginning of time (ie 70s to 80s)

Very simple to handle

Lots and lots of basic probabilities calculations for

students

Major problem Nodes don‟t check what‟s going on in the

channel each acting on its own No manners

32

17

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

Protocol

1 Listen to the channel

2 If channel sensed idle transmit entire frame

3 If channel sensed busy defer transmission by

1-Persistent CSMA

Wait until channel is quiet and transmit immediately If collision

occurs wait a random time and listen again (go to 1)

Non-Persistent CSMA

Wait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission

CSMA human analogy don‟t interrupt others

33

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMA

When transmitting try to sense if there is a collision

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

34

18

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots

adapter doesn‟t transmit if it

senses that some other

adapter is transmitting that is

carrier sense

transmitting adapter aborts

when it senses that another

adapter is transmitting that is

collision detection

Before attempting a

retransmission adapter

waits a random time that

is random access

36

19

Unreliable connectionless service

Connectionless No handshaking between sending and

receiving adapter

Unreliable receiving adapter doesn‟t send acks or nacks to

sending adapter

stream of datagrams passed to network layer can have gaps

gaps will be filled if app is using TCP

otherwise app will see the gaps

37

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other

transmitters are aware of

collision 48 bits

Bit time 1 microsec for 10 Mbps

Ethernet

for K=1023 wait time is about

50 msec

Exponential Backoff

Goal adapt retransmission

attempts to estimated current

load

heavy load random wait will be

longer

first collision choose K from

01 delay is K 512 bit

transmission times

after second collision choose K

from 0123hellip

after ten collisions choose K

from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

38

20

8023 CSMACD (Ethernet) Algorithm

39

Ethernet CSMACD algorithm

1 Adaptor receives datagram

from net layer amp creates frame

2 If adapter senses channel idle it

starts to transmit frame If it

senses channel busy waits until

channel idle and then transmits

3 If adapter transmits entire

frame without detecting

another transmission the

adapter is done with frame

4 If adapter detects another

transmission while transmitting

aborts and sends jam signal

5 After aborting adapter enters

exponential backoff after

the mth collision adapter

chooses a K at random from

012hellip2m-1 Adapter waits

K512 bit times and returns to

Step 2

40

21

Ethernet Minimum Packet Size

41

Summary of MAC protocols

What do you do with a shared media

Channel Partitioning by time frequency or code

Time Division Frequency Division Code Division

Random partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACD

carrier sensing easy in some technologies (wire) hard in

others (wireless)

CSMACD used in Ethernet

CSMACA used in 80211 (Wireless)

42

22

LAN technologies

Data link layer so far

MAC protocols The random protocol approach

Next LAN technologies

Addressing

Ethernet

Hubs bridges and switches

43

MAC Addresses and ARP

32-bit IP address network-layer address

used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet)

address used to get datagram from one interface to another physically-

connected interface (same network)

48 bit MAC address (for most LANs)

burned in the adapter ROM but can be modified

44

23

LAN Addresses and ARP

Each adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN(wired orwireless)

45

LAN Address (more)

MAC address allocation administered by IEEE

manufacturer buys portion of MAC address space (to assure

uniqueness)

Analogy

(a) MAC address like Social Security Number

(b) IP address like postal address

MAC flat address portability

can move LAN card from one LAN to another

IP hierarchical address NOT portable

depends on IP subnet to which node is attached

46

24

ARP Address Resolution Protocol

Each IP node (Host Router)

on LAN has ARP table

ARP Table IPMAC address

mappings for some LAN

nodes

lt IP address MAC address TTLgt

TTL (Time To Live) time after

which address mapping will be

forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

237196723

237196778

237196714

237196788

47

ARP protocol Same LAN (network)

A wants to send datagram to B

and B‟s MAC address not in A‟s

ARP table

A broadcasts ARP query packet

containing Bs IP address

Dest MAC address = FF-FF-

FF-FF-FF-FF

all machines on LAN receive

ARP query

B receives ARP packet replies to

A with its (Bs) MAC address

frame sent to A‟s MAC address

(unicast)

A caches (saves) IP-to-MAC

address pair in its ARP table until

information becomes old (times

out)

soft state information that

times out (goes away) unless

refreshed

ARP is ldquoplug-and-playrdquo

nodes create their ARP tables

without intervention from net

administrator

48

25

Routing to another LANwalkthrough send datagram from A to B via R

assume A know‟s B IP address

Two ARP tables in router R one for each IP network (LAN)

In routing table at source Host find router 111111111110

In ARP table at source find MAC address E6-E9-00-17-BB-4B etc

A

RB

49

Ossi Mokryn - Data link layer

A creates datagram with source A destination B

A uses ARP to get R‟s MAC address for 111111111110

A creates link-layer frame with Rs MAC address as dest frame

contains A-to-B IP datagram

A‟s adapter sends frame

R‟s adapter receives frame

R removes IP datagram from Ethernet frame sees its destined to B

R uses ARP to get B‟s MAC address

R creates frame containing A-to-B IP datagram sends to B

A

RB

50

26

Ethernet

ldquodominantrdquo wired LAN technology developed at the 70s

cheap $20 for 100Mbs

first widely used LAN technology

Simple cheap

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

51

Ethernet topology Through the Years

Classic Ethernet Now star topology prevails

Connection choices hub or switch (more later)

Fast Ethernet 100 Mbs

Gigabit Ethernet 1Gbps

52

hub orswitch

bull Shared Bus with CSMACDbull Bus maximal length 500 mbullTransmission rate 10Mbs

Through the years the only common is The Frame

27

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network

layer protocol packet) in Ethernet frame

Preamble

7 bytes with pattern 10101010 followed by one byte with

pattern 10101011

used to synchronize receiver sender clock rates what is

the length in clock ticks of one bit

53

Type length length or type of frame

Ethernet Frame Structure (more)

Ossi Mokryn - Data link layer

Addresses 6 bytes

if adapter receives frame with matching destination address or with

broadcast address (eg ARP packet) it passes data in frame to net-layer

protocol

otherwise adapter discards frame

MAC addresses also called Physical addresses

Type indicates the higher layer protocol (mostly IP but others

may be supported such as Novell IPX and AppleTalk)

CRC checked at receiver if error is detected the frame is

simply dropped Before CRC there is a padding field for the

CRC to pad to 64 bytes

54

28

55

Ethernet Technology 10Base2

10 10Mbps 2 under 200 meters max cable length

thin coaxial cable in a bus topology

repeaters used to connect up to multiple segments

repeater repeats bits it hears on one interface to its other

interfaces physical layer device only

Ethernet technology 100BaseT

10100 Mbps rate latter called ldquofast ethernetrdquo

T stands for Twisted Pair

Nodes connect to a hub ldquostar topologyrdquo 100 m max

distance between nodes and hub

twisted pair

hub

56

29

Ethernet technology 100BaseT

Problem must keep minimal packet size when bandwidth

increases

With fixed cable length and propagation speed must

increase minimal size proportionally to bandwidth

increase

Eg 100Mbs 1500m of cable prop remains 6μs minimal

size becomes 1200 bits

Solutions

Cable length limited to 100m

Prevent collisions by ldquoEthernet Switchesrdquo (later)

Max distance from node to Hub is 100 meters

57

58

Gbit Ethernet

use standard Ethernet frame format

allows for point-to-point links and shared broadcast channels

in shared mode CSMACD is used short distances between

nodes to be efficiency

uses hubs called here ldquoBuffered Distributorsrdquo

Full-Duplex at 1 Gbps for point-to-point links

10 Gbpsec now

30

Hubs

QWhy not just one big LAN

Limited amount of supportable traffic on single LAN

all stations must share bandwidth

limited length 8023 (Ethernet) specifies maximum

cable length

large ldquocollision domainrdquo (can collide with many

stations)

limited number of stations 8025 (token ring) have

token passing delays at each station

59

Lecture 360

Hubs (Multiport repeaters Bus in a box)

Physical Layer devices essentially repeaters operating at bit

levels repeat received bits on one interface to all other

interfaces

Can‟t interconnect 10BaseT amp 100BaseT (because

segments don‟t share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design)

with backbone hub at its top

31

61

Hubs (Multiport repeaters Bus in a box)

Each connected LAN referred to as LAN segment

Hubs do not isolate collision domains node may collide with any

node residing at any segment in LAN

Extends max distance between nodes but all the segments become

one large collision domain

Hub Advantages

simple inexpensive device

Multi-tier provides graceful degradation portions of the LAN

continue to operate if one hub malfunctions

extends maximum distance between node pairs (100m per Hub)

62

Bridges

Link Layer devices operate on Ethernet frames examining

frame header and selectively forwarding frame based on its

destination

Bridge isolates collision domains since it buffers frames

When frame is to be forwarded on segment bridge uses

CSMACD to access segment and transmit

Store and forward element So different types of Ethernet

types can be connected

Transparent no need for any change to hosts LAN adapters

Forwarding is selective do not always flood All connected

segments can work independently in parallel

32

63

Bridge Filtering

bridges learn which hosts can be reached through which

interfaces maintain filtering tables

when frame received bridge ldquolearnsrdquo location of sender

incoming LAN segment

records sender location in filtering table

filtering table entry

(Node LAN Address Bridge Interface Time Stamp)

stale entries in Filtering Table dropped (TTL can be 60 minutes)

64

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_port

if (out_port not valid) no entry found for destination

then flood forward on all but the interface on which the frame arrived

if (in_port = out_port) destination is on LAN on which frame was received

then drop the frame

Otherwise (out_port is valid) entry found for destination then forward the frame on interface indicated

33

65

Bridge Learning example

Suppose C sends frame to D and D replies back with frame

to C

C sends frame bridge has no info about D so floods to both LANs bridge notes that C is on port 1

frame ignored on upper LAN

frame received by D

66

Bridge Learning example

D generates reply to C sends

bridge sees frame from D

bridge notes that D is on interface 2

bridge knows C on interface 1 so selectivelyforwards frame out via interface 1

C 1

34

67

What will happen with loops

Incorrect learning

A

B

1 1

22

A 1 A 122

68

What will happen with loops

Frame looping

A

C

1 1

22

C C

35

69

What will happen with loops

Frame looping

A

B

1 1

22

B2 B1

70

Introducing Spanning Tree

Allow a path between every LAN without causing loops

(loop-free environment)

Bridges communicate with special configuration

messages (BPDUs)

Standardized by IEEE 8021D

Note redundant paths are good active redundant paths are bad (they cause

loops)

36

How to Construct a Spanning Tree

Bridges run a distributed spanning tree

Algorithm

Select what ports (and bridges) should actively forward

frames

Finding the root flooding

Building a tree Bellman-Ford Algorithm

Can combine efficiently

Standardized in IEEE 8021 specification

71

72

Spanning Tree Requirements

Each bridge is assigned a unique identifier

A broadcast address for bridges on a LAN

A unique port identifier for all ports on all bridges

MAC address

Bridge id + port number

37

73

Spanning Tree Concepts

Root Bridge The bridge with the lowest bridge ID value is elected the

root bridge

One root bridge chosen among all bridges

Every other bridge calculates a path to the root bridge

74

Spanning Tree Concepts

Path Cost A cost associated with each port on each bridge

default is 1

The cost associated with transmission onto the LAN

connected to the port

Can be manually or automatically assigned

Can be used to alter the path to the root bridge

38

75

Spanning Tree Concepts

Root Port The port on each bridge that is on the path towards the

root bridge

The root port is part of the lowest cost path towards

the root bridge

If port costs are equal on a bridge the port with the

lowest ID becomes root port

76

Spanning Tree Concepts

Root Path Cost The minimum cost path to the root bridge

The cost starts at the root bridge

Each bridge computes root path cost independently

based on their view of the network

39

77

Spanning Tree Concepts Designated

Bridge Only one bridge on a LAN at one time is chosen the

designated bridge

This bridge provides the minimum cost path to the root

bridge for the LAN

Only the designated bridge passes frames towards the

root bridge

78

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Protocol operation1 Picks a root2 For each LAN

picks a designated bridgethat is closest to the root

3 All bridges on a LANsend packets towards the root via the designatedbridge

B8

40

79

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

80

Spanning Tree Algorithm

An Overview 1 Determine the root bridge among all bridges

2 Each bridge determines its root port

The port in the direction of the root bridge

3 Determine the designated bridge on each LAN

The bridge which accepts frames to forward towards the root bridge

The frames are sent on the root port of the designated bridge

41

81

Spanning Tree Algorithm

Selecting Root Bridge Initially each bridge considers itself to be the root bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

Best one wins

(lowest root IDcostpriority)

82

Spanning Tree Algorithm

Selecting Root Ports Each bridge selects one of its ports which has the

minimal cost to the root bridge

In case of a tie the lowest uplink (transmitter) bridge ID is

used

In case of another tie the lowest port ID is used

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 14: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

14

Aloha - efficiency

Only 18

Suppose there are n stations and the probability that a

station starts transmitting in a time unit is p

Then The probability that exactly one node transmits

in a time unit is

27

Efficiency is the long-run fraction of successful transmissions when there are many nodes each with many frames to send

Aloha - efficiency

Only 18

Maximize the utilization function by differentiation

yields maximum point at with utilization

of

Trivial improvement

Why be vulnerable for 2 time units

Synchronize and use slotted time May transmit only

at integer times

28

Efficiency is the long-run fraction of successful transmissions when there are many nodes each with many frames to send

15

Slotted 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

29

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

Cons

collisions wasting slots

idle slots

nodes may be able to detect collision in less than time to transmit packet

clock synchronization

30

16

Slotted Aloha - efficiency

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

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 1e = 37

Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send

At best channelused for useful transmissions 37of time

31

Aloha - Summary

Very popular at the beginning of time (ie 70s to 80s)

Very simple to handle

Lots and lots of basic probabilities calculations for

students

Major problem Nodes don‟t check what‟s going on in the

channel each acting on its own No manners

32

17

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

Protocol

1 Listen to the channel

2 If channel sensed idle transmit entire frame

3 If channel sensed busy defer transmission by

1-Persistent CSMA

Wait until channel is quiet and transmit immediately If collision

occurs wait a random time and listen again (go to 1)

Non-Persistent CSMA

Wait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission

CSMA human analogy don‟t interrupt others

33

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMA

When transmitting try to sense if there is a collision

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

34

18

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots

adapter doesn‟t transmit if it

senses that some other

adapter is transmitting that is

carrier sense

transmitting adapter aborts

when it senses that another

adapter is transmitting that is

collision detection

Before attempting a

retransmission adapter

waits a random time that

is random access

36

19

Unreliable connectionless service

Connectionless No handshaking between sending and

receiving adapter

Unreliable receiving adapter doesn‟t send acks or nacks to

sending adapter

stream of datagrams passed to network layer can have gaps

gaps will be filled if app is using TCP

otherwise app will see the gaps

37

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other

transmitters are aware of

collision 48 bits

Bit time 1 microsec for 10 Mbps

Ethernet

for K=1023 wait time is about

50 msec

Exponential Backoff

Goal adapt retransmission

attempts to estimated current

load

heavy load random wait will be

longer

first collision choose K from

01 delay is K 512 bit

transmission times

after second collision choose K

from 0123hellip

after ten collisions choose K

from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

38

20

8023 CSMACD (Ethernet) Algorithm

39

Ethernet CSMACD algorithm

1 Adaptor receives datagram

from net layer amp creates frame

2 If adapter senses channel idle it

starts to transmit frame If it

senses channel busy waits until

channel idle and then transmits

3 If adapter transmits entire

frame without detecting

another transmission the

adapter is done with frame

4 If adapter detects another

transmission while transmitting

aborts and sends jam signal

5 After aborting adapter enters

exponential backoff after

the mth collision adapter

chooses a K at random from

012hellip2m-1 Adapter waits

K512 bit times and returns to

Step 2

40

21

Ethernet Minimum Packet Size

41

Summary of MAC protocols

What do you do with a shared media

Channel Partitioning by time frequency or code

Time Division Frequency Division Code Division

Random partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACD

carrier sensing easy in some technologies (wire) hard in

others (wireless)

CSMACD used in Ethernet

CSMACA used in 80211 (Wireless)

42

22

LAN technologies

Data link layer so far

MAC protocols The random protocol approach

Next LAN technologies

Addressing

Ethernet

Hubs bridges and switches

43

MAC Addresses and ARP

32-bit IP address network-layer address

used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet)

address used to get datagram from one interface to another physically-

connected interface (same network)

48 bit MAC address (for most LANs)

burned in the adapter ROM but can be modified

44

23

LAN Addresses and ARP

Each adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN(wired orwireless)

45

LAN Address (more)

MAC address allocation administered by IEEE

manufacturer buys portion of MAC address space (to assure

uniqueness)

Analogy

(a) MAC address like Social Security Number

(b) IP address like postal address

MAC flat address portability

can move LAN card from one LAN to another

IP hierarchical address NOT portable

depends on IP subnet to which node is attached

46

24

ARP Address Resolution Protocol

Each IP node (Host Router)

on LAN has ARP table

ARP Table IPMAC address

mappings for some LAN

nodes

lt IP address MAC address TTLgt

TTL (Time To Live) time after

which address mapping will be

forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

237196723

237196778

237196714

237196788

47

ARP protocol Same LAN (network)

A wants to send datagram to B

and B‟s MAC address not in A‟s

ARP table

A broadcasts ARP query packet

containing Bs IP address

Dest MAC address = FF-FF-

FF-FF-FF-FF

all machines on LAN receive

ARP query

B receives ARP packet replies to

A with its (Bs) MAC address

frame sent to A‟s MAC address

(unicast)

A caches (saves) IP-to-MAC

address pair in its ARP table until

information becomes old (times

out)

soft state information that

times out (goes away) unless

refreshed

ARP is ldquoplug-and-playrdquo

nodes create their ARP tables

without intervention from net

administrator

48

25

Routing to another LANwalkthrough send datagram from A to B via R

assume A know‟s B IP address

Two ARP tables in router R one for each IP network (LAN)

In routing table at source Host find router 111111111110

In ARP table at source find MAC address E6-E9-00-17-BB-4B etc

A

RB

49

Ossi Mokryn - Data link layer

A creates datagram with source A destination B

A uses ARP to get R‟s MAC address for 111111111110

A creates link-layer frame with Rs MAC address as dest frame

contains A-to-B IP datagram

A‟s adapter sends frame

R‟s adapter receives frame

R removes IP datagram from Ethernet frame sees its destined to B

R uses ARP to get B‟s MAC address

R creates frame containing A-to-B IP datagram sends to B

A

RB

50

26

Ethernet

ldquodominantrdquo wired LAN technology developed at the 70s

cheap $20 for 100Mbs

first widely used LAN technology

Simple cheap

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

51

Ethernet topology Through the Years

Classic Ethernet Now star topology prevails

Connection choices hub or switch (more later)

Fast Ethernet 100 Mbs

Gigabit Ethernet 1Gbps

52

hub orswitch

bull Shared Bus with CSMACDbull Bus maximal length 500 mbullTransmission rate 10Mbs

Through the years the only common is The Frame

27

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network

layer protocol packet) in Ethernet frame

Preamble

7 bytes with pattern 10101010 followed by one byte with

pattern 10101011

used to synchronize receiver sender clock rates what is

the length in clock ticks of one bit

53

Type length length or type of frame

Ethernet Frame Structure (more)

Ossi Mokryn - Data link layer

Addresses 6 bytes

if adapter receives frame with matching destination address or with

broadcast address (eg ARP packet) it passes data in frame to net-layer

protocol

otherwise adapter discards frame

MAC addresses also called Physical addresses

Type indicates the higher layer protocol (mostly IP but others

may be supported such as Novell IPX and AppleTalk)

CRC checked at receiver if error is detected the frame is

simply dropped Before CRC there is a padding field for the

CRC to pad to 64 bytes

54

28

55

Ethernet Technology 10Base2

10 10Mbps 2 under 200 meters max cable length

thin coaxial cable in a bus topology

repeaters used to connect up to multiple segments

repeater repeats bits it hears on one interface to its other

interfaces physical layer device only

Ethernet technology 100BaseT

10100 Mbps rate latter called ldquofast ethernetrdquo

T stands for Twisted Pair

Nodes connect to a hub ldquostar topologyrdquo 100 m max

distance between nodes and hub

twisted pair

hub

56

29

Ethernet technology 100BaseT

Problem must keep minimal packet size when bandwidth

increases

With fixed cable length and propagation speed must

increase minimal size proportionally to bandwidth

increase

Eg 100Mbs 1500m of cable prop remains 6μs minimal

size becomes 1200 bits

Solutions

Cable length limited to 100m

Prevent collisions by ldquoEthernet Switchesrdquo (later)

Max distance from node to Hub is 100 meters

57

58

Gbit Ethernet

use standard Ethernet frame format

allows for point-to-point links and shared broadcast channels

in shared mode CSMACD is used short distances between

nodes to be efficiency

uses hubs called here ldquoBuffered Distributorsrdquo

Full-Duplex at 1 Gbps for point-to-point links

10 Gbpsec now

30

Hubs

QWhy not just one big LAN

Limited amount of supportable traffic on single LAN

all stations must share bandwidth

limited length 8023 (Ethernet) specifies maximum

cable length

large ldquocollision domainrdquo (can collide with many

stations)

limited number of stations 8025 (token ring) have

token passing delays at each station

59

Lecture 360

Hubs (Multiport repeaters Bus in a box)

Physical Layer devices essentially repeaters operating at bit

levels repeat received bits on one interface to all other

interfaces

Can‟t interconnect 10BaseT amp 100BaseT (because

segments don‟t share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design)

with backbone hub at its top

31

61

Hubs (Multiport repeaters Bus in a box)

Each connected LAN referred to as LAN segment

Hubs do not isolate collision domains node may collide with any

node residing at any segment in LAN

Extends max distance between nodes but all the segments become

one large collision domain

Hub Advantages

simple inexpensive device

Multi-tier provides graceful degradation portions of the LAN

continue to operate if one hub malfunctions

extends maximum distance between node pairs (100m per Hub)

62

Bridges

Link Layer devices operate on Ethernet frames examining

frame header and selectively forwarding frame based on its

destination

Bridge isolates collision domains since it buffers frames

When frame is to be forwarded on segment bridge uses

CSMACD to access segment and transmit

Store and forward element So different types of Ethernet

types can be connected

Transparent no need for any change to hosts LAN adapters

Forwarding is selective do not always flood All connected

segments can work independently in parallel

32

63

Bridge Filtering

bridges learn which hosts can be reached through which

interfaces maintain filtering tables

when frame received bridge ldquolearnsrdquo location of sender

incoming LAN segment

records sender location in filtering table

filtering table entry

(Node LAN Address Bridge Interface Time Stamp)

stale entries in Filtering Table dropped (TTL can be 60 minutes)

64

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_port

if (out_port not valid) no entry found for destination

then flood forward on all but the interface on which the frame arrived

if (in_port = out_port) destination is on LAN on which frame was received

then drop the frame

Otherwise (out_port is valid) entry found for destination then forward the frame on interface indicated

33

65

Bridge Learning example

Suppose C sends frame to D and D replies back with frame

to C

C sends frame bridge has no info about D so floods to both LANs bridge notes that C is on port 1

frame ignored on upper LAN

frame received by D

66

Bridge Learning example

D generates reply to C sends

bridge sees frame from D

bridge notes that D is on interface 2

bridge knows C on interface 1 so selectivelyforwards frame out via interface 1

C 1

34

67

What will happen with loops

Incorrect learning

A

B

1 1

22

A 1 A 122

68

What will happen with loops

Frame looping

A

C

1 1

22

C C

35

69

What will happen with loops

Frame looping

A

B

1 1

22

B2 B1

70

Introducing Spanning Tree

Allow a path between every LAN without causing loops

(loop-free environment)

Bridges communicate with special configuration

messages (BPDUs)

Standardized by IEEE 8021D

Note redundant paths are good active redundant paths are bad (they cause

loops)

36

How to Construct a Spanning Tree

Bridges run a distributed spanning tree

Algorithm

Select what ports (and bridges) should actively forward

frames

Finding the root flooding

Building a tree Bellman-Ford Algorithm

Can combine efficiently

Standardized in IEEE 8021 specification

71

72

Spanning Tree Requirements

Each bridge is assigned a unique identifier

A broadcast address for bridges on a LAN

A unique port identifier for all ports on all bridges

MAC address

Bridge id + port number

37

73

Spanning Tree Concepts

Root Bridge The bridge with the lowest bridge ID value is elected the

root bridge

One root bridge chosen among all bridges

Every other bridge calculates a path to the root bridge

74

Spanning Tree Concepts

Path Cost A cost associated with each port on each bridge

default is 1

The cost associated with transmission onto the LAN

connected to the port

Can be manually or automatically assigned

Can be used to alter the path to the root bridge

38

75

Spanning Tree Concepts

Root Port The port on each bridge that is on the path towards the

root bridge

The root port is part of the lowest cost path towards

the root bridge

If port costs are equal on a bridge the port with the

lowest ID becomes root port

76

Spanning Tree Concepts

Root Path Cost The minimum cost path to the root bridge

The cost starts at the root bridge

Each bridge computes root path cost independently

based on their view of the network

39

77

Spanning Tree Concepts Designated

Bridge Only one bridge on a LAN at one time is chosen the

designated bridge

This bridge provides the minimum cost path to the root

bridge for the LAN

Only the designated bridge passes frames towards the

root bridge

78

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Protocol operation1 Picks a root2 For each LAN

picks a designated bridgethat is closest to the root

3 All bridges on a LANsend packets towards the root via the designatedbridge

B8

40

79

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

80

Spanning Tree Algorithm

An Overview 1 Determine the root bridge among all bridges

2 Each bridge determines its root port

The port in the direction of the root bridge

3 Determine the designated bridge on each LAN

The bridge which accepts frames to forward towards the root bridge

The frames are sent on the root port of the designated bridge

41

81

Spanning Tree Algorithm

Selecting Root Bridge Initially each bridge considers itself to be the root bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

Best one wins

(lowest root IDcostpriority)

82

Spanning Tree Algorithm

Selecting Root Ports Each bridge selects one of its ports which has the

minimal cost to the root bridge

In case of a tie the lowest uplink (transmitter) bridge ID is

used

In case of another tie the lowest port ID is used

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 15: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

15

Slotted 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

29

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

Cons

collisions wasting slots

idle slots

nodes may be able to detect collision in less than time to transmit packet

clock synchronization

30

16

Slotted Aloha - efficiency

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

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 1e = 37

Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send

At best channelused for useful transmissions 37of time

31

Aloha - Summary

Very popular at the beginning of time (ie 70s to 80s)

Very simple to handle

Lots and lots of basic probabilities calculations for

students

Major problem Nodes don‟t check what‟s going on in the

channel each acting on its own No manners

32

17

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

Protocol

1 Listen to the channel

2 If channel sensed idle transmit entire frame

3 If channel sensed busy defer transmission by

1-Persistent CSMA

Wait until channel is quiet and transmit immediately If collision

occurs wait a random time and listen again (go to 1)

Non-Persistent CSMA

Wait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission

CSMA human analogy don‟t interrupt others

33

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMA

When transmitting try to sense if there is a collision

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

34

18

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots

adapter doesn‟t transmit if it

senses that some other

adapter is transmitting that is

carrier sense

transmitting adapter aborts

when it senses that another

adapter is transmitting that is

collision detection

Before attempting a

retransmission adapter

waits a random time that

is random access

36

19

Unreliable connectionless service

Connectionless No handshaking between sending and

receiving adapter

Unreliable receiving adapter doesn‟t send acks or nacks to

sending adapter

stream of datagrams passed to network layer can have gaps

gaps will be filled if app is using TCP

otherwise app will see the gaps

37

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other

transmitters are aware of

collision 48 bits

Bit time 1 microsec for 10 Mbps

Ethernet

for K=1023 wait time is about

50 msec

Exponential Backoff

Goal adapt retransmission

attempts to estimated current

load

heavy load random wait will be

longer

first collision choose K from

01 delay is K 512 bit

transmission times

after second collision choose K

from 0123hellip

after ten collisions choose K

from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

38

20

8023 CSMACD (Ethernet) Algorithm

39

Ethernet CSMACD algorithm

1 Adaptor receives datagram

from net layer amp creates frame

2 If adapter senses channel idle it

starts to transmit frame If it

senses channel busy waits until

channel idle and then transmits

3 If adapter transmits entire

frame without detecting

another transmission the

adapter is done with frame

4 If adapter detects another

transmission while transmitting

aborts and sends jam signal

5 After aborting adapter enters

exponential backoff after

the mth collision adapter

chooses a K at random from

012hellip2m-1 Adapter waits

K512 bit times and returns to

Step 2

40

21

Ethernet Minimum Packet Size

41

Summary of MAC protocols

What do you do with a shared media

Channel Partitioning by time frequency or code

Time Division Frequency Division Code Division

Random partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACD

carrier sensing easy in some technologies (wire) hard in

others (wireless)

CSMACD used in Ethernet

CSMACA used in 80211 (Wireless)

42

22

LAN technologies

Data link layer so far

MAC protocols The random protocol approach

Next LAN technologies

Addressing

Ethernet

Hubs bridges and switches

43

MAC Addresses and ARP

32-bit IP address network-layer address

used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet)

address used to get datagram from one interface to another physically-

connected interface (same network)

48 bit MAC address (for most LANs)

burned in the adapter ROM but can be modified

44

23

LAN Addresses and ARP

Each adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN(wired orwireless)

45

LAN Address (more)

MAC address allocation administered by IEEE

manufacturer buys portion of MAC address space (to assure

uniqueness)

Analogy

(a) MAC address like Social Security Number

(b) IP address like postal address

MAC flat address portability

can move LAN card from one LAN to another

IP hierarchical address NOT portable

depends on IP subnet to which node is attached

46

24

ARP Address Resolution Protocol

Each IP node (Host Router)

on LAN has ARP table

ARP Table IPMAC address

mappings for some LAN

nodes

lt IP address MAC address TTLgt

TTL (Time To Live) time after

which address mapping will be

forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

237196723

237196778

237196714

237196788

47

ARP protocol Same LAN (network)

A wants to send datagram to B

and B‟s MAC address not in A‟s

ARP table

A broadcasts ARP query packet

containing Bs IP address

Dest MAC address = FF-FF-

FF-FF-FF-FF

all machines on LAN receive

ARP query

B receives ARP packet replies to

A with its (Bs) MAC address

frame sent to A‟s MAC address

(unicast)

A caches (saves) IP-to-MAC

address pair in its ARP table until

information becomes old (times

out)

soft state information that

times out (goes away) unless

refreshed

ARP is ldquoplug-and-playrdquo

nodes create their ARP tables

without intervention from net

administrator

48

25

Routing to another LANwalkthrough send datagram from A to B via R

assume A know‟s B IP address

Two ARP tables in router R one for each IP network (LAN)

In routing table at source Host find router 111111111110

In ARP table at source find MAC address E6-E9-00-17-BB-4B etc

A

RB

49

Ossi Mokryn - Data link layer

A creates datagram with source A destination B

A uses ARP to get R‟s MAC address for 111111111110

A creates link-layer frame with Rs MAC address as dest frame

contains A-to-B IP datagram

A‟s adapter sends frame

R‟s adapter receives frame

R removes IP datagram from Ethernet frame sees its destined to B

R uses ARP to get B‟s MAC address

R creates frame containing A-to-B IP datagram sends to B

A

RB

50

26

Ethernet

ldquodominantrdquo wired LAN technology developed at the 70s

cheap $20 for 100Mbs

first widely used LAN technology

Simple cheap

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

51

Ethernet topology Through the Years

Classic Ethernet Now star topology prevails

Connection choices hub or switch (more later)

Fast Ethernet 100 Mbs

Gigabit Ethernet 1Gbps

52

hub orswitch

bull Shared Bus with CSMACDbull Bus maximal length 500 mbullTransmission rate 10Mbs

Through the years the only common is The Frame

27

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network

layer protocol packet) in Ethernet frame

Preamble

7 bytes with pattern 10101010 followed by one byte with

pattern 10101011

used to synchronize receiver sender clock rates what is

the length in clock ticks of one bit

53

Type length length or type of frame

Ethernet Frame Structure (more)

Ossi Mokryn - Data link layer

Addresses 6 bytes

if adapter receives frame with matching destination address or with

broadcast address (eg ARP packet) it passes data in frame to net-layer

protocol

otherwise adapter discards frame

MAC addresses also called Physical addresses

Type indicates the higher layer protocol (mostly IP but others

may be supported such as Novell IPX and AppleTalk)

CRC checked at receiver if error is detected the frame is

simply dropped Before CRC there is a padding field for the

CRC to pad to 64 bytes

54

28

55

Ethernet Technology 10Base2

10 10Mbps 2 under 200 meters max cable length

thin coaxial cable in a bus topology

repeaters used to connect up to multiple segments

repeater repeats bits it hears on one interface to its other

interfaces physical layer device only

Ethernet technology 100BaseT

10100 Mbps rate latter called ldquofast ethernetrdquo

T stands for Twisted Pair

Nodes connect to a hub ldquostar topologyrdquo 100 m max

distance between nodes and hub

twisted pair

hub

56

29

Ethernet technology 100BaseT

Problem must keep minimal packet size when bandwidth

increases

With fixed cable length and propagation speed must

increase minimal size proportionally to bandwidth

increase

Eg 100Mbs 1500m of cable prop remains 6μs minimal

size becomes 1200 bits

Solutions

Cable length limited to 100m

Prevent collisions by ldquoEthernet Switchesrdquo (later)

Max distance from node to Hub is 100 meters

57

58

Gbit Ethernet

use standard Ethernet frame format

allows for point-to-point links and shared broadcast channels

in shared mode CSMACD is used short distances between

nodes to be efficiency

uses hubs called here ldquoBuffered Distributorsrdquo

Full-Duplex at 1 Gbps for point-to-point links

10 Gbpsec now

30

Hubs

QWhy not just one big LAN

Limited amount of supportable traffic on single LAN

all stations must share bandwidth

limited length 8023 (Ethernet) specifies maximum

cable length

large ldquocollision domainrdquo (can collide with many

stations)

limited number of stations 8025 (token ring) have

token passing delays at each station

59

Lecture 360

Hubs (Multiport repeaters Bus in a box)

Physical Layer devices essentially repeaters operating at bit

levels repeat received bits on one interface to all other

interfaces

Can‟t interconnect 10BaseT amp 100BaseT (because

segments don‟t share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design)

with backbone hub at its top

31

61

Hubs (Multiport repeaters Bus in a box)

Each connected LAN referred to as LAN segment

Hubs do not isolate collision domains node may collide with any

node residing at any segment in LAN

Extends max distance between nodes but all the segments become

one large collision domain

Hub Advantages

simple inexpensive device

Multi-tier provides graceful degradation portions of the LAN

continue to operate if one hub malfunctions

extends maximum distance between node pairs (100m per Hub)

62

Bridges

Link Layer devices operate on Ethernet frames examining

frame header and selectively forwarding frame based on its

destination

Bridge isolates collision domains since it buffers frames

When frame is to be forwarded on segment bridge uses

CSMACD to access segment and transmit

Store and forward element So different types of Ethernet

types can be connected

Transparent no need for any change to hosts LAN adapters

Forwarding is selective do not always flood All connected

segments can work independently in parallel

32

63

Bridge Filtering

bridges learn which hosts can be reached through which

interfaces maintain filtering tables

when frame received bridge ldquolearnsrdquo location of sender

incoming LAN segment

records sender location in filtering table

filtering table entry

(Node LAN Address Bridge Interface Time Stamp)

stale entries in Filtering Table dropped (TTL can be 60 minutes)

64

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_port

if (out_port not valid) no entry found for destination

then flood forward on all but the interface on which the frame arrived

if (in_port = out_port) destination is on LAN on which frame was received

then drop the frame

Otherwise (out_port is valid) entry found for destination then forward the frame on interface indicated

33

65

Bridge Learning example

Suppose C sends frame to D and D replies back with frame

to C

C sends frame bridge has no info about D so floods to both LANs bridge notes that C is on port 1

frame ignored on upper LAN

frame received by D

66

Bridge Learning example

D generates reply to C sends

bridge sees frame from D

bridge notes that D is on interface 2

bridge knows C on interface 1 so selectivelyforwards frame out via interface 1

C 1

34

67

What will happen with loops

Incorrect learning

A

B

1 1

22

A 1 A 122

68

What will happen with loops

Frame looping

A

C

1 1

22

C C

35

69

What will happen with loops

Frame looping

A

B

1 1

22

B2 B1

70

Introducing Spanning Tree

Allow a path between every LAN without causing loops

(loop-free environment)

Bridges communicate with special configuration

messages (BPDUs)

Standardized by IEEE 8021D

Note redundant paths are good active redundant paths are bad (they cause

loops)

36

How to Construct a Spanning Tree

Bridges run a distributed spanning tree

Algorithm

Select what ports (and bridges) should actively forward

frames

Finding the root flooding

Building a tree Bellman-Ford Algorithm

Can combine efficiently

Standardized in IEEE 8021 specification

71

72

Spanning Tree Requirements

Each bridge is assigned a unique identifier

A broadcast address for bridges on a LAN

A unique port identifier for all ports on all bridges

MAC address

Bridge id + port number

37

73

Spanning Tree Concepts

Root Bridge The bridge with the lowest bridge ID value is elected the

root bridge

One root bridge chosen among all bridges

Every other bridge calculates a path to the root bridge

74

Spanning Tree Concepts

Path Cost A cost associated with each port on each bridge

default is 1

The cost associated with transmission onto the LAN

connected to the port

Can be manually or automatically assigned

Can be used to alter the path to the root bridge

38

75

Spanning Tree Concepts

Root Port The port on each bridge that is on the path towards the

root bridge

The root port is part of the lowest cost path towards

the root bridge

If port costs are equal on a bridge the port with the

lowest ID becomes root port

76

Spanning Tree Concepts

Root Path Cost The minimum cost path to the root bridge

The cost starts at the root bridge

Each bridge computes root path cost independently

based on their view of the network

39

77

Spanning Tree Concepts Designated

Bridge Only one bridge on a LAN at one time is chosen the

designated bridge

This bridge provides the minimum cost path to the root

bridge for the LAN

Only the designated bridge passes frames towards the

root bridge

78

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Protocol operation1 Picks a root2 For each LAN

picks a designated bridgethat is closest to the root

3 All bridges on a LANsend packets towards the root via the designatedbridge

B8

40

79

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

80

Spanning Tree Algorithm

An Overview 1 Determine the root bridge among all bridges

2 Each bridge determines its root port

The port in the direction of the root bridge

3 Determine the designated bridge on each LAN

The bridge which accepts frames to forward towards the root bridge

The frames are sent on the root port of the designated bridge

41

81

Spanning Tree Algorithm

Selecting Root Bridge Initially each bridge considers itself to be the root bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

Best one wins

(lowest root IDcostpriority)

82

Spanning Tree Algorithm

Selecting Root Ports Each bridge selects one of its ports which has the

minimal cost to the root bridge

In case of a tie the lowest uplink (transmitter) bridge ID is

used

In case of another tie the lowest port ID is used

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 16: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

16

Slotted Aloha - efficiency

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

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 1e = 37

Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send

At best channelused for useful transmissions 37of time

31

Aloha - Summary

Very popular at the beginning of time (ie 70s to 80s)

Very simple to handle

Lots and lots of basic probabilities calculations for

students

Major problem Nodes don‟t check what‟s going on in the

channel each acting on its own No manners

32

17

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

Protocol

1 Listen to the channel

2 If channel sensed idle transmit entire frame

3 If channel sensed busy defer transmission by

1-Persistent CSMA

Wait until channel is quiet and transmit immediately If collision

occurs wait a random time and listen again (go to 1)

Non-Persistent CSMA

Wait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission

CSMA human analogy don‟t interrupt others

33

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMA

When transmitting try to sense if there is a collision

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

34

18

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots

adapter doesn‟t transmit if it

senses that some other

adapter is transmitting that is

carrier sense

transmitting adapter aborts

when it senses that another

adapter is transmitting that is

collision detection

Before attempting a

retransmission adapter

waits a random time that

is random access

36

19

Unreliable connectionless service

Connectionless No handshaking between sending and

receiving adapter

Unreliable receiving adapter doesn‟t send acks or nacks to

sending adapter

stream of datagrams passed to network layer can have gaps

gaps will be filled if app is using TCP

otherwise app will see the gaps

37

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other

transmitters are aware of

collision 48 bits

Bit time 1 microsec for 10 Mbps

Ethernet

for K=1023 wait time is about

50 msec

Exponential Backoff

Goal adapt retransmission

attempts to estimated current

load

heavy load random wait will be

longer

first collision choose K from

01 delay is K 512 bit

transmission times

after second collision choose K

from 0123hellip

after ten collisions choose K

from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

38

20

8023 CSMACD (Ethernet) Algorithm

39

Ethernet CSMACD algorithm

1 Adaptor receives datagram

from net layer amp creates frame

2 If adapter senses channel idle it

starts to transmit frame If it

senses channel busy waits until

channel idle and then transmits

3 If adapter transmits entire

frame without detecting

another transmission the

adapter is done with frame

4 If adapter detects another

transmission while transmitting

aborts and sends jam signal

5 After aborting adapter enters

exponential backoff after

the mth collision adapter

chooses a K at random from

012hellip2m-1 Adapter waits

K512 bit times and returns to

Step 2

40

21

Ethernet Minimum Packet Size

41

Summary of MAC protocols

What do you do with a shared media

Channel Partitioning by time frequency or code

Time Division Frequency Division Code Division

Random partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACD

carrier sensing easy in some technologies (wire) hard in

others (wireless)

CSMACD used in Ethernet

CSMACA used in 80211 (Wireless)

42

22

LAN technologies

Data link layer so far

MAC protocols The random protocol approach

Next LAN technologies

Addressing

Ethernet

Hubs bridges and switches

43

MAC Addresses and ARP

32-bit IP address network-layer address

used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet)

address used to get datagram from one interface to another physically-

connected interface (same network)

48 bit MAC address (for most LANs)

burned in the adapter ROM but can be modified

44

23

LAN Addresses and ARP

Each adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN(wired orwireless)

45

LAN Address (more)

MAC address allocation administered by IEEE

manufacturer buys portion of MAC address space (to assure

uniqueness)

Analogy

(a) MAC address like Social Security Number

(b) IP address like postal address

MAC flat address portability

can move LAN card from one LAN to another

IP hierarchical address NOT portable

depends on IP subnet to which node is attached

46

24

ARP Address Resolution Protocol

Each IP node (Host Router)

on LAN has ARP table

ARP Table IPMAC address

mappings for some LAN

nodes

lt IP address MAC address TTLgt

TTL (Time To Live) time after

which address mapping will be

forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

237196723

237196778

237196714

237196788

47

ARP protocol Same LAN (network)

A wants to send datagram to B

and B‟s MAC address not in A‟s

ARP table

A broadcasts ARP query packet

containing Bs IP address

Dest MAC address = FF-FF-

FF-FF-FF-FF

all machines on LAN receive

ARP query

B receives ARP packet replies to

A with its (Bs) MAC address

frame sent to A‟s MAC address

(unicast)

A caches (saves) IP-to-MAC

address pair in its ARP table until

information becomes old (times

out)

soft state information that

times out (goes away) unless

refreshed

ARP is ldquoplug-and-playrdquo

nodes create their ARP tables

without intervention from net

administrator

48

25

Routing to another LANwalkthrough send datagram from A to B via R

assume A know‟s B IP address

Two ARP tables in router R one for each IP network (LAN)

In routing table at source Host find router 111111111110

In ARP table at source find MAC address E6-E9-00-17-BB-4B etc

A

RB

49

Ossi Mokryn - Data link layer

A creates datagram with source A destination B

A uses ARP to get R‟s MAC address for 111111111110

A creates link-layer frame with Rs MAC address as dest frame

contains A-to-B IP datagram

A‟s adapter sends frame

R‟s adapter receives frame

R removes IP datagram from Ethernet frame sees its destined to B

R uses ARP to get B‟s MAC address

R creates frame containing A-to-B IP datagram sends to B

A

RB

50

26

Ethernet

ldquodominantrdquo wired LAN technology developed at the 70s

cheap $20 for 100Mbs

first widely used LAN technology

Simple cheap

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

51

Ethernet topology Through the Years

Classic Ethernet Now star topology prevails

Connection choices hub or switch (more later)

Fast Ethernet 100 Mbs

Gigabit Ethernet 1Gbps

52

hub orswitch

bull Shared Bus with CSMACDbull Bus maximal length 500 mbullTransmission rate 10Mbs

Through the years the only common is The Frame

27

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network

layer protocol packet) in Ethernet frame

Preamble

7 bytes with pattern 10101010 followed by one byte with

pattern 10101011

used to synchronize receiver sender clock rates what is

the length in clock ticks of one bit

53

Type length length or type of frame

Ethernet Frame Structure (more)

Ossi Mokryn - Data link layer

Addresses 6 bytes

if adapter receives frame with matching destination address or with

broadcast address (eg ARP packet) it passes data in frame to net-layer

protocol

otherwise adapter discards frame

MAC addresses also called Physical addresses

Type indicates the higher layer protocol (mostly IP but others

may be supported such as Novell IPX and AppleTalk)

CRC checked at receiver if error is detected the frame is

simply dropped Before CRC there is a padding field for the

CRC to pad to 64 bytes

54

28

55

Ethernet Technology 10Base2

10 10Mbps 2 under 200 meters max cable length

thin coaxial cable in a bus topology

repeaters used to connect up to multiple segments

repeater repeats bits it hears on one interface to its other

interfaces physical layer device only

Ethernet technology 100BaseT

10100 Mbps rate latter called ldquofast ethernetrdquo

T stands for Twisted Pair

Nodes connect to a hub ldquostar topologyrdquo 100 m max

distance between nodes and hub

twisted pair

hub

56

29

Ethernet technology 100BaseT

Problem must keep minimal packet size when bandwidth

increases

With fixed cable length and propagation speed must

increase minimal size proportionally to bandwidth

increase

Eg 100Mbs 1500m of cable prop remains 6μs minimal

size becomes 1200 bits

Solutions

Cable length limited to 100m

Prevent collisions by ldquoEthernet Switchesrdquo (later)

Max distance from node to Hub is 100 meters

57

58

Gbit Ethernet

use standard Ethernet frame format

allows for point-to-point links and shared broadcast channels

in shared mode CSMACD is used short distances between

nodes to be efficiency

uses hubs called here ldquoBuffered Distributorsrdquo

Full-Duplex at 1 Gbps for point-to-point links

10 Gbpsec now

30

Hubs

QWhy not just one big LAN

Limited amount of supportable traffic on single LAN

all stations must share bandwidth

limited length 8023 (Ethernet) specifies maximum

cable length

large ldquocollision domainrdquo (can collide with many

stations)

limited number of stations 8025 (token ring) have

token passing delays at each station

59

Lecture 360

Hubs (Multiport repeaters Bus in a box)

Physical Layer devices essentially repeaters operating at bit

levels repeat received bits on one interface to all other

interfaces

Can‟t interconnect 10BaseT amp 100BaseT (because

segments don‟t share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design)

with backbone hub at its top

31

61

Hubs (Multiport repeaters Bus in a box)

Each connected LAN referred to as LAN segment

Hubs do not isolate collision domains node may collide with any

node residing at any segment in LAN

Extends max distance between nodes but all the segments become

one large collision domain

Hub Advantages

simple inexpensive device

Multi-tier provides graceful degradation portions of the LAN

continue to operate if one hub malfunctions

extends maximum distance between node pairs (100m per Hub)

62

Bridges

Link Layer devices operate on Ethernet frames examining

frame header and selectively forwarding frame based on its

destination

Bridge isolates collision domains since it buffers frames

When frame is to be forwarded on segment bridge uses

CSMACD to access segment and transmit

Store and forward element So different types of Ethernet

types can be connected

Transparent no need for any change to hosts LAN adapters

Forwarding is selective do not always flood All connected

segments can work independently in parallel

32

63

Bridge Filtering

bridges learn which hosts can be reached through which

interfaces maintain filtering tables

when frame received bridge ldquolearnsrdquo location of sender

incoming LAN segment

records sender location in filtering table

filtering table entry

(Node LAN Address Bridge Interface Time Stamp)

stale entries in Filtering Table dropped (TTL can be 60 minutes)

64

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_port

if (out_port not valid) no entry found for destination

then flood forward on all but the interface on which the frame arrived

if (in_port = out_port) destination is on LAN on which frame was received

then drop the frame

Otherwise (out_port is valid) entry found for destination then forward the frame on interface indicated

33

65

Bridge Learning example

Suppose C sends frame to D and D replies back with frame

to C

C sends frame bridge has no info about D so floods to both LANs bridge notes that C is on port 1

frame ignored on upper LAN

frame received by D

66

Bridge Learning example

D generates reply to C sends

bridge sees frame from D

bridge notes that D is on interface 2

bridge knows C on interface 1 so selectivelyforwards frame out via interface 1

C 1

34

67

What will happen with loops

Incorrect learning

A

B

1 1

22

A 1 A 122

68

What will happen with loops

Frame looping

A

C

1 1

22

C C

35

69

What will happen with loops

Frame looping

A

B

1 1

22

B2 B1

70

Introducing Spanning Tree

Allow a path between every LAN without causing loops

(loop-free environment)

Bridges communicate with special configuration

messages (BPDUs)

Standardized by IEEE 8021D

Note redundant paths are good active redundant paths are bad (they cause

loops)

36

How to Construct a Spanning Tree

Bridges run a distributed spanning tree

Algorithm

Select what ports (and bridges) should actively forward

frames

Finding the root flooding

Building a tree Bellman-Ford Algorithm

Can combine efficiently

Standardized in IEEE 8021 specification

71

72

Spanning Tree Requirements

Each bridge is assigned a unique identifier

A broadcast address for bridges on a LAN

A unique port identifier for all ports on all bridges

MAC address

Bridge id + port number

37

73

Spanning Tree Concepts

Root Bridge The bridge with the lowest bridge ID value is elected the

root bridge

One root bridge chosen among all bridges

Every other bridge calculates a path to the root bridge

74

Spanning Tree Concepts

Path Cost A cost associated with each port on each bridge

default is 1

The cost associated with transmission onto the LAN

connected to the port

Can be manually or automatically assigned

Can be used to alter the path to the root bridge

38

75

Spanning Tree Concepts

Root Port The port on each bridge that is on the path towards the

root bridge

The root port is part of the lowest cost path towards

the root bridge

If port costs are equal on a bridge the port with the

lowest ID becomes root port

76

Spanning Tree Concepts

Root Path Cost The minimum cost path to the root bridge

The cost starts at the root bridge

Each bridge computes root path cost independently

based on their view of the network

39

77

Spanning Tree Concepts Designated

Bridge Only one bridge on a LAN at one time is chosen the

designated bridge

This bridge provides the minimum cost path to the root

bridge for the LAN

Only the designated bridge passes frames towards the

root bridge

78

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Protocol operation1 Picks a root2 For each LAN

picks a designated bridgethat is closest to the root

3 All bridges on a LANsend packets towards the root via the designatedbridge

B8

40

79

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

80

Spanning Tree Algorithm

An Overview 1 Determine the root bridge among all bridges

2 Each bridge determines its root port

The port in the direction of the root bridge

3 Determine the designated bridge on each LAN

The bridge which accepts frames to forward towards the root bridge

The frames are sent on the root port of the designated bridge

41

81

Spanning Tree Algorithm

Selecting Root Bridge Initially each bridge considers itself to be the root bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

Best one wins

(lowest root IDcostpriority)

82

Spanning Tree Algorithm

Selecting Root Ports Each bridge selects one of its ports which has the

minimal cost to the root bridge

In case of a tie the lowest uplink (transmitter) bridge ID is

used

In case of another tie the lowest port ID is used

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 17: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

17

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

Protocol

1 Listen to the channel

2 If channel sensed idle transmit entire frame

3 If channel sensed busy defer transmission by

1-Persistent CSMA

Wait until channel is quiet and transmit immediately If collision

occurs wait a random time and listen again (go to 1)

Non-Persistent CSMA

Wait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission

CSMA human analogy don‟t interrupt others

33

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMA

When transmitting try to sense if there is a collision

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

34

18

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots

adapter doesn‟t transmit if it

senses that some other

adapter is transmitting that is

carrier sense

transmitting adapter aborts

when it senses that another

adapter is transmitting that is

collision detection

Before attempting a

retransmission adapter

waits a random time that

is random access

36

19

Unreliable connectionless service

Connectionless No handshaking between sending and

receiving adapter

Unreliable receiving adapter doesn‟t send acks or nacks to

sending adapter

stream of datagrams passed to network layer can have gaps

gaps will be filled if app is using TCP

otherwise app will see the gaps

37

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other

transmitters are aware of

collision 48 bits

Bit time 1 microsec for 10 Mbps

Ethernet

for K=1023 wait time is about

50 msec

Exponential Backoff

Goal adapt retransmission

attempts to estimated current

load

heavy load random wait will be

longer

first collision choose K from

01 delay is K 512 bit

transmission times

after second collision choose K

from 0123hellip

after ten collisions choose K

from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

38

20

8023 CSMACD (Ethernet) Algorithm

39

Ethernet CSMACD algorithm

1 Adaptor receives datagram

from net layer amp creates frame

2 If adapter senses channel idle it

starts to transmit frame If it

senses channel busy waits until

channel idle and then transmits

3 If adapter transmits entire

frame without detecting

another transmission the

adapter is done with frame

4 If adapter detects another

transmission while transmitting

aborts and sends jam signal

5 After aborting adapter enters

exponential backoff after

the mth collision adapter

chooses a K at random from

012hellip2m-1 Adapter waits

K512 bit times and returns to

Step 2

40

21

Ethernet Minimum Packet Size

41

Summary of MAC protocols

What do you do with a shared media

Channel Partitioning by time frequency or code

Time Division Frequency Division Code Division

Random partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACD

carrier sensing easy in some technologies (wire) hard in

others (wireless)

CSMACD used in Ethernet

CSMACA used in 80211 (Wireless)

42

22

LAN technologies

Data link layer so far

MAC protocols The random protocol approach

Next LAN technologies

Addressing

Ethernet

Hubs bridges and switches

43

MAC Addresses and ARP

32-bit IP address network-layer address

used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet)

address used to get datagram from one interface to another physically-

connected interface (same network)

48 bit MAC address (for most LANs)

burned in the adapter ROM but can be modified

44

23

LAN Addresses and ARP

Each adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN(wired orwireless)

45

LAN Address (more)

MAC address allocation administered by IEEE

manufacturer buys portion of MAC address space (to assure

uniqueness)

Analogy

(a) MAC address like Social Security Number

(b) IP address like postal address

MAC flat address portability

can move LAN card from one LAN to another

IP hierarchical address NOT portable

depends on IP subnet to which node is attached

46

24

ARP Address Resolution Protocol

Each IP node (Host Router)

on LAN has ARP table

ARP Table IPMAC address

mappings for some LAN

nodes

lt IP address MAC address TTLgt

TTL (Time To Live) time after

which address mapping will be

forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

237196723

237196778

237196714

237196788

47

ARP protocol Same LAN (network)

A wants to send datagram to B

and B‟s MAC address not in A‟s

ARP table

A broadcasts ARP query packet

containing Bs IP address

Dest MAC address = FF-FF-

FF-FF-FF-FF

all machines on LAN receive

ARP query

B receives ARP packet replies to

A with its (Bs) MAC address

frame sent to A‟s MAC address

(unicast)

A caches (saves) IP-to-MAC

address pair in its ARP table until

information becomes old (times

out)

soft state information that

times out (goes away) unless

refreshed

ARP is ldquoplug-and-playrdquo

nodes create their ARP tables

without intervention from net

administrator

48

25

Routing to another LANwalkthrough send datagram from A to B via R

assume A know‟s B IP address

Two ARP tables in router R one for each IP network (LAN)

In routing table at source Host find router 111111111110

In ARP table at source find MAC address E6-E9-00-17-BB-4B etc

A

RB

49

Ossi Mokryn - Data link layer

A creates datagram with source A destination B

A uses ARP to get R‟s MAC address for 111111111110

A creates link-layer frame with Rs MAC address as dest frame

contains A-to-B IP datagram

A‟s adapter sends frame

R‟s adapter receives frame

R removes IP datagram from Ethernet frame sees its destined to B

R uses ARP to get B‟s MAC address

R creates frame containing A-to-B IP datagram sends to B

A

RB

50

26

Ethernet

ldquodominantrdquo wired LAN technology developed at the 70s

cheap $20 for 100Mbs

first widely used LAN technology

Simple cheap

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

51

Ethernet topology Through the Years

Classic Ethernet Now star topology prevails

Connection choices hub or switch (more later)

Fast Ethernet 100 Mbs

Gigabit Ethernet 1Gbps

52

hub orswitch

bull Shared Bus with CSMACDbull Bus maximal length 500 mbullTransmission rate 10Mbs

Through the years the only common is The Frame

27

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network

layer protocol packet) in Ethernet frame

Preamble

7 bytes with pattern 10101010 followed by one byte with

pattern 10101011

used to synchronize receiver sender clock rates what is

the length in clock ticks of one bit

53

Type length length or type of frame

Ethernet Frame Structure (more)

Ossi Mokryn - Data link layer

Addresses 6 bytes

if adapter receives frame with matching destination address or with

broadcast address (eg ARP packet) it passes data in frame to net-layer

protocol

otherwise adapter discards frame

MAC addresses also called Physical addresses

Type indicates the higher layer protocol (mostly IP but others

may be supported such as Novell IPX and AppleTalk)

CRC checked at receiver if error is detected the frame is

simply dropped Before CRC there is a padding field for the

CRC to pad to 64 bytes

54

28

55

Ethernet Technology 10Base2

10 10Mbps 2 under 200 meters max cable length

thin coaxial cable in a bus topology

repeaters used to connect up to multiple segments

repeater repeats bits it hears on one interface to its other

interfaces physical layer device only

Ethernet technology 100BaseT

10100 Mbps rate latter called ldquofast ethernetrdquo

T stands for Twisted Pair

Nodes connect to a hub ldquostar topologyrdquo 100 m max

distance between nodes and hub

twisted pair

hub

56

29

Ethernet technology 100BaseT

Problem must keep minimal packet size when bandwidth

increases

With fixed cable length and propagation speed must

increase minimal size proportionally to bandwidth

increase

Eg 100Mbs 1500m of cable prop remains 6μs minimal

size becomes 1200 bits

Solutions

Cable length limited to 100m

Prevent collisions by ldquoEthernet Switchesrdquo (later)

Max distance from node to Hub is 100 meters

57

58

Gbit Ethernet

use standard Ethernet frame format

allows for point-to-point links and shared broadcast channels

in shared mode CSMACD is used short distances between

nodes to be efficiency

uses hubs called here ldquoBuffered Distributorsrdquo

Full-Duplex at 1 Gbps for point-to-point links

10 Gbpsec now

30

Hubs

QWhy not just one big LAN

Limited amount of supportable traffic on single LAN

all stations must share bandwidth

limited length 8023 (Ethernet) specifies maximum

cable length

large ldquocollision domainrdquo (can collide with many

stations)

limited number of stations 8025 (token ring) have

token passing delays at each station

59

Lecture 360

Hubs (Multiport repeaters Bus in a box)

Physical Layer devices essentially repeaters operating at bit

levels repeat received bits on one interface to all other

interfaces

Can‟t interconnect 10BaseT amp 100BaseT (because

segments don‟t share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design)

with backbone hub at its top

31

61

Hubs (Multiport repeaters Bus in a box)

Each connected LAN referred to as LAN segment

Hubs do not isolate collision domains node may collide with any

node residing at any segment in LAN

Extends max distance between nodes but all the segments become

one large collision domain

Hub Advantages

simple inexpensive device

Multi-tier provides graceful degradation portions of the LAN

continue to operate if one hub malfunctions

extends maximum distance between node pairs (100m per Hub)

62

Bridges

Link Layer devices operate on Ethernet frames examining

frame header and selectively forwarding frame based on its

destination

Bridge isolates collision domains since it buffers frames

When frame is to be forwarded on segment bridge uses

CSMACD to access segment and transmit

Store and forward element So different types of Ethernet

types can be connected

Transparent no need for any change to hosts LAN adapters

Forwarding is selective do not always flood All connected

segments can work independently in parallel

32

63

Bridge Filtering

bridges learn which hosts can be reached through which

interfaces maintain filtering tables

when frame received bridge ldquolearnsrdquo location of sender

incoming LAN segment

records sender location in filtering table

filtering table entry

(Node LAN Address Bridge Interface Time Stamp)

stale entries in Filtering Table dropped (TTL can be 60 minutes)

64

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_port

if (out_port not valid) no entry found for destination

then flood forward on all but the interface on which the frame arrived

if (in_port = out_port) destination is on LAN on which frame was received

then drop the frame

Otherwise (out_port is valid) entry found for destination then forward the frame on interface indicated

33

65

Bridge Learning example

Suppose C sends frame to D and D replies back with frame

to C

C sends frame bridge has no info about D so floods to both LANs bridge notes that C is on port 1

frame ignored on upper LAN

frame received by D

66

Bridge Learning example

D generates reply to C sends

bridge sees frame from D

bridge notes that D is on interface 2

bridge knows C on interface 1 so selectivelyforwards frame out via interface 1

C 1

34

67

What will happen with loops

Incorrect learning

A

B

1 1

22

A 1 A 122

68

What will happen with loops

Frame looping

A

C

1 1

22

C C

35

69

What will happen with loops

Frame looping

A

B

1 1

22

B2 B1

70

Introducing Spanning Tree

Allow a path between every LAN without causing loops

(loop-free environment)

Bridges communicate with special configuration

messages (BPDUs)

Standardized by IEEE 8021D

Note redundant paths are good active redundant paths are bad (they cause

loops)

36

How to Construct a Spanning Tree

Bridges run a distributed spanning tree

Algorithm

Select what ports (and bridges) should actively forward

frames

Finding the root flooding

Building a tree Bellman-Ford Algorithm

Can combine efficiently

Standardized in IEEE 8021 specification

71

72

Spanning Tree Requirements

Each bridge is assigned a unique identifier

A broadcast address for bridges on a LAN

A unique port identifier for all ports on all bridges

MAC address

Bridge id + port number

37

73

Spanning Tree Concepts

Root Bridge The bridge with the lowest bridge ID value is elected the

root bridge

One root bridge chosen among all bridges

Every other bridge calculates a path to the root bridge

74

Spanning Tree Concepts

Path Cost A cost associated with each port on each bridge

default is 1

The cost associated with transmission onto the LAN

connected to the port

Can be manually or automatically assigned

Can be used to alter the path to the root bridge

38

75

Spanning Tree Concepts

Root Port The port on each bridge that is on the path towards the

root bridge

The root port is part of the lowest cost path towards

the root bridge

If port costs are equal on a bridge the port with the

lowest ID becomes root port

76

Spanning Tree Concepts

Root Path Cost The minimum cost path to the root bridge

The cost starts at the root bridge

Each bridge computes root path cost independently

based on their view of the network

39

77

Spanning Tree Concepts Designated

Bridge Only one bridge on a LAN at one time is chosen the

designated bridge

This bridge provides the minimum cost path to the root

bridge for the LAN

Only the designated bridge passes frames towards the

root bridge

78

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Protocol operation1 Picks a root2 For each LAN

picks a designated bridgethat is closest to the root

3 All bridges on a LANsend packets towards the root via the designatedbridge

B8

40

79

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

80

Spanning Tree Algorithm

An Overview 1 Determine the root bridge among all bridges

2 Each bridge determines its root port

The port in the direction of the root bridge

3 Determine the designated bridge on each LAN

The bridge which accepts frames to forward towards the root bridge

The frames are sent on the root port of the designated bridge

41

81

Spanning Tree Algorithm

Selecting Root Bridge Initially each bridge considers itself to be the root bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

Best one wins

(lowest root IDcostpriority)

82

Spanning Tree Algorithm

Selecting Root Ports Each bridge selects one of its ports which has the

minimal cost to the root bridge

In case of a tie the lowest uplink (transmitter) bridge ID is

used

In case of another tie the lowest port ID is used

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 18: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

18

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots

adapter doesn‟t transmit if it

senses that some other

adapter is transmitting that is

carrier sense

transmitting adapter aborts

when it senses that another

adapter is transmitting that is

collision detection

Before attempting a

retransmission adapter

waits a random time that

is random access

36

19

Unreliable connectionless service

Connectionless No handshaking between sending and

receiving adapter

Unreliable receiving adapter doesn‟t send acks or nacks to

sending adapter

stream of datagrams passed to network layer can have gaps

gaps will be filled if app is using TCP

otherwise app will see the gaps

37

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other

transmitters are aware of

collision 48 bits

Bit time 1 microsec for 10 Mbps

Ethernet

for K=1023 wait time is about

50 msec

Exponential Backoff

Goal adapt retransmission

attempts to estimated current

load

heavy load random wait will be

longer

first collision choose K from

01 delay is K 512 bit

transmission times

after second collision choose K

from 0123hellip

after ten collisions choose K

from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

38

20

8023 CSMACD (Ethernet) Algorithm

39

Ethernet CSMACD algorithm

1 Adaptor receives datagram

from net layer amp creates frame

2 If adapter senses channel idle it

starts to transmit frame If it

senses channel busy waits until

channel idle and then transmits

3 If adapter transmits entire

frame without detecting

another transmission the

adapter is done with frame

4 If adapter detects another

transmission while transmitting

aborts and sends jam signal

5 After aborting adapter enters

exponential backoff after

the mth collision adapter

chooses a K at random from

012hellip2m-1 Adapter waits

K512 bit times and returns to

Step 2

40

21

Ethernet Minimum Packet Size

41

Summary of MAC protocols

What do you do with a shared media

Channel Partitioning by time frequency or code

Time Division Frequency Division Code Division

Random partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACD

carrier sensing easy in some technologies (wire) hard in

others (wireless)

CSMACD used in Ethernet

CSMACA used in 80211 (Wireless)

42

22

LAN technologies

Data link layer so far

MAC protocols The random protocol approach

Next LAN technologies

Addressing

Ethernet

Hubs bridges and switches

43

MAC Addresses and ARP

32-bit IP address network-layer address

used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet)

address used to get datagram from one interface to another physically-

connected interface (same network)

48 bit MAC address (for most LANs)

burned in the adapter ROM but can be modified

44

23

LAN Addresses and ARP

Each adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN(wired orwireless)

45

LAN Address (more)

MAC address allocation administered by IEEE

manufacturer buys portion of MAC address space (to assure

uniqueness)

Analogy

(a) MAC address like Social Security Number

(b) IP address like postal address

MAC flat address portability

can move LAN card from one LAN to another

IP hierarchical address NOT portable

depends on IP subnet to which node is attached

46

24

ARP Address Resolution Protocol

Each IP node (Host Router)

on LAN has ARP table

ARP Table IPMAC address

mappings for some LAN

nodes

lt IP address MAC address TTLgt

TTL (Time To Live) time after

which address mapping will be

forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

237196723

237196778

237196714

237196788

47

ARP protocol Same LAN (network)

A wants to send datagram to B

and B‟s MAC address not in A‟s

ARP table

A broadcasts ARP query packet

containing Bs IP address

Dest MAC address = FF-FF-

FF-FF-FF-FF

all machines on LAN receive

ARP query

B receives ARP packet replies to

A with its (Bs) MAC address

frame sent to A‟s MAC address

(unicast)

A caches (saves) IP-to-MAC

address pair in its ARP table until

information becomes old (times

out)

soft state information that

times out (goes away) unless

refreshed

ARP is ldquoplug-and-playrdquo

nodes create their ARP tables

without intervention from net

administrator

48

25

Routing to another LANwalkthrough send datagram from A to B via R

assume A know‟s B IP address

Two ARP tables in router R one for each IP network (LAN)

In routing table at source Host find router 111111111110

In ARP table at source find MAC address E6-E9-00-17-BB-4B etc

A

RB

49

Ossi Mokryn - Data link layer

A creates datagram with source A destination B

A uses ARP to get R‟s MAC address for 111111111110

A creates link-layer frame with Rs MAC address as dest frame

contains A-to-B IP datagram

A‟s adapter sends frame

R‟s adapter receives frame

R removes IP datagram from Ethernet frame sees its destined to B

R uses ARP to get B‟s MAC address

R creates frame containing A-to-B IP datagram sends to B

A

RB

50

26

Ethernet

ldquodominantrdquo wired LAN technology developed at the 70s

cheap $20 for 100Mbs

first widely used LAN technology

Simple cheap

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

51

Ethernet topology Through the Years

Classic Ethernet Now star topology prevails

Connection choices hub or switch (more later)

Fast Ethernet 100 Mbs

Gigabit Ethernet 1Gbps

52

hub orswitch

bull Shared Bus with CSMACDbull Bus maximal length 500 mbullTransmission rate 10Mbs

Through the years the only common is The Frame

27

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network

layer protocol packet) in Ethernet frame

Preamble

7 bytes with pattern 10101010 followed by one byte with

pattern 10101011

used to synchronize receiver sender clock rates what is

the length in clock ticks of one bit

53

Type length length or type of frame

Ethernet Frame Structure (more)

Ossi Mokryn - Data link layer

Addresses 6 bytes

if adapter receives frame with matching destination address or with

broadcast address (eg ARP packet) it passes data in frame to net-layer

protocol

otherwise adapter discards frame

MAC addresses also called Physical addresses

Type indicates the higher layer protocol (mostly IP but others

may be supported such as Novell IPX and AppleTalk)

CRC checked at receiver if error is detected the frame is

simply dropped Before CRC there is a padding field for the

CRC to pad to 64 bytes

54

28

55

Ethernet Technology 10Base2

10 10Mbps 2 under 200 meters max cable length

thin coaxial cable in a bus topology

repeaters used to connect up to multiple segments

repeater repeats bits it hears on one interface to its other

interfaces physical layer device only

Ethernet technology 100BaseT

10100 Mbps rate latter called ldquofast ethernetrdquo

T stands for Twisted Pair

Nodes connect to a hub ldquostar topologyrdquo 100 m max

distance between nodes and hub

twisted pair

hub

56

29

Ethernet technology 100BaseT

Problem must keep minimal packet size when bandwidth

increases

With fixed cable length and propagation speed must

increase minimal size proportionally to bandwidth

increase

Eg 100Mbs 1500m of cable prop remains 6μs minimal

size becomes 1200 bits

Solutions

Cable length limited to 100m

Prevent collisions by ldquoEthernet Switchesrdquo (later)

Max distance from node to Hub is 100 meters

57

58

Gbit Ethernet

use standard Ethernet frame format

allows for point-to-point links and shared broadcast channels

in shared mode CSMACD is used short distances between

nodes to be efficiency

uses hubs called here ldquoBuffered Distributorsrdquo

Full-Duplex at 1 Gbps for point-to-point links

10 Gbpsec now

30

Hubs

QWhy not just one big LAN

Limited amount of supportable traffic on single LAN

all stations must share bandwidth

limited length 8023 (Ethernet) specifies maximum

cable length

large ldquocollision domainrdquo (can collide with many

stations)

limited number of stations 8025 (token ring) have

token passing delays at each station

59

Lecture 360

Hubs (Multiport repeaters Bus in a box)

Physical Layer devices essentially repeaters operating at bit

levels repeat received bits on one interface to all other

interfaces

Can‟t interconnect 10BaseT amp 100BaseT (because

segments don‟t share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design)

with backbone hub at its top

31

61

Hubs (Multiport repeaters Bus in a box)

Each connected LAN referred to as LAN segment

Hubs do not isolate collision domains node may collide with any

node residing at any segment in LAN

Extends max distance between nodes but all the segments become

one large collision domain

Hub Advantages

simple inexpensive device

Multi-tier provides graceful degradation portions of the LAN

continue to operate if one hub malfunctions

extends maximum distance between node pairs (100m per Hub)

62

Bridges

Link Layer devices operate on Ethernet frames examining

frame header and selectively forwarding frame based on its

destination

Bridge isolates collision domains since it buffers frames

When frame is to be forwarded on segment bridge uses

CSMACD to access segment and transmit

Store and forward element So different types of Ethernet

types can be connected

Transparent no need for any change to hosts LAN adapters

Forwarding is selective do not always flood All connected

segments can work independently in parallel

32

63

Bridge Filtering

bridges learn which hosts can be reached through which

interfaces maintain filtering tables

when frame received bridge ldquolearnsrdquo location of sender

incoming LAN segment

records sender location in filtering table

filtering table entry

(Node LAN Address Bridge Interface Time Stamp)

stale entries in Filtering Table dropped (TTL can be 60 minutes)

64

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_port

if (out_port not valid) no entry found for destination

then flood forward on all but the interface on which the frame arrived

if (in_port = out_port) destination is on LAN on which frame was received

then drop the frame

Otherwise (out_port is valid) entry found for destination then forward the frame on interface indicated

33

65

Bridge Learning example

Suppose C sends frame to D and D replies back with frame

to C

C sends frame bridge has no info about D so floods to both LANs bridge notes that C is on port 1

frame ignored on upper LAN

frame received by D

66

Bridge Learning example

D generates reply to C sends

bridge sees frame from D

bridge notes that D is on interface 2

bridge knows C on interface 1 so selectivelyforwards frame out via interface 1

C 1

34

67

What will happen with loops

Incorrect learning

A

B

1 1

22

A 1 A 122

68

What will happen with loops

Frame looping

A

C

1 1

22

C C

35

69

What will happen with loops

Frame looping

A

B

1 1

22

B2 B1

70

Introducing Spanning Tree

Allow a path between every LAN without causing loops

(loop-free environment)

Bridges communicate with special configuration

messages (BPDUs)

Standardized by IEEE 8021D

Note redundant paths are good active redundant paths are bad (they cause

loops)

36

How to Construct a Spanning Tree

Bridges run a distributed spanning tree

Algorithm

Select what ports (and bridges) should actively forward

frames

Finding the root flooding

Building a tree Bellman-Ford Algorithm

Can combine efficiently

Standardized in IEEE 8021 specification

71

72

Spanning Tree Requirements

Each bridge is assigned a unique identifier

A broadcast address for bridges on a LAN

A unique port identifier for all ports on all bridges

MAC address

Bridge id + port number

37

73

Spanning Tree Concepts

Root Bridge The bridge with the lowest bridge ID value is elected the

root bridge

One root bridge chosen among all bridges

Every other bridge calculates a path to the root bridge

74

Spanning Tree Concepts

Path Cost A cost associated with each port on each bridge

default is 1

The cost associated with transmission onto the LAN

connected to the port

Can be manually or automatically assigned

Can be used to alter the path to the root bridge

38

75

Spanning Tree Concepts

Root Port The port on each bridge that is on the path towards the

root bridge

The root port is part of the lowest cost path towards

the root bridge

If port costs are equal on a bridge the port with the

lowest ID becomes root port

76

Spanning Tree Concepts

Root Path Cost The minimum cost path to the root bridge

The cost starts at the root bridge

Each bridge computes root path cost independently

based on their view of the network

39

77

Spanning Tree Concepts Designated

Bridge Only one bridge on a LAN at one time is chosen the

designated bridge

This bridge provides the minimum cost path to the root

bridge for the LAN

Only the designated bridge passes frames towards the

root bridge

78

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Protocol operation1 Picks a root2 For each LAN

picks a designated bridgethat is closest to the root

3 All bridges on a LANsend packets towards the root via the designatedbridge

B8

40

79

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

80

Spanning Tree Algorithm

An Overview 1 Determine the root bridge among all bridges

2 Each bridge determines its root port

The port in the direction of the root bridge

3 Determine the designated bridge on each LAN

The bridge which accepts frames to forward towards the root bridge

The frames are sent on the root port of the designated bridge

41

81

Spanning Tree Algorithm

Selecting Root Bridge Initially each bridge considers itself to be the root bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

Best one wins

(lowest root IDcostpriority)

82

Spanning Tree Algorithm

Selecting Root Ports Each bridge selects one of its ports which has the

minimal cost to the root bridge

In case of a tie the lowest uplink (transmitter) bridge ID is

used

In case of another tie the lowest port ID is used

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 19: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

19

Unreliable connectionless service

Connectionless No handshaking between sending and

receiving adapter

Unreliable receiving adapter doesn‟t send acks or nacks to

sending adapter

stream of datagrams passed to network layer can have gaps

gaps will be filled if app is using TCP

otherwise app will see the gaps

37

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other

transmitters are aware of

collision 48 bits

Bit time 1 microsec for 10 Mbps

Ethernet

for K=1023 wait time is about

50 msec

Exponential Backoff

Goal adapt retransmission

attempts to estimated current

load

heavy load random wait will be

longer

first collision choose K from

01 delay is K 512 bit

transmission times

after second collision choose K

from 0123hellip

after ten collisions choose K

from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

38

20

8023 CSMACD (Ethernet) Algorithm

39

Ethernet CSMACD algorithm

1 Adaptor receives datagram

from net layer amp creates frame

2 If adapter senses channel idle it

starts to transmit frame If it

senses channel busy waits until

channel idle and then transmits

3 If adapter transmits entire

frame without detecting

another transmission the

adapter is done with frame

4 If adapter detects another

transmission while transmitting

aborts and sends jam signal

5 After aborting adapter enters

exponential backoff after

the mth collision adapter

chooses a K at random from

012hellip2m-1 Adapter waits

K512 bit times and returns to

Step 2

40

21

Ethernet Minimum Packet Size

41

Summary of MAC protocols

What do you do with a shared media

Channel Partitioning by time frequency or code

Time Division Frequency Division Code Division

Random partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACD

carrier sensing easy in some technologies (wire) hard in

others (wireless)

CSMACD used in Ethernet

CSMACA used in 80211 (Wireless)

42

22

LAN technologies

Data link layer so far

MAC protocols The random protocol approach

Next LAN technologies

Addressing

Ethernet

Hubs bridges and switches

43

MAC Addresses and ARP

32-bit IP address network-layer address

used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet)

address used to get datagram from one interface to another physically-

connected interface (same network)

48 bit MAC address (for most LANs)

burned in the adapter ROM but can be modified

44

23

LAN Addresses and ARP

Each adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN(wired orwireless)

45

LAN Address (more)

MAC address allocation administered by IEEE

manufacturer buys portion of MAC address space (to assure

uniqueness)

Analogy

(a) MAC address like Social Security Number

(b) IP address like postal address

MAC flat address portability

can move LAN card from one LAN to another

IP hierarchical address NOT portable

depends on IP subnet to which node is attached

46

24

ARP Address Resolution Protocol

Each IP node (Host Router)

on LAN has ARP table

ARP Table IPMAC address

mappings for some LAN

nodes

lt IP address MAC address TTLgt

TTL (Time To Live) time after

which address mapping will be

forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

237196723

237196778

237196714

237196788

47

ARP protocol Same LAN (network)

A wants to send datagram to B

and B‟s MAC address not in A‟s

ARP table

A broadcasts ARP query packet

containing Bs IP address

Dest MAC address = FF-FF-

FF-FF-FF-FF

all machines on LAN receive

ARP query

B receives ARP packet replies to

A with its (Bs) MAC address

frame sent to A‟s MAC address

(unicast)

A caches (saves) IP-to-MAC

address pair in its ARP table until

information becomes old (times

out)

soft state information that

times out (goes away) unless

refreshed

ARP is ldquoplug-and-playrdquo

nodes create their ARP tables

without intervention from net

administrator

48

25

Routing to another LANwalkthrough send datagram from A to B via R

assume A know‟s B IP address

Two ARP tables in router R one for each IP network (LAN)

In routing table at source Host find router 111111111110

In ARP table at source find MAC address E6-E9-00-17-BB-4B etc

A

RB

49

Ossi Mokryn - Data link layer

A creates datagram with source A destination B

A uses ARP to get R‟s MAC address for 111111111110

A creates link-layer frame with Rs MAC address as dest frame

contains A-to-B IP datagram

A‟s adapter sends frame

R‟s adapter receives frame

R removes IP datagram from Ethernet frame sees its destined to B

R uses ARP to get B‟s MAC address

R creates frame containing A-to-B IP datagram sends to B

A

RB

50

26

Ethernet

ldquodominantrdquo wired LAN technology developed at the 70s

cheap $20 for 100Mbs

first widely used LAN technology

Simple cheap

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

51

Ethernet topology Through the Years

Classic Ethernet Now star topology prevails

Connection choices hub or switch (more later)

Fast Ethernet 100 Mbs

Gigabit Ethernet 1Gbps

52

hub orswitch

bull Shared Bus with CSMACDbull Bus maximal length 500 mbullTransmission rate 10Mbs

Through the years the only common is The Frame

27

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network

layer protocol packet) in Ethernet frame

Preamble

7 bytes with pattern 10101010 followed by one byte with

pattern 10101011

used to synchronize receiver sender clock rates what is

the length in clock ticks of one bit

53

Type length length or type of frame

Ethernet Frame Structure (more)

Ossi Mokryn - Data link layer

Addresses 6 bytes

if adapter receives frame with matching destination address or with

broadcast address (eg ARP packet) it passes data in frame to net-layer

protocol

otherwise adapter discards frame

MAC addresses also called Physical addresses

Type indicates the higher layer protocol (mostly IP but others

may be supported such as Novell IPX and AppleTalk)

CRC checked at receiver if error is detected the frame is

simply dropped Before CRC there is a padding field for the

CRC to pad to 64 bytes

54

28

55

Ethernet Technology 10Base2

10 10Mbps 2 under 200 meters max cable length

thin coaxial cable in a bus topology

repeaters used to connect up to multiple segments

repeater repeats bits it hears on one interface to its other

interfaces physical layer device only

Ethernet technology 100BaseT

10100 Mbps rate latter called ldquofast ethernetrdquo

T stands for Twisted Pair

Nodes connect to a hub ldquostar topologyrdquo 100 m max

distance between nodes and hub

twisted pair

hub

56

29

Ethernet technology 100BaseT

Problem must keep minimal packet size when bandwidth

increases

With fixed cable length and propagation speed must

increase minimal size proportionally to bandwidth

increase

Eg 100Mbs 1500m of cable prop remains 6μs minimal

size becomes 1200 bits

Solutions

Cable length limited to 100m

Prevent collisions by ldquoEthernet Switchesrdquo (later)

Max distance from node to Hub is 100 meters

57

58

Gbit Ethernet

use standard Ethernet frame format

allows for point-to-point links and shared broadcast channels

in shared mode CSMACD is used short distances between

nodes to be efficiency

uses hubs called here ldquoBuffered Distributorsrdquo

Full-Duplex at 1 Gbps for point-to-point links

10 Gbpsec now

30

Hubs

QWhy not just one big LAN

Limited amount of supportable traffic on single LAN

all stations must share bandwidth

limited length 8023 (Ethernet) specifies maximum

cable length

large ldquocollision domainrdquo (can collide with many

stations)

limited number of stations 8025 (token ring) have

token passing delays at each station

59

Lecture 360

Hubs (Multiport repeaters Bus in a box)

Physical Layer devices essentially repeaters operating at bit

levels repeat received bits on one interface to all other

interfaces

Can‟t interconnect 10BaseT amp 100BaseT (because

segments don‟t share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design)

with backbone hub at its top

31

61

Hubs (Multiport repeaters Bus in a box)

Each connected LAN referred to as LAN segment

Hubs do not isolate collision domains node may collide with any

node residing at any segment in LAN

Extends max distance between nodes but all the segments become

one large collision domain

Hub Advantages

simple inexpensive device

Multi-tier provides graceful degradation portions of the LAN

continue to operate if one hub malfunctions

extends maximum distance between node pairs (100m per Hub)

62

Bridges

Link Layer devices operate on Ethernet frames examining

frame header and selectively forwarding frame based on its

destination

Bridge isolates collision domains since it buffers frames

When frame is to be forwarded on segment bridge uses

CSMACD to access segment and transmit

Store and forward element So different types of Ethernet

types can be connected

Transparent no need for any change to hosts LAN adapters

Forwarding is selective do not always flood All connected

segments can work independently in parallel

32

63

Bridge Filtering

bridges learn which hosts can be reached through which

interfaces maintain filtering tables

when frame received bridge ldquolearnsrdquo location of sender

incoming LAN segment

records sender location in filtering table

filtering table entry

(Node LAN Address Bridge Interface Time Stamp)

stale entries in Filtering Table dropped (TTL can be 60 minutes)

64

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_port

if (out_port not valid) no entry found for destination

then flood forward on all but the interface on which the frame arrived

if (in_port = out_port) destination is on LAN on which frame was received

then drop the frame

Otherwise (out_port is valid) entry found for destination then forward the frame on interface indicated

33

65

Bridge Learning example

Suppose C sends frame to D and D replies back with frame

to C

C sends frame bridge has no info about D so floods to both LANs bridge notes that C is on port 1

frame ignored on upper LAN

frame received by D

66

Bridge Learning example

D generates reply to C sends

bridge sees frame from D

bridge notes that D is on interface 2

bridge knows C on interface 1 so selectivelyforwards frame out via interface 1

C 1

34

67

What will happen with loops

Incorrect learning

A

B

1 1

22

A 1 A 122

68

What will happen with loops

Frame looping

A

C

1 1

22

C C

35

69

What will happen with loops

Frame looping

A

B

1 1

22

B2 B1

70

Introducing Spanning Tree

Allow a path between every LAN without causing loops

(loop-free environment)

Bridges communicate with special configuration

messages (BPDUs)

Standardized by IEEE 8021D

Note redundant paths are good active redundant paths are bad (they cause

loops)

36

How to Construct a Spanning Tree

Bridges run a distributed spanning tree

Algorithm

Select what ports (and bridges) should actively forward

frames

Finding the root flooding

Building a tree Bellman-Ford Algorithm

Can combine efficiently

Standardized in IEEE 8021 specification

71

72

Spanning Tree Requirements

Each bridge is assigned a unique identifier

A broadcast address for bridges on a LAN

A unique port identifier for all ports on all bridges

MAC address

Bridge id + port number

37

73

Spanning Tree Concepts

Root Bridge The bridge with the lowest bridge ID value is elected the

root bridge

One root bridge chosen among all bridges

Every other bridge calculates a path to the root bridge

74

Spanning Tree Concepts

Path Cost A cost associated with each port on each bridge

default is 1

The cost associated with transmission onto the LAN

connected to the port

Can be manually or automatically assigned

Can be used to alter the path to the root bridge

38

75

Spanning Tree Concepts

Root Port The port on each bridge that is on the path towards the

root bridge

The root port is part of the lowest cost path towards

the root bridge

If port costs are equal on a bridge the port with the

lowest ID becomes root port

76

Spanning Tree Concepts

Root Path Cost The minimum cost path to the root bridge

The cost starts at the root bridge

Each bridge computes root path cost independently

based on their view of the network

39

77

Spanning Tree Concepts Designated

Bridge Only one bridge on a LAN at one time is chosen the

designated bridge

This bridge provides the minimum cost path to the root

bridge for the LAN

Only the designated bridge passes frames towards the

root bridge

78

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Protocol operation1 Picks a root2 For each LAN

picks a designated bridgethat is closest to the root

3 All bridges on a LANsend packets towards the root via the designatedbridge

B8

40

79

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

80

Spanning Tree Algorithm

An Overview 1 Determine the root bridge among all bridges

2 Each bridge determines its root port

The port in the direction of the root bridge

3 Determine the designated bridge on each LAN

The bridge which accepts frames to forward towards the root bridge

The frames are sent on the root port of the designated bridge

41

81

Spanning Tree Algorithm

Selecting Root Bridge Initially each bridge considers itself to be the root bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

Best one wins

(lowest root IDcostpriority)

82

Spanning Tree Algorithm

Selecting Root Ports Each bridge selects one of its ports which has the

minimal cost to the root bridge

In case of a tie the lowest uplink (transmitter) bridge ID is

used

In case of another tie the lowest port ID is used

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 20: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

20

8023 CSMACD (Ethernet) Algorithm

39

Ethernet CSMACD algorithm

1 Adaptor receives datagram

from net layer amp creates frame

2 If adapter senses channel idle it

starts to transmit frame If it

senses channel busy waits until

channel idle and then transmits

3 If adapter transmits entire

frame without detecting

another transmission the

adapter is done with frame

4 If adapter detects another

transmission while transmitting

aborts and sends jam signal

5 After aborting adapter enters

exponential backoff after

the mth collision adapter

chooses a K at random from

012hellip2m-1 Adapter waits

K512 bit times and returns to

Step 2

40

21

Ethernet Minimum Packet Size

41

Summary of MAC protocols

What do you do with a shared media

Channel Partitioning by time frequency or code

Time Division Frequency Division Code Division

Random partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACD

carrier sensing easy in some technologies (wire) hard in

others (wireless)

CSMACD used in Ethernet

CSMACA used in 80211 (Wireless)

42

22

LAN technologies

Data link layer so far

MAC protocols The random protocol approach

Next LAN technologies

Addressing

Ethernet

Hubs bridges and switches

43

MAC Addresses and ARP

32-bit IP address network-layer address

used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet)

address used to get datagram from one interface to another physically-

connected interface (same network)

48 bit MAC address (for most LANs)

burned in the adapter ROM but can be modified

44

23

LAN Addresses and ARP

Each adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN(wired orwireless)

45

LAN Address (more)

MAC address allocation administered by IEEE

manufacturer buys portion of MAC address space (to assure

uniqueness)

Analogy

(a) MAC address like Social Security Number

(b) IP address like postal address

MAC flat address portability

can move LAN card from one LAN to another

IP hierarchical address NOT portable

depends on IP subnet to which node is attached

46

24

ARP Address Resolution Protocol

Each IP node (Host Router)

on LAN has ARP table

ARP Table IPMAC address

mappings for some LAN

nodes

lt IP address MAC address TTLgt

TTL (Time To Live) time after

which address mapping will be

forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

237196723

237196778

237196714

237196788

47

ARP protocol Same LAN (network)

A wants to send datagram to B

and B‟s MAC address not in A‟s

ARP table

A broadcasts ARP query packet

containing Bs IP address

Dest MAC address = FF-FF-

FF-FF-FF-FF

all machines on LAN receive

ARP query

B receives ARP packet replies to

A with its (Bs) MAC address

frame sent to A‟s MAC address

(unicast)

A caches (saves) IP-to-MAC

address pair in its ARP table until

information becomes old (times

out)

soft state information that

times out (goes away) unless

refreshed

ARP is ldquoplug-and-playrdquo

nodes create their ARP tables

without intervention from net

administrator

48

25

Routing to another LANwalkthrough send datagram from A to B via R

assume A know‟s B IP address

Two ARP tables in router R one for each IP network (LAN)

In routing table at source Host find router 111111111110

In ARP table at source find MAC address E6-E9-00-17-BB-4B etc

A

RB

49

Ossi Mokryn - Data link layer

A creates datagram with source A destination B

A uses ARP to get R‟s MAC address for 111111111110

A creates link-layer frame with Rs MAC address as dest frame

contains A-to-B IP datagram

A‟s adapter sends frame

R‟s adapter receives frame

R removes IP datagram from Ethernet frame sees its destined to B

R uses ARP to get B‟s MAC address

R creates frame containing A-to-B IP datagram sends to B

A

RB

50

26

Ethernet

ldquodominantrdquo wired LAN technology developed at the 70s

cheap $20 for 100Mbs

first widely used LAN technology

Simple cheap

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

51

Ethernet topology Through the Years

Classic Ethernet Now star topology prevails

Connection choices hub or switch (more later)

Fast Ethernet 100 Mbs

Gigabit Ethernet 1Gbps

52

hub orswitch

bull Shared Bus with CSMACDbull Bus maximal length 500 mbullTransmission rate 10Mbs

Through the years the only common is The Frame

27

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network

layer protocol packet) in Ethernet frame

Preamble

7 bytes with pattern 10101010 followed by one byte with

pattern 10101011

used to synchronize receiver sender clock rates what is

the length in clock ticks of one bit

53

Type length length or type of frame

Ethernet Frame Structure (more)

Ossi Mokryn - Data link layer

Addresses 6 bytes

if adapter receives frame with matching destination address or with

broadcast address (eg ARP packet) it passes data in frame to net-layer

protocol

otherwise adapter discards frame

MAC addresses also called Physical addresses

Type indicates the higher layer protocol (mostly IP but others

may be supported such as Novell IPX and AppleTalk)

CRC checked at receiver if error is detected the frame is

simply dropped Before CRC there is a padding field for the

CRC to pad to 64 bytes

54

28

55

Ethernet Technology 10Base2

10 10Mbps 2 under 200 meters max cable length

thin coaxial cable in a bus topology

repeaters used to connect up to multiple segments

repeater repeats bits it hears on one interface to its other

interfaces physical layer device only

Ethernet technology 100BaseT

10100 Mbps rate latter called ldquofast ethernetrdquo

T stands for Twisted Pair

Nodes connect to a hub ldquostar topologyrdquo 100 m max

distance between nodes and hub

twisted pair

hub

56

29

Ethernet technology 100BaseT

Problem must keep minimal packet size when bandwidth

increases

With fixed cable length and propagation speed must

increase minimal size proportionally to bandwidth

increase

Eg 100Mbs 1500m of cable prop remains 6μs minimal

size becomes 1200 bits

Solutions

Cable length limited to 100m

Prevent collisions by ldquoEthernet Switchesrdquo (later)

Max distance from node to Hub is 100 meters

57

58

Gbit Ethernet

use standard Ethernet frame format

allows for point-to-point links and shared broadcast channels

in shared mode CSMACD is used short distances between

nodes to be efficiency

uses hubs called here ldquoBuffered Distributorsrdquo

Full-Duplex at 1 Gbps for point-to-point links

10 Gbpsec now

30

Hubs

QWhy not just one big LAN

Limited amount of supportable traffic on single LAN

all stations must share bandwidth

limited length 8023 (Ethernet) specifies maximum

cable length

large ldquocollision domainrdquo (can collide with many

stations)

limited number of stations 8025 (token ring) have

token passing delays at each station

59

Lecture 360

Hubs (Multiport repeaters Bus in a box)

Physical Layer devices essentially repeaters operating at bit

levels repeat received bits on one interface to all other

interfaces

Can‟t interconnect 10BaseT amp 100BaseT (because

segments don‟t share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design)

with backbone hub at its top

31

61

Hubs (Multiport repeaters Bus in a box)

Each connected LAN referred to as LAN segment

Hubs do not isolate collision domains node may collide with any

node residing at any segment in LAN

Extends max distance between nodes but all the segments become

one large collision domain

Hub Advantages

simple inexpensive device

Multi-tier provides graceful degradation portions of the LAN

continue to operate if one hub malfunctions

extends maximum distance between node pairs (100m per Hub)

62

Bridges

Link Layer devices operate on Ethernet frames examining

frame header and selectively forwarding frame based on its

destination

Bridge isolates collision domains since it buffers frames

When frame is to be forwarded on segment bridge uses

CSMACD to access segment and transmit

Store and forward element So different types of Ethernet

types can be connected

Transparent no need for any change to hosts LAN adapters

Forwarding is selective do not always flood All connected

segments can work independently in parallel

32

63

Bridge Filtering

bridges learn which hosts can be reached through which

interfaces maintain filtering tables

when frame received bridge ldquolearnsrdquo location of sender

incoming LAN segment

records sender location in filtering table

filtering table entry

(Node LAN Address Bridge Interface Time Stamp)

stale entries in Filtering Table dropped (TTL can be 60 minutes)

64

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_port

if (out_port not valid) no entry found for destination

then flood forward on all but the interface on which the frame arrived

if (in_port = out_port) destination is on LAN on which frame was received

then drop the frame

Otherwise (out_port is valid) entry found for destination then forward the frame on interface indicated

33

65

Bridge Learning example

Suppose C sends frame to D and D replies back with frame

to C

C sends frame bridge has no info about D so floods to both LANs bridge notes that C is on port 1

frame ignored on upper LAN

frame received by D

66

Bridge Learning example

D generates reply to C sends

bridge sees frame from D

bridge notes that D is on interface 2

bridge knows C on interface 1 so selectivelyforwards frame out via interface 1

C 1

34

67

What will happen with loops

Incorrect learning

A

B

1 1

22

A 1 A 122

68

What will happen with loops

Frame looping

A

C

1 1

22

C C

35

69

What will happen with loops

Frame looping

A

B

1 1

22

B2 B1

70

Introducing Spanning Tree

Allow a path between every LAN without causing loops

(loop-free environment)

Bridges communicate with special configuration

messages (BPDUs)

Standardized by IEEE 8021D

Note redundant paths are good active redundant paths are bad (they cause

loops)

36

How to Construct a Spanning Tree

Bridges run a distributed spanning tree

Algorithm

Select what ports (and bridges) should actively forward

frames

Finding the root flooding

Building a tree Bellman-Ford Algorithm

Can combine efficiently

Standardized in IEEE 8021 specification

71

72

Spanning Tree Requirements

Each bridge is assigned a unique identifier

A broadcast address for bridges on a LAN

A unique port identifier for all ports on all bridges

MAC address

Bridge id + port number

37

73

Spanning Tree Concepts

Root Bridge The bridge with the lowest bridge ID value is elected the

root bridge

One root bridge chosen among all bridges

Every other bridge calculates a path to the root bridge

74

Spanning Tree Concepts

Path Cost A cost associated with each port on each bridge

default is 1

The cost associated with transmission onto the LAN

connected to the port

Can be manually or automatically assigned

Can be used to alter the path to the root bridge

38

75

Spanning Tree Concepts

Root Port The port on each bridge that is on the path towards the

root bridge

The root port is part of the lowest cost path towards

the root bridge

If port costs are equal on a bridge the port with the

lowest ID becomes root port

76

Spanning Tree Concepts

Root Path Cost The minimum cost path to the root bridge

The cost starts at the root bridge

Each bridge computes root path cost independently

based on their view of the network

39

77

Spanning Tree Concepts Designated

Bridge Only one bridge on a LAN at one time is chosen the

designated bridge

This bridge provides the minimum cost path to the root

bridge for the LAN

Only the designated bridge passes frames towards the

root bridge

78

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Protocol operation1 Picks a root2 For each LAN

picks a designated bridgethat is closest to the root

3 All bridges on a LANsend packets towards the root via the designatedbridge

B8

40

79

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

80

Spanning Tree Algorithm

An Overview 1 Determine the root bridge among all bridges

2 Each bridge determines its root port

The port in the direction of the root bridge

3 Determine the designated bridge on each LAN

The bridge which accepts frames to forward towards the root bridge

The frames are sent on the root port of the designated bridge

41

81

Spanning Tree Algorithm

Selecting Root Bridge Initially each bridge considers itself to be the root bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

Best one wins

(lowest root IDcostpriority)

82

Spanning Tree Algorithm

Selecting Root Ports Each bridge selects one of its ports which has the

minimal cost to the root bridge

In case of a tie the lowest uplink (transmitter) bridge ID is

used

In case of another tie the lowest port ID is used

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 21: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

21

Ethernet Minimum Packet Size

41

Summary of MAC protocols

What do you do with a shared media

Channel Partitioning by time frequency or code

Time Division Frequency Division Code Division

Random partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACD

carrier sensing easy in some technologies (wire) hard in

others (wireless)

CSMACD used in Ethernet

CSMACA used in 80211 (Wireless)

42

22

LAN technologies

Data link layer so far

MAC protocols The random protocol approach

Next LAN technologies

Addressing

Ethernet

Hubs bridges and switches

43

MAC Addresses and ARP

32-bit IP address network-layer address

used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet)

address used to get datagram from one interface to another physically-

connected interface (same network)

48 bit MAC address (for most LANs)

burned in the adapter ROM but can be modified

44

23

LAN Addresses and ARP

Each adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN(wired orwireless)

45

LAN Address (more)

MAC address allocation administered by IEEE

manufacturer buys portion of MAC address space (to assure

uniqueness)

Analogy

(a) MAC address like Social Security Number

(b) IP address like postal address

MAC flat address portability

can move LAN card from one LAN to another

IP hierarchical address NOT portable

depends on IP subnet to which node is attached

46

24

ARP Address Resolution Protocol

Each IP node (Host Router)

on LAN has ARP table

ARP Table IPMAC address

mappings for some LAN

nodes

lt IP address MAC address TTLgt

TTL (Time To Live) time after

which address mapping will be

forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

237196723

237196778

237196714

237196788

47

ARP protocol Same LAN (network)

A wants to send datagram to B

and B‟s MAC address not in A‟s

ARP table

A broadcasts ARP query packet

containing Bs IP address

Dest MAC address = FF-FF-

FF-FF-FF-FF

all machines on LAN receive

ARP query

B receives ARP packet replies to

A with its (Bs) MAC address

frame sent to A‟s MAC address

(unicast)

A caches (saves) IP-to-MAC

address pair in its ARP table until

information becomes old (times

out)

soft state information that

times out (goes away) unless

refreshed

ARP is ldquoplug-and-playrdquo

nodes create their ARP tables

without intervention from net

administrator

48

25

Routing to another LANwalkthrough send datagram from A to B via R

assume A know‟s B IP address

Two ARP tables in router R one for each IP network (LAN)

In routing table at source Host find router 111111111110

In ARP table at source find MAC address E6-E9-00-17-BB-4B etc

A

RB

49

Ossi Mokryn - Data link layer

A creates datagram with source A destination B

A uses ARP to get R‟s MAC address for 111111111110

A creates link-layer frame with Rs MAC address as dest frame

contains A-to-B IP datagram

A‟s adapter sends frame

R‟s adapter receives frame

R removes IP datagram from Ethernet frame sees its destined to B

R uses ARP to get B‟s MAC address

R creates frame containing A-to-B IP datagram sends to B

A

RB

50

26

Ethernet

ldquodominantrdquo wired LAN technology developed at the 70s

cheap $20 for 100Mbs

first widely used LAN technology

Simple cheap

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

51

Ethernet topology Through the Years

Classic Ethernet Now star topology prevails

Connection choices hub or switch (more later)

Fast Ethernet 100 Mbs

Gigabit Ethernet 1Gbps

52

hub orswitch

bull Shared Bus with CSMACDbull Bus maximal length 500 mbullTransmission rate 10Mbs

Through the years the only common is The Frame

27

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network

layer protocol packet) in Ethernet frame

Preamble

7 bytes with pattern 10101010 followed by one byte with

pattern 10101011

used to synchronize receiver sender clock rates what is

the length in clock ticks of one bit

53

Type length length or type of frame

Ethernet Frame Structure (more)

Ossi Mokryn - Data link layer

Addresses 6 bytes

if adapter receives frame with matching destination address or with

broadcast address (eg ARP packet) it passes data in frame to net-layer

protocol

otherwise adapter discards frame

MAC addresses also called Physical addresses

Type indicates the higher layer protocol (mostly IP but others

may be supported such as Novell IPX and AppleTalk)

CRC checked at receiver if error is detected the frame is

simply dropped Before CRC there is a padding field for the

CRC to pad to 64 bytes

54

28

55

Ethernet Technology 10Base2

10 10Mbps 2 under 200 meters max cable length

thin coaxial cable in a bus topology

repeaters used to connect up to multiple segments

repeater repeats bits it hears on one interface to its other

interfaces physical layer device only

Ethernet technology 100BaseT

10100 Mbps rate latter called ldquofast ethernetrdquo

T stands for Twisted Pair

Nodes connect to a hub ldquostar topologyrdquo 100 m max

distance between nodes and hub

twisted pair

hub

56

29

Ethernet technology 100BaseT

Problem must keep minimal packet size when bandwidth

increases

With fixed cable length and propagation speed must

increase minimal size proportionally to bandwidth

increase

Eg 100Mbs 1500m of cable prop remains 6μs minimal

size becomes 1200 bits

Solutions

Cable length limited to 100m

Prevent collisions by ldquoEthernet Switchesrdquo (later)

Max distance from node to Hub is 100 meters

57

58

Gbit Ethernet

use standard Ethernet frame format

allows for point-to-point links and shared broadcast channels

in shared mode CSMACD is used short distances between

nodes to be efficiency

uses hubs called here ldquoBuffered Distributorsrdquo

Full-Duplex at 1 Gbps for point-to-point links

10 Gbpsec now

30

Hubs

QWhy not just one big LAN

Limited amount of supportable traffic on single LAN

all stations must share bandwidth

limited length 8023 (Ethernet) specifies maximum

cable length

large ldquocollision domainrdquo (can collide with many

stations)

limited number of stations 8025 (token ring) have

token passing delays at each station

59

Lecture 360

Hubs (Multiport repeaters Bus in a box)

Physical Layer devices essentially repeaters operating at bit

levels repeat received bits on one interface to all other

interfaces

Can‟t interconnect 10BaseT amp 100BaseT (because

segments don‟t share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design)

with backbone hub at its top

31

61

Hubs (Multiport repeaters Bus in a box)

Each connected LAN referred to as LAN segment

Hubs do not isolate collision domains node may collide with any

node residing at any segment in LAN

Extends max distance between nodes but all the segments become

one large collision domain

Hub Advantages

simple inexpensive device

Multi-tier provides graceful degradation portions of the LAN

continue to operate if one hub malfunctions

extends maximum distance between node pairs (100m per Hub)

62

Bridges

Link Layer devices operate on Ethernet frames examining

frame header and selectively forwarding frame based on its

destination

Bridge isolates collision domains since it buffers frames

When frame is to be forwarded on segment bridge uses

CSMACD to access segment and transmit

Store and forward element So different types of Ethernet

types can be connected

Transparent no need for any change to hosts LAN adapters

Forwarding is selective do not always flood All connected

segments can work independently in parallel

32

63

Bridge Filtering

bridges learn which hosts can be reached through which

interfaces maintain filtering tables

when frame received bridge ldquolearnsrdquo location of sender

incoming LAN segment

records sender location in filtering table

filtering table entry

(Node LAN Address Bridge Interface Time Stamp)

stale entries in Filtering Table dropped (TTL can be 60 minutes)

64

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_port

if (out_port not valid) no entry found for destination

then flood forward on all but the interface on which the frame arrived

if (in_port = out_port) destination is on LAN on which frame was received

then drop the frame

Otherwise (out_port is valid) entry found for destination then forward the frame on interface indicated

33

65

Bridge Learning example

Suppose C sends frame to D and D replies back with frame

to C

C sends frame bridge has no info about D so floods to both LANs bridge notes that C is on port 1

frame ignored on upper LAN

frame received by D

66

Bridge Learning example

D generates reply to C sends

bridge sees frame from D

bridge notes that D is on interface 2

bridge knows C on interface 1 so selectivelyforwards frame out via interface 1

C 1

34

67

What will happen with loops

Incorrect learning

A

B

1 1

22

A 1 A 122

68

What will happen with loops

Frame looping

A

C

1 1

22

C C

35

69

What will happen with loops

Frame looping

A

B

1 1

22

B2 B1

70

Introducing Spanning Tree

Allow a path between every LAN without causing loops

(loop-free environment)

Bridges communicate with special configuration

messages (BPDUs)

Standardized by IEEE 8021D

Note redundant paths are good active redundant paths are bad (they cause

loops)

36

How to Construct a Spanning Tree

Bridges run a distributed spanning tree

Algorithm

Select what ports (and bridges) should actively forward

frames

Finding the root flooding

Building a tree Bellman-Ford Algorithm

Can combine efficiently

Standardized in IEEE 8021 specification

71

72

Spanning Tree Requirements

Each bridge is assigned a unique identifier

A broadcast address for bridges on a LAN

A unique port identifier for all ports on all bridges

MAC address

Bridge id + port number

37

73

Spanning Tree Concepts

Root Bridge The bridge with the lowest bridge ID value is elected the

root bridge

One root bridge chosen among all bridges

Every other bridge calculates a path to the root bridge

74

Spanning Tree Concepts

Path Cost A cost associated with each port on each bridge

default is 1

The cost associated with transmission onto the LAN

connected to the port

Can be manually or automatically assigned

Can be used to alter the path to the root bridge

38

75

Spanning Tree Concepts

Root Port The port on each bridge that is on the path towards the

root bridge

The root port is part of the lowest cost path towards

the root bridge

If port costs are equal on a bridge the port with the

lowest ID becomes root port

76

Spanning Tree Concepts

Root Path Cost The minimum cost path to the root bridge

The cost starts at the root bridge

Each bridge computes root path cost independently

based on their view of the network

39

77

Spanning Tree Concepts Designated

Bridge Only one bridge on a LAN at one time is chosen the

designated bridge

This bridge provides the minimum cost path to the root

bridge for the LAN

Only the designated bridge passes frames towards the

root bridge

78

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Protocol operation1 Picks a root2 For each LAN

picks a designated bridgethat is closest to the root

3 All bridges on a LANsend packets towards the root via the designatedbridge

B8

40

79

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

80

Spanning Tree Algorithm

An Overview 1 Determine the root bridge among all bridges

2 Each bridge determines its root port

The port in the direction of the root bridge

3 Determine the designated bridge on each LAN

The bridge which accepts frames to forward towards the root bridge

The frames are sent on the root port of the designated bridge

41

81

Spanning Tree Algorithm

Selecting Root Bridge Initially each bridge considers itself to be the root bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

Best one wins

(lowest root IDcostpriority)

82

Spanning Tree Algorithm

Selecting Root Ports Each bridge selects one of its ports which has the

minimal cost to the root bridge

In case of a tie the lowest uplink (transmitter) bridge ID is

used

In case of another tie the lowest port ID is used

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 22: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

22

LAN technologies

Data link layer so far

MAC protocols The random protocol approach

Next LAN technologies

Addressing

Ethernet

Hubs bridges and switches

43

MAC Addresses and ARP

32-bit IP address network-layer address

used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet)

address used to get datagram from one interface to another physically-

connected interface (same network)

48 bit MAC address (for most LANs)

burned in the adapter ROM but can be modified

44

23

LAN Addresses and ARP

Each adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN(wired orwireless)

45

LAN Address (more)

MAC address allocation administered by IEEE

manufacturer buys portion of MAC address space (to assure

uniqueness)

Analogy

(a) MAC address like Social Security Number

(b) IP address like postal address

MAC flat address portability

can move LAN card from one LAN to another

IP hierarchical address NOT portable

depends on IP subnet to which node is attached

46

24

ARP Address Resolution Protocol

Each IP node (Host Router)

on LAN has ARP table

ARP Table IPMAC address

mappings for some LAN

nodes

lt IP address MAC address TTLgt

TTL (Time To Live) time after

which address mapping will be

forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

237196723

237196778

237196714

237196788

47

ARP protocol Same LAN (network)

A wants to send datagram to B

and B‟s MAC address not in A‟s

ARP table

A broadcasts ARP query packet

containing Bs IP address

Dest MAC address = FF-FF-

FF-FF-FF-FF

all machines on LAN receive

ARP query

B receives ARP packet replies to

A with its (Bs) MAC address

frame sent to A‟s MAC address

(unicast)

A caches (saves) IP-to-MAC

address pair in its ARP table until

information becomes old (times

out)

soft state information that

times out (goes away) unless

refreshed

ARP is ldquoplug-and-playrdquo

nodes create their ARP tables

without intervention from net

administrator

48

25

Routing to another LANwalkthrough send datagram from A to B via R

assume A know‟s B IP address

Two ARP tables in router R one for each IP network (LAN)

In routing table at source Host find router 111111111110

In ARP table at source find MAC address E6-E9-00-17-BB-4B etc

A

RB

49

Ossi Mokryn - Data link layer

A creates datagram with source A destination B

A uses ARP to get R‟s MAC address for 111111111110

A creates link-layer frame with Rs MAC address as dest frame

contains A-to-B IP datagram

A‟s adapter sends frame

R‟s adapter receives frame

R removes IP datagram from Ethernet frame sees its destined to B

R uses ARP to get B‟s MAC address

R creates frame containing A-to-B IP datagram sends to B

A

RB

50

26

Ethernet

ldquodominantrdquo wired LAN technology developed at the 70s

cheap $20 for 100Mbs

first widely used LAN technology

Simple cheap

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

51

Ethernet topology Through the Years

Classic Ethernet Now star topology prevails

Connection choices hub or switch (more later)

Fast Ethernet 100 Mbs

Gigabit Ethernet 1Gbps

52

hub orswitch

bull Shared Bus with CSMACDbull Bus maximal length 500 mbullTransmission rate 10Mbs

Through the years the only common is The Frame

27

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network

layer protocol packet) in Ethernet frame

Preamble

7 bytes with pattern 10101010 followed by one byte with

pattern 10101011

used to synchronize receiver sender clock rates what is

the length in clock ticks of one bit

53

Type length length or type of frame

Ethernet Frame Structure (more)

Ossi Mokryn - Data link layer

Addresses 6 bytes

if adapter receives frame with matching destination address or with

broadcast address (eg ARP packet) it passes data in frame to net-layer

protocol

otherwise adapter discards frame

MAC addresses also called Physical addresses

Type indicates the higher layer protocol (mostly IP but others

may be supported such as Novell IPX and AppleTalk)

CRC checked at receiver if error is detected the frame is

simply dropped Before CRC there is a padding field for the

CRC to pad to 64 bytes

54

28

55

Ethernet Technology 10Base2

10 10Mbps 2 under 200 meters max cable length

thin coaxial cable in a bus topology

repeaters used to connect up to multiple segments

repeater repeats bits it hears on one interface to its other

interfaces physical layer device only

Ethernet technology 100BaseT

10100 Mbps rate latter called ldquofast ethernetrdquo

T stands for Twisted Pair

Nodes connect to a hub ldquostar topologyrdquo 100 m max

distance between nodes and hub

twisted pair

hub

56

29

Ethernet technology 100BaseT

Problem must keep minimal packet size when bandwidth

increases

With fixed cable length and propagation speed must

increase minimal size proportionally to bandwidth

increase

Eg 100Mbs 1500m of cable prop remains 6μs minimal

size becomes 1200 bits

Solutions

Cable length limited to 100m

Prevent collisions by ldquoEthernet Switchesrdquo (later)

Max distance from node to Hub is 100 meters

57

58

Gbit Ethernet

use standard Ethernet frame format

allows for point-to-point links and shared broadcast channels

in shared mode CSMACD is used short distances between

nodes to be efficiency

uses hubs called here ldquoBuffered Distributorsrdquo

Full-Duplex at 1 Gbps for point-to-point links

10 Gbpsec now

30

Hubs

QWhy not just one big LAN

Limited amount of supportable traffic on single LAN

all stations must share bandwidth

limited length 8023 (Ethernet) specifies maximum

cable length

large ldquocollision domainrdquo (can collide with many

stations)

limited number of stations 8025 (token ring) have

token passing delays at each station

59

Lecture 360

Hubs (Multiport repeaters Bus in a box)

Physical Layer devices essentially repeaters operating at bit

levels repeat received bits on one interface to all other

interfaces

Can‟t interconnect 10BaseT amp 100BaseT (because

segments don‟t share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design)

with backbone hub at its top

31

61

Hubs (Multiport repeaters Bus in a box)

Each connected LAN referred to as LAN segment

Hubs do not isolate collision domains node may collide with any

node residing at any segment in LAN

Extends max distance between nodes but all the segments become

one large collision domain

Hub Advantages

simple inexpensive device

Multi-tier provides graceful degradation portions of the LAN

continue to operate if one hub malfunctions

extends maximum distance between node pairs (100m per Hub)

62

Bridges

Link Layer devices operate on Ethernet frames examining

frame header and selectively forwarding frame based on its

destination

Bridge isolates collision domains since it buffers frames

When frame is to be forwarded on segment bridge uses

CSMACD to access segment and transmit

Store and forward element So different types of Ethernet

types can be connected

Transparent no need for any change to hosts LAN adapters

Forwarding is selective do not always flood All connected

segments can work independently in parallel

32

63

Bridge Filtering

bridges learn which hosts can be reached through which

interfaces maintain filtering tables

when frame received bridge ldquolearnsrdquo location of sender

incoming LAN segment

records sender location in filtering table

filtering table entry

(Node LAN Address Bridge Interface Time Stamp)

stale entries in Filtering Table dropped (TTL can be 60 minutes)

64

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_port

if (out_port not valid) no entry found for destination

then flood forward on all but the interface on which the frame arrived

if (in_port = out_port) destination is on LAN on which frame was received

then drop the frame

Otherwise (out_port is valid) entry found for destination then forward the frame on interface indicated

33

65

Bridge Learning example

Suppose C sends frame to D and D replies back with frame

to C

C sends frame bridge has no info about D so floods to both LANs bridge notes that C is on port 1

frame ignored on upper LAN

frame received by D

66

Bridge Learning example

D generates reply to C sends

bridge sees frame from D

bridge notes that D is on interface 2

bridge knows C on interface 1 so selectivelyforwards frame out via interface 1

C 1

34

67

What will happen with loops

Incorrect learning

A

B

1 1

22

A 1 A 122

68

What will happen with loops

Frame looping

A

C

1 1

22

C C

35

69

What will happen with loops

Frame looping

A

B

1 1

22

B2 B1

70

Introducing Spanning Tree

Allow a path between every LAN without causing loops

(loop-free environment)

Bridges communicate with special configuration

messages (BPDUs)

Standardized by IEEE 8021D

Note redundant paths are good active redundant paths are bad (they cause

loops)

36

How to Construct a Spanning Tree

Bridges run a distributed spanning tree

Algorithm

Select what ports (and bridges) should actively forward

frames

Finding the root flooding

Building a tree Bellman-Ford Algorithm

Can combine efficiently

Standardized in IEEE 8021 specification

71

72

Spanning Tree Requirements

Each bridge is assigned a unique identifier

A broadcast address for bridges on a LAN

A unique port identifier for all ports on all bridges

MAC address

Bridge id + port number

37

73

Spanning Tree Concepts

Root Bridge The bridge with the lowest bridge ID value is elected the

root bridge

One root bridge chosen among all bridges

Every other bridge calculates a path to the root bridge

74

Spanning Tree Concepts

Path Cost A cost associated with each port on each bridge

default is 1

The cost associated with transmission onto the LAN

connected to the port

Can be manually or automatically assigned

Can be used to alter the path to the root bridge

38

75

Spanning Tree Concepts

Root Port The port on each bridge that is on the path towards the

root bridge

The root port is part of the lowest cost path towards

the root bridge

If port costs are equal on a bridge the port with the

lowest ID becomes root port

76

Spanning Tree Concepts

Root Path Cost The minimum cost path to the root bridge

The cost starts at the root bridge

Each bridge computes root path cost independently

based on their view of the network

39

77

Spanning Tree Concepts Designated

Bridge Only one bridge on a LAN at one time is chosen the

designated bridge

This bridge provides the minimum cost path to the root

bridge for the LAN

Only the designated bridge passes frames towards the

root bridge

78

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Protocol operation1 Picks a root2 For each LAN

picks a designated bridgethat is closest to the root

3 All bridges on a LANsend packets towards the root via the designatedbridge

B8

40

79

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

80

Spanning Tree Algorithm

An Overview 1 Determine the root bridge among all bridges

2 Each bridge determines its root port

The port in the direction of the root bridge

3 Determine the designated bridge on each LAN

The bridge which accepts frames to forward towards the root bridge

The frames are sent on the root port of the designated bridge

41

81

Spanning Tree Algorithm

Selecting Root Bridge Initially each bridge considers itself to be the root bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

Best one wins

(lowest root IDcostpriority)

82

Spanning Tree Algorithm

Selecting Root Ports Each bridge selects one of its ports which has the

minimal cost to the root bridge

In case of a tie the lowest uplink (transmitter) bridge ID is

used

In case of another tie the lowest port ID is used

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 23: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

23

LAN Addresses and ARP

Each adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN(wired orwireless)

45

LAN Address (more)

MAC address allocation administered by IEEE

manufacturer buys portion of MAC address space (to assure

uniqueness)

Analogy

(a) MAC address like Social Security Number

(b) IP address like postal address

MAC flat address portability

can move LAN card from one LAN to another

IP hierarchical address NOT portable

depends on IP subnet to which node is attached

46

24

ARP Address Resolution Protocol

Each IP node (Host Router)

on LAN has ARP table

ARP Table IPMAC address

mappings for some LAN

nodes

lt IP address MAC address TTLgt

TTL (Time To Live) time after

which address mapping will be

forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

237196723

237196778

237196714

237196788

47

ARP protocol Same LAN (network)

A wants to send datagram to B

and B‟s MAC address not in A‟s

ARP table

A broadcasts ARP query packet

containing Bs IP address

Dest MAC address = FF-FF-

FF-FF-FF-FF

all machines on LAN receive

ARP query

B receives ARP packet replies to

A with its (Bs) MAC address

frame sent to A‟s MAC address

(unicast)

A caches (saves) IP-to-MAC

address pair in its ARP table until

information becomes old (times

out)

soft state information that

times out (goes away) unless

refreshed

ARP is ldquoplug-and-playrdquo

nodes create their ARP tables

without intervention from net

administrator

48

25

Routing to another LANwalkthrough send datagram from A to B via R

assume A know‟s B IP address

Two ARP tables in router R one for each IP network (LAN)

In routing table at source Host find router 111111111110

In ARP table at source find MAC address E6-E9-00-17-BB-4B etc

A

RB

49

Ossi Mokryn - Data link layer

A creates datagram with source A destination B

A uses ARP to get R‟s MAC address for 111111111110

A creates link-layer frame with Rs MAC address as dest frame

contains A-to-B IP datagram

A‟s adapter sends frame

R‟s adapter receives frame

R removes IP datagram from Ethernet frame sees its destined to B

R uses ARP to get B‟s MAC address

R creates frame containing A-to-B IP datagram sends to B

A

RB

50

26

Ethernet

ldquodominantrdquo wired LAN technology developed at the 70s

cheap $20 for 100Mbs

first widely used LAN technology

Simple cheap

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

51

Ethernet topology Through the Years

Classic Ethernet Now star topology prevails

Connection choices hub or switch (more later)

Fast Ethernet 100 Mbs

Gigabit Ethernet 1Gbps

52

hub orswitch

bull Shared Bus with CSMACDbull Bus maximal length 500 mbullTransmission rate 10Mbs

Through the years the only common is The Frame

27

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network

layer protocol packet) in Ethernet frame

Preamble

7 bytes with pattern 10101010 followed by one byte with

pattern 10101011

used to synchronize receiver sender clock rates what is

the length in clock ticks of one bit

53

Type length length or type of frame

Ethernet Frame Structure (more)

Ossi Mokryn - Data link layer

Addresses 6 bytes

if adapter receives frame with matching destination address or with

broadcast address (eg ARP packet) it passes data in frame to net-layer

protocol

otherwise adapter discards frame

MAC addresses also called Physical addresses

Type indicates the higher layer protocol (mostly IP but others

may be supported such as Novell IPX and AppleTalk)

CRC checked at receiver if error is detected the frame is

simply dropped Before CRC there is a padding field for the

CRC to pad to 64 bytes

54

28

55

Ethernet Technology 10Base2

10 10Mbps 2 under 200 meters max cable length

thin coaxial cable in a bus topology

repeaters used to connect up to multiple segments

repeater repeats bits it hears on one interface to its other

interfaces physical layer device only

Ethernet technology 100BaseT

10100 Mbps rate latter called ldquofast ethernetrdquo

T stands for Twisted Pair

Nodes connect to a hub ldquostar topologyrdquo 100 m max

distance between nodes and hub

twisted pair

hub

56

29

Ethernet technology 100BaseT

Problem must keep minimal packet size when bandwidth

increases

With fixed cable length and propagation speed must

increase minimal size proportionally to bandwidth

increase

Eg 100Mbs 1500m of cable prop remains 6μs minimal

size becomes 1200 bits

Solutions

Cable length limited to 100m

Prevent collisions by ldquoEthernet Switchesrdquo (later)

Max distance from node to Hub is 100 meters

57

58

Gbit Ethernet

use standard Ethernet frame format

allows for point-to-point links and shared broadcast channels

in shared mode CSMACD is used short distances between

nodes to be efficiency

uses hubs called here ldquoBuffered Distributorsrdquo

Full-Duplex at 1 Gbps for point-to-point links

10 Gbpsec now

30

Hubs

QWhy not just one big LAN

Limited amount of supportable traffic on single LAN

all stations must share bandwidth

limited length 8023 (Ethernet) specifies maximum

cable length

large ldquocollision domainrdquo (can collide with many

stations)

limited number of stations 8025 (token ring) have

token passing delays at each station

59

Lecture 360

Hubs (Multiport repeaters Bus in a box)

Physical Layer devices essentially repeaters operating at bit

levels repeat received bits on one interface to all other

interfaces

Can‟t interconnect 10BaseT amp 100BaseT (because

segments don‟t share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design)

with backbone hub at its top

31

61

Hubs (Multiport repeaters Bus in a box)

Each connected LAN referred to as LAN segment

Hubs do not isolate collision domains node may collide with any

node residing at any segment in LAN

Extends max distance between nodes but all the segments become

one large collision domain

Hub Advantages

simple inexpensive device

Multi-tier provides graceful degradation portions of the LAN

continue to operate if one hub malfunctions

extends maximum distance between node pairs (100m per Hub)

62

Bridges

Link Layer devices operate on Ethernet frames examining

frame header and selectively forwarding frame based on its

destination

Bridge isolates collision domains since it buffers frames

When frame is to be forwarded on segment bridge uses

CSMACD to access segment and transmit

Store and forward element So different types of Ethernet

types can be connected

Transparent no need for any change to hosts LAN adapters

Forwarding is selective do not always flood All connected

segments can work independently in parallel

32

63

Bridge Filtering

bridges learn which hosts can be reached through which

interfaces maintain filtering tables

when frame received bridge ldquolearnsrdquo location of sender

incoming LAN segment

records sender location in filtering table

filtering table entry

(Node LAN Address Bridge Interface Time Stamp)

stale entries in Filtering Table dropped (TTL can be 60 minutes)

64

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_port

if (out_port not valid) no entry found for destination

then flood forward on all but the interface on which the frame arrived

if (in_port = out_port) destination is on LAN on which frame was received

then drop the frame

Otherwise (out_port is valid) entry found for destination then forward the frame on interface indicated

33

65

Bridge Learning example

Suppose C sends frame to D and D replies back with frame

to C

C sends frame bridge has no info about D so floods to both LANs bridge notes that C is on port 1

frame ignored on upper LAN

frame received by D

66

Bridge Learning example

D generates reply to C sends

bridge sees frame from D

bridge notes that D is on interface 2

bridge knows C on interface 1 so selectivelyforwards frame out via interface 1

C 1

34

67

What will happen with loops

Incorrect learning

A

B

1 1

22

A 1 A 122

68

What will happen with loops

Frame looping

A

C

1 1

22

C C

35

69

What will happen with loops

Frame looping

A

B

1 1

22

B2 B1

70

Introducing Spanning Tree

Allow a path between every LAN without causing loops

(loop-free environment)

Bridges communicate with special configuration

messages (BPDUs)

Standardized by IEEE 8021D

Note redundant paths are good active redundant paths are bad (they cause

loops)

36

How to Construct a Spanning Tree

Bridges run a distributed spanning tree

Algorithm

Select what ports (and bridges) should actively forward

frames

Finding the root flooding

Building a tree Bellman-Ford Algorithm

Can combine efficiently

Standardized in IEEE 8021 specification

71

72

Spanning Tree Requirements

Each bridge is assigned a unique identifier

A broadcast address for bridges on a LAN

A unique port identifier for all ports on all bridges

MAC address

Bridge id + port number

37

73

Spanning Tree Concepts

Root Bridge The bridge with the lowest bridge ID value is elected the

root bridge

One root bridge chosen among all bridges

Every other bridge calculates a path to the root bridge

74

Spanning Tree Concepts

Path Cost A cost associated with each port on each bridge

default is 1

The cost associated with transmission onto the LAN

connected to the port

Can be manually or automatically assigned

Can be used to alter the path to the root bridge

38

75

Spanning Tree Concepts

Root Port The port on each bridge that is on the path towards the

root bridge

The root port is part of the lowest cost path towards

the root bridge

If port costs are equal on a bridge the port with the

lowest ID becomes root port

76

Spanning Tree Concepts

Root Path Cost The minimum cost path to the root bridge

The cost starts at the root bridge

Each bridge computes root path cost independently

based on their view of the network

39

77

Spanning Tree Concepts Designated

Bridge Only one bridge on a LAN at one time is chosen the

designated bridge

This bridge provides the minimum cost path to the root

bridge for the LAN

Only the designated bridge passes frames towards the

root bridge

78

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Protocol operation1 Picks a root2 For each LAN

picks a designated bridgethat is closest to the root

3 All bridges on a LANsend packets towards the root via the designatedbridge

B8

40

79

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

80

Spanning Tree Algorithm

An Overview 1 Determine the root bridge among all bridges

2 Each bridge determines its root port

The port in the direction of the root bridge

3 Determine the designated bridge on each LAN

The bridge which accepts frames to forward towards the root bridge

The frames are sent on the root port of the designated bridge

41

81

Spanning Tree Algorithm

Selecting Root Bridge Initially each bridge considers itself to be the root bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

Best one wins

(lowest root IDcostpriority)

82

Spanning Tree Algorithm

Selecting Root Ports Each bridge selects one of its ports which has the

minimal cost to the root bridge

In case of a tie the lowest uplink (transmitter) bridge ID is

used

In case of another tie the lowest port ID is used

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 24: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

24

ARP Address Resolution Protocol

Each IP node (Host Router)

on LAN has ARP table

ARP Table IPMAC address

mappings for some LAN

nodes

lt IP address MAC address TTLgt

TTL (Time To Live) time after

which address mapping will be

forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

237196723

237196778

237196714

237196788

47

ARP protocol Same LAN (network)

A wants to send datagram to B

and B‟s MAC address not in A‟s

ARP table

A broadcasts ARP query packet

containing Bs IP address

Dest MAC address = FF-FF-

FF-FF-FF-FF

all machines on LAN receive

ARP query

B receives ARP packet replies to

A with its (Bs) MAC address

frame sent to A‟s MAC address

(unicast)

A caches (saves) IP-to-MAC

address pair in its ARP table until

information becomes old (times

out)

soft state information that

times out (goes away) unless

refreshed

ARP is ldquoplug-and-playrdquo

nodes create their ARP tables

without intervention from net

administrator

48

25

Routing to another LANwalkthrough send datagram from A to B via R

assume A know‟s B IP address

Two ARP tables in router R one for each IP network (LAN)

In routing table at source Host find router 111111111110

In ARP table at source find MAC address E6-E9-00-17-BB-4B etc

A

RB

49

Ossi Mokryn - Data link layer

A creates datagram with source A destination B

A uses ARP to get R‟s MAC address for 111111111110

A creates link-layer frame with Rs MAC address as dest frame

contains A-to-B IP datagram

A‟s adapter sends frame

R‟s adapter receives frame

R removes IP datagram from Ethernet frame sees its destined to B

R uses ARP to get B‟s MAC address

R creates frame containing A-to-B IP datagram sends to B

A

RB

50

26

Ethernet

ldquodominantrdquo wired LAN technology developed at the 70s

cheap $20 for 100Mbs

first widely used LAN technology

Simple cheap

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

51

Ethernet topology Through the Years

Classic Ethernet Now star topology prevails

Connection choices hub or switch (more later)

Fast Ethernet 100 Mbs

Gigabit Ethernet 1Gbps

52

hub orswitch

bull Shared Bus with CSMACDbull Bus maximal length 500 mbullTransmission rate 10Mbs

Through the years the only common is The Frame

27

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network

layer protocol packet) in Ethernet frame

Preamble

7 bytes with pattern 10101010 followed by one byte with

pattern 10101011

used to synchronize receiver sender clock rates what is

the length in clock ticks of one bit

53

Type length length or type of frame

Ethernet Frame Structure (more)

Ossi Mokryn - Data link layer

Addresses 6 bytes

if adapter receives frame with matching destination address or with

broadcast address (eg ARP packet) it passes data in frame to net-layer

protocol

otherwise adapter discards frame

MAC addresses also called Physical addresses

Type indicates the higher layer protocol (mostly IP but others

may be supported such as Novell IPX and AppleTalk)

CRC checked at receiver if error is detected the frame is

simply dropped Before CRC there is a padding field for the

CRC to pad to 64 bytes

54

28

55

Ethernet Technology 10Base2

10 10Mbps 2 under 200 meters max cable length

thin coaxial cable in a bus topology

repeaters used to connect up to multiple segments

repeater repeats bits it hears on one interface to its other

interfaces physical layer device only

Ethernet technology 100BaseT

10100 Mbps rate latter called ldquofast ethernetrdquo

T stands for Twisted Pair

Nodes connect to a hub ldquostar topologyrdquo 100 m max

distance between nodes and hub

twisted pair

hub

56

29

Ethernet technology 100BaseT

Problem must keep minimal packet size when bandwidth

increases

With fixed cable length and propagation speed must

increase minimal size proportionally to bandwidth

increase

Eg 100Mbs 1500m of cable prop remains 6μs minimal

size becomes 1200 bits

Solutions

Cable length limited to 100m

Prevent collisions by ldquoEthernet Switchesrdquo (later)

Max distance from node to Hub is 100 meters

57

58

Gbit Ethernet

use standard Ethernet frame format

allows for point-to-point links and shared broadcast channels

in shared mode CSMACD is used short distances between

nodes to be efficiency

uses hubs called here ldquoBuffered Distributorsrdquo

Full-Duplex at 1 Gbps for point-to-point links

10 Gbpsec now

30

Hubs

QWhy not just one big LAN

Limited amount of supportable traffic on single LAN

all stations must share bandwidth

limited length 8023 (Ethernet) specifies maximum

cable length

large ldquocollision domainrdquo (can collide with many

stations)

limited number of stations 8025 (token ring) have

token passing delays at each station

59

Lecture 360

Hubs (Multiport repeaters Bus in a box)

Physical Layer devices essentially repeaters operating at bit

levels repeat received bits on one interface to all other

interfaces

Can‟t interconnect 10BaseT amp 100BaseT (because

segments don‟t share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design)

with backbone hub at its top

31

61

Hubs (Multiport repeaters Bus in a box)

Each connected LAN referred to as LAN segment

Hubs do not isolate collision domains node may collide with any

node residing at any segment in LAN

Extends max distance between nodes but all the segments become

one large collision domain

Hub Advantages

simple inexpensive device

Multi-tier provides graceful degradation portions of the LAN

continue to operate if one hub malfunctions

extends maximum distance between node pairs (100m per Hub)

62

Bridges

Link Layer devices operate on Ethernet frames examining

frame header and selectively forwarding frame based on its

destination

Bridge isolates collision domains since it buffers frames

When frame is to be forwarded on segment bridge uses

CSMACD to access segment and transmit

Store and forward element So different types of Ethernet

types can be connected

Transparent no need for any change to hosts LAN adapters

Forwarding is selective do not always flood All connected

segments can work independently in parallel

32

63

Bridge Filtering

bridges learn which hosts can be reached through which

interfaces maintain filtering tables

when frame received bridge ldquolearnsrdquo location of sender

incoming LAN segment

records sender location in filtering table

filtering table entry

(Node LAN Address Bridge Interface Time Stamp)

stale entries in Filtering Table dropped (TTL can be 60 minutes)

64

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_port

if (out_port not valid) no entry found for destination

then flood forward on all but the interface on which the frame arrived

if (in_port = out_port) destination is on LAN on which frame was received

then drop the frame

Otherwise (out_port is valid) entry found for destination then forward the frame on interface indicated

33

65

Bridge Learning example

Suppose C sends frame to D and D replies back with frame

to C

C sends frame bridge has no info about D so floods to both LANs bridge notes that C is on port 1

frame ignored on upper LAN

frame received by D

66

Bridge Learning example

D generates reply to C sends

bridge sees frame from D

bridge notes that D is on interface 2

bridge knows C on interface 1 so selectivelyforwards frame out via interface 1

C 1

34

67

What will happen with loops

Incorrect learning

A

B

1 1

22

A 1 A 122

68

What will happen with loops

Frame looping

A

C

1 1

22

C C

35

69

What will happen with loops

Frame looping

A

B

1 1

22

B2 B1

70

Introducing Spanning Tree

Allow a path between every LAN without causing loops

(loop-free environment)

Bridges communicate with special configuration

messages (BPDUs)

Standardized by IEEE 8021D

Note redundant paths are good active redundant paths are bad (they cause

loops)

36

How to Construct a Spanning Tree

Bridges run a distributed spanning tree

Algorithm

Select what ports (and bridges) should actively forward

frames

Finding the root flooding

Building a tree Bellman-Ford Algorithm

Can combine efficiently

Standardized in IEEE 8021 specification

71

72

Spanning Tree Requirements

Each bridge is assigned a unique identifier

A broadcast address for bridges on a LAN

A unique port identifier for all ports on all bridges

MAC address

Bridge id + port number

37

73

Spanning Tree Concepts

Root Bridge The bridge with the lowest bridge ID value is elected the

root bridge

One root bridge chosen among all bridges

Every other bridge calculates a path to the root bridge

74

Spanning Tree Concepts

Path Cost A cost associated with each port on each bridge

default is 1

The cost associated with transmission onto the LAN

connected to the port

Can be manually or automatically assigned

Can be used to alter the path to the root bridge

38

75

Spanning Tree Concepts

Root Port The port on each bridge that is on the path towards the

root bridge

The root port is part of the lowest cost path towards

the root bridge

If port costs are equal on a bridge the port with the

lowest ID becomes root port

76

Spanning Tree Concepts

Root Path Cost The minimum cost path to the root bridge

The cost starts at the root bridge

Each bridge computes root path cost independently

based on their view of the network

39

77

Spanning Tree Concepts Designated

Bridge Only one bridge on a LAN at one time is chosen the

designated bridge

This bridge provides the minimum cost path to the root

bridge for the LAN

Only the designated bridge passes frames towards the

root bridge

78

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Protocol operation1 Picks a root2 For each LAN

picks a designated bridgethat is closest to the root

3 All bridges on a LANsend packets towards the root via the designatedbridge

B8

40

79

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

80

Spanning Tree Algorithm

An Overview 1 Determine the root bridge among all bridges

2 Each bridge determines its root port

The port in the direction of the root bridge

3 Determine the designated bridge on each LAN

The bridge which accepts frames to forward towards the root bridge

The frames are sent on the root port of the designated bridge

41

81

Spanning Tree Algorithm

Selecting Root Bridge Initially each bridge considers itself to be the root bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

Best one wins

(lowest root IDcostpriority)

82

Spanning Tree Algorithm

Selecting Root Ports Each bridge selects one of its ports which has the

minimal cost to the root bridge

In case of a tie the lowest uplink (transmitter) bridge ID is

used

In case of another tie the lowest port ID is used

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 25: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

25

Routing to another LANwalkthrough send datagram from A to B via R

assume A know‟s B IP address

Two ARP tables in router R one for each IP network (LAN)

In routing table at source Host find router 111111111110

In ARP table at source find MAC address E6-E9-00-17-BB-4B etc

A

RB

49

Ossi Mokryn - Data link layer

A creates datagram with source A destination B

A uses ARP to get R‟s MAC address for 111111111110

A creates link-layer frame with Rs MAC address as dest frame

contains A-to-B IP datagram

A‟s adapter sends frame

R‟s adapter receives frame

R removes IP datagram from Ethernet frame sees its destined to B

R uses ARP to get B‟s MAC address

R creates frame containing A-to-B IP datagram sends to B

A

RB

50

26

Ethernet

ldquodominantrdquo wired LAN technology developed at the 70s

cheap $20 for 100Mbs

first widely used LAN technology

Simple cheap

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

51

Ethernet topology Through the Years

Classic Ethernet Now star topology prevails

Connection choices hub or switch (more later)

Fast Ethernet 100 Mbs

Gigabit Ethernet 1Gbps

52

hub orswitch

bull Shared Bus with CSMACDbull Bus maximal length 500 mbullTransmission rate 10Mbs

Through the years the only common is The Frame

27

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network

layer protocol packet) in Ethernet frame

Preamble

7 bytes with pattern 10101010 followed by one byte with

pattern 10101011

used to synchronize receiver sender clock rates what is

the length in clock ticks of one bit

53

Type length length or type of frame

Ethernet Frame Structure (more)

Ossi Mokryn - Data link layer

Addresses 6 bytes

if adapter receives frame with matching destination address or with

broadcast address (eg ARP packet) it passes data in frame to net-layer

protocol

otherwise adapter discards frame

MAC addresses also called Physical addresses

Type indicates the higher layer protocol (mostly IP but others

may be supported such as Novell IPX and AppleTalk)

CRC checked at receiver if error is detected the frame is

simply dropped Before CRC there is a padding field for the

CRC to pad to 64 bytes

54

28

55

Ethernet Technology 10Base2

10 10Mbps 2 under 200 meters max cable length

thin coaxial cable in a bus topology

repeaters used to connect up to multiple segments

repeater repeats bits it hears on one interface to its other

interfaces physical layer device only

Ethernet technology 100BaseT

10100 Mbps rate latter called ldquofast ethernetrdquo

T stands for Twisted Pair

Nodes connect to a hub ldquostar topologyrdquo 100 m max

distance between nodes and hub

twisted pair

hub

56

29

Ethernet technology 100BaseT

Problem must keep minimal packet size when bandwidth

increases

With fixed cable length and propagation speed must

increase minimal size proportionally to bandwidth

increase

Eg 100Mbs 1500m of cable prop remains 6μs minimal

size becomes 1200 bits

Solutions

Cable length limited to 100m

Prevent collisions by ldquoEthernet Switchesrdquo (later)

Max distance from node to Hub is 100 meters

57

58

Gbit Ethernet

use standard Ethernet frame format

allows for point-to-point links and shared broadcast channels

in shared mode CSMACD is used short distances between

nodes to be efficiency

uses hubs called here ldquoBuffered Distributorsrdquo

Full-Duplex at 1 Gbps for point-to-point links

10 Gbpsec now

30

Hubs

QWhy not just one big LAN

Limited amount of supportable traffic on single LAN

all stations must share bandwidth

limited length 8023 (Ethernet) specifies maximum

cable length

large ldquocollision domainrdquo (can collide with many

stations)

limited number of stations 8025 (token ring) have

token passing delays at each station

59

Lecture 360

Hubs (Multiport repeaters Bus in a box)

Physical Layer devices essentially repeaters operating at bit

levels repeat received bits on one interface to all other

interfaces

Can‟t interconnect 10BaseT amp 100BaseT (because

segments don‟t share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design)

with backbone hub at its top

31

61

Hubs (Multiport repeaters Bus in a box)

Each connected LAN referred to as LAN segment

Hubs do not isolate collision domains node may collide with any

node residing at any segment in LAN

Extends max distance between nodes but all the segments become

one large collision domain

Hub Advantages

simple inexpensive device

Multi-tier provides graceful degradation portions of the LAN

continue to operate if one hub malfunctions

extends maximum distance between node pairs (100m per Hub)

62

Bridges

Link Layer devices operate on Ethernet frames examining

frame header and selectively forwarding frame based on its

destination

Bridge isolates collision domains since it buffers frames

When frame is to be forwarded on segment bridge uses

CSMACD to access segment and transmit

Store and forward element So different types of Ethernet

types can be connected

Transparent no need for any change to hosts LAN adapters

Forwarding is selective do not always flood All connected

segments can work independently in parallel

32

63

Bridge Filtering

bridges learn which hosts can be reached through which

interfaces maintain filtering tables

when frame received bridge ldquolearnsrdquo location of sender

incoming LAN segment

records sender location in filtering table

filtering table entry

(Node LAN Address Bridge Interface Time Stamp)

stale entries in Filtering Table dropped (TTL can be 60 minutes)

64

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_port

if (out_port not valid) no entry found for destination

then flood forward on all but the interface on which the frame arrived

if (in_port = out_port) destination is on LAN on which frame was received

then drop the frame

Otherwise (out_port is valid) entry found for destination then forward the frame on interface indicated

33

65

Bridge Learning example

Suppose C sends frame to D and D replies back with frame

to C

C sends frame bridge has no info about D so floods to both LANs bridge notes that C is on port 1

frame ignored on upper LAN

frame received by D

66

Bridge Learning example

D generates reply to C sends

bridge sees frame from D

bridge notes that D is on interface 2

bridge knows C on interface 1 so selectivelyforwards frame out via interface 1

C 1

34

67

What will happen with loops

Incorrect learning

A

B

1 1

22

A 1 A 122

68

What will happen with loops

Frame looping

A

C

1 1

22

C C

35

69

What will happen with loops

Frame looping

A

B

1 1

22

B2 B1

70

Introducing Spanning Tree

Allow a path between every LAN without causing loops

(loop-free environment)

Bridges communicate with special configuration

messages (BPDUs)

Standardized by IEEE 8021D

Note redundant paths are good active redundant paths are bad (they cause

loops)

36

How to Construct a Spanning Tree

Bridges run a distributed spanning tree

Algorithm

Select what ports (and bridges) should actively forward

frames

Finding the root flooding

Building a tree Bellman-Ford Algorithm

Can combine efficiently

Standardized in IEEE 8021 specification

71

72

Spanning Tree Requirements

Each bridge is assigned a unique identifier

A broadcast address for bridges on a LAN

A unique port identifier for all ports on all bridges

MAC address

Bridge id + port number

37

73

Spanning Tree Concepts

Root Bridge The bridge with the lowest bridge ID value is elected the

root bridge

One root bridge chosen among all bridges

Every other bridge calculates a path to the root bridge

74

Spanning Tree Concepts

Path Cost A cost associated with each port on each bridge

default is 1

The cost associated with transmission onto the LAN

connected to the port

Can be manually or automatically assigned

Can be used to alter the path to the root bridge

38

75

Spanning Tree Concepts

Root Port The port on each bridge that is on the path towards the

root bridge

The root port is part of the lowest cost path towards

the root bridge

If port costs are equal on a bridge the port with the

lowest ID becomes root port

76

Spanning Tree Concepts

Root Path Cost The minimum cost path to the root bridge

The cost starts at the root bridge

Each bridge computes root path cost independently

based on their view of the network

39

77

Spanning Tree Concepts Designated

Bridge Only one bridge on a LAN at one time is chosen the

designated bridge

This bridge provides the minimum cost path to the root

bridge for the LAN

Only the designated bridge passes frames towards the

root bridge

78

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Protocol operation1 Picks a root2 For each LAN

picks a designated bridgethat is closest to the root

3 All bridges on a LANsend packets towards the root via the designatedbridge

B8

40

79

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

80

Spanning Tree Algorithm

An Overview 1 Determine the root bridge among all bridges

2 Each bridge determines its root port

The port in the direction of the root bridge

3 Determine the designated bridge on each LAN

The bridge which accepts frames to forward towards the root bridge

The frames are sent on the root port of the designated bridge

41

81

Spanning Tree Algorithm

Selecting Root Bridge Initially each bridge considers itself to be the root bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

Best one wins

(lowest root IDcostpriority)

82

Spanning Tree Algorithm

Selecting Root Ports Each bridge selects one of its ports which has the

minimal cost to the root bridge

In case of a tie the lowest uplink (transmitter) bridge ID is

used

In case of another tie the lowest port ID is used

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 26: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

26

Ethernet

ldquodominantrdquo wired LAN technology developed at the 70s

cheap $20 for 100Mbs

first widely used LAN technology

Simple cheap

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

51

Ethernet topology Through the Years

Classic Ethernet Now star topology prevails

Connection choices hub or switch (more later)

Fast Ethernet 100 Mbs

Gigabit Ethernet 1Gbps

52

hub orswitch

bull Shared Bus with CSMACDbull Bus maximal length 500 mbullTransmission rate 10Mbs

Through the years the only common is The Frame

27

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network

layer protocol packet) in Ethernet frame

Preamble

7 bytes with pattern 10101010 followed by one byte with

pattern 10101011

used to synchronize receiver sender clock rates what is

the length in clock ticks of one bit

53

Type length length or type of frame

Ethernet Frame Structure (more)

Ossi Mokryn - Data link layer

Addresses 6 bytes

if adapter receives frame with matching destination address or with

broadcast address (eg ARP packet) it passes data in frame to net-layer

protocol

otherwise adapter discards frame

MAC addresses also called Physical addresses

Type indicates the higher layer protocol (mostly IP but others

may be supported such as Novell IPX and AppleTalk)

CRC checked at receiver if error is detected the frame is

simply dropped Before CRC there is a padding field for the

CRC to pad to 64 bytes

54

28

55

Ethernet Technology 10Base2

10 10Mbps 2 under 200 meters max cable length

thin coaxial cable in a bus topology

repeaters used to connect up to multiple segments

repeater repeats bits it hears on one interface to its other

interfaces physical layer device only

Ethernet technology 100BaseT

10100 Mbps rate latter called ldquofast ethernetrdquo

T stands for Twisted Pair

Nodes connect to a hub ldquostar topologyrdquo 100 m max

distance between nodes and hub

twisted pair

hub

56

29

Ethernet technology 100BaseT

Problem must keep minimal packet size when bandwidth

increases

With fixed cable length and propagation speed must

increase minimal size proportionally to bandwidth

increase

Eg 100Mbs 1500m of cable prop remains 6μs minimal

size becomes 1200 bits

Solutions

Cable length limited to 100m

Prevent collisions by ldquoEthernet Switchesrdquo (later)

Max distance from node to Hub is 100 meters

57

58

Gbit Ethernet

use standard Ethernet frame format

allows for point-to-point links and shared broadcast channels

in shared mode CSMACD is used short distances between

nodes to be efficiency

uses hubs called here ldquoBuffered Distributorsrdquo

Full-Duplex at 1 Gbps for point-to-point links

10 Gbpsec now

30

Hubs

QWhy not just one big LAN

Limited amount of supportable traffic on single LAN

all stations must share bandwidth

limited length 8023 (Ethernet) specifies maximum

cable length

large ldquocollision domainrdquo (can collide with many

stations)

limited number of stations 8025 (token ring) have

token passing delays at each station

59

Lecture 360

Hubs (Multiport repeaters Bus in a box)

Physical Layer devices essentially repeaters operating at bit

levels repeat received bits on one interface to all other

interfaces

Can‟t interconnect 10BaseT amp 100BaseT (because

segments don‟t share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design)

with backbone hub at its top

31

61

Hubs (Multiport repeaters Bus in a box)

Each connected LAN referred to as LAN segment

Hubs do not isolate collision domains node may collide with any

node residing at any segment in LAN

Extends max distance between nodes but all the segments become

one large collision domain

Hub Advantages

simple inexpensive device

Multi-tier provides graceful degradation portions of the LAN

continue to operate if one hub malfunctions

extends maximum distance between node pairs (100m per Hub)

62

Bridges

Link Layer devices operate on Ethernet frames examining

frame header and selectively forwarding frame based on its

destination

Bridge isolates collision domains since it buffers frames

When frame is to be forwarded on segment bridge uses

CSMACD to access segment and transmit

Store and forward element So different types of Ethernet

types can be connected

Transparent no need for any change to hosts LAN adapters

Forwarding is selective do not always flood All connected

segments can work independently in parallel

32

63

Bridge Filtering

bridges learn which hosts can be reached through which

interfaces maintain filtering tables

when frame received bridge ldquolearnsrdquo location of sender

incoming LAN segment

records sender location in filtering table

filtering table entry

(Node LAN Address Bridge Interface Time Stamp)

stale entries in Filtering Table dropped (TTL can be 60 minutes)

64

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_port

if (out_port not valid) no entry found for destination

then flood forward on all but the interface on which the frame arrived

if (in_port = out_port) destination is on LAN on which frame was received

then drop the frame

Otherwise (out_port is valid) entry found for destination then forward the frame on interface indicated

33

65

Bridge Learning example

Suppose C sends frame to D and D replies back with frame

to C

C sends frame bridge has no info about D so floods to both LANs bridge notes that C is on port 1

frame ignored on upper LAN

frame received by D

66

Bridge Learning example

D generates reply to C sends

bridge sees frame from D

bridge notes that D is on interface 2

bridge knows C on interface 1 so selectivelyforwards frame out via interface 1

C 1

34

67

What will happen with loops

Incorrect learning

A

B

1 1

22

A 1 A 122

68

What will happen with loops

Frame looping

A

C

1 1

22

C C

35

69

What will happen with loops

Frame looping

A

B

1 1

22

B2 B1

70

Introducing Spanning Tree

Allow a path between every LAN without causing loops

(loop-free environment)

Bridges communicate with special configuration

messages (BPDUs)

Standardized by IEEE 8021D

Note redundant paths are good active redundant paths are bad (they cause

loops)

36

How to Construct a Spanning Tree

Bridges run a distributed spanning tree

Algorithm

Select what ports (and bridges) should actively forward

frames

Finding the root flooding

Building a tree Bellman-Ford Algorithm

Can combine efficiently

Standardized in IEEE 8021 specification

71

72

Spanning Tree Requirements

Each bridge is assigned a unique identifier

A broadcast address for bridges on a LAN

A unique port identifier for all ports on all bridges

MAC address

Bridge id + port number

37

73

Spanning Tree Concepts

Root Bridge The bridge with the lowest bridge ID value is elected the

root bridge

One root bridge chosen among all bridges

Every other bridge calculates a path to the root bridge

74

Spanning Tree Concepts

Path Cost A cost associated with each port on each bridge

default is 1

The cost associated with transmission onto the LAN

connected to the port

Can be manually or automatically assigned

Can be used to alter the path to the root bridge

38

75

Spanning Tree Concepts

Root Port The port on each bridge that is on the path towards the

root bridge

The root port is part of the lowest cost path towards

the root bridge

If port costs are equal on a bridge the port with the

lowest ID becomes root port

76

Spanning Tree Concepts

Root Path Cost The minimum cost path to the root bridge

The cost starts at the root bridge

Each bridge computes root path cost independently

based on their view of the network

39

77

Spanning Tree Concepts Designated

Bridge Only one bridge on a LAN at one time is chosen the

designated bridge

This bridge provides the minimum cost path to the root

bridge for the LAN

Only the designated bridge passes frames towards the

root bridge

78

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Protocol operation1 Picks a root2 For each LAN

picks a designated bridgethat is closest to the root

3 All bridges on a LANsend packets towards the root via the designatedbridge

B8

40

79

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

80

Spanning Tree Algorithm

An Overview 1 Determine the root bridge among all bridges

2 Each bridge determines its root port

The port in the direction of the root bridge

3 Determine the designated bridge on each LAN

The bridge which accepts frames to forward towards the root bridge

The frames are sent on the root port of the designated bridge

41

81

Spanning Tree Algorithm

Selecting Root Bridge Initially each bridge considers itself to be the root bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

Best one wins

(lowest root IDcostpriority)

82

Spanning Tree Algorithm

Selecting Root Ports Each bridge selects one of its ports which has the

minimal cost to the root bridge

In case of a tie the lowest uplink (transmitter) bridge ID is

used

In case of another tie the lowest port ID is used

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 27: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

27

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network

layer protocol packet) in Ethernet frame

Preamble

7 bytes with pattern 10101010 followed by one byte with

pattern 10101011

used to synchronize receiver sender clock rates what is

the length in clock ticks of one bit

53

Type length length or type of frame

Ethernet Frame Structure (more)

Ossi Mokryn - Data link layer

Addresses 6 bytes

if adapter receives frame with matching destination address or with

broadcast address (eg ARP packet) it passes data in frame to net-layer

protocol

otherwise adapter discards frame

MAC addresses also called Physical addresses

Type indicates the higher layer protocol (mostly IP but others

may be supported such as Novell IPX and AppleTalk)

CRC checked at receiver if error is detected the frame is

simply dropped Before CRC there is a padding field for the

CRC to pad to 64 bytes

54

28

55

Ethernet Technology 10Base2

10 10Mbps 2 under 200 meters max cable length

thin coaxial cable in a bus topology

repeaters used to connect up to multiple segments

repeater repeats bits it hears on one interface to its other

interfaces physical layer device only

Ethernet technology 100BaseT

10100 Mbps rate latter called ldquofast ethernetrdquo

T stands for Twisted Pair

Nodes connect to a hub ldquostar topologyrdquo 100 m max

distance between nodes and hub

twisted pair

hub

56

29

Ethernet technology 100BaseT

Problem must keep minimal packet size when bandwidth

increases

With fixed cable length and propagation speed must

increase minimal size proportionally to bandwidth

increase

Eg 100Mbs 1500m of cable prop remains 6μs minimal

size becomes 1200 bits

Solutions

Cable length limited to 100m

Prevent collisions by ldquoEthernet Switchesrdquo (later)

Max distance from node to Hub is 100 meters

57

58

Gbit Ethernet

use standard Ethernet frame format

allows for point-to-point links and shared broadcast channels

in shared mode CSMACD is used short distances between

nodes to be efficiency

uses hubs called here ldquoBuffered Distributorsrdquo

Full-Duplex at 1 Gbps for point-to-point links

10 Gbpsec now

30

Hubs

QWhy not just one big LAN

Limited amount of supportable traffic on single LAN

all stations must share bandwidth

limited length 8023 (Ethernet) specifies maximum

cable length

large ldquocollision domainrdquo (can collide with many

stations)

limited number of stations 8025 (token ring) have

token passing delays at each station

59

Lecture 360

Hubs (Multiport repeaters Bus in a box)

Physical Layer devices essentially repeaters operating at bit

levels repeat received bits on one interface to all other

interfaces

Can‟t interconnect 10BaseT amp 100BaseT (because

segments don‟t share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design)

with backbone hub at its top

31

61

Hubs (Multiport repeaters Bus in a box)

Each connected LAN referred to as LAN segment

Hubs do not isolate collision domains node may collide with any

node residing at any segment in LAN

Extends max distance between nodes but all the segments become

one large collision domain

Hub Advantages

simple inexpensive device

Multi-tier provides graceful degradation portions of the LAN

continue to operate if one hub malfunctions

extends maximum distance between node pairs (100m per Hub)

62

Bridges

Link Layer devices operate on Ethernet frames examining

frame header and selectively forwarding frame based on its

destination

Bridge isolates collision domains since it buffers frames

When frame is to be forwarded on segment bridge uses

CSMACD to access segment and transmit

Store and forward element So different types of Ethernet

types can be connected

Transparent no need for any change to hosts LAN adapters

Forwarding is selective do not always flood All connected

segments can work independently in parallel

32

63

Bridge Filtering

bridges learn which hosts can be reached through which

interfaces maintain filtering tables

when frame received bridge ldquolearnsrdquo location of sender

incoming LAN segment

records sender location in filtering table

filtering table entry

(Node LAN Address Bridge Interface Time Stamp)

stale entries in Filtering Table dropped (TTL can be 60 minutes)

64

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_port

if (out_port not valid) no entry found for destination

then flood forward on all but the interface on which the frame arrived

if (in_port = out_port) destination is on LAN on which frame was received

then drop the frame

Otherwise (out_port is valid) entry found for destination then forward the frame on interface indicated

33

65

Bridge Learning example

Suppose C sends frame to D and D replies back with frame

to C

C sends frame bridge has no info about D so floods to both LANs bridge notes that C is on port 1

frame ignored on upper LAN

frame received by D

66

Bridge Learning example

D generates reply to C sends

bridge sees frame from D

bridge notes that D is on interface 2

bridge knows C on interface 1 so selectivelyforwards frame out via interface 1

C 1

34

67

What will happen with loops

Incorrect learning

A

B

1 1

22

A 1 A 122

68

What will happen with loops

Frame looping

A

C

1 1

22

C C

35

69

What will happen with loops

Frame looping

A

B

1 1

22

B2 B1

70

Introducing Spanning Tree

Allow a path between every LAN without causing loops

(loop-free environment)

Bridges communicate with special configuration

messages (BPDUs)

Standardized by IEEE 8021D

Note redundant paths are good active redundant paths are bad (they cause

loops)

36

How to Construct a Spanning Tree

Bridges run a distributed spanning tree

Algorithm

Select what ports (and bridges) should actively forward

frames

Finding the root flooding

Building a tree Bellman-Ford Algorithm

Can combine efficiently

Standardized in IEEE 8021 specification

71

72

Spanning Tree Requirements

Each bridge is assigned a unique identifier

A broadcast address for bridges on a LAN

A unique port identifier for all ports on all bridges

MAC address

Bridge id + port number

37

73

Spanning Tree Concepts

Root Bridge The bridge with the lowest bridge ID value is elected the

root bridge

One root bridge chosen among all bridges

Every other bridge calculates a path to the root bridge

74

Spanning Tree Concepts

Path Cost A cost associated with each port on each bridge

default is 1

The cost associated with transmission onto the LAN

connected to the port

Can be manually or automatically assigned

Can be used to alter the path to the root bridge

38

75

Spanning Tree Concepts

Root Port The port on each bridge that is on the path towards the

root bridge

The root port is part of the lowest cost path towards

the root bridge

If port costs are equal on a bridge the port with the

lowest ID becomes root port

76

Spanning Tree Concepts

Root Path Cost The minimum cost path to the root bridge

The cost starts at the root bridge

Each bridge computes root path cost independently

based on their view of the network

39

77

Spanning Tree Concepts Designated

Bridge Only one bridge on a LAN at one time is chosen the

designated bridge

This bridge provides the minimum cost path to the root

bridge for the LAN

Only the designated bridge passes frames towards the

root bridge

78

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Protocol operation1 Picks a root2 For each LAN

picks a designated bridgethat is closest to the root

3 All bridges on a LANsend packets towards the root via the designatedbridge

B8

40

79

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

80

Spanning Tree Algorithm

An Overview 1 Determine the root bridge among all bridges

2 Each bridge determines its root port

The port in the direction of the root bridge

3 Determine the designated bridge on each LAN

The bridge which accepts frames to forward towards the root bridge

The frames are sent on the root port of the designated bridge

41

81

Spanning Tree Algorithm

Selecting Root Bridge Initially each bridge considers itself to be the root bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

Best one wins

(lowest root IDcostpriority)

82

Spanning Tree Algorithm

Selecting Root Ports Each bridge selects one of its ports which has the

minimal cost to the root bridge

In case of a tie the lowest uplink (transmitter) bridge ID is

used

In case of another tie the lowest port ID is used

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 28: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

28

55

Ethernet Technology 10Base2

10 10Mbps 2 under 200 meters max cable length

thin coaxial cable in a bus topology

repeaters used to connect up to multiple segments

repeater repeats bits it hears on one interface to its other

interfaces physical layer device only

Ethernet technology 100BaseT

10100 Mbps rate latter called ldquofast ethernetrdquo

T stands for Twisted Pair

Nodes connect to a hub ldquostar topologyrdquo 100 m max

distance between nodes and hub

twisted pair

hub

56

29

Ethernet technology 100BaseT

Problem must keep minimal packet size when bandwidth

increases

With fixed cable length and propagation speed must

increase minimal size proportionally to bandwidth

increase

Eg 100Mbs 1500m of cable prop remains 6μs minimal

size becomes 1200 bits

Solutions

Cable length limited to 100m

Prevent collisions by ldquoEthernet Switchesrdquo (later)

Max distance from node to Hub is 100 meters

57

58

Gbit Ethernet

use standard Ethernet frame format

allows for point-to-point links and shared broadcast channels

in shared mode CSMACD is used short distances between

nodes to be efficiency

uses hubs called here ldquoBuffered Distributorsrdquo

Full-Duplex at 1 Gbps for point-to-point links

10 Gbpsec now

30

Hubs

QWhy not just one big LAN

Limited amount of supportable traffic on single LAN

all stations must share bandwidth

limited length 8023 (Ethernet) specifies maximum

cable length

large ldquocollision domainrdquo (can collide with many

stations)

limited number of stations 8025 (token ring) have

token passing delays at each station

59

Lecture 360

Hubs (Multiport repeaters Bus in a box)

Physical Layer devices essentially repeaters operating at bit

levels repeat received bits on one interface to all other

interfaces

Can‟t interconnect 10BaseT amp 100BaseT (because

segments don‟t share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design)

with backbone hub at its top

31

61

Hubs (Multiport repeaters Bus in a box)

Each connected LAN referred to as LAN segment

Hubs do not isolate collision domains node may collide with any

node residing at any segment in LAN

Extends max distance between nodes but all the segments become

one large collision domain

Hub Advantages

simple inexpensive device

Multi-tier provides graceful degradation portions of the LAN

continue to operate if one hub malfunctions

extends maximum distance between node pairs (100m per Hub)

62

Bridges

Link Layer devices operate on Ethernet frames examining

frame header and selectively forwarding frame based on its

destination

Bridge isolates collision domains since it buffers frames

When frame is to be forwarded on segment bridge uses

CSMACD to access segment and transmit

Store and forward element So different types of Ethernet

types can be connected

Transparent no need for any change to hosts LAN adapters

Forwarding is selective do not always flood All connected

segments can work independently in parallel

32

63

Bridge Filtering

bridges learn which hosts can be reached through which

interfaces maintain filtering tables

when frame received bridge ldquolearnsrdquo location of sender

incoming LAN segment

records sender location in filtering table

filtering table entry

(Node LAN Address Bridge Interface Time Stamp)

stale entries in Filtering Table dropped (TTL can be 60 minutes)

64

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_port

if (out_port not valid) no entry found for destination

then flood forward on all but the interface on which the frame arrived

if (in_port = out_port) destination is on LAN on which frame was received

then drop the frame

Otherwise (out_port is valid) entry found for destination then forward the frame on interface indicated

33

65

Bridge Learning example

Suppose C sends frame to D and D replies back with frame

to C

C sends frame bridge has no info about D so floods to both LANs bridge notes that C is on port 1

frame ignored on upper LAN

frame received by D

66

Bridge Learning example

D generates reply to C sends

bridge sees frame from D

bridge notes that D is on interface 2

bridge knows C on interface 1 so selectivelyforwards frame out via interface 1

C 1

34

67

What will happen with loops

Incorrect learning

A

B

1 1

22

A 1 A 122

68

What will happen with loops

Frame looping

A

C

1 1

22

C C

35

69

What will happen with loops

Frame looping

A

B

1 1

22

B2 B1

70

Introducing Spanning Tree

Allow a path between every LAN without causing loops

(loop-free environment)

Bridges communicate with special configuration

messages (BPDUs)

Standardized by IEEE 8021D

Note redundant paths are good active redundant paths are bad (they cause

loops)

36

How to Construct a Spanning Tree

Bridges run a distributed spanning tree

Algorithm

Select what ports (and bridges) should actively forward

frames

Finding the root flooding

Building a tree Bellman-Ford Algorithm

Can combine efficiently

Standardized in IEEE 8021 specification

71

72

Spanning Tree Requirements

Each bridge is assigned a unique identifier

A broadcast address for bridges on a LAN

A unique port identifier for all ports on all bridges

MAC address

Bridge id + port number

37

73

Spanning Tree Concepts

Root Bridge The bridge with the lowest bridge ID value is elected the

root bridge

One root bridge chosen among all bridges

Every other bridge calculates a path to the root bridge

74

Spanning Tree Concepts

Path Cost A cost associated with each port on each bridge

default is 1

The cost associated with transmission onto the LAN

connected to the port

Can be manually or automatically assigned

Can be used to alter the path to the root bridge

38

75

Spanning Tree Concepts

Root Port The port on each bridge that is on the path towards the

root bridge

The root port is part of the lowest cost path towards

the root bridge

If port costs are equal on a bridge the port with the

lowest ID becomes root port

76

Spanning Tree Concepts

Root Path Cost The minimum cost path to the root bridge

The cost starts at the root bridge

Each bridge computes root path cost independently

based on their view of the network

39

77

Spanning Tree Concepts Designated

Bridge Only one bridge on a LAN at one time is chosen the

designated bridge

This bridge provides the minimum cost path to the root

bridge for the LAN

Only the designated bridge passes frames towards the

root bridge

78

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Protocol operation1 Picks a root2 For each LAN

picks a designated bridgethat is closest to the root

3 All bridges on a LANsend packets towards the root via the designatedbridge

B8

40

79

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

80

Spanning Tree Algorithm

An Overview 1 Determine the root bridge among all bridges

2 Each bridge determines its root port

The port in the direction of the root bridge

3 Determine the designated bridge on each LAN

The bridge which accepts frames to forward towards the root bridge

The frames are sent on the root port of the designated bridge

41

81

Spanning Tree Algorithm

Selecting Root Bridge Initially each bridge considers itself to be the root bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

Best one wins

(lowest root IDcostpriority)

82

Spanning Tree Algorithm

Selecting Root Ports Each bridge selects one of its ports which has the

minimal cost to the root bridge

In case of a tie the lowest uplink (transmitter) bridge ID is

used

In case of another tie the lowest port ID is used

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 29: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

29

Ethernet technology 100BaseT

Problem must keep minimal packet size when bandwidth

increases

With fixed cable length and propagation speed must

increase minimal size proportionally to bandwidth

increase

Eg 100Mbs 1500m of cable prop remains 6μs minimal

size becomes 1200 bits

Solutions

Cable length limited to 100m

Prevent collisions by ldquoEthernet Switchesrdquo (later)

Max distance from node to Hub is 100 meters

57

58

Gbit Ethernet

use standard Ethernet frame format

allows for point-to-point links and shared broadcast channels

in shared mode CSMACD is used short distances between

nodes to be efficiency

uses hubs called here ldquoBuffered Distributorsrdquo

Full-Duplex at 1 Gbps for point-to-point links

10 Gbpsec now

30

Hubs

QWhy not just one big LAN

Limited amount of supportable traffic on single LAN

all stations must share bandwidth

limited length 8023 (Ethernet) specifies maximum

cable length

large ldquocollision domainrdquo (can collide with many

stations)

limited number of stations 8025 (token ring) have

token passing delays at each station

59

Lecture 360

Hubs (Multiport repeaters Bus in a box)

Physical Layer devices essentially repeaters operating at bit

levels repeat received bits on one interface to all other

interfaces

Can‟t interconnect 10BaseT amp 100BaseT (because

segments don‟t share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design)

with backbone hub at its top

31

61

Hubs (Multiport repeaters Bus in a box)

Each connected LAN referred to as LAN segment

Hubs do not isolate collision domains node may collide with any

node residing at any segment in LAN

Extends max distance between nodes but all the segments become

one large collision domain

Hub Advantages

simple inexpensive device

Multi-tier provides graceful degradation portions of the LAN

continue to operate if one hub malfunctions

extends maximum distance between node pairs (100m per Hub)

62

Bridges

Link Layer devices operate on Ethernet frames examining

frame header and selectively forwarding frame based on its

destination

Bridge isolates collision domains since it buffers frames

When frame is to be forwarded on segment bridge uses

CSMACD to access segment and transmit

Store and forward element So different types of Ethernet

types can be connected

Transparent no need for any change to hosts LAN adapters

Forwarding is selective do not always flood All connected

segments can work independently in parallel

32

63

Bridge Filtering

bridges learn which hosts can be reached through which

interfaces maintain filtering tables

when frame received bridge ldquolearnsrdquo location of sender

incoming LAN segment

records sender location in filtering table

filtering table entry

(Node LAN Address Bridge Interface Time Stamp)

stale entries in Filtering Table dropped (TTL can be 60 minutes)

64

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_port

if (out_port not valid) no entry found for destination

then flood forward on all but the interface on which the frame arrived

if (in_port = out_port) destination is on LAN on which frame was received

then drop the frame

Otherwise (out_port is valid) entry found for destination then forward the frame on interface indicated

33

65

Bridge Learning example

Suppose C sends frame to D and D replies back with frame

to C

C sends frame bridge has no info about D so floods to both LANs bridge notes that C is on port 1

frame ignored on upper LAN

frame received by D

66

Bridge Learning example

D generates reply to C sends

bridge sees frame from D

bridge notes that D is on interface 2

bridge knows C on interface 1 so selectivelyforwards frame out via interface 1

C 1

34

67

What will happen with loops

Incorrect learning

A

B

1 1

22

A 1 A 122

68

What will happen with loops

Frame looping

A

C

1 1

22

C C

35

69

What will happen with loops

Frame looping

A

B

1 1

22

B2 B1

70

Introducing Spanning Tree

Allow a path between every LAN without causing loops

(loop-free environment)

Bridges communicate with special configuration

messages (BPDUs)

Standardized by IEEE 8021D

Note redundant paths are good active redundant paths are bad (they cause

loops)

36

How to Construct a Spanning Tree

Bridges run a distributed spanning tree

Algorithm

Select what ports (and bridges) should actively forward

frames

Finding the root flooding

Building a tree Bellman-Ford Algorithm

Can combine efficiently

Standardized in IEEE 8021 specification

71

72

Spanning Tree Requirements

Each bridge is assigned a unique identifier

A broadcast address for bridges on a LAN

A unique port identifier for all ports on all bridges

MAC address

Bridge id + port number

37

73

Spanning Tree Concepts

Root Bridge The bridge with the lowest bridge ID value is elected the

root bridge

One root bridge chosen among all bridges

Every other bridge calculates a path to the root bridge

74

Spanning Tree Concepts

Path Cost A cost associated with each port on each bridge

default is 1

The cost associated with transmission onto the LAN

connected to the port

Can be manually or automatically assigned

Can be used to alter the path to the root bridge

38

75

Spanning Tree Concepts

Root Port The port on each bridge that is on the path towards the

root bridge

The root port is part of the lowest cost path towards

the root bridge

If port costs are equal on a bridge the port with the

lowest ID becomes root port

76

Spanning Tree Concepts

Root Path Cost The minimum cost path to the root bridge

The cost starts at the root bridge

Each bridge computes root path cost independently

based on their view of the network

39

77

Spanning Tree Concepts Designated

Bridge Only one bridge on a LAN at one time is chosen the

designated bridge

This bridge provides the minimum cost path to the root

bridge for the LAN

Only the designated bridge passes frames towards the

root bridge

78

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Protocol operation1 Picks a root2 For each LAN

picks a designated bridgethat is closest to the root

3 All bridges on a LANsend packets towards the root via the designatedbridge

B8

40

79

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

80

Spanning Tree Algorithm

An Overview 1 Determine the root bridge among all bridges

2 Each bridge determines its root port

The port in the direction of the root bridge

3 Determine the designated bridge on each LAN

The bridge which accepts frames to forward towards the root bridge

The frames are sent on the root port of the designated bridge

41

81

Spanning Tree Algorithm

Selecting Root Bridge Initially each bridge considers itself to be the root bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

Best one wins

(lowest root IDcostpriority)

82

Spanning Tree Algorithm

Selecting Root Ports Each bridge selects one of its ports which has the

minimal cost to the root bridge

In case of a tie the lowest uplink (transmitter) bridge ID is

used

In case of another tie the lowest port ID is used

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 30: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

30

Hubs

QWhy not just one big LAN

Limited amount of supportable traffic on single LAN

all stations must share bandwidth

limited length 8023 (Ethernet) specifies maximum

cable length

large ldquocollision domainrdquo (can collide with many

stations)

limited number of stations 8025 (token ring) have

token passing delays at each station

59

Lecture 360

Hubs (Multiport repeaters Bus in a box)

Physical Layer devices essentially repeaters operating at bit

levels repeat received bits on one interface to all other

interfaces

Can‟t interconnect 10BaseT amp 100BaseT (because

segments don‟t share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design)

with backbone hub at its top

31

61

Hubs (Multiport repeaters Bus in a box)

Each connected LAN referred to as LAN segment

Hubs do not isolate collision domains node may collide with any

node residing at any segment in LAN

Extends max distance between nodes but all the segments become

one large collision domain

Hub Advantages

simple inexpensive device

Multi-tier provides graceful degradation portions of the LAN

continue to operate if one hub malfunctions

extends maximum distance between node pairs (100m per Hub)

62

Bridges

Link Layer devices operate on Ethernet frames examining

frame header and selectively forwarding frame based on its

destination

Bridge isolates collision domains since it buffers frames

When frame is to be forwarded on segment bridge uses

CSMACD to access segment and transmit

Store and forward element So different types of Ethernet

types can be connected

Transparent no need for any change to hosts LAN adapters

Forwarding is selective do not always flood All connected

segments can work independently in parallel

32

63

Bridge Filtering

bridges learn which hosts can be reached through which

interfaces maintain filtering tables

when frame received bridge ldquolearnsrdquo location of sender

incoming LAN segment

records sender location in filtering table

filtering table entry

(Node LAN Address Bridge Interface Time Stamp)

stale entries in Filtering Table dropped (TTL can be 60 minutes)

64

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_port

if (out_port not valid) no entry found for destination

then flood forward on all but the interface on which the frame arrived

if (in_port = out_port) destination is on LAN on which frame was received

then drop the frame

Otherwise (out_port is valid) entry found for destination then forward the frame on interface indicated

33

65

Bridge Learning example

Suppose C sends frame to D and D replies back with frame

to C

C sends frame bridge has no info about D so floods to both LANs bridge notes that C is on port 1

frame ignored on upper LAN

frame received by D

66

Bridge Learning example

D generates reply to C sends

bridge sees frame from D

bridge notes that D is on interface 2

bridge knows C on interface 1 so selectivelyforwards frame out via interface 1

C 1

34

67

What will happen with loops

Incorrect learning

A

B

1 1

22

A 1 A 122

68

What will happen with loops

Frame looping

A

C

1 1

22

C C

35

69

What will happen with loops

Frame looping

A

B

1 1

22

B2 B1

70

Introducing Spanning Tree

Allow a path between every LAN without causing loops

(loop-free environment)

Bridges communicate with special configuration

messages (BPDUs)

Standardized by IEEE 8021D

Note redundant paths are good active redundant paths are bad (they cause

loops)

36

How to Construct a Spanning Tree

Bridges run a distributed spanning tree

Algorithm

Select what ports (and bridges) should actively forward

frames

Finding the root flooding

Building a tree Bellman-Ford Algorithm

Can combine efficiently

Standardized in IEEE 8021 specification

71

72

Spanning Tree Requirements

Each bridge is assigned a unique identifier

A broadcast address for bridges on a LAN

A unique port identifier for all ports on all bridges

MAC address

Bridge id + port number

37

73

Spanning Tree Concepts

Root Bridge The bridge with the lowest bridge ID value is elected the

root bridge

One root bridge chosen among all bridges

Every other bridge calculates a path to the root bridge

74

Spanning Tree Concepts

Path Cost A cost associated with each port on each bridge

default is 1

The cost associated with transmission onto the LAN

connected to the port

Can be manually or automatically assigned

Can be used to alter the path to the root bridge

38

75

Spanning Tree Concepts

Root Port The port on each bridge that is on the path towards the

root bridge

The root port is part of the lowest cost path towards

the root bridge

If port costs are equal on a bridge the port with the

lowest ID becomes root port

76

Spanning Tree Concepts

Root Path Cost The minimum cost path to the root bridge

The cost starts at the root bridge

Each bridge computes root path cost independently

based on their view of the network

39

77

Spanning Tree Concepts Designated

Bridge Only one bridge on a LAN at one time is chosen the

designated bridge

This bridge provides the minimum cost path to the root

bridge for the LAN

Only the designated bridge passes frames towards the

root bridge

78

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Protocol operation1 Picks a root2 For each LAN

picks a designated bridgethat is closest to the root

3 All bridges on a LANsend packets towards the root via the designatedbridge

B8

40

79

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

80

Spanning Tree Algorithm

An Overview 1 Determine the root bridge among all bridges

2 Each bridge determines its root port

The port in the direction of the root bridge

3 Determine the designated bridge on each LAN

The bridge which accepts frames to forward towards the root bridge

The frames are sent on the root port of the designated bridge

41

81

Spanning Tree Algorithm

Selecting Root Bridge Initially each bridge considers itself to be the root bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

Best one wins

(lowest root IDcostpriority)

82

Spanning Tree Algorithm

Selecting Root Ports Each bridge selects one of its ports which has the

minimal cost to the root bridge

In case of a tie the lowest uplink (transmitter) bridge ID is

used

In case of another tie the lowest port ID is used

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 31: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

31

61

Hubs (Multiport repeaters Bus in a box)

Each connected LAN referred to as LAN segment

Hubs do not isolate collision domains node may collide with any

node residing at any segment in LAN

Extends max distance between nodes but all the segments become

one large collision domain

Hub Advantages

simple inexpensive device

Multi-tier provides graceful degradation portions of the LAN

continue to operate if one hub malfunctions

extends maximum distance between node pairs (100m per Hub)

62

Bridges

Link Layer devices operate on Ethernet frames examining

frame header and selectively forwarding frame based on its

destination

Bridge isolates collision domains since it buffers frames

When frame is to be forwarded on segment bridge uses

CSMACD to access segment and transmit

Store and forward element So different types of Ethernet

types can be connected

Transparent no need for any change to hosts LAN adapters

Forwarding is selective do not always flood All connected

segments can work independently in parallel

32

63

Bridge Filtering

bridges learn which hosts can be reached through which

interfaces maintain filtering tables

when frame received bridge ldquolearnsrdquo location of sender

incoming LAN segment

records sender location in filtering table

filtering table entry

(Node LAN Address Bridge Interface Time Stamp)

stale entries in Filtering Table dropped (TTL can be 60 minutes)

64

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_port

if (out_port not valid) no entry found for destination

then flood forward on all but the interface on which the frame arrived

if (in_port = out_port) destination is on LAN on which frame was received

then drop the frame

Otherwise (out_port is valid) entry found for destination then forward the frame on interface indicated

33

65

Bridge Learning example

Suppose C sends frame to D and D replies back with frame

to C

C sends frame bridge has no info about D so floods to both LANs bridge notes that C is on port 1

frame ignored on upper LAN

frame received by D

66

Bridge Learning example

D generates reply to C sends

bridge sees frame from D

bridge notes that D is on interface 2

bridge knows C on interface 1 so selectivelyforwards frame out via interface 1

C 1

34

67

What will happen with loops

Incorrect learning

A

B

1 1

22

A 1 A 122

68

What will happen with loops

Frame looping

A

C

1 1

22

C C

35

69

What will happen with loops

Frame looping

A

B

1 1

22

B2 B1

70

Introducing Spanning Tree

Allow a path between every LAN without causing loops

(loop-free environment)

Bridges communicate with special configuration

messages (BPDUs)

Standardized by IEEE 8021D

Note redundant paths are good active redundant paths are bad (they cause

loops)

36

How to Construct a Spanning Tree

Bridges run a distributed spanning tree

Algorithm

Select what ports (and bridges) should actively forward

frames

Finding the root flooding

Building a tree Bellman-Ford Algorithm

Can combine efficiently

Standardized in IEEE 8021 specification

71

72

Spanning Tree Requirements

Each bridge is assigned a unique identifier

A broadcast address for bridges on a LAN

A unique port identifier for all ports on all bridges

MAC address

Bridge id + port number

37

73

Spanning Tree Concepts

Root Bridge The bridge with the lowest bridge ID value is elected the

root bridge

One root bridge chosen among all bridges

Every other bridge calculates a path to the root bridge

74

Spanning Tree Concepts

Path Cost A cost associated with each port on each bridge

default is 1

The cost associated with transmission onto the LAN

connected to the port

Can be manually or automatically assigned

Can be used to alter the path to the root bridge

38

75

Spanning Tree Concepts

Root Port The port on each bridge that is on the path towards the

root bridge

The root port is part of the lowest cost path towards

the root bridge

If port costs are equal on a bridge the port with the

lowest ID becomes root port

76

Spanning Tree Concepts

Root Path Cost The minimum cost path to the root bridge

The cost starts at the root bridge

Each bridge computes root path cost independently

based on their view of the network

39

77

Spanning Tree Concepts Designated

Bridge Only one bridge on a LAN at one time is chosen the

designated bridge

This bridge provides the minimum cost path to the root

bridge for the LAN

Only the designated bridge passes frames towards the

root bridge

78

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Protocol operation1 Picks a root2 For each LAN

picks a designated bridgethat is closest to the root

3 All bridges on a LANsend packets towards the root via the designatedbridge

B8

40

79

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

80

Spanning Tree Algorithm

An Overview 1 Determine the root bridge among all bridges

2 Each bridge determines its root port

The port in the direction of the root bridge

3 Determine the designated bridge on each LAN

The bridge which accepts frames to forward towards the root bridge

The frames are sent on the root port of the designated bridge

41

81

Spanning Tree Algorithm

Selecting Root Bridge Initially each bridge considers itself to be the root bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

Best one wins

(lowest root IDcostpriority)

82

Spanning Tree Algorithm

Selecting Root Ports Each bridge selects one of its ports which has the

minimal cost to the root bridge

In case of a tie the lowest uplink (transmitter) bridge ID is

used

In case of another tie the lowest port ID is used

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 32: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

32

63

Bridge Filtering

bridges learn which hosts can be reached through which

interfaces maintain filtering tables

when frame received bridge ldquolearnsrdquo location of sender

incoming LAN segment

records sender location in filtering table

filtering table entry

(Node LAN Address Bridge Interface Time Stamp)

stale entries in Filtering Table dropped (TTL can be 60 minutes)

64

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_port

if (out_port not valid) no entry found for destination

then flood forward on all but the interface on which the frame arrived

if (in_port = out_port) destination is on LAN on which frame was received

then drop the frame

Otherwise (out_port is valid) entry found for destination then forward the frame on interface indicated

33

65

Bridge Learning example

Suppose C sends frame to D and D replies back with frame

to C

C sends frame bridge has no info about D so floods to both LANs bridge notes that C is on port 1

frame ignored on upper LAN

frame received by D

66

Bridge Learning example

D generates reply to C sends

bridge sees frame from D

bridge notes that D is on interface 2

bridge knows C on interface 1 so selectivelyforwards frame out via interface 1

C 1

34

67

What will happen with loops

Incorrect learning

A

B

1 1

22

A 1 A 122

68

What will happen with loops

Frame looping

A

C

1 1

22

C C

35

69

What will happen with loops

Frame looping

A

B

1 1

22

B2 B1

70

Introducing Spanning Tree

Allow a path between every LAN without causing loops

(loop-free environment)

Bridges communicate with special configuration

messages (BPDUs)

Standardized by IEEE 8021D

Note redundant paths are good active redundant paths are bad (they cause

loops)

36

How to Construct a Spanning Tree

Bridges run a distributed spanning tree

Algorithm

Select what ports (and bridges) should actively forward

frames

Finding the root flooding

Building a tree Bellman-Ford Algorithm

Can combine efficiently

Standardized in IEEE 8021 specification

71

72

Spanning Tree Requirements

Each bridge is assigned a unique identifier

A broadcast address for bridges on a LAN

A unique port identifier for all ports on all bridges

MAC address

Bridge id + port number

37

73

Spanning Tree Concepts

Root Bridge The bridge with the lowest bridge ID value is elected the

root bridge

One root bridge chosen among all bridges

Every other bridge calculates a path to the root bridge

74

Spanning Tree Concepts

Path Cost A cost associated with each port on each bridge

default is 1

The cost associated with transmission onto the LAN

connected to the port

Can be manually or automatically assigned

Can be used to alter the path to the root bridge

38

75

Spanning Tree Concepts

Root Port The port on each bridge that is on the path towards the

root bridge

The root port is part of the lowest cost path towards

the root bridge

If port costs are equal on a bridge the port with the

lowest ID becomes root port

76

Spanning Tree Concepts

Root Path Cost The minimum cost path to the root bridge

The cost starts at the root bridge

Each bridge computes root path cost independently

based on their view of the network

39

77

Spanning Tree Concepts Designated

Bridge Only one bridge on a LAN at one time is chosen the

designated bridge

This bridge provides the minimum cost path to the root

bridge for the LAN

Only the designated bridge passes frames towards the

root bridge

78

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Protocol operation1 Picks a root2 For each LAN

picks a designated bridgethat is closest to the root

3 All bridges on a LANsend packets towards the root via the designatedbridge

B8

40

79

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

80

Spanning Tree Algorithm

An Overview 1 Determine the root bridge among all bridges

2 Each bridge determines its root port

The port in the direction of the root bridge

3 Determine the designated bridge on each LAN

The bridge which accepts frames to forward towards the root bridge

The frames are sent on the root port of the designated bridge

41

81

Spanning Tree Algorithm

Selecting Root Bridge Initially each bridge considers itself to be the root bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

Best one wins

(lowest root IDcostpriority)

82

Spanning Tree Algorithm

Selecting Root Ports Each bridge selects one of its ports which has the

minimal cost to the root bridge

In case of a tie the lowest uplink (transmitter) bridge ID is

used

In case of another tie the lowest port ID is used

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 33: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

33

65

Bridge Learning example

Suppose C sends frame to D and D replies back with frame

to C

C sends frame bridge has no info about D so floods to both LANs bridge notes that C is on port 1

frame ignored on upper LAN

frame received by D

66

Bridge Learning example

D generates reply to C sends

bridge sees frame from D

bridge notes that D is on interface 2

bridge knows C on interface 1 so selectivelyforwards frame out via interface 1

C 1

34

67

What will happen with loops

Incorrect learning

A

B

1 1

22

A 1 A 122

68

What will happen with loops

Frame looping

A

C

1 1

22

C C

35

69

What will happen with loops

Frame looping

A

B

1 1

22

B2 B1

70

Introducing Spanning Tree

Allow a path between every LAN without causing loops

(loop-free environment)

Bridges communicate with special configuration

messages (BPDUs)

Standardized by IEEE 8021D

Note redundant paths are good active redundant paths are bad (they cause

loops)

36

How to Construct a Spanning Tree

Bridges run a distributed spanning tree

Algorithm

Select what ports (and bridges) should actively forward

frames

Finding the root flooding

Building a tree Bellman-Ford Algorithm

Can combine efficiently

Standardized in IEEE 8021 specification

71

72

Spanning Tree Requirements

Each bridge is assigned a unique identifier

A broadcast address for bridges on a LAN

A unique port identifier for all ports on all bridges

MAC address

Bridge id + port number

37

73

Spanning Tree Concepts

Root Bridge The bridge with the lowest bridge ID value is elected the

root bridge

One root bridge chosen among all bridges

Every other bridge calculates a path to the root bridge

74

Spanning Tree Concepts

Path Cost A cost associated with each port on each bridge

default is 1

The cost associated with transmission onto the LAN

connected to the port

Can be manually or automatically assigned

Can be used to alter the path to the root bridge

38

75

Spanning Tree Concepts

Root Port The port on each bridge that is on the path towards the

root bridge

The root port is part of the lowest cost path towards

the root bridge

If port costs are equal on a bridge the port with the

lowest ID becomes root port

76

Spanning Tree Concepts

Root Path Cost The minimum cost path to the root bridge

The cost starts at the root bridge

Each bridge computes root path cost independently

based on their view of the network

39

77

Spanning Tree Concepts Designated

Bridge Only one bridge on a LAN at one time is chosen the

designated bridge

This bridge provides the minimum cost path to the root

bridge for the LAN

Only the designated bridge passes frames towards the

root bridge

78

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Protocol operation1 Picks a root2 For each LAN

picks a designated bridgethat is closest to the root

3 All bridges on a LANsend packets towards the root via the designatedbridge

B8

40

79

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

80

Spanning Tree Algorithm

An Overview 1 Determine the root bridge among all bridges

2 Each bridge determines its root port

The port in the direction of the root bridge

3 Determine the designated bridge on each LAN

The bridge which accepts frames to forward towards the root bridge

The frames are sent on the root port of the designated bridge

41

81

Spanning Tree Algorithm

Selecting Root Bridge Initially each bridge considers itself to be the root bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

Best one wins

(lowest root IDcostpriority)

82

Spanning Tree Algorithm

Selecting Root Ports Each bridge selects one of its ports which has the

minimal cost to the root bridge

In case of a tie the lowest uplink (transmitter) bridge ID is

used

In case of another tie the lowest port ID is used

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 34: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

34

67

What will happen with loops

Incorrect learning

A

B

1 1

22

A 1 A 122

68

What will happen with loops

Frame looping

A

C

1 1

22

C C

35

69

What will happen with loops

Frame looping

A

B

1 1

22

B2 B1

70

Introducing Spanning Tree

Allow a path between every LAN without causing loops

(loop-free environment)

Bridges communicate with special configuration

messages (BPDUs)

Standardized by IEEE 8021D

Note redundant paths are good active redundant paths are bad (they cause

loops)

36

How to Construct a Spanning Tree

Bridges run a distributed spanning tree

Algorithm

Select what ports (and bridges) should actively forward

frames

Finding the root flooding

Building a tree Bellman-Ford Algorithm

Can combine efficiently

Standardized in IEEE 8021 specification

71

72

Spanning Tree Requirements

Each bridge is assigned a unique identifier

A broadcast address for bridges on a LAN

A unique port identifier for all ports on all bridges

MAC address

Bridge id + port number

37

73

Spanning Tree Concepts

Root Bridge The bridge with the lowest bridge ID value is elected the

root bridge

One root bridge chosen among all bridges

Every other bridge calculates a path to the root bridge

74

Spanning Tree Concepts

Path Cost A cost associated with each port on each bridge

default is 1

The cost associated with transmission onto the LAN

connected to the port

Can be manually or automatically assigned

Can be used to alter the path to the root bridge

38

75

Spanning Tree Concepts

Root Port The port on each bridge that is on the path towards the

root bridge

The root port is part of the lowest cost path towards

the root bridge

If port costs are equal on a bridge the port with the

lowest ID becomes root port

76

Spanning Tree Concepts

Root Path Cost The minimum cost path to the root bridge

The cost starts at the root bridge

Each bridge computes root path cost independently

based on their view of the network

39

77

Spanning Tree Concepts Designated

Bridge Only one bridge on a LAN at one time is chosen the

designated bridge

This bridge provides the minimum cost path to the root

bridge for the LAN

Only the designated bridge passes frames towards the

root bridge

78

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Protocol operation1 Picks a root2 For each LAN

picks a designated bridgethat is closest to the root

3 All bridges on a LANsend packets towards the root via the designatedbridge

B8

40

79

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

80

Spanning Tree Algorithm

An Overview 1 Determine the root bridge among all bridges

2 Each bridge determines its root port

The port in the direction of the root bridge

3 Determine the designated bridge on each LAN

The bridge which accepts frames to forward towards the root bridge

The frames are sent on the root port of the designated bridge

41

81

Spanning Tree Algorithm

Selecting Root Bridge Initially each bridge considers itself to be the root bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

Best one wins

(lowest root IDcostpriority)

82

Spanning Tree Algorithm

Selecting Root Ports Each bridge selects one of its ports which has the

minimal cost to the root bridge

In case of a tie the lowest uplink (transmitter) bridge ID is

used

In case of another tie the lowest port ID is used

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 35: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

35

69

What will happen with loops

Frame looping

A

B

1 1

22

B2 B1

70

Introducing Spanning Tree

Allow a path between every LAN without causing loops

(loop-free environment)

Bridges communicate with special configuration

messages (BPDUs)

Standardized by IEEE 8021D

Note redundant paths are good active redundant paths are bad (they cause

loops)

36

How to Construct a Spanning Tree

Bridges run a distributed spanning tree

Algorithm

Select what ports (and bridges) should actively forward

frames

Finding the root flooding

Building a tree Bellman-Ford Algorithm

Can combine efficiently

Standardized in IEEE 8021 specification

71

72

Spanning Tree Requirements

Each bridge is assigned a unique identifier

A broadcast address for bridges on a LAN

A unique port identifier for all ports on all bridges

MAC address

Bridge id + port number

37

73

Spanning Tree Concepts

Root Bridge The bridge with the lowest bridge ID value is elected the

root bridge

One root bridge chosen among all bridges

Every other bridge calculates a path to the root bridge

74

Spanning Tree Concepts

Path Cost A cost associated with each port on each bridge

default is 1

The cost associated with transmission onto the LAN

connected to the port

Can be manually or automatically assigned

Can be used to alter the path to the root bridge

38

75

Spanning Tree Concepts

Root Port The port on each bridge that is on the path towards the

root bridge

The root port is part of the lowest cost path towards

the root bridge

If port costs are equal on a bridge the port with the

lowest ID becomes root port

76

Spanning Tree Concepts

Root Path Cost The minimum cost path to the root bridge

The cost starts at the root bridge

Each bridge computes root path cost independently

based on their view of the network

39

77

Spanning Tree Concepts Designated

Bridge Only one bridge on a LAN at one time is chosen the

designated bridge

This bridge provides the minimum cost path to the root

bridge for the LAN

Only the designated bridge passes frames towards the

root bridge

78

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Protocol operation1 Picks a root2 For each LAN

picks a designated bridgethat is closest to the root

3 All bridges on a LANsend packets towards the root via the designatedbridge

B8

40

79

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

80

Spanning Tree Algorithm

An Overview 1 Determine the root bridge among all bridges

2 Each bridge determines its root port

The port in the direction of the root bridge

3 Determine the designated bridge on each LAN

The bridge which accepts frames to forward towards the root bridge

The frames are sent on the root port of the designated bridge

41

81

Spanning Tree Algorithm

Selecting Root Bridge Initially each bridge considers itself to be the root bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

Best one wins

(lowest root IDcostpriority)

82

Spanning Tree Algorithm

Selecting Root Ports Each bridge selects one of its ports which has the

minimal cost to the root bridge

In case of a tie the lowest uplink (transmitter) bridge ID is

used

In case of another tie the lowest port ID is used

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 36: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

36

How to Construct a Spanning Tree

Bridges run a distributed spanning tree

Algorithm

Select what ports (and bridges) should actively forward

frames

Finding the root flooding

Building a tree Bellman-Ford Algorithm

Can combine efficiently

Standardized in IEEE 8021 specification

71

72

Spanning Tree Requirements

Each bridge is assigned a unique identifier

A broadcast address for bridges on a LAN

A unique port identifier for all ports on all bridges

MAC address

Bridge id + port number

37

73

Spanning Tree Concepts

Root Bridge The bridge with the lowest bridge ID value is elected the

root bridge

One root bridge chosen among all bridges

Every other bridge calculates a path to the root bridge

74

Spanning Tree Concepts

Path Cost A cost associated with each port on each bridge

default is 1

The cost associated with transmission onto the LAN

connected to the port

Can be manually or automatically assigned

Can be used to alter the path to the root bridge

38

75

Spanning Tree Concepts

Root Port The port on each bridge that is on the path towards the

root bridge

The root port is part of the lowest cost path towards

the root bridge

If port costs are equal on a bridge the port with the

lowest ID becomes root port

76

Spanning Tree Concepts

Root Path Cost The minimum cost path to the root bridge

The cost starts at the root bridge

Each bridge computes root path cost independently

based on their view of the network

39

77

Spanning Tree Concepts Designated

Bridge Only one bridge on a LAN at one time is chosen the

designated bridge

This bridge provides the minimum cost path to the root

bridge for the LAN

Only the designated bridge passes frames towards the

root bridge

78

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Protocol operation1 Picks a root2 For each LAN

picks a designated bridgethat is closest to the root

3 All bridges on a LANsend packets towards the root via the designatedbridge

B8

40

79

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

80

Spanning Tree Algorithm

An Overview 1 Determine the root bridge among all bridges

2 Each bridge determines its root port

The port in the direction of the root bridge

3 Determine the designated bridge on each LAN

The bridge which accepts frames to forward towards the root bridge

The frames are sent on the root port of the designated bridge

41

81

Spanning Tree Algorithm

Selecting Root Bridge Initially each bridge considers itself to be the root bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

Best one wins

(lowest root IDcostpriority)

82

Spanning Tree Algorithm

Selecting Root Ports Each bridge selects one of its ports which has the

minimal cost to the root bridge

In case of a tie the lowest uplink (transmitter) bridge ID is

used

In case of another tie the lowest port ID is used

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 37: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

37

73

Spanning Tree Concepts

Root Bridge The bridge with the lowest bridge ID value is elected the

root bridge

One root bridge chosen among all bridges

Every other bridge calculates a path to the root bridge

74

Spanning Tree Concepts

Path Cost A cost associated with each port on each bridge

default is 1

The cost associated with transmission onto the LAN

connected to the port

Can be manually or automatically assigned

Can be used to alter the path to the root bridge

38

75

Spanning Tree Concepts

Root Port The port on each bridge that is on the path towards the

root bridge

The root port is part of the lowest cost path towards

the root bridge

If port costs are equal on a bridge the port with the

lowest ID becomes root port

76

Spanning Tree Concepts

Root Path Cost The minimum cost path to the root bridge

The cost starts at the root bridge

Each bridge computes root path cost independently

based on their view of the network

39

77

Spanning Tree Concepts Designated

Bridge Only one bridge on a LAN at one time is chosen the

designated bridge

This bridge provides the minimum cost path to the root

bridge for the LAN

Only the designated bridge passes frames towards the

root bridge

78

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Protocol operation1 Picks a root2 For each LAN

picks a designated bridgethat is closest to the root

3 All bridges on a LANsend packets towards the root via the designatedbridge

B8

40

79

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

80

Spanning Tree Algorithm

An Overview 1 Determine the root bridge among all bridges

2 Each bridge determines its root port

The port in the direction of the root bridge

3 Determine the designated bridge on each LAN

The bridge which accepts frames to forward towards the root bridge

The frames are sent on the root port of the designated bridge

41

81

Spanning Tree Algorithm

Selecting Root Bridge Initially each bridge considers itself to be the root bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

Best one wins

(lowest root IDcostpriority)

82

Spanning Tree Algorithm

Selecting Root Ports Each bridge selects one of its ports which has the

minimal cost to the root bridge

In case of a tie the lowest uplink (transmitter) bridge ID is

used

In case of another tie the lowest port ID is used

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 38: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

38

75

Spanning Tree Concepts

Root Port The port on each bridge that is on the path towards the

root bridge

The root port is part of the lowest cost path towards

the root bridge

If port costs are equal on a bridge the port with the

lowest ID becomes root port

76

Spanning Tree Concepts

Root Path Cost The minimum cost path to the root bridge

The cost starts at the root bridge

Each bridge computes root path cost independently

based on their view of the network

39

77

Spanning Tree Concepts Designated

Bridge Only one bridge on a LAN at one time is chosen the

designated bridge

This bridge provides the minimum cost path to the root

bridge for the LAN

Only the designated bridge passes frames towards the

root bridge

78

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Protocol operation1 Picks a root2 For each LAN

picks a designated bridgethat is closest to the root

3 All bridges on a LANsend packets towards the root via the designatedbridge

B8

40

79

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

80

Spanning Tree Algorithm

An Overview 1 Determine the root bridge among all bridges

2 Each bridge determines its root port

The port in the direction of the root bridge

3 Determine the designated bridge on each LAN

The bridge which accepts frames to forward towards the root bridge

The frames are sent on the root port of the designated bridge

41

81

Spanning Tree Algorithm

Selecting Root Bridge Initially each bridge considers itself to be the root bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

Best one wins

(lowest root IDcostpriority)

82

Spanning Tree Algorithm

Selecting Root Ports Each bridge selects one of its ports which has the

minimal cost to the root bridge

In case of a tie the lowest uplink (transmitter) bridge ID is

used

In case of another tie the lowest port ID is used

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 39: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

39

77

Spanning Tree Concepts Designated

Bridge Only one bridge on a LAN at one time is chosen the

designated bridge

This bridge provides the minimum cost path to the root

bridge for the LAN

Only the designated bridge passes frames towards the

root bridge

78

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Protocol operation1 Picks a root2 For each LAN

picks a designated bridgethat is closest to the root

3 All bridges on a LANsend packets towards the root via the designatedbridge

B8

40

79

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

80

Spanning Tree Algorithm

An Overview 1 Determine the root bridge among all bridges

2 Each bridge determines its root port

The port in the direction of the root bridge

3 Determine the designated bridge on each LAN

The bridge which accepts frames to forward towards the root bridge

The frames are sent on the root port of the designated bridge

41

81

Spanning Tree Algorithm

Selecting Root Bridge Initially each bridge considers itself to be the root bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

Best one wins

(lowest root IDcostpriority)

82

Spanning Tree Algorithm

Selecting Root Ports Each bridge selects one of its ports which has the

minimal cost to the root bridge

In case of a tie the lowest uplink (transmitter) bridge ID is

used

In case of another tie the lowest port ID is used

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 40: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

40

79

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

80

Spanning Tree Algorithm

An Overview 1 Determine the root bridge among all bridges

2 Each bridge determines its root port

The port in the direction of the root bridge

3 Determine the designated bridge on each LAN

The bridge which accepts frames to forward towards the root bridge

The frames are sent on the root port of the designated bridge

41

81

Spanning Tree Algorithm

Selecting Root Bridge Initially each bridge considers itself to be the root bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

Best one wins

(lowest root IDcostpriority)

82

Spanning Tree Algorithm

Selecting Root Ports Each bridge selects one of its ports which has the

minimal cost to the root bridge

In case of a tie the lowest uplink (transmitter) bridge ID is

used

In case of another tie the lowest port ID is used

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 41: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

41

81

Spanning Tree Algorithm

Selecting Root Bridge Initially each bridge considers itself to be the root bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

Best one wins

(lowest root IDcostpriority)

82

Spanning Tree Algorithm

Selecting Root Ports Each bridge selects one of its ports which has the

minimal cost to the root bridge

In case of a tie the lowest uplink (transmitter) bridge ID is

used

In case of another tie the lowest port ID is used

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 42: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

42

83

Spanning Tree Algorithm

Select Designated Bridges

Initially each bridge considers itself to be the designated

bridge

Bridges send BDPU frames to its attached LANs The bridge and port ID of the sending bridge

The bridge and port ID of the bridge the sending bridge considers root

The root path cost for the sending bridge

3 Best one wins

(lowest IDcostpriority)

84

ForwardingBlocking State

Root and designated bridges will forward frames to and

from their attached LANs

All other ports are in the blocking state

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 43: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

43

85

Ethernet Switches

layer 2 (frame) forwarding

filtering using LAN addresses

Switching A-to-B and A‟-to-B‟

simultaneously no collisions

large number of interfaces

often individual hosts star-

connected into switch

Ethernet but no collisions

Confused with Ethernet

bridgeshellip

86

Ethernet Switches

cut-through switching frame forwarded from input to

output port without awaiting for assembly of entire frame

slight reduction in latency

combinations of shareddedicated 101001000 Mbps

interfaces

Offers VLANS (Virtual LANs)

Nowadays routers are actually combined with

Ethernet switches

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 44: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

44

87

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffic

isolation

no yes yes

plug amp play yes no yes

optimal

routing

no yes no

cut

through

yes no yes

88

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 45: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

45

Road-Map and Keywords IEEE 802 Model compared to the OSI

LLC MAC

Physical Media

Coax Twisted Pairs Fibers

Link Types

Point-to-point Broadcast Switched

Different MAC protocol approaches

Channel Partitioning Random Access ldquoTaking Turnsrdquo

Portioning MAC protocols

TDMA FDMA CDMA

Random Access MAC protocols

Aloha Slotted Aloha

LAN technology ndash Ethernet Protocol

MAC Addresses Frame Structure ARP

LAN interconnect

Hubs Bridges and Ethernet Switches

89

IEEE 802 Model Compared to the OSI The Data-Link and Physical layers in the OSI model are divided to other

layers according to the IEEE 802 model

90

Higher Layers

Data-Link Layer

Physical Layer

IEEE 8021Higher Levels Interface

IEEE 8022Logical Link Control (LLC)

IEEE 8023CSMACDMedium AccessControl

IEEE 80211WirelessMedium AccessControl

IEEE 8025Token Ring

Medium AccessControl

CSMACDMedium

WirelessMedium

Token RingMedium

OSI IEEE 802

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91

Page 46: The Data-Link Layer: Ethernet, ARP and LANshbinsky/intro comp comm/5_Data Link Layer.pdflayer-2 packet is a frame, encapsulates datagram “link” data-link layerhas responsibility

46

IEEE 802 Model Compared to the OSI The LLC provides common interface for common LAN functionality

There are various media which offer different methods for communication

(OSI so called Physical layer)

Each LAN technology uses different MAC (Medium Access Control)

method to use its corresponding medias

What kind of medias do we have

What kind of corresponding MAC protocols do we have

91