91
Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Embed Size (px)

Citation preview

Page 1: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Link Layer and LANs

Ossi Mokryn and Irad Ratmansky Based on Slides from the Top Down Approach book

1

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

Link Layer IntroductionSome 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

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 bitsItrsquos 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

Physical Media (Examples)Coaxial cable Two concentric shielded wires

Basebandsingle channel on cable

broadbandmultiple 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 fiberrsquos attenuation) Secured

Common used for 100-Mbps Ethernet and 1000-Mbps Ethernet (ldquoGigabit Ethernetrdquo)

8

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

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

Link TypesThree 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

Wersquoll 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 timeMultiple 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

Human Analogy

Ossi Mokryn - Data link layer15

Rules for lsquoparty conversationrsquo 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

DecentralizedNo special node uses to coordinate transmission (no ldquoleaderrdquo)No synchronization of clocks or slotsFault tolerant

SimpleShould be very fast and implemented in NICs firmware

16

MAC Protocol TypesThree 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 TDMATDMA (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

Channel Partitioning MAC protocols FDMAFDMA (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

bands

time

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

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 wersquoll 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

Aloha Protocol Invented at the rsquo70s 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

Ossi Mokryn - Data link layer23

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)

Ossi Mokryn - Data link layer24

Aloha Protocol

1 Accept a new frame arrives2 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

Ossi Mokryn - Data link layer25

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

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 unitsSynchronize 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

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 synchronization30

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 donrsquot check whatrsquos

going on in the channel each acting on its own No manners

32

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit Protocol

1 Listen to the channel2 If channel sensed idle transmit entire frame3 If channel sensed busy defer transmission by

1-Persistent CSMAWait until channel is quiet and transmit immediately If collision occurs wait a random time and listen again (go to 1)

Non-Persistent CSMAWait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission CSMA human analogy donrsquot interrupt others33

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

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots adapter doesnrsquot

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

Unreliable connectionless service Connectionless No handshaking between sending

and receiving adapter Unreliable receiving adapter doesnrsquot 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

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

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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

Link Layer IntroductionSome 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

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 bitsItrsquos 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

Physical Media (Examples)Coaxial cable Two concentric shielded wires

Basebandsingle channel on cable

broadbandmultiple 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 fiberrsquos attenuation) Secured

Common used for 100-Mbps Ethernet and 1000-Mbps Ethernet (ldquoGigabit Ethernetrdquo)

8

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

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

Link TypesThree 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

Wersquoll 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 timeMultiple 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

Human Analogy

Ossi Mokryn - Data link layer15

Rules for lsquoparty conversationrsquo 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

DecentralizedNo special node uses to coordinate transmission (no ldquoleaderrdquo)No synchronization of clocks or slotsFault tolerant

SimpleShould be very fast and implemented in NICs firmware

16

MAC Protocol TypesThree 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 TDMATDMA (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

Channel Partitioning MAC protocols FDMAFDMA (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

bands

time

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

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 wersquoll 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

Aloha Protocol Invented at the rsquo70s 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

Ossi Mokryn - Data link layer23

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)

Ossi Mokryn - Data link layer24

Aloha Protocol

1 Accept a new frame arrives2 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

Ossi Mokryn - Data link layer25

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

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 unitsSynchronize 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

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 synchronization30

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 donrsquot check whatrsquos

going on in the channel each acting on its own No manners

32

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit Protocol

1 Listen to the channel2 If channel sensed idle transmit entire frame3 If channel sensed busy defer transmission by

1-Persistent CSMAWait until channel is quiet and transmit immediately If collision occurs wait a random time and listen again (go to 1)

Non-Persistent CSMAWait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission CSMA human analogy donrsquot interrupt others33

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

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots adapter doesnrsquot

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

Unreliable connectionless service Connectionless No handshaking between sending

and receiving adapter Unreliable receiving adapter doesnrsquot 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

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

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Link Layer IntroductionSome 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

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 bitsItrsquos 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

Physical Media (Examples)Coaxial cable Two concentric shielded wires

Basebandsingle channel on cable

broadbandmultiple 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 fiberrsquos attenuation) Secured

Common used for 100-Mbps Ethernet and 1000-Mbps Ethernet (ldquoGigabit Ethernetrdquo)

8

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

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

Link TypesThree 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

Wersquoll 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 timeMultiple 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

Human Analogy

Ossi Mokryn - Data link layer15

Rules for lsquoparty conversationrsquo 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

DecentralizedNo special node uses to coordinate transmission (no ldquoleaderrdquo)No synchronization of clocks or slotsFault tolerant

SimpleShould be very fast and implemented in NICs firmware

16

MAC Protocol TypesThree 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 TDMATDMA (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

Channel Partitioning MAC protocols FDMAFDMA (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

bands

time

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

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 wersquoll 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

Aloha Protocol Invented at the rsquo70s 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

Ossi Mokryn - Data link layer23

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)

Ossi Mokryn - Data link layer24

Aloha Protocol

1 Accept a new frame arrives2 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

Ossi Mokryn - Data link layer25

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

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 unitsSynchronize 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

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 synchronization30

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 donrsquot check whatrsquos

going on in the channel each acting on its own No manners

32

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit Protocol

1 Listen to the channel2 If channel sensed idle transmit entire frame3 If channel sensed busy defer transmission by

1-Persistent CSMAWait until channel is quiet and transmit immediately If collision occurs wait a random time and listen again (go to 1)

Non-Persistent CSMAWait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission CSMA human analogy donrsquot interrupt others33

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

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots adapter doesnrsquot

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

Unreliable connectionless service Connectionless No handshaking between sending

and receiving adapter Unreliable receiving adapter doesnrsquot 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

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

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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

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 bitsItrsquos 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

Physical Media (Examples)Coaxial cable Two concentric shielded wires

Basebandsingle channel on cable

broadbandmultiple 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 fiberrsquos attenuation) Secured

Common used for 100-Mbps Ethernet and 1000-Mbps Ethernet (ldquoGigabit Ethernetrdquo)

8

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

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

Link TypesThree 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

Wersquoll 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 timeMultiple 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

Human Analogy

Ossi Mokryn - Data link layer15

Rules for lsquoparty conversationrsquo 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

DecentralizedNo special node uses to coordinate transmission (no ldquoleaderrdquo)No synchronization of clocks or slotsFault tolerant

SimpleShould be very fast and implemented in NICs firmware

16

MAC Protocol TypesThree 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 TDMATDMA (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

Channel Partitioning MAC protocols FDMAFDMA (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

bands

time

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

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 wersquoll 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

Aloha Protocol Invented at the rsquo70s 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

Ossi Mokryn - Data link layer23

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)

Ossi Mokryn - Data link layer24

Aloha Protocol

1 Accept a new frame arrives2 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

Ossi Mokryn - Data link layer25

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

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 unitsSynchronize 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

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 synchronization30

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 donrsquot check whatrsquos

going on in the channel each acting on its own No manners

32

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit Protocol

1 Listen to the channel2 If channel sensed idle transmit entire frame3 If channel sensed busy defer transmission by

1-Persistent CSMAWait until channel is quiet and transmit immediately If collision occurs wait a random time and listen again (go to 1)

Non-Persistent CSMAWait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission CSMA human analogy donrsquot interrupt others33

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

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots adapter doesnrsquot

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

Unreliable connectionless service Connectionless No handshaking between sending

and receiving adapter Unreliable receiving adapter doesnrsquot 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

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

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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 bitsItrsquos 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

Physical Media (Examples)Coaxial cable Two concentric shielded wires

Basebandsingle channel on cable

broadbandmultiple 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 fiberrsquos attenuation) Secured

Common used for 100-Mbps Ethernet and 1000-Mbps Ethernet (ldquoGigabit Ethernetrdquo)

8

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

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

Link TypesThree 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

Wersquoll 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 timeMultiple 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

Human Analogy

Ossi Mokryn - Data link layer15

Rules for lsquoparty conversationrsquo 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

DecentralizedNo special node uses to coordinate transmission (no ldquoleaderrdquo)No synchronization of clocks or slotsFault tolerant

SimpleShould be very fast and implemented in NICs firmware

16

MAC Protocol TypesThree 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 TDMATDMA (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

Channel Partitioning MAC protocols FDMAFDMA (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

bands

time

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

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 wersquoll 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

Aloha Protocol Invented at the rsquo70s 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

Ossi Mokryn - Data link layer23

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)

Ossi Mokryn - Data link layer24

Aloha Protocol

1 Accept a new frame arrives2 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

Ossi Mokryn - Data link layer25

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

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 unitsSynchronize 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

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 synchronization30

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 donrsquot check whatrsquos

going on in the channel each acting on its own No manners

32

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit Protocol

1 Listen to the channel2 If channel sensed idle transmit entire frame3 If channel sensed busy defer transmission by

1-Persistent CSMAWait until channel is quiet and transmit immediately If collision occurs wait a random time and listen again (go to 1)

Non-Persistent CSMAWait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission CSMA human analogy donrsquot interrupt others33

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

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots adapter doesnrsquot

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

Unreliable connectionless service Connectionless No handshaking between sending

and receiving adapter Unreliable receiving adapter doesnrsquot 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

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

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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

Physical Media (Examples)Coaxial cable Two concentric shielded wires

Basebandsingle channel on cable

broadbandmultiple 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 fiberrsquos attenuation) Secured

Common used for 100-Mbps Ethernet and 1000-Mbps Ethernet (ldquoGigabit Ethernetrdquo)

8

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

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

Link TypesThree 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

Wersquoll 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 timeMultiple 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

Human Analogy

Ossi Mokryn - Data link layer15

Rules for lsquoparty conversationrsquo 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

DecentralizedNo special node uses to coordinate transmission (no ldquoleaderrdquo)No synchronization of clocks or slotsFault tolerant

SimpleShould be very fast and implemented in NICs firmware

16

MAC Protocol TypesThree 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 TDMATDMA (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

Channel Partitioning MAC protocols FDMAFDMA (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

bands

time

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

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 wersquoll 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

Aloha Protocol Invented at the rsquo70s 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

Ossi Mokryn - Data link layer23

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)

Ossi Mokryn - Data link layer24

Aloha Protocol

1 Accept a new frame arrives2 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

Ossi Mokryn - Data link layer25

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

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 unitsSynchronize 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

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 synchronization30

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 donrsquot check whatrsquos

going on in the channel each acting on its own No manners

32

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit Protocol

1 Listen to the channel2 If channel sensed idle transmit entire frame3 If channel sensed busy defer transmission by

1-Persistent CSMAWait until channel is quiet and transmit immediately If collision occurs wait a random time and listen again (go to 1)

Non-Persistent CSMAWait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission CSMA human analogy donrsquot interrupt others33

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

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots adapter doesnrsquot

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

Unreliable connectionless service Connectionless No handshaking between sending

and receiving adapter Unreliable receiving adapter doesnrsquot 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

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

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Physical Media (Examples)Coaxial cable Two concentric shielded wires

Basebandsingle channel on cable

broadbandmultiple 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 fiberrsquos attenuation) Secured

Common used for 100-Mbps Ethernet and 1000-Mbps Ethernet (ldquoGigabit Ethernetrdquo)

8

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

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

Link TypesThree 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

Wersquoll 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 timeMultiple 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

Human Analogy

Ossi Mokryn - Data link layer15

Rules for lsquoparty conversationrsquo 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

DecentralizedNo special node uses to coordinate transmission (no ldquoleaderrdquo)No synchronization of clocks or slotsFault tolerant

SimpleShould be very fast and implemented in NICs firmware

16

MAC Protocol TypesThree 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 TDMATDMA (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

Channel Partitioning MAC protocols FDMAFDMA (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

bands

time

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

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 wersquoll 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

Aloha Protocol Invented at the rsquo70s 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

Ossi Mokryn - Data link layer23

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)

Ossi Mokryn - Data link layer24

Aloha Protocol

1 Accept a new frame arrives2 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

Ossi Mokryn - Data link layer25

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

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 unitsSynchronize 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

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 synchronization30

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 donrsquot check whatrsquos

going on in the channel each acting on its own No manners

32

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit Protocol

1 Listen to the channel2 If channel sensed idle transmit entire frame3 If channel sensed busy defer transmission by

1-Persistent CSMAWait until channel is quiet and transmit immediately If collision occurs wait a random time and listen again (go to 1)

Non-Persistent CSMAWait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission CSMA human analogy donrsquot interrupt others33

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

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots adapter doesnrsquot

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

Unreliable connectionless service Connectionless No handshaking between sending

and receiving adapter Unreliable receiving adapter doesnrsquot 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

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

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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 fiberrsquos attenuation) Secured

Common used for 100-Mbps Ethernet and 1000-Mbps Ethernet (ldquoGigabit Ethernetrdquo)

8

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

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

Link TypesThree 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

Wersquoll 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 timeMultiple 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

Human Analogy

Ossi Mokryn - Data link layer15

Rules for lsquoparty conversationrsquo 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

DecentralizedNo special node uses to coordinate transmission (no ldquoleaderrdquo)No synchronization of clocks or slotsFault tolerant

SimpleShould be very fast and implemented in NICs firmware

16

MAC Protocol TypesThree 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 TDMATDMA (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

Channel Partitioning MAC protocols FDMAFDMA (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

bands

time

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

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 wersquoll 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

Aloha Protocol Invented at the rsquo70s 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

Ossi Mokryn - Data link layer23

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)

Ossi Mokryn - Data link layer24

Aloha Protocol

1 Accept a new frame arrives2 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

Ossi Mokryn - Data link layer25

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

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 unitsSynchronize 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

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 synchronization30

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 donrsquot check whatrsquos

going on in the channel each acting on its own No manners

32

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit Protocol

1 Listen to the channel2 If channel sensed idle transmit entire frame3 If channel sensed busy defer transmission by

1-Persistent CSMAWait until channel is quiet and transmit immediately If collision occurs wait a random time and listen again (go to 1)

Non-Persistent CSMAWait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission CSMA human analogy donrsquot interrupt others33

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

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots adapter doesnrsquot

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

Unreliable connectionless service Connectionless No handshaking between sending

and receiving adapter Unreliable receiving adapter doesnrsquot 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

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

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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

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

Link TypesThree 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

Wersquoll 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 timeMultiple 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

Human Analogy

Ossi Mokryn - Data link layer15

Rules for lsquoparty conversationrsquo 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

DecentralizedNo special node uses to coordinate transmission (no ldquoleaderrdquo)No synchronization of clocks or slotsFault tolerant

SimpleShould be very fast and implemented in NICs firmware

16

MAC Protocol TypesThree 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 TDMATDMA (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

Channel Partitioning MAC protocols FDMAFDMA (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

bands

time

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

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 wersquoll 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

Aloha Protocol Invented at the rsquo70s 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

Ossi Mokryn - Data link layer23

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)

Ossi Mokryn - Data link layer24

Aloha Protocol

1 Accept a new frame arrives2 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

Ossi Mokryn - Data link layer25

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

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 unitsSynchronize 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

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 synchronization30

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 donrsquot check whatrsquos

going on in the channel each acting on its own No manners

32

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit Protocol

1 Listen to the channel2 If channel sensed idle transmit entire frame3 If channel sensed busy defer transmission by

1-Persistent CSMAWait until channel is quiet and transmit immediately If collision occurs wait a random time and listen again (go to 1)

Non-Persistent CSMAWait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission CSMA human analogy donrsquot interrupt others33

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

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots adapter doesnrsquot

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

Unreliable connectionless service Connectionless No handshaking between sending

and receiving adapter Unreliable receiving adapter doesnrsquot 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

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

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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

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

Link TypesThree 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

Wersquoll 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 timeMultiple 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

Human Analogy

Ossi Mokryn - Data link layer15

Rules for lsquoparty conversationrsquo 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

DecentralizedNo special node uses to coordinate transmission (no ldquoleaderrdquo)No synchronization of clocks or slotsFault tolerant

SimpleShould be very fast and implemented in NICs firmware

16

MAC Protocol TypesThree 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 TDMATDMA (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

Channel Partitioning MAC protocols FDMAFDMA (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

bands

time

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

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 wersquoll 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

Aloha Protocol Invented at the rsquo70s 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

Ossi Mokryn - Data link layer23

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)

Ossi Mokryn - Data link layer24

Aloha Protocol

1 Accept a new frame arrives2 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

Ossi Mokryn - Data link layer25

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

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 unitsSynchronize 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

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 synchronization30

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 donrsquot check whatrsquos

going on in the channel each acting on its own No manners

32

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit Protocol

1 Listen to the channel2 If channel sensed idle transmit entire frame3 If channel sensed busy defer transmission by

1-Persistent CSMAWait until channel is quiet and transmit immediately If collision occurs wait a random time and listen again (go to 1)

Non-Persistent CSMAWait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission CSMA human analogy donrsquot interrupt others33

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

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots adapter doesnrsquot

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

Unreliable connectionless service Connectionless No handshaking between sending

and receiving adapter Unreliable receiving adapter doesnrsquot 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

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

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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

Link TypesThree 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

Wersquoll 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 timeMultiple 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

Human Analogy

Ossi Mokryn - Data link layer15

Rules for lsquoparty conversationrsquo 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

DecentralizedNo special node uses to coordinate transmission (no ldquoleaderrdquo)No synchronization of clocks or slotsFault tolerant

SimpleShould be very fast and implemented in NICs firmware

16

MAC Protocol TypesThree 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 TDMATDMA (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

Channel Partitioning MAC protocols FDMAFDMA (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

bands

time

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

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 wersquoll 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

Aloha Protocol Invented at the rsquo70s 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

Ossi Mokryn - Data link layer23

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)

Ossi Mokryn - Data link layer24

Aloha Protocol

1 Accept a new frame arrives2 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

Ossi Mokryn - Data link layer25

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

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 unitsSynchronize 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

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 synchronization30

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 donrsquot check whatrsquos

going on in the channel each acting on its own No manners

32

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit Protocol

1 Listen to the channel2 If channel sensed idle transmit entire frame3 If channel sensed busy defer transmission by

1-Persistent CSMAWait until channel is quiet and transmit immediately If collision occurs wait a random time and listen again (go to 1)

Non-Persistent CSMAWait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission CSMA human analogy donrsquot interrupt others33

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

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots adapter doesnrsquot

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

Unreliable connectionless service Connectionless No handshaking between sending

and receiving adapter Unreliable receiving adapter doesnrsquot 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

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

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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

Link TypesThree 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

Wersquoll 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 timeMultiple 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

Human Analogy

Ossi Mokryn - Data link layer15

Rules for lsquoparty conversationrsquo 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

DecentralizedNo special node uses to coordinate transmission (no ldquoleaderrdquo)No synchronization of clocks or slotsFault tolerant

SimpleShould be very fast and implemented in NICs firmware

16

MAC Protocol TypesThree 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 TDMATDMA (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

Channel Partitioning MAC protocols FDMAFDMA (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

bands

time

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

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 wersquoll 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

Aloha Protocol Invented at the rsquo70s 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

Ossi Mokryn - Data link layer23

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)

Ossi Mokryn - Data link layer24

Aloha Protocol

1 Accept a new frame arrives2 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

Ossi Mokryn - Data link layer25

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

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 unitsSynchronize 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

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 synchronization30

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 donrsquot check whatrsquos

going on in the channel each acting on its own No manners

32

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit Protocol

1 Listen to the channel2 If channel sensed idle transmit entire frame3 If channel sensed busy defer transmission by

1-Persistent CSMAWait until channel is quiet and transmit immediately If collision occurs wait a random time and listen again (go to 1)

Non-Persistent CSMAWait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission CSMA human analogy donrsquot interrupt others33

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

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots adapter doesnrsquot

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

Unreliable connectionless service Connectionless No handshaking between sending

and receiving adapter Unreliable receiving adapter doesnrsquot 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

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

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Link TypesThree 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

Wersquoll 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 timeMultiple 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

Human Analogy

Ossi Mokryn - Data link layer15

Rules for lsquoparty conversationrsquo 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

DecentralizedNo special node uses to coordinate transmission (no ldquoleaderrdquo)No synchronization of clocks or slotsFault tolerant

SimpleShould be very fast and implemented in NICs firmware

16

MAC Protocol TypesThree 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 TDMATDMA (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

Channel Partitioning MAC protocols FDMAFDMA (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

bands

time

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

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 wersquoll 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

Aloha Protocol Invented at the rsquo70s 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

Ossi Mokryn - Data link layer23

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)

Ossi Mokryn - Data link layer24

Aloha Protocol

1 Accept a new frame arrives2 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

Ossi Mokryn - Data link layer25

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

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 unitsSynchronize 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

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 synchronization30

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 donrsquot check whatrsquos

going on in the channel each acting on its own No manners

32

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit Protocol

1 Listen to the channel2 If channel sensed idle transmit entire frame3 If channel sensed busy defer transmission by

1-Persistent CSMAWait until channel is quiet and transmit immediately If collision occurs wait a random time and listen again (go to 1)

Non-Persistent CSMAWait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission CSMA human analogy donrsquot interrupt others33

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

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots adapter doesnrsquot

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

Unreliable connectionless service Connectionless No handshaking between sending

and receiving adapter Unreliable receiving adapter doesnrsquot 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

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

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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 timeMultiple 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

Human Analogy

Ossi Mokryn - Data link layer15

Rules for lsquoparty conversationrsquo 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

DecentralizedNo special node uses to coordinate transmission (no ldquoleaderrdquo)No synchronization of clocks or slotsFault tolerant

SimpleShould be very fast and implemented in NICs firmware

16

MAC Protocol TypesThree 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 TDMATDMA (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

Channel Partitioning MAC protocols FDMAFDMA (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

bands

time

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

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 wersquoll 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

Aloha Protocol Invented at the rsquo70s 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

Ossi Mokryn - Data link layer23

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)

Ossi Mokryn - Data link layer24

Aloha Protocol

1 Accept a new frame arrives2 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

Ossi Mokryn - Data link layer25

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

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 unitsSynchronize 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

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 synchronization30

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 donrsquot check whatrsquos

going on in the channel each acting on its own No manners

32

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit Protocol

1 Listen to the channel2 If channel sensed idle transmit entire frame3 If channel sensed busy defer transmission by

1-Persistent CSMAWait until channel is quiet and transmit immediately If collision occurs wait a random time and listen again (go to 1)

Non-Persistent CSMAWait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission CSMA human analogy donrsquot interrupt others33

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

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots adapter doesnrsquot

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

Unreliable connectionless service Connectionless No handshaking between sending

and receiving adapter Unreliable receiving adapter doesnrsquot 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

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

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Human Analogy

Ossi Mokryn - Data link layer15

Rules for lsquoparty conversationrsquo 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

DecentralizedNo special node uses to coordinate transmission (no ldquoleaderrdquo)No synchronization of clocks or slotsFault tolerant

SimpleShould be very fast and implemented in NICs firmware

16

MAC Protocol TypesThree 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 TDMATDMA (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

Channel Partitioning MAC protocols FDMAFDMA (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

bands

time

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

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 wersquoll 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

Aloha Protocol Invented at the rsquo70s 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

Ossi Mokryn - Data link layer23

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)

Ossi Mokryn - Data link layer24

Aloha Protocol

1 Accept a new frame arrives2 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

Ossi Mokryn - Data link layer25

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

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 unitsSynchronize 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

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 synchronization30

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 donrsquot check whatrsquos

going on in the channel each acting on its own No manners

32

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit Protocol

1 Listen to the channel2 If channel sensed idle transmit entire frame3 If channel sensed busy defer transmission by

1-Persistent CSMAWait until channel is quiet and transmit immediately If collision occurs wait a random time and listen again (go to 1)

Non-Persistent CSMAWait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission CSMA human analogy donrsquot interrupt others33

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

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots adapter doesnrsquot

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

Unreliable connectionless service Connectionless No handshaking between sending

and receiving adapter Unreliable receiving adapter doesnrsquot 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

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

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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

DecentralizedNo special node uses to coordinate transmission (no ldquoleaderrdquo)No synchronization of clocks or slotsFault tolerant

SimpleShould be very fast and implemented in NICs firmware

16

MAC Protocol TypesThree 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 TDMATDMA (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

Channel Partitioning MAC protocols FDMAFDMA (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

bands

time

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

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 wersquoll 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

Aloha Protocol Invented at the rsquo70s 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

Ossi Mokryn - Data link layer23

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)

Ossi Mokryn - Data link layer24

Aloha Protocol

1 Accept a new frame arrives2 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

Ossi Mokryn - Data link layer25

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

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 unitsSynchronize 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

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 synchronization30

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 donrsquot check whatrsquos

going on in the channel each acting on its own No manners

32

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit Protocol

1 Listen to the channel2 If channel sensed idle transmit entire frame3 If channel sensed busy defer transmission by

1-Persistent CSMAWait until channel is quiet and transmit immediately If collision occurs wait a random time and listen again (go to 1)

Non-Persistent CSMAWait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission CSMA human analogy donrsquot interrupt others33

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

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots adapter doesnrsquot

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

Unreliable connectionless service Connectionless No handshaking between sending

and receiving adapter Unreliable receiving adapter doesnrsquot 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

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

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

MAC Protocol TypesThree 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 TDMATDMA (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

Channel Partitioning MAC protocols FDMAFDMA (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

bands

time

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

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 wersquoll 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

Aloha Protocol Invented at the rsquo70s 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

Ossi Mokryn - Data link layer23

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)

Ossi Mokryn - Data link layer24

Aloha Protocol

1 Accept a new frame arrives2 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

Ossi Mokryn - Data link layer25

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

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 unitsSynchronize 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

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 synchronization30

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 donrsquot check whatrsquos

going on in the channel each acting on its own No manners

32

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit Protocol

1 Listen to the channel2 If channel sensed idle transmit entire frame3 If channel sensed busy defer transmission by

1-Persistent CSMAWait until channel is quiet and transmit immediately If collision occurs wait a random time and listen again (go to 1)

Non-Persistent CSMAWait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission CSMA human analogy donrsquot interrupt others33

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

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots adapter doesnrsquot

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

Unreliable connectionless service Connectionless No handshaking between sending

and receiving adapter Unreliable receiving adapter doesnrsquot 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

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

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Channel Partitioning MAC protocols TDMATDMA (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

Channel Partitioning MAC protocols FDMAFDMA (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

bands

time

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

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 wersquoll 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

Aloha Protocol Invented at the rsquo70s 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

Ossi Mokryn - Data link layer23

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)

Ossi Mokryn - Data link layer24

Aloha Protocol

1 Accept a new frame arrives2 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

Ossi Mokryn - Data link layer25

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

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 unitsSynchronize 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

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 synchronization30

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 donrsquot check whatrsquos

going on in the channel each acting on its own No manners

32

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit Protocol

1 Listen to the channel2 If channel sensed idle transmit entire frame3 If channel sensed busy defer transmission by

1-Persistent CSMAWait until channel is quiet and transmit immediately If collision occurs wait a random time and listen again (go to 1)

Non-Persistent CSMAWait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission CSMA human analogy donrsquot interrupt others33

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

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots adapter doesnrsquot

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

Unreliable connectionless service Connectionless No handshaking between sending

and receiving adapter Unreliable receiving adapter doesnrsquot 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

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

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Channel Partitioning MAC protocols FDMAFDMA (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

bands

time

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

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 wersquoll 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

Aloha Protocol Invented at the rsquo70s 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

Ossi Mokryn - Data link layer23

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)

Ossi Mokryn - Data link layer24

Aloha Protocol

1 Accept a new frame arrives2 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

Ossi Mokryn - Data link layer25

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

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 unitsSynchronize 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

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 synchronization30

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 donrsquot check whatrsquos

going on in the channel each acting on its own No manners

32

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit Protocol

1 Listen to the channel2 If channel sensed idle transmit entire frame3 If channel sensed busy defer transmission by

1-Persistent CSMAWait until channel is quiet and transmit immediately If collision occurs wait a random time and listen again (go to 1)

Non-Persistent CSMAWait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission CSMA human analogy donrsquot interrupt others33

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

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots adapter doesnrsquot

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

Unreliable connectionless service Connectionless No handshaking between sending

and receiving adapter Unreliable receiving adapter doesnrsquot 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

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

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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

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 wersquoll 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

Aloha Protocol Invented at the rsquo70s 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

Ossi Mokryn - Data link layer23

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)

Ossi Mokryn - Data link layer24

Aloha Protocol

1 Accept a new frame arrives2 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

Ossi Mokryn - Data link layer25

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

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 unitsSynchronize 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

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 synchronization30

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 donrsquot check whatrsquos

going on in the channel each acting on its own No manners

32

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit Protocol

1 Listen to the channel2 If channel sensed idle transmit entire frame3 If channel sensed busy defer transmission by

1-Persistent CSMAWait until channel is quiet and transmit immediately If collision occurs wait a random time and listen again (go to 1)

Non-Persistent CSMAWait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission CSMA human analogy donrsquot interrupt others33

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

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots adapter doesnrsquot

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

Unreliable connectionless service Connectionless No handshaking between sending

and receiving adapter Unreliable receiving adapter doesnrsquot 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

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

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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 wersquoll 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

Aloha Protocol Invented at the rsquo70s 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

Ossi Mokryn - Data link layer23

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)

Ossi Mokryn - Data link layer24

Aloha Protocol

1 Accept a new frame arrives2 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

Ossi Mokryn - Data link layer25

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

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 unitsSynchronize 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

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 synchronization30

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 donrsquot check whatrsquos

going on in the channel each acting on its own No manners

32

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit Protocol

1 Listen to the channel2 If channel sensed idle transmit entire frame3 If channel sensed busy defer transmission by

1-Persistent CSMAWait until channel is quiet and transmit immediately If collision occurs wait a random time and listen again (go to 1)

Non-Persistent CSMAWait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission CSMA human analogy donrsquot interrupt others33

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

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots adapter doesnrsquot

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

Unreliable connectionless service Connectionless No handshaking between sending

and receiving adapter Unreliable receiving adapter doesnrsquot 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

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

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Random Access MAC Protocols From here on wersquoll 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

Aloha Protocol Invented at the rsquo70s 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

Ossi Mokryn - Data link layer23

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)

Ossi Mokryn - Data link layer24

Aloha Protocol

1 Accept a new frame arrives2 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

Ossi Mokryn - Data link layer25

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

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 unitsSynchronize 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

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 synchronization30

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 donrsquot check whatrsquos

going on in the channel each acting on its own No manners

32

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit Protocol

1 Listen to the channel2 If channel sensed idle transmit entire frame3 If channel sensed busy defer transmission by

1-Persistent CSMAWait until channel is quiet and transmit immediately If collision occurs wait a random time and listen again (go to 1)

Non-Persistent CSMAWait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission CSMA human analogy donrsquot interrupt others33

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

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots adapter doesnrsquot

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

Unreliable connectionless service Connectionless No handshaking between sending

and receiving adapter Unreliable receiving adapter doesnrsquot 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

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

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Aloha Protocol Invented at the rsquo70s 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

Ossi Mokryn - Data link layer23

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)

Ossi Mokryn - Data link layer24

Aloha Protocol

1 Accept a new frame arrives2 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

Ossi Mokryn - Data link layer25

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

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 unitsSynchronize 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

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 synchronization30

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 donrsquot check whatrsquos

going on in the channel each acting on its own No manners

32

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit Protocol

1 Listen to the channel2 If channel sensed idle transmit entire frame3 If channel sensed busy defer transmission by

1-Persistent CSMAWait until channel is quiet and transmit immediately If collision occurs wait a random time and listen again (go to 1)

Non-Persistent CSMAWait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission CSMA human analogy donrsquot interrupt others33

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

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots adapter doesnrsquot

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

Unreliable connectionless service Connectionless No handshaking between sending

and receiving adapter Unreliable receiving adapter doesnrsquot 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

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

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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)

Ossi Mokryn - Data link layer24

Aloha Protocol

1 Accept a new frame arrives2 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

Ossi Mokryn - Data link layer25

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

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 unitsSynchronize 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

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 synchronization30

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 donrsquot check whatrsquos

going on in the channel each acting on its own No manners

32

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit Protocol

1 Listen to the channel2 If channel sensed idle transmit entire frame3 If channel sensed busy defer transmission by

1-Persistent CSMAWait until channel is quiet and transmit immediately If collision occurs wait a random time and listen again (go to 1)

Non-Persistent CSMAWait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission CSMA human analogy donrsquot interrupt others33

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

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots adapter doesnrsquot

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

Unreliable connectionless service Connectionless No handshaking between sending

and receiving adapter Unreliable receiving adapter doesnrsquot 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

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

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Aloha Protocol

1 Accept a new frame arrives2 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

Ossi Mokryn - Data link layer25

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

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 unitsSynchronize 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

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 synchronization30

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 donrsquot check whatrsquos

going on in the channel each acting on its own No manners

32

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit Protocol

1 Listen to the channel2 If channel sensed idle transmit entire frame3 If channel sensed busy defer transmission by

1-Persistent CSMAWait until channel is quiet and transmit immediately If collision occurs wait a random time and listen again (go to 1)

Non-Persistent CSMAWait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission CSMA human analogy donrsquot interrupt others33

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

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots adapter doesnrsquot

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

Unreliable connectionless service Connectionless No handshaking between sending

and receiving adapter Unreliable receiving adapter doesnrsquot 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

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

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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

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 unitsSynchronize 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

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 synchronization30

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 donrsquot check whatrsquos

going on in the channel each acting on its own No manners

32

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit Protocol

1 Listen to the channel2 If channel sensed idle transmit entire frame3 If channel sensed busy defer transmission by

1-Persistent CSMAWait until channel is quiet and transmit immediately If collision occurs wait a random time and listen again (go to 1)

Non-Persistent CSMAWait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission CSMA human analogy donrsquot interrupt others33

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

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots adapter doesnrsquot

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

Unreliable connectionless service Connectionless No handshaking between sending

and receiving adapter Unreliable receiving adapter doesnrsquot 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

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

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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 unitsSynchronize 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

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 synchronization30

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 donrsquot check whatrsquos

going on in the channel each acting on its own No manners

32

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit Protocol

1 Listen to the channel2 If channel sensed idle transmit entire frame3 If channel sensed busy defer transmission by

1-Persistent CSMAWait until channel is quiet and transmit immediately If collision occurs wait a random time and listen again (go to 1)

Non-Persistent CSMAWait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission CSMA human analogy donrsquot interrupt others33

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

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots adapter doesnrsquot

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

Unreliable connectionless service Connectionless No handshaking between sending

and receiving adapter Unreliable receiving adapter doesnrsquot 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

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

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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 unitsSynchronize 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

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 synchronization30

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 donrsquot check whatrsquos

going on in the channel each acting on its own No manners

32

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit Protocol

1 Listen to the channel2 If channel sensed idle transmit entire frame3 If channel sensed busy defer transmission by

1-Persistent CSMAWait until channel is quiet and transmit immediately If collision occurs wait a random time and listen again (go to 1)

Non-Persistent CSMAWait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission CSMA human analogy donrsquot interrupt others33

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

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots adapter doesnrsquot

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

Unreliable connectionless service Connectionless No handshaking between sending

and receiving adapter Unreliable receiving adapter doesnrsquot 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

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

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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 synchronization30

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 donrsquot check whatrsquos

going on in the channel each acting on its own No manners

32

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit Protocol

1 Listen to the channel2 If channel sensed idle transmit entire frame3 If channel sensed busy defer transmission by

1-Persistent CSMAWait until channel is quiet and transmit immediately If collision occurs wait a random time and listen again (go to 1)

Non-Persistent CSMAWait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission CSMA human analogy donrsquot interrupt others33

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

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots adapter doesnrsquot

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

Unreliable connectionless service Connectionless No handshaking between sending

and receiving adapter Unreliable receiving adapter doesnrsquot 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

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

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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 synchronization30

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 donrsquot check whatrsquos

going on in the channel each acting on its own No manners

32

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit Protocol

1 Listen to the channel2 If channel sensed idle transmit entire frame3 If channel sensed busy defer transmission by

1-Persistent CSMAWait until channel is quiet and transmit immediately If collision occurs wait a random time and listen again (go to 1)

Non-Persistent CSMAWait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission CSMA human analogy donrsquot interrupt others33

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

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots adapter doesnrsquot

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

Unreliable connectionless service Connectionless No handshaking between sending

and receiving adapter Unreliable receiving adapter doesnrsquot 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

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

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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 donrsquot check whatrsquos

going on in the channel each acting on its own No manners

32

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit Protocol

1 Listen to the channel2 If channel sensed idle transmit entire frame3 If channel sensed busy defer transmission by

1-Persistent CSMAWait until channel is quiet and transmit immediately If collision occurs wait a random time and listen again (go to 1)

Non-Persistent CSMAWait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission CSMA human analogy donrsquot interrupt others33

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

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots adapter doesnrsquot

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

Unreliable connectionless service Connectionless No handshaking between sending

and receiving adapter Unreliable receiving adapter doesnrsquot 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

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

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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 donrsquot check whatrsquos

going on in the channel each acting on its own No manners

32

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit Protocol

1 Listen to the channel2 If channel sensed idle transmit entire frame3 If channel sensed busy defer transmission by

1-Persistent CSMAWait until channel is quiet and transmit immediately If collision occurs wait a random time and listen again (go to 1)

Non-Persistent CSMAWait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission CSMA human analogy donrsquot interrupt others33

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

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots adapter doesnrsquot

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

Unreliable connectionless service Connectionless No handshaking between sending

and receiving adapter Unreliable receiving adapter doesnrsquot 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

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

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit Protocol

1 Listen to the channel2 If channel sensed idle transmit entire frame3 If channel sensed busy defer transmission by

1-Persistent CSMAWait until channel is quiet and transmit immediately If collision occurs wait a random time and listen again (go to 1)

Non-Persistent CSMAWait a random time and listen again (go to 1)

They differ only by the treatment of 1st transmission CSMA human analogy donrsquot interrupt others33

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

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots adapter doesnrsquot

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

Unreliable connectionless service Connectionless No handshaking between sending

and receiving adapter Unreliable receiving adapter doesnrsquot 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

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

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots adapter doesnrsquot

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

Unreliable connectionless service Connectionless No handshaking between sending

and receiving adapter Unreliable receiving adapter doesnrsquot 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

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

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

CSMACD Minimum Packet Size

35

Ethernet uses CSMACD

No slots adapter doesnrsquot

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

Unreliable connectionless service Connectionless No handshaking between sending

and receiving adapter Unreliable receiving adapter doesnrsquot 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

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

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Ethernet uses CSMACD

No slots adapter doesnrsquot

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

Unreliable connectionless service Connectionless No handshaking between sending

and receiving adapter Unreliable receiving adapter doesnrsquot 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

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

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Unreliable connectionless service Connectionless No handshaking between sending

and receiving adapter Unreliable receiving adapter doesnrsquot 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

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

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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

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

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 47: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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 Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 48: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

ARP protocol Same LAN (network) A wants to send datagram

to B and Brsquos MAC address not in Arsquos 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 Arsquos 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

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 49: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos 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 Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 50: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Ossi Mokryn - Data link layer

A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

A

RB

50

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 51: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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 Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 52: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Ethernet topology Through the Years

Classic Ethernet Now star topology Now star topology prevailsprevails

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

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 53: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 54: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 55: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 56: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 57: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 58: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 59: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

HubsQ Why 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

Ossi Mokryn - Data link layer59

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 60: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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

Canrsquot interconnect 10BaseT amp 100BaseT (because segments donrsquot share the same rate)

Hubs can be arranged in a hierarchy (or multi-tier design) with backbone hub at its top

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 61: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Lecture 361

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)

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 62: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Lecture 362

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

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 63: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Lecture 363

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)

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 64: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Lecture 364

Bridge Operation

bridge procedure(in_MAC in_portout_MAC)lookup in filtering table (out_MAC) receive out_portif (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

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 65: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Lecture 365

Bridge Learning exampleSuppose 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

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 66: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Lecture 366

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 selectively

forwards frame out via interface 1

C 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 67: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Lecture 367

What will happen with loopsIncorrect learning

A

B

1 1

22

A 1 A 122

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 68: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Lecture 368

What will happen with loopsFrame looping

A

C

1 1

22

C C

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 69: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Lecture 369

What will happen with loopsFrame looping

A

B

1 1

22

B2 B1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 70: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Lecture 370

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)

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 71: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 72: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Lecture 372

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

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 73: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Lecture 373

Spanning Tree ConceptsRoot 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

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 74: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Lecture 374

Spanning Tree ConceptsPath 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

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 75: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Lecture 375

Spanning Tree ConceptsRoot 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

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 76: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Lecture 376

Spanning Tree ConceptsRoot 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

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 77: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Lecture 377

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

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 78: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Lecture 378

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 designated bridge

B8

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 79: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Lecture 379

Example Spanning Tree

B3

B5

B7B2

B1

B6 B4

Root

B8

B2 B4 B5 B7

B8

B1

Spanning Tree

Designated Bridge

root port

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 80: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Lecture 380

Spanning Tree AlgorithmAn 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

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 81: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Lecture 381

Spanning Tree AlgorithmSelecting 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)

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 82: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Lecture 382

Spanning Tree AlgorithmSelecting 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

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 83: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Lecture 383

Spanning Tree AlgorithmSelect 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)

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 84: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Lecture 384

ForwardingBlocking State Root and designated bridges will forward

frames to and from their attached LANs All other ports are in the blocking state

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 85: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Lecture 385

Ethernet Switches

layer 2 (frame) forwarding filtering using LAN addresses

Switching A-to-B and Arsquo-to-Brsquo simultaneously no collisions

large number of interfaces often individual hosts star-

connected into switch Ethernet but no collisions

Confused with Ethernet bridgeshellip

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 86: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Lecture 386

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

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 87: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Lecture 387

Ethernet Switches (more)

Dedicated

Shared

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 88: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

Summary comparison

hubs routers Bridges

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

5-88

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

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 89: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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

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 90: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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

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 91: Link Layer and LANs Ossi Mokryn and Irad Ratmansky, Based on Slides from the Top Down Approach book 1

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