99
Computer Computer Networking Networking A Top-Down Approach Featuring the Internet 计计计计计 - 计计计计计计计 Internet 计计 Chapter5 The Link Layer and Local Area Networks

Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

Embed Size (px)

Citation preview

Page 1: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

Computer NetworkingComputer Networking A Top-Down Approach Featuring the Internet

计算机网络 - 自顶向下方法与 Internet 特色

Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology22

Chapter Goals

understand principlesprinciples behind data link layer serviceserror detectionerror detection amp correctioncorrectionsharing a broadcast channel multiplemultiple accessaccesslink layer addressingaddressingreliable data transfer flow control donedone

implementation of various link layer technologiesEthernetEthernet broadcast channelPPPPPP point to point channel

School of Computer Science amp Technology33

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology44

A link-layer protocol is used to move a datagram over an individualindividual linkLinksLinks

communication channelscommunication channels that connect adjacent nodes

The PDU PDU of a link-layer protocol is called FrameFrame

ldquo linkrdquo

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

1 Link Layer Services

School of Computer Science amp Technology55

Datagrams may be transferred by differentdifferent linklink protocolsprotocols over different linksdifferent links

eg EthernetEthernet on first link frameframe relayrelay on intermediate links 8021180211 on the last link

Different link protocol may provide differentdifferent servicesservices

eg may or may not provide rdt (reliable data transfer) over a link

1 Link Layer Services

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology66

1 Link Layer Services

Possible Services

FramingFraming

Link AccessLink Access

Reliable deliveryReliable delivery

Flow ControlFlow Control

Error detection and correctionError detection and correction

HalfFull duplexHalfFull duplex

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology77

FramingFramingencapsulate a datagramdatagram into a frameframe adding

headerheader and trailertrailerThe structurestructure of a the frameframe is specified by

the link layer protocolLinkLink AccessAccess

How to share a medium Medium Access ControlMedium Access Control (MACMAC) protocol serves to

coordinate the frame transmission of the many nodes

1 Link Layer Services

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology88

ReliableReliable deliverydelivery between adjacentadjacent nodesUsing ack ack and retransmissionretransmission as TCP

we have learned how to do this already

seldom used on low bit error link Such as fiber some twisted pair media

wireless links high error rates

Q why both link-levellink-level and end-endend-end reliability

1 Link Layer Services

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology99

Flow ControlFlow Control pacingpacing adjacent sending and receiving nodes

Error Detection and Correction Error Detection and Correction errors caused by signal attenuationattenuation noisenoise receiver detectsdetects presence of errors

informsinforms sender for retransmission or dropsdrops frame receiver identifiesidentifies and correctscorrects bit error (s) without

resorting to retransmission

Full-duplex Half-duplex SimplexFull-duplex Half-duplex Simplexwith half duplexhalf duplex nodes at both ends of a link can

transmit but notnot at same time

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

1 Link Layer Services

School of Computer Science amp Technology1010

link layer protocol implementedimplemented in an adapteradapter

aka Network Interface Card (NICNIC)

Ethernet card PCMCIA card 80211 card

sendingnode

frame

rcvingnode

datagram

frame

adapter adapter

link layer protocol

2 Adapters Communicating

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology1111

sending sidesending sideencapsulates datagramdatagram in a frameframeaddsadds errorerror checkingchecking bits rdtrdt flowflow controlcontrol etc

receiving sidereceiving sidecheckingchecking errorserrors rdtrdt flowflow controlcontrol etcextractsextracts datagram from frame and passespasses it to receiving node

sendingnode

frame

rcvingnode

datagram

frame

adapter adapter

link layer protocol

2 Adapters Communicating

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology1212

2 Adapters Communicating

adapter is a semi-autonomous semi-autonomous system

It can receivereceive a frame checkcheck errorserrors and discarddiscard the corrupted frames withoutwithout notifying other componentsIt interruptsinterrupts the parent node onlyonly ifif it wants to pass

datagram up the protocol stack

The parent node fullyfully delegateddelegated to the adapter the task of transmitting the datagram across the link

The adapter is typically housedhoused in the box as the rest of the node

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology1414

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology1515

EDCEDC= ErrorError DetectionDetection and CorrectionCorrection bits (redundancy)

D D = Data protected by error checking may include header fields

bull Error detection not 100 reliable

bull protocol may miss some errors but rarely

bull larger EDC field yields better detection and correction

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

Error Detection and Correction

School of Computer Science amp Technology1616

Error-Detection amp -Correction Techniques

Parity Checks

Internet Checksumming

Cyclic redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology1717

1Single Bit Parity Single Bit Parity Detect single bit errors

- Can detect odd number bits errorodd number bits error

even

odd

1 Parity Checks

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

1

School of Computer Science amp Technology1818

22 Two Dimensional Bit ParityTwo Dimensional Bit Parity - can detectdetect single bit errors - can correct correct single bit errors

0 0

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

1 Parity Checks

School of Computer Science amp Technology1919

FECFEC The ability of the receiverreceiver to both detectdetect and correctcorrect errors

0 0

1 Parity Checks

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2020

Sendertreat segmentsegment contents as sequencesequence of 16-bit 16-bit

integersintegerschecksumchecksum addition (1rsquos complement sum) of

segment contentssender puts checksumchecksum value into checksumchecksum field

Receiverthe sum of the received data (including the

checksum) = all 1 bitsNO -NO - error detectedYESYES - no error detected

2 Internet Checksum

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2121

Checksumming Checksumming methods require require relatively littlelittle overhead but provideprovide relatively weakweak protection against errors

Why is checksummingchecksumming used at the transporttransport layerTransport layer is typically implemented in

softsoft in a host as a part of OSOS

2 Checksumming

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2222

The data (DD) ) are viewed as a d-bit d-bit binary number

The SenderSender chooses rr additional bits (R CRC bitsR CRC bits) and appends them to the DD such that d+r d+r bits is exactly divisible by GG using modulo-2 modulo-2 arithmetic Sender and receiver both know the (r+1)-bitr+1)-bit generator (G)(G)

The receiver receiver divides (d+r)-bit(d+r)-bit (DRDR) by G G If non-zeronon-zero remainder error detectederror detected

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2323

Modulo-2 algorithmNo addition carriesaddition carries

No subtraction borrows subtraction borrows The addition (+)addition (+) and the subtraction (-)subtraction (-) are identical identical

and both are equivalentare equivalent to the bitwisebitwise exclusive-orexclusive-or (XORXOR)

For example1011 XOR 0101 = 1110

1011 mdash 0101 = 1110

1011 + 0101 = 1110

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2424

How the Sender computes the How the Sender computes the RRWant Want DD22rr XOR RR = nGnG

equivalentlyequivalently DD22rr XOR RR XOR RR = nG nG XOR RR

DD22rr = nG nG XOR RR

equivalentlyequivalently if we divide D2r by G want remainderremainder R

R = remainder[ ]

D2r

G

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

School of Computer Science amp Technology2525

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

ExampleExampleDD=101110 GG = 1001rr =3 and TT

(D000D000)=101110000000TT (DRDR)=101110011011

CRC can detect all burst errors less thanless than r+1 bits r+1 bitsCRC-32( international standard ) =100000100110000010001110110110111

School of Computer Science amp Technology2626

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology2727

Two types of linkslinkspoint-to-pointpoint-to-point

Only Only a sender and a receivera receiver sits at each end PPP for dial-up access

broadcast (shared wire or medium)broadcast (shared wire or medium)Many Many senders and receivers shareshare the link

traditional EthernetWLANUpstream of HFC

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2828

single shared broadcast channel two or more simultaneoussimultaneous transmissions by

nodes will cause interference CollisionCollision-if node receives twotwo oror moremore

signals at the same time

Multiple Access ProblemHow to coordinatecoordinate the access of a

sharedshared broadcastbroadcast channelchannel

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2929

multiple access protocolmultiple access protocoldistributed algorithmdistributed algorithm that determines how

nodes share the channel ie determine whenwhen and whichwhich node can transmit

communication about channel sharing must use channel itself

no out-of-bandout-of-band channel for coordination

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3030

The requirements to multiple access multiple access protocolprotocol for a broadcast channelbroadcast channel of rate RR bpsWhen one node can transmit it send at rate RRWhen M M nodes want to transmit over the channel

each can send at average rate RMRM bpsFully decentralized

no special nodespecial node to coordinate transmissionsno synchronizationsynchronization of clocks slots

Simple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3131

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code)

allocate piece to node for exclusive useRandom AccessRandom Access

channel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3232

TDM (Time Division MultiplexingTime Division Multiplexing)Time divided into FramesFrames and further divides each

Frame into N slotsslots each slot is then assigned to one of the N N nodes

Nodes access to channel in rounds unused slots go idleidle

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3333

TDMA eliminates collisions collisions and is perfectly fairfair but has two drawbacksdrawbacks

each node gets a dedicateddedicated transmission rate of RNRN and the average rate is limited to RNRN

a node mustmust always wait for its turnwait for its turn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

11 TDMA

School of Computer Science amp Technology3434

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

The spectrumspectrum is divided into frequencyfrequency bandsbandseach station assigned fixedfixed frequency bandunused transmission time in each frequency

bands goes idleidle

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3535

advantagesadvantages and drawbacksdrawbacks

can avoids collisionscollisions

shareshare the channel fairlyfairly

a node is limitedlimited to a bandwidthbandwidth of RNRN

a node needneed notnot waitswaits forfor its turnturn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

12 FDMA

frequ

ency

bands

time

School of Computer Science amp Technology3636

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)Assign a different codecode to each node

Each node encodesencodes the data bits using its unique code

Different nodes can transmit simultaneously

Usually used in military systems in early time

Details discussed in wireless networking of Advanced Advanced Computer NetworksComputer Networks

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3737

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Accesschannel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3838

When a node has a packet to send it transmit the packet at fullfull channelchannel datadata raterate R R bpsno a prioripriori coordination coordination among nodes

may cause collisioncollision

Each node involved in the collision repeatedlyrepeatedly retransmitsretransmits its packet until the packet gets through withoutwithout anyany collisioncollisiona node waits some time choosed randomly randomly

before retransmission

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology3939

random access protocol specifies how to detect collisionshow to recover from collisions

Examples of random access protocolsslottedslotted ALOHAALOHA

Pure ALOHAPure ALOHA

CSMACSMA CSMACDCSMACD CSMACACSMACA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology4040

Assumptionsall framesframes have same sizesame size L bitstimetime is divided into equal size slotsequal size slots

time to transmit 1 frame LR

nodes start to transmit frames onlyonly at beginningbeginning of slotsslotsnodes are synchronizedsynchronized

if there 2 or more2 or more nodes transmitting in a slot all nodes can detectdetect the collisioncollision

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4141

Operationwhen node obtains fresh framefresh frame it transmits

in the next slotnext slotIf there is not a collisioncollision node can send new new

frameframe in next slotnext slotThe sending node can detect the collision before

the end of the slot

If there is a collision collision node retransmitsretransmits frame in each subsequentsubsequent slotslot with probability pp until successsuccess

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4242

Advantages single active nodesingle active node can continuously transmit at fullfull

raterate of channelhighly decentralized only slots in nodesnodes needneed to be to be

inin synchronizationsynchronizationsimplesimple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 2: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology22

Chapter Goals

understand principlesprinciples behind data link layer serviceserror detectionerror detection amp correctioncorrectionsharing a broadcast channel multiplemultiple accessaccesslink layer addressingaddressingreliable data transfer flow control donedone

implementation of various link layer technologiesEthernetEthernet broadcast channelPPPPPP point to point channel

School of Computer Science amp Technology33

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology44

A link-layer protocol is used to move a datagram over an individualindividual linkLinksLinks

communication channelscommunication channels that connect adjacent nodes

The PDU PDU of a link-layer protocol is called FrameFrame

ldquo linkrdquo

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

1 Link Layer Services

School of Computer Science amp Technology55

Datagrams may be transferred by differentdifferent linklink protocolsprotocols over different linksdifferent links

eg EthernetEthernet on first link frameframe relayrelay on intermediate links 8021180211 on the last link

Different link protocol may provide differentdifferent servicesservices

eg may or may not provide rdt (reliable data transfer) over a link

1 Link Layer Services

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology66

1 Link Layer Services

Possible Services

FramingFraming

Link AccessLink Access

Reliable deliveryReliable delivery

Flow ControlFlow Control

Error detection and correctionError detection and correction

HalfFull duplexHalfFull duplex

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology77

FramingFramingencapsulate a datagramdatagram into a frameframe adding

headerheader and trailertrailerThe structurestructure of a the frameframe is specified by

the link layer protocolLinkLink AccessAccess

How to share a medium Medium Access ControlMedium Access Control (MACMAC) protocol serves to

coordinate the frame transmission of the many nodes

1 Link Layer Services

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology88

ReliableReliable deliverydelivery between adjacentadjacent nodesUsing ack ack and retransmissionretransmission as TCP

we have learned how to do this already

seldom used on low bit error link Such as fiber some twisted pair media

wireless links high error rates

Q why both link-levellink-level and end-endend-end reliability

1 Link Layer Services

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology99

Flow ControlFlow Control pacingpacing adjacent sending and receiving nodes

Error Detection and Correction Error Detection and Correction errors caused by signal attenuationattenuation noisenoise receiver detectsdetects presence of errors

informsinforms sender for retransmission or dropsdrops frame receiver identifiesidentifies and correctscorrects bit error (s) without

resorting to retransmission

Full-duplex Half-duplex SimplexFull-duplex Half-duplex Simplexwith half duplexhalf duplex nodes at both ends of a link can

transmit but notnot at same time

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

1 Link Layer Services

School of Computer Science amp Technology1010

link layer protocol implementedimplemented in an adapteradapter

aka Network Interface Card (NICNIC)

Ethernet card PCMCIA card 80211 card

sendingnode

frame

rcvingnode

datagram

frame

adapter adapter

link layer protocol

2 Adapters Communicating

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology1111

sending sidesending sideencapsulates datagramdatagram in a frameframeaddsadds errorerror checkingchecking bits rdtrdt flowflow controlcontrol etc

receiving sidereceiving sidecheckingchecking errorserrors rdtrdt flowflow controlcontrol etcextractsextracts datagram from frame and passespasses it to receiving node

sendingnode

frame

rcvingnode

datagram

frame

adapter adapter

link layer protocol

2 Adapters Communicating

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology1212

2 Adapters Communicating

adapter is a semi-autonomous semi-autonomous system

It can receivereceive a frame checkcheck errorserrors and discarddiscard the corrupted frames withoutwithout notifying other componentsIt interruptsinterrupts the parent node onlyonly ifif it wants to pass

datagram up the protocol stack

The parent node fullyfully delegateddelegated to the adapter the task of transmitting the datagram across the link

The adapter is typically housedhoused in the box as the rest of the node

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology1414

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology1515

EDCEDC= ErrorError DetectionDetection and CorrectionCorrection bits (redundancy)

D D = Data protected by error checking may include header fields

bull Error detection not 100 reliable

bull protocol may miss some errors but rarely

bull larger EDC field yields better detection and correction

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

Error Detection and Correction

School of Computer Science amp Technology1616

Error-Detection amp -Correction Techniques

Parity Checks

Internet Checksumming

Cyclic redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology1717

1Single Bit Parity Single Bit Parity Detect single bit errors

- Can detect odd number bits errorodd number bits error

even

odd

1 Parity Checks

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

1

School of Computer Science amp Technology1818

22 Two Dimensional Bit ParityTwo Dimensional Bit Parity - can detectdetect single bit errors - can correct correct single bit errors

0 0

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

1 Parity Checks

School of Computer Science amp Technology1919

FECFEC The ability of the receiverreceiver to both detectdetect and correctcorrect errors

0 0

1 Parity Checks

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2020

Sendertreat segmentsegment contents as sequencesequence of 16-bit 16-bit

integersintegerschecksumchecksum addition (1rsquos complement sum) of

segment contentssender puts checksumchecksum value into checksumchecksum field

Receiverthe sum of the received data (including the

checksum) = all 1 bitsNO -NO - error detectedYESYES - no error detected

2 Internet Checksum

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2121

Checksumming Checksumming methods require require relatively littlelittle overhead but provideprovide relatively weakweak protection against errors

Why is checksummingchecksumming used at the transporttransport layerTransport layer is typically implemented in

softsoft in a host as a part of OSOS

2 Checksumming

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2222

The data (DD) ) are viewed as a d-bit d-bit binary number

The SenderSender chooses rr additional bits (R CRC bitsR CRC bits) and appends them to the DD such that d+r d+r bits is exactly divisible by GG using modulo-2 modulo-2 arithmetic Sender and receiver both know the (r+1)-bitr+1)-bit generator (G)(G)

The receiver receiver divides (d+r)-bit(d+r)-bit (DRDR) by G G If non-zeronon-zero remainder error detectederror detected

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2323

Modulo-2 algorithmNo addition carriesaddition carries

No subtraction borrows subtraction borrows The addition (+)addition (+) and the subtraction (-)subtraction (-) are identical identical

and both are equivalentare equivalent to the bitwisebitwise exclusive-orexclusive-or (XORXOR)

For example1011 XOR 0101 = 1110

1011 mdash 0101 = 1110

1011 + 0101 = 1110

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2424

How the Sender computes the How the Sender computes the RRWant Want DD22rr XOR RR = nGnG

equivalentlyequivalently DD22rr XOR RR XOR RR = nG nG XOR RR

DD22rr = nG nG XOR RR

equivalentlyequivalently if we divide D2r by G want remainderremainder R

R = remainder[ ]

D2r

G

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

School of Computer Science amp Technology2525

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

ExampleExampleDD=101110 GG = 1001rr =3 and TT

(D000D000)=101110000000TT (DRDR)=101110011011

CRC can detect all burst errors less thanless than r+1 bits r+1 bitsCRC-32( international standard ) =100000100110000010001110110110111

School of Computer Science amp Technology2626

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology2727

Two types of linkslinkspoint-to-pointpoint-to-point

Only Only a sender and a receivera receiver sits at each end PPP for dial-up access

broadcast (shared wire or medium)broadcast (shared wire or medium)Many Many senders and receivers shareshare the link

traditional EthernetWLANUpstream of HFC

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2828

single shared broadcast channel two or more simultaneoussimultaneous transmissions by

nodes will cause interference CollisionCollision-if node receives twotwo oror moremore

signals at the same time

Multiple Access ProblemHow to coordinatecoordinate the access of a

sharedshared broadcastbroadcast channelchannel

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2929

multiple access protocolmultiple access protocoldistributed algorithmdistributed algorithm that determines how

nodes share the channel ie determine whenwhen and whichwhich node can transmit

communication about channel sharing must use channel itself

no out-of-bandout-of-band channel for coordination

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3030

The requirements to multiple access multiple access protocolprotocol for a broadcast channelbroadcast channel of rate RR bpsWhen one node can transmit it send at rate RRWhen M M nodes want to transmit over the channel

each can send at average rate RMRM bpsFully decentralized

no special nodespecial node to coordinate transmissionsno synchronizationsynchronization of clocks slots

Simple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3131

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code)

allocate piece to node for exclusive useRandom AccessRandom Access

channel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3232

TDM (Time Division MultiplexingTime Division Multiplexing)Time divided into FramesFrames and further divides each

Frame into N slotsslots each slot is then assigned to one of the N N nodes

Nodes access to channel in rounds unused slots go idleidle

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3333

TDMA eliminates collisions collisions and is perfectly fairfair but has two drawbacksdrawbacks

each node gets a dedicateddedicated transmission rate of RNRN and the average rate is limited to RNRN

a node mustmust always wait for its turnwait for its turn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

11 TDMA

School of Computer Science amp Technology3434

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

The spectrumspectrum is divided into frequencyfrequency bandsbandseach station assigned fixedfixed frequency bandunused transmission time in each frequency

bands goes idleidle

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3535

advantagesadvantages and drawbacksdrawbacks

can avoids collisionscollisions

shareshare the channel fairlyfairly

a node is limitedlimited to a bandwidthbandwidth of RNRN

a node needneed notnot waitswaits forfor its turnturn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

12 FDMA

frequ

ency

bands

time

School of Computer Science amp Technology3636

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)Assign a different codecode to each node

Each node encodesencodes the data bits using its unique code

Different nodes can transmit simultaneously

Usually used in military systems in early time

Details discussed in wireless networking of Advanced Advanced Computer NetworksComputer Networks

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3737

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Accesschannel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3838

When a node has a packet to send it transmit the packet at fullfull channelchannel datadata raterate R R bpsno a prioripriori coordination coordination among nodes

may cause collisioncollision

Each node involved in the collision repeatedlyrepeatedly retransmitsretransmits its packet until the packet gets through withoutwithout anyany collisioncollisiona node waits some time choosed randomly randomly

before retransmission

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology3939

random access protocol specifies how to detect collisionshow to recover from collisions

Examples of random access protocolsslottedslotted ALOHAALOHA

Pure ALOHAPure ALOHA

CSMACSMA CSMACDCSMACD CSMACACSMACA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology4040

Assumptionsall framesframes have same sizesame size L bitstimetime is divided into equal size slotsequal size slots

time to transmit 1 frame LR

nodes start to transmit frames onlyonly at beginningbeginning of slotsslotsnodes are synchronizedsynchronized

if there 2 or more2 or more nodes transmitting in a slot all nodes can detectdetect the collisioncollision

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4141

Operationwhen node obtains fresh framefresh frame it transmits

in the next slotnext slotIf there is not a collisioncollision node can send new new

frameframe in next slotnext slotThe sending node can detect the collision before

the end of the slot

If there is a collision collision node retransmitsretransmits frame in each subsequentsubsequent slotslot with probability pp until successsuccess

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4242

Advantages single active nodesingle active node can continuously transmit at fullfull

raterate of channelhighly decentralized only slots in nodesnodes needneed to be to be

inin synchronizationsynchronizationsimplesimple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 3: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology33

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology44

A link-layer protocol is used to move a datagram over an individualindividual linkLinksLinks

communication channelscommunication channels that connect adjacent nodes

The PDU PDU of a link-layer protocol is called FrameFrame

ldquo linkrdquo

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

1 Link Layer Services

School of Computer Science amp Technology55

Datagrams may be transferred by differentdifferent linklink protocolsprotocols over different linksdifferent links

eg EthernetEthernet on first link frameframe relayrelay on intermediate links 8021180211 on the last link

Different link protocol may provide differentdifferent servicesservices

eg may or may not provide rdt (reliable data transfer) over a link

1 Link Layer Services

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology66

1 Link Layer Services

Possible Services

FramingFraming

Link AccessLink Access

Reliable deliveryReliable delivery

Flow ControlFlow Control

Error detection and correctionError detection and correction

HalfFull duplexHalfFull duplex

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology77

FramingFramingencapsulate a datagramdatagram into a frameframe adding

headerheader and trailertrailerThe structurestructure of a the frameframe is specified by

the link layer protocolLinkLink AccessAccess

How to share a medium Medium Access ControlMedium Access Control (MACMAC) protocol serves to

coordinate the frame transmission of the many nodes

1 Link Layer Services

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology88

ReliableReliable deliverydelivery between adjacentadjacent nodesUsing ack ack and retransmissionretransmission as TCP

we have learned how to do this already

seldom used on low bit error link Such as fiber some twisted pair media

wireless links high error rates

Q why both link-levellink-level and end-endend-end reliability

1 Link Layer Services

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology99

Flow ControlFlow Control pacingpacing adjacent sending and receiving nodes

Error Detection and Correction Error Detection and Correction errors caused by signal attenuationattenuation noisenoise receiver detectsdetects presence of errors

informsinforms sender for retransmission or dropsdrops frame receiver identifiesidentifies and correctscorrects bit error (s) without

resorting to retransmission

Full-duplex Half-duplex SimplexFull-duplex Half-duplex Simplexwith half duplexhalf duplex nodes at both ends of a link can

transmit but notnot at same time

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

1 Link Layer Services

School of Computer Science amp Technology1010

link layer protocol implementedimplemented in an adapteradapter

aka Network Interface Card (NICNIC)

Ethernet card PCMCIA card 80211 card

sendingnode

frame

rcvingnode

datagram

frame

adapter adapter

link layer protocol

2 Adapters Communicating

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology1111

sending sidesending sideencapsulates datagramdatagram in a frameframeaddsadds errorerror checkingchecking bits rdtrdt flowflow controlcontrol etc

receiving sidereceiving sidecheckingchecking errorserrors rdtrdt flowflow controlcontrol etcextractsextracts datagram from frame and passespasses it to receiving node

sendingnode

frame

rcvingnode

datagram

frame

adapter adapter

link layer protocol

2 Adapters Communicating

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology1212

2 Adapters Communicating

adapter is a semi-autonomous semi-autonomous system

It can receivereceive a frame checkcheck errorserrors and discarddiscard the corrupted frames withoutwithout notifying other componentsIt interruptsinterrupts the parent node onlyonly ifif it wants to pass

datagram up the protocol stack

The parent node fullyfully delegateddelegated to the adapter the task of transmitting the datagram across the link

The adapter is typically housedhoused in the box as the rest of the node

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology1414

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology1515

EDCEDC= ErrorError DetectionDetection and CorrectionCorrection bits (redundancy)

D D = Data protected by error checking may include header fields

bull Error detection not 100 reliable

bull protocol may miss some errors but rarely

bull larger EDC field yields better detection and correction

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

Error Detection and Correction

School of Computer Science amp Technology1616

Error-Detection amp -Correction Techniques

Parity Checks

Internet Checksumming

Cyclic redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology1717

1Single Bit Parity Single Bit Parity Detect single bit errors

- Can detect odd number bits errorodd number bits error

even

odd

1 Parity Checks

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

1

School of Computer Science amp Technology1818

22 Two Dimensional Bit ParityTwo Dimensional Bit Parity - can detectdetect single bit errors - can correct correct single bit errors

0 0

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

1 Parity Checks

School of Computer Science amp Technology1919

FECFEC The ability of the receiverreceiver to both detectdetect and correctcorrect errors

0 0

1 Parity Checks

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2020

Sendertreat segmentsegment contents as sequencesequence of 16-bit 16-bit

integersintegerschecksumchecksum addition (1rsquos complement sum) of

segment contentssender puts checksumchecksum value into checksumchecksum field

Receiverthe sum of the received data (including the

checksum) = all 1 bitsNO -NO - error detectedYESYES - no error detected

2 Internet Checksum

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2121

Checksumming Checksumming methods require require relatively littlelittle overhead but provideprovide relatively weakweak protection against errors

Why is checksummingchecksumming used at the transporttransport layerTransport layer is typically implemented in

softsoft in a host as a part of OSOS

2 Checksumming

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2222

The data (DD) ) are viewed as a d-bit d-bit binary number

The SenderSender chooses rr additional bits (R CRC bitsR CRC bits) and appends them to the DD such that d+r d+r bits is exactly divisible by GG using modulo-2 modulo-2 arithmetic Sender and receiver both know the (r+1)-bitr+1)-bit generator (G)(G)

The receiver receiver divides (d+r)-bit(d+r)-bit (DRDR) by G G If non-zeronon-zero remainder error detectederror detected

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2323

Modulo-2 algorithmNo addition carriesaddition carries

No subtraction borrows subtraction borrows The addition (+)addition (+) and the subtraction (-)subtraction (-) are identical identical

and both are equivalentare equivalent to the bitwisebitwise exclusive-orexclusive-or (XORXOR)

For example1011 XOR 0101 = 1110

1011 mdash 0101 = 1110

1011 + 0101 = 1110

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2424

How the Sender computes the How the Sender computes the RRWant Want DD22rr XOR RR = nGnG

equivalentlyequivalently DD22rr XOR RR XOR RR = nG nG XOR RR

DD22rr = nG nG XOR RR

equivalentlyequivalently if we divide D2r by G want remainderremainder R

R = remainder[ ]

D2r

G

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

School of Computer Science amp Technology2525

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

ExampleExampleDD=101110 GG = 1001rr =3 and TT

(D000D000)=101110000000TT (DRDR)=101110011011

CRC can detect all burst errors less thanless than r+1 bits r+1 bitsCRC-32( international standard ) =100000100110000010001110110110111

School of Computer Science amp Technology2626

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology2727

Two types of linkslinkspoint-to-pointpoint-to-point

Only Only a sender and a receivera receiver sits at each end PPP for dial-up access

broadcast (shared wire or medium)broadcast (shared wire or medium)Many Many senders and receivers shareshare the link

traditional EthernetWLANUpstream of HFC

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2828

single shared broadcast channel two or more simultaneoussimultaneous transmissions by

nodes will cause interference CollisionCollision-if node receives twotwo oror moremore

signals at the same time

Multiple Access ProblemHow to coordinatecoordinate the access of a

sharedshared broadcastbroadcast channelchannel

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2929

multiple access protocolmultiple access protocoldistributed algorithmdistributed algorithm that determines how

nodes share the channel ie determine whenwhen and whichwhich node can transmit

communication about channel sharing must use channel itself

no out-of-bandout-of-band channel for coordination

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3030

The requirements to multiple access multiple access protocolprotocol for a broadcast channelbroadcast channel of rate RR bpsWhen one node can transmit it send at rate RRWhen M M nodes want to transmit over the channel

each can send at average rate RMRM bpsFully decentralized

no special nodespecial node to coordinate transmissionsno synchronizationsynchronization of clocks slots

Simple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3131

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code)

allocate piece to node for exclusive useRandom AccessRandom Access

channel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3232

TDM (Time Division MultiplexingTime Division Multiplexing)Time divided into FramesFrames and further divides each

Frame into N slotsslots each slot is then assigned to one of the N N nodes

Nodes access to channel in rounds unused slots go idleidle

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3333

TDMA eliminates collisions collisions and is perfectly fairfair but has two drawbacksdrawbacks

each node gets a dedicateddedicated transmission rate of RNRN and the average rate is limited to RNRN

a node mustmust always wait for its turnwait for its turn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

11 TDMA

School of Computer Science amp Technology3434

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

The spectrumspectrum is divided into frequencyfrequency bandsbandseach station assigned fixedfixed frequency bandunused transmission time in each frequency

bands goes idleidle

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3535

advantagesadvantages and drawbacksdrawbacks

can avoids collisionscollisions

shareshare the channel fairlyfairly

a node is limitedlimited to a bandwidthbandwidth of RNRN

a node needneed notnot waitswaits forfor its turnturn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

12 FDMA

frequ

ency

bands

time

School of Computer Science amp Technology3636

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)Assign a different codecode to each node

Each node encodesencodes the data bits using its unique code

Different nodes can transmit simultaneously

Usually used in military systems in early time

Details discussed in wireless networking of Advanced Advanced Computer NetworksComputer Networks

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3737

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Accesschannel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3838

When a node has a packet to send it transmit the packet at fullfull channelchannel datadata raterate R R bpsno a prioripriori coordination coordination among nodes

may cause collisioncollision

Each node involved in the collision repeatedlyrepeatedly retransmitsretransmits its packet until the packet gets through withoutwithout anyany collisioncollisiona node waits some time choosed randomly randomly

before retransmission

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology3939

random access protocol specifies how to detect collisionshow to recover from collisions

Examples of random access protocolsslottedslotted ALOHAALOHA

Pure ALOHAPure ALOHA

CSMACSMA CSMACDCSMACD CSMACACSMACA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology4040

Assumptionsall framesframes have same sizesame size L bitstimetime is divided into equal size slotsequal size slots

time to transmit 1 frame LR

nodes start to transmit frames onlyonly at beginningbeginning of slotsslotsnodes are synchronizedsynchronized

if there 2 or more2 or more nodes transmitting in a slot all nodes can detectdetect the collisioncollision

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4141

Operationwhen node obtains fresh framefresh frame it transmits

in the next slotnext slotIf there is not a collisioncollision node can send new new

frameframe in next slotnext slotThe sending node can detect the collision before

the end of the slot

If there is a collision collision node retransmitsretransmits frame in each subsequentsubsequent slotslot with probability pp until successsuccess

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4242

Advantages single active nodesingle active node can continuously transmit at fullfull

raterate of channelhighly decentralized only slots in nodesnodes needneed to be to be

inin synchronizationsynchronizationsimplesimple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 4: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology44

A link-layer protocol is used to move a datagram over an individualindividual linkLinksLinks

communication channelscommunication channels that connect adjacent nodes

The PDU PDU of a link-layer protocol is called FrameFrame

ldquo linkrdquo

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

1 Link Layer Services

School of Computer Science amp Technology55

Datagrams may be transferred by differentdifferent linklink protocolsprotocols over different linksdifferent links

eg EthernetEthernet on first link frameframe relayrelay on intermediate links 8021180211 on the last link

Different link protocol may provide differentdifferent servicesservices

eg may or may not provide rdt (reliable data transfer) over a link

1 Link Layer Services

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology66

1 Link Layer Services

Possible Services

FramingFraming

Link AccessLink Access

Reliable deliveryReliable delivery

Flow ControlFlow Control

Error detection and correctionError detection and correction

HalfFull duplexHalfFull duplex

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology77

FramingFramingencapsulate a datagramdatagram into a frameframe adding

headerheader and trailertrailerThe structurestructure of a the frameframe is specified by

the link layer protocolLinkLink AccessAccess

How to share a medium Medium Access ControlMedium Access Control (MACMAC) protocol serves to

coordinate the frame transmission of the many nodes

1 Link Layer Services

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology88

ReliableReliable deliverydelivery between adjacentadjacent nodesUsing ack ack and retransmissionretransmission as TCP

we have learned how to do this already

seldom used on low bit error link Such as fiber some twisted pair media

wireless links high error rates

Q why both link-levellink-level and end-endend-end reliability

1 Link Layer Services

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology99

Flow ControlFlow Control pacingpacing adjacent sending and receiving nodes

Error Detection and Correction Error Detection and Correction errors caused by signal attenuationattenuation noisenoise receiver detectsdetects presence of errors

informsinforms sender for retransmission or dropsdrops frame receiver identifiesidentifies and correctscorrects bit error (s) without

resorting to retransmission

Full-duplex Half-duplex SimplexFull-duplex Half-duplex Simplexwith half duplexhalf duplex nodes at both ends of a link can

transmit but notnot at same time

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

1 Link Layer Services

School of Computer Science amp Technology1010

link layer protocol implementedimplemented in an adapteradapter

aka Network Interface Card (NICNIC)

Ethernet card PCMCIA card 80211 card

sendingnode

frame

rcvingnode

datagram

frame

adapter adapter

link layer protocol

2 Adapters Communicating

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology1111

sending sidesending sideencapsulates datagramdatagram in a frameframeaddsadds errorerror checkingchecking bits rdtrdt flowflow controlcontrol etc

receiving sidereceiving sidecheckingchecking errorserrors rdtrdt flowflow controlcontrol etcextractsextracts datagram from frame and passespasses it to receiving node

sendingnode

frame

rcvingnode

datagram

frame

adapter adapter

link layer protocol

2 Adapters Communicating

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology1212

2 Adapters Communicating

adapter is a semi-autonomous semi-autonomous system

It can receivereceive a frame checkcheck errorserrors and discarddiscard the corrupted frames withoutwithout notifying other componentsIt interruptsinterrupts the parent node onlyonly ifif it wants to pass

datagram up the protocol stack

The parent node fullyfully delegateddelegated to the adapter the task of transmitting the datagram across the link

The adapter is typically housedhoused in the box as the rest of the node

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology1414

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology1515

EDCEDC= ErrorError DetectionDetection and CorrectionCorrection bits (redundancy)

D D = Data protected by error checking may include header fields

bull Error detection not 100 reliable

bull protocol may miss some errors but rarely

bull larger EDC field yields better detection and correction

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

Error Detection and Correction

School of Computer Science amp Technology1616

Error-Detection amp -Correction Techniques

Parity Checks

Internet Checksumming

Cyclic redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology1717

1Single Bit Parity Single Bit Parity Detect single bit errors

- Can detect odd number bits errorodd number bits error

even

odd

1 Parity Checks

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

1

School of Computer Science amp Technology1818

22 Two Dimensional Bit ParityTwo Dimensional Bit Parity - can detectdetect single bit errors - can correct correct single bit errors

0 0

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

1 Parity Checks

School of Computer Science amp Technology1919

FECFEC The ability of the receiverreceiver to both detectdetect and correctcorrect errors

0 0

1 Parity Checks

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2020

Sendertreat segmentsegment contents as sequencesequence of 16-bit 16-bit

integersintegerschecksumchecksum addition (1rsquos complement sum) of

segment contentssender puts checksumchecksum value into checksumchecksum field

Receiverthe sum of the received data (including the

checksum) = all 1 bitsNO -NO - error detectedYESYES - no error detected

2 Internet Checksum

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2121

Checksumming Checksumming methods require require relatively littlelittle overhead but provideprovide relatively weakweak protection against errors

Why is checksummingchecksumming used at the transporttransport layerTransport layer is typically implemented in

softsoft in a host as a part of OSOS

2 Checksumming

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2222

The data (DD) ) are viewed as a d-bit d-bit binary number

The SenderSender chooses rr additional bits (R CRC bitsR CRC bits) and appends them to the DD such that d+r d+r bits is exactly divisible by GG using modulo-2 modulo-2 arithmetic Sender and receiver both know the (r+1)-bitr+1)-bit generator (G)(G)

The receiver receiver divides (d+r)-bit(d+r)-bit (DRDR) by G G If non-zeronon-zero remainder error detectederror detected

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2323

Modulo-2 algorithmNo addition carriesaddition carries

No subtraction borrows subtraction borrows The addition (+)addition (+) and the subtraction (-)subtraction (-) are identical identical

and both are equivalentare equivalent to the bitwisebitwise exclusive-orexclusive-or (XORXOR)

For example1011 XOR 0101 = 1110

1011 mdash 0101 = 1110

1011 + 0101 = 1110

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2424

How the Sender computes the How the Sender computes the RRWant Want DD22rr XOR RR = nGnG

equivalentlyequivalently DD22rr XOR RR XOR RR = nG nG XOR RR

DD22rr = nG nG XOR RR

equivalentlyequivalently if we divide D2r by G want remainderremainder R

R = remainder[ ]

D2r

G

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

School of Computer Science amp Technology2525

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

ExampleExampleDD=101110 GG = 1001rr =3 and TT

(D000D000)=101110000000TT (DRDR)=101110011011

CRC can detect all burst errors less thanless than r+1 bits r+1 bitsCRC-32( international standard ) =100000100110000010001110110110111

School of Computer Science amp Technology2626

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology2727

Two types of linkslinkspoint-to-pointpoint-to-point

Only Only a sender and a receivera receiver sits at each end PPP for dial-up access

broadcast (shared wire or medium)broadcast (shared wire or medium)Many Many senders and receivers shareshare the link

traditional EthernetWLANUpstream of HFC

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2828

single shared broadcast channel two or more simultaneoussimultaneous transmissions by

nodes will cause interference CollisionCollision-if node receives twotwo oror moremore

signals at the same time

Multiple Access ProblemHow to coordinatecoordinate the access of a

sharedshared broadcastbroadcast channelchannel

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2929

multiple access protocolmultiple access protocoldistributed algorithmdistributed algorithm that determines how

nodes share the channel ie determine whenwhen and whichwhich node can transmit

communication about channel sharing must use channel itself

no out-of-bandout-of-band channel for coordination

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3030

The requirements to multiple access multiple access protocolprotocol for a broadcast channelbroadcast channel of rate RR bpsWhen one node can transmit it send at rate RRWhen M M nodes want to transmit over the channel

each can send at average rate RMRM bpsFully decentralized

no special nodespecial node to coordinate transmissionsno synchronizationsynchronization of clocks slots

Simple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3131

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code)

allocate piece to node for exclusive useRandom AccessRandom Access

channel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3232

TDM (Time Division MultiplexingTime Division Multiplexing)Time divided into FramesFrames and further divides each

Frame into N slotsslots each slot is then assigned to one of the N N nodes

Nodes access to channel in rounds unused slots go idleidle

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3333

TDMA eliminates collisions collisions and is perfectly fairfair but has two drawbacksdrawbacks

each node gets a dedicateddedicated transmission rate of RNRN and the average rate is limited to RNRN

a node mustmust always wait for its turnwait for its turn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

11 TDMA

School of Computer Science amp Technology3434

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

The spectrumspectrum is divided into frequencyfrequency bandsbandseach station assigned fixedfixed frequency bandunused transmission time in each frequency

bands goes idleidle

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3535

advantagesadvantages and drawbacksdrawbacks

can avoids collisionscollisions

shareshare the channel fairlyfairly

a node is limitedlimited to a bandwidthbandwidth of RNRN

a node needneed notnot waitswaits forfor its turnturn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

12 FDMA

frequ

ency

bands

time

School of Computer Science amp Technology3636

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)Assign a different codecode to each node

Each node encodesencodes the data bits using its unique code

Different nodes can transmit simultaneously

Usually used in military systems in early time

Details discussed in wireless networking of Advanced Advanced Computer NetworksComputer Networks

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3737

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Accesschannel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3838

When a node has a packet to send it transmit the packet at fullfull channelchannel datadata raterate R R bpsno a prioripriori coordination coordination among nodes

may cause collisioncollision

Each node involved in the collision repeatedlyrepeatedly retransmitsretransmits its packet until the packet gets through withoutwithout anyany collisioncollisiona node waits some time choosed randomly randomly

before retransmission

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology3939

random access protocol specifies how to detect collisionshow to recover from collisions

Examples of random access protocolsslottedslotted ALOHAALOHA

Pure ALOHAPure ALOHA

CSMACSMA CSMACDCSMACD CSMACACSMACA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology4040

Assumptionsall framesframes have same sizesame size L bitstimetime is divided into equal size slotsequal size slots

time to transmit 1 frame LR

nodes start to transmit frames onlyonly at beginningbeginning of slotsslotsnodes are synchronizedsynchronized

if there 2 or more2 or more nodes transmitting in a slot all nodes can detectdetect the collisioncollision

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4141

Operationwhen node obtains fresh framefresh frame it transmits

in the next slotnext slotIf there is not a collisioncollision node can send new new

frameframe in next slotnext slotThe sending node can detect the collision before

the end of the slot

If there is a collision collision node retransmitsretransmits frame in each subsequentsubsequent slotslot with probability pp until successsuccess

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4242

Advantages single active nodesingle active node can continuously transmit at fullfull

raterate of channelhighly decentralized only slots in nodesnodes needneed to be to be

inin synchronizationsynchronizationsimplesimple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 5: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology55

Datagrams may be transferred by differentdifferent linklink protocolsprotocols over different linksdifferent links

eg EthernetEthernet on first link frameframe relayrelay on intermediate links 8021180211 on the last link

Different link protocol may provide differentdifferent servicesservices

eg may or may not provide rdt (reliable data transfer) over a link

1 Link Layer Services

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology66

1 Link Layer Services

Possible Services

FramingFraming

Link AccessLink Access

Reliable deliveryReliable delivery

Flow ControlFlow Control

Error detection and correctionError detection and correction

HalfFull duplexHalfFull duplex

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology77

FramingFramingencapsulate a datagramdatagram into a frameframe adding

headerheader and trailertrailerThe structurestructure of a the frameframe is specified by

the link layer protocolLinkLink AccessAccess

How to share a medium Medium Access ControlMedium Access Control (MACMAC) protocol serves to

coordinate the frame transmission of the many nodes

1 Link Layer Services

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology88

ReliableReliable deliverydelivery between adjacentadjacent nodesUsing ack ack and retransmissionretransmission as TCP

we have learned how to do this already

seldom used on low bit error link Such as fiber some twisted pair media

wireless links high error rates

Q why both link-levellink-level and end-endend-end reliability

1 Link Layer Services

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology99

Flow ControlFlow Control pacingpacing adjacent sending and receiving nodes

Error Detection and Correction Error Detection and Correction errors caused by signal attenuationattenuation noisenoise receiver detectsdetects presence of errors

informsinforms sender for retransmission or dropsdrops frame receiver identifiesidentifies and correctscorrects bit error (s) without

resorting to retransmission

Full-duplex Half-duplex SimplexFull-duplex Half-duplex Simplexwith half duplexhalf duplex nodes at both ends of a link can

transmit but notnot at same time

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

1 Link Layer Services

School of Computer Science amp Technology1010

link layer protocol implementedimplemented in an adapteradapter

aka Network Interface Card (NICNIC)

Ethernet card PCMCIA card 80211 card

sendingnode

frame

rcvingnode

datagram

frame

adapter adapter

link layer protocol

2 Adapters Communicating

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology1111

sending sidesending sideencapsulates datagramdatagram in a frameframeaddsadds errorerror checkingchecking bits rdtrdt flowflow controlcontrol etc

receiving sidereceiving sidecheckingchecking errorserrors rdtrdt flowflow controlcontrol etcextractsextracts datagram from frame and passespasses it to receiving node

sendingnode

frame

rcvingnode

datagram

frame

adapter adapter

link layer protocol

2 Adapters Communicating

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology1212

2 Adapters Communicating

adapter is a semi-autonomous semi-autonomous system

It can receivereceive a frame checkcheck errorserrors and discarddiscard the corrupted frames withoutwithout notifying other componentsIt interruptsinterrupts the parent node onlyonly ifif it wants to pass

datagram up the protocol stack

The parent node fullyfully delegateddelegated to the adapter the task of transmitting the datagram across the link

The adapter is typically housedhoused in the box as the rest of the node

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology1414

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology1515

EDCEDC= ErrorError DetectionDetection and CorrectionCorrection bits (redundancy)

D D = Data protected by error checking may include header fields

bull Error detection not 100 reliable

bull protocol may miss some errors but rarely

bull larger EDC field yields better detection and correction

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

Error Detection and Correction

School of Computer Science amp Technology1616

Error-Detection amp -Correction Techniques

Parity Checks

Internet Checksumming

Cyclic redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology1717

1Single Bit Parity Single Bit Parity Detect single bit errors

- Can detect odd number bits errorodd number bits error

even

odd

1 Parity Checks

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

1

School of Computer Science amp Technology1818

22 Two Dimensional Bit ParityTwo Dimensional Bit Parity - can detectdetect single bit errors - can correct correct single bit errors

0 0

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

1 Parity Checks

School of Computer Science amp Technology1919

FECFEC The ability of the receiverreceiver to both detectdetect and correctcorrect errors

0 0

1 Parity Checks

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2020

Sendertreat segmentsegment contents as sequencesequence of 16-bit 16-bit

integersintegerschecksumchecksum addition (1rsquos complement sum) of

segment contentssender puts checksumchecksum value into checksumchecksum field

Receiverthe sum of the received data (including the

checksum) = all 1 bitsNO -NO - error detectedYESYES - no error detected

2 Internet Checksum

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2121

Checksumming Checksumming methods require require relatively littlelittle overhead but provideprovide relatively weakweak protection against errors

Why is checksummingchecksumming used at the transporttransport layerTransport layer is typically implemented in

softsoft in a host as a part of OSOS

2 Checksumming

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2222

The data (DD) ) are viewed as a d-bit d-bit binary number

The SenderSender chooses rr additional bits (R CRC bitsR CRC bits) and appends them to the DD such that d+r d+r bits is exactly divisible by GG using modulo-2 modulo-2 arithmetic Sender and receiver both know the (r+1)-bitr+1)-bit generator (G)(G)

The receiver receiver divides (d+r)-bit(d+r)-bit (DRDR) by G G If non-zeronon-zero remainder error detectederror detected

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2323

Modulo-2 algorithmNo addition carriesaddition carries

No subtraction borrows subtraction borrows The addition (+)addition (+) and the subtraction (-)subtraction (-) are identical identical

and both are equivalentare equivalent to the bitwisebitwise exclusive-orexclusive-or (XORXOR)

For example1011 XOR 0101 = 1110

1011 mdash 0101 = 1110

1011 + 0101 = 1110

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2424

How the Sender computes the How the Sender computes the RRWant Want DD22rr XOR RR = nGnG

equivalentlyequivalently DD22rr XOR RR XOR RR = nG nG XOR RR

DD22rr = nG nG XOR RR

equivalentlyequivalently if we divide D2r by G want remainderremainder R

R = remainder[ ]

D2r

G

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

School of Computer Science amp Technology2525

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

ExampleExampleDD=101110 GG = 1001rr =3 and TT

(D000D000)=101110000000TT (DRDR)=101110011011

CRC can detect all burst errors less thanless than r+1 bits r+1 bitsCRC-32( international standard ) =100000100110000010001110110110111

School of Computer Science amp Technology2626

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology2727

Two types of linkslinkspoint-to-pointpoint-to-point

Only Only a sender and a receivera receiver sits at each end PPP for dial-up access

broadcast (shared wire or medium)broadcast (shared wire or medium)Many Many senders and receivers shareshare the link

traditional EthernetWLANUpstream of HFC

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2828

single shared broadcast channel two or more simultaneoussimultaneous transmissions by

nodes will cause interference CollisionCollision-if node receives twotwo oror moremore

signals at the same time

Multiple Access ProblemHow to coordinatecoordinate the access of a

sharedshared broadcastbroadcast channelchannel

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2929

multiple access protocolmultiple access protocoldistributed algorithmdistributed algorithm that determines how

nodes share the channel ie determine whenwhen and whichwhich node can transmit

communication about channel sharing must use channel itself

no out-of-bandout-of-band channel for coordination

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3030

The requirements to multiple access multiple access protocolprotocol for a broadcast channelbroadcast channel of rate RR bpsWhen one node can transmit it send at rate RRWhen M M nodes want to transmit over the channel

each can send at average rate RMRM bpsFully decentralized

no special nodespecial node to coordinate transmissionsno synchronizationsynchronization of clocks slots

Simple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3131

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code)

allocate piece to node for exclusive useRandom AccessRandom Access

channel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3232

TDM (Time Division MultiplexingTime Division Multiplexing)Time divided into FramesFrames and further divides each

Frame into N slotsslots each slot is then assigned to one of the N N nodes

Nodes access to channel in rounds unused slots go idleidle

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3333

TDMA eliminates collisions collisions and is perfectly fairfair but has two drawbacksdrawbacks

each node gets a dedicateddedicated transmission rate of RNRN and the average rate is limited to RNRN

a node mustmust always wait for its turnwait for its turn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

11 TDMA

School of Computer Science amp Technology3434

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

The spectrumspectrum is divided into frequencyfrequency bandsbandseach station assigned fixedfixed frequency bandunused transmission time in each frequency

bands goes idleidle

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3535

advantagesadvantages and drawbacksdrawbacks

can avoids collisionscollisions

shareshare the channel fairlyfairly

a node is limitedlimited to a bandwidthbandwidth of RNRN

a node needneed notnot waitswaits forfor its turnturn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

12 FDMA

frequ

ency

bands

time

School of Computer Science amp Technology3636

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)Assign a different codecode to each node

Each node encodesencodes the data bits using its unique code

Different nodes can transmit simultaneously

Usually used in military systems in early time

Details discussed in wireless networking of Advanced Advanced Computer NetworksComputer Networks

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3737

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Accesschannel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3838

When a node has a packet to send it transmit the packet at fullfull channelchannel datadata raterate R R bpsno a prioripriori coordination coordination among nodes

may cause collisioncollision

Each node involved in the collision repeatedlyrepeatedly retransmitsretransmits its packet until the packet gets through withoutwithout anyany collisioncollisiona node waits some time choosed randomly randomly

before retransmission

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology3939

random access protocol specifies how to detect collisionshow to recover from collisions

Examples of random access protocolsslottedslotted ALOHAALOHA

Pure ALOHAPure ALOHA

CSMACSMA CSMACDCSMACD CSMACACSMACA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology4040

Assumptionsall framesframes have same sizesame size L bitstimetime is divided into equal size slotsequal size slots

time to transmit 1 frame LR

nodes start to transmit frames onlyonly at beginningbeginning of slotsslotsnodes are synchronizedsynchronized

if there 2 or more2 or more nodes transmitting in a slot all nodes can detectdetect the collisioncollision

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4141

Operationwhen node obtains fresh framefresh frame it transmits

in the next slotnext slotIf there is not a collisioncollision node can send new new

frameframe in next slotnext slotThe sending node can detect the collision before

the end of the slot

If there is a collision collision node retransmitsretransmits frame in each subsequentsubsequent slotslot with probability pp until successsuccess

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4242

Advantages single active nodesingle active node can continuously transmit at fullfull

raterate of channelhighly decentralized only slots in nodesnodes needneed to be to be

inin synchronizationsynchronizationsimplesimple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 6: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology66

1 Link Layer Services

Possible Services

FramingFraming

Link AccessLink Access

Reliable deliveryReliable delivery

Flow ControlFlow Control

Error detection and correctionError detection and correction

HalfFull duplexHalfFull duplex

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology77

FramingFramingencapsulate a datagramdatagram into a frameframe adding

headerheader and trailertrailerThe structurestructure of a the frameframe is specified by

the link layer protocolLinkLink AccessAccess

How to share a medium Medium Access ControlMedium Access Control (MACMAC) protocol serves to

coordinate the frame transmission of the many nodes

1 Link Layer Services

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology88

ReliableReliable deliverydelivery between adjacentadjacent nodesUsing ack ack and retransmissionretransmission as TCP

we have learned how to do this already

seldom used on low bit error link Such as fiber some twisted pair media

wireless links high error rates

Q why both link-levellink-level and end-endend-end reliability

1 Link Layer Services

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology99

Flow ControlFlow Control pacingpacing adjacent sending and receiving nodes

Error Detection and Correction Error Detection and Correction errors caused by signal attenuationattenuation noisenoise receiver detectsdetects presence of errors

informsinforms sender for retransmission or dropsdrops frame receiver identifiesidentifies and correctscorrects bit error (s) without

resorting to retransmission

Full-duplex Half-duplex SimplexFull-duplex Half-duplex Simplexwith half duplexhalf duplex nodes at both ends of a link can

transmit but notnot at same time

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

1 Link Layer Services

School of Computer Science amp Technology1010

link layer protocol implementedimplemented in an adapteradapter

aka Network Interface Card (NICNIC)

Ethernet card PCMCIA card 80211 card

sendingnode

frame

rcvingnode

datagram

frame

adapter adapter

link layer protocol

2 Adapters Communicating

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology1111

sending sidesending sideencapsulates datagramdatagram in a frameframeaddsadds errorerror checkingchecking bits rdtrdt flowflow controlcontrol etc

receiving sidereceiving sidecheckingchecking errorserrors rdtrdt flowflow controlcontrol etcextractsextracts datagram from frame and passespasses it to receiving node

sendingnode

frame

rcvingnode

datagram

frame

adapter adapter

link layer protocol

2 Adapters Communicating

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology1212

2 Adapters Communicating

adapter is a semi-autonomous semi-autonomous system

It can receivereceive a frame checkcheck errorserrors and discarddiscard the corrupted frames withoutwithout notifying other componentsIt interruptsinterrupts the parent node onlyonly ifif it wants to pass

datagram up the protocol stack

The parent node fullyfully delegateddelegated to the adapter the task of transmitting the datagram across the link

The adapter is typically housedhoused in the box as the rest of the node

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology1414

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology1515

EDCEDC= ErrorError DetectionDetection and CorrectionCorrection bits (redundancy)

D D = Data protected by error checking may include header fields

bull Error detection not 100 reliable

bull protocol may miss some errors but rarely

bull larger EDC field yields better detection and correction

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

Error Detection and Correction

School of Computer Science amp Technology1616

Error-Detection amp -Correction Techniques

Parity Checks

Internet Checksumming

Cyclic redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology1717

1Single Bit Parity Single Bit Parity Detect single bit errors

- Can detect odd number bits errorodd number bits error

even

odd

1 Parity Checks

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

1

School of Computer Science amp Technology1818

22 Two Dimensional Bit ParityTwo Dimensional Bit Parity - can detectdetect single bit errors - can correct correct single bit errors

0 0

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

1 Parity Checks

School of Computer Science amp Technology1919

FECFEC The ability of the receiverreceiver to both detectdetect and correctcorrect errors

0 0

1 Parity Checks

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2020

Sendertreat segmentsegment contents as sequencesequence of 16-bit 16-bit

integersintegerschecksumchecksum addition (1rsquos complement sum) of

segment contentssender puts checksumchecksum value into checksumchecksum field

Receiverthe sum of the received data (including the

checksum) = all 1 bitsNO -NO - error detectedYESYES - no error detected

2 Internet Checksum

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2121

Checksumming Checksumming methods require require relatively littlelittle overhead but provideprovide relatively weakweak protection against errors

Why is checksummingchecksumming used at the transporttransport layerTransport layer is typically implemented in

softsoft in a host as a part of OSOS

2 Checksumming

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2222

The data (DD) ) are viewed as a d-bit d-bit binary number

The SenderSender chooses rr additional bits (R CRC bitsR CRC bits) and appends them to the DD such that d+r d+r bits is exactly divisible by GG using modulo-2 modulo-2 arithmetic Sender and receiver both know the (r+1)-bitr+1)-bit generator (G)(G)

The receiver receiver divides (d+r)-bit(d+r)-bit (DRDR) by G G If non-zeronon-zero remainder error detectederror detected

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2323

Modulo-2 algorithmNo addition carriesaddition carries

No subtraction borrows subtraction borrows The addition (+)addition (+) and the subtraction (-)subtraction (-) are identical identical

and both are equivalentare equivalent to the bitwisebitwise exclusive-orexclusive-or (XORXOR)

For example1011 XOR 0101 = 1110

1011 mdash 0101 = 1110

1011 + 0101 = 1110

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2424

How the Sender computes the How the Sender computes the RRWant Want DD22rr XOR RR = nGnG

equivalentlyequivalently DD22rr XOR RR XOR RR = nG nG XOR RR

DD22rr = nG nG XOR RR

equivalentlyequivalently if we divide D2r by G want remainderremainder R

R = remainder[ ]

D2r

G

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

School of Computer Science amp Technology2525

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

ExampleExampleDD=101110 GG = 1001rr =3 and TT

(D000D000)=101110000000TT (DRDR)=101110011011

CRC can detect all burst errors less thanless than r+1 bits r+1 bitsCRC-32( international standard ) =100000100110000010001110110110111

School of Computer Science amp Technology2626

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology2727

Two types of linkslinkspoint-to-pointpoint-to-point

Only Only a sender and a receivera receiver sits at each end PPP for dial-up access

broadcast (shared wire or medium)broadcast (shared wire or medium)Many Many senders and receivers shareshare the link

traditional EthernetWLANUpstream of HFC

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2828

single shared broadcast channel two or more simultaneoussimultaneous transmissions by

nodes will cause interference CollisionCollision-if node receives twotwo oror moremore

signals at the same time

Multiple Access ProblemHow to coordinatecoordinate the access of a

sharedshared broadcastbroadcast channelchannel

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2929

multiple access protocolmultiple access protocoldistributed algorithmdistributed algorithm that determines how

nodes share the channel ie determine whenwhen and whichwhich node can transmit

communication about channel sharing must use channel itself

no out-of-bandout-of-band channel for coordination

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3030

The requirements to multiple access multiple access protocolprotocol for a broadcast channelbroadcast channel of rate RR bpsWhen one node can transmit it send at rate RRWhen M M nodes want to transmit over the channel

each can send at average rate RMRM bpsFully decentralized

no special nodespecial node to coordinate transmissionsno synchronizationsynchronization of clocks slots

Simple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3131

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code)

allocate piece to node for exclusive useRandom AccessRandom Access

channel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3232

TDM (Time Division MultiplexingTime Division Multiplexing)Time divided into FramesFrames and further divides each

Frame into N slotsslots each slot is then assigned to one of the N N nodes

Nodes access to channel in rounds unused slots go idleidle

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3333

TDMA eliminates collisions collisions and is perfectly fairfair but has two drawbacksdrawbacks

each node gets a dedicateddedicated transmission rate of RNRN and the average rate is limited to RNRN

a node mustmust always wait for its turnwait for its turn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

11 TDMA

School of Computer Science amp Technology3434

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

The spectrumspectrum is divided into frequencyfrequency bandsbandseach station assigned fixedfixed frequency bandunused transmission time in each frequency

bands goes idleidle

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3535

advantagesadvantages and drawbacksdrawbacks

can avoids collisionscollisions

shareshare the channel fairlyfairly

a node is limitedlimited to a bandwidthbandwidth of RNRN

a node needneed notnot waitswaits forfor its turnturn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

12 FDMA

frequ

ency

bands

time

School of Computer Science amp Technology3636

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)Assign a different codecode to each node

Each node encodesencodes the data bits using its unique code

Different nodes can transmit simultaneously

Usually used in military systems in early time

Details discussed in wireless networking of Advanced Advanced Computer NetworksComputer Networks

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3737

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Accesschannel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3838

When a node has a packet to send it transmit the packet at fullfull channelchannel datadata raterate R R bpsno a prioripriori coordination coordination among nodes

may cause collisioncollision

Each node involved in the collision repeatedlyrepeatedly retransmitsretransmits its packet until the packet gets through withoutwithout anyany collisioncollisiona node waits some time choosed randomly randomly

before retransmission

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology3939

random access protocol specifies how to detect collisionshow to recover from collisions

Examples of random access protocolsslottedslotted ALOHAALOHA

Pure ALOHAPure ALOHA

CSMACSMA CSMACDCSMACD CSMACACSMACA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology4040

Assumptionsall framesframes have same sizesame size L bitstimetime is divided into equal size slotsequal size slots

time to transmit 1 frame LR

nodes start to transmit frames onlyonly at beginningbeginning of slotsslotsnodes are synchronizedsynchronized

if there 2 or more2 or more nodes transmitting in a slot all nodes can detectdetect the collisioncollision

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4141

Operationwhen node obtains fresh framefresh frame it transmits

in the next slotnext slotIf there is not a collisioncollision node can send new new

frameframe in next slotnext slotThe sending node can detect the collision before

the end of the slot

If there is a collision collision node retransmitsretransmits frame in each subsequentsubsequent slotslot with probability pp until successsuccess

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4242

Advantages single active nodesingle active node can continuously transmit at fullfull

raterate of channelhighly decentralized only slots in nodesnodes needneed to be to be

inin synchronizationsynchronizationsimplesimple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 7: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology77

FramingFramingencapsulate a datagramdatagram into a frameframe adding

headerheader and trailertrailerThe structurestructure of a the frameframe is specified by

the link layer protocolLinkLink AccessAccess

How to share a medium Medium Access ControlMedium Access Control (MACMAC) protocol serves to

coordinate the frame transmission of the many nodes

1 Link Layer Services

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology88

ReliableReliable deliverydelivery between adjacentadjacent nodesUsing ack ack and retransmissionretransmission as TCP

we have learned how to do this already

seldom used on low bit error link Such as fiber some twisted pair media

wireless links high error rates

Q why both link-levellink-level and end-endend-end reliability

1 Link Layer Services

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology99

Flow ControlFlow Control pacingpacing adjacent sending and receiving nodes

Error Detection and Correction Error Detection and Correction errors caused by signal attenuationattenuation noisenoise receiver detectsdetects presence of errors

informsinforms sender for retransmission or dropsdrops frame receiver identifiesidentifies and correctscorrects bit error (s) without

resorting to retransmission

Full-duplex Half-duplex SimplexFull-duplex Half-duplex Simplexwith half duplexhalf duplex nodes at both ends of a link can

transmit but notnot at same time

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

1 Link Layer Services

School of Computer Science amp Technology1010

link layer protocol implementedimplemented in an adapteradapter

aka Network Interface Card (NICNIC)

Ethernet card PCMCIA card 80211 card

sendingnode

frame

rcvingnode

datagram

frame

adapter adapter

link layer protocol

2 Adapters Communicating

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology1111

sending sidesending sideencapsulates datagramdatagram in a frameframeaddsadds errorerror checkingchecking bits rdtrdt flowflow controlcontrol etc

receiving sidereceiving sidecheckingchecking errorserrors rdtrdt flowflow controlcontrol etcextractsextracts datagram from frame and passespasses it to receiving node

sendingnode

frame

rcvingnode

datagram

frame

adapter adapter

link layer protocol

2 Adapters Communicating

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology1212

2 Adapters Communicating

adapter is a semi-autonomous semi-autonomous system

It can receivereceive a frame checkcheck errorserrors and discarddiscard the corrupted frames withoutwithout notifying other componentsIt interruptsinterrupts the parent node onlyonly ifif it wants to pass

datagram up the protocol stack

The parent node fullyfully delegateddelegated to the adapter the task of transmitting the datagram across the link

The adapter is typically housedhoused in the box as the rest of the node

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology1414

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology1515

EDCEDC= ErrorError DetectionDetection and CorrectionCorrection bits (redundancy)

D D = Data protected by error checking may include header fields

bull Error detection not 100 reliable

bull protocol may miss some errors but rarely

bull larger EDC field yields better detection and correction

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

Error Detection and Correction

School of Computer Science amp Technology1616

Error-Detection amp -Correction Techniques

Parity Checks

Internet Checksumming

Cyclic redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology1717

1Single Bit Parity Single Bit Parity Detect single bit errors

- Can detect odd number bits errorodd number bits error

even

odd

1 Parity Checks

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

1

School of Computer Science amp Technology1818

22 Two Dimensional Bit ParityTwo Dimensional Bit Parity - can detectdetect single bit errors - can correct correct single bit errors

0 0

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

1 Parity Checks

School of Computer Science amp Technology1919

FECFEC The ability of the receiverreceiver to both detectdetect and correctcorrect errors

0 0

1 Parity Checks

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2020

Sendertreat segmentsegment contents as sequencesequence of 16-bit 16-bit

integersintegerschecksumchecksum addition (1rsquos complement sum) of

segment contentssender puts checksumchecksum value into checksumchecksum field

Receiverthe sum of the received data (including the

checksum) = all 1 bitsNO -NO - error detectedYESYES - no error detected

2 Internet Checksum

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2121

Checksumming Checksumming methods require require relatively littlelittle overhead but provideprovide relatively weakweak protection against errors

Why is checksummingchecksumming used at the transporttransport layerTransport layer is typically implemented in

softsoft in a host as a part of OSOS

2 Checksumming

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2222

The data (DD) ) are viewed as a d-bit d-bit binary number

The SenderSender chooses rr additional bits (R CRC bitsR CRC bits) and appends them to the DD such that d+r d+r bits is exactly divisible by GG using modulo-2 modulo-2 arithmetic Sender and receiver both know the (r+1)-bitr+1)-bit generator (G)(G)

The receiver receiver divides (d+r)-bit(d+r)-bit (DRDR) by G G If non-zeronon-zero remainder error detectederror detected

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2323

Modulo-2 algorithmNo addition carriesaddition carries

No subtraction borrows subtraction borrows The addition (+)addition (+) and the subtraction (-)subtraction (-) are identical identical

and both are equivalentare equivalent to the bitwisebitwise exclusive-orexclusive-or (XORXOR)

For example1011 XOR 0101 = 1110

1011 mdash 0101 = 1110

1011 + 0101 = 1110

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2424

How the Sender computes the How the Sender computes the RRWant Want DD22rr XOR RR = nGnG

equivalentlyequivalently DD22rr XOR RR XOR RR = nG nG XOR RR

DD22rr = nG nG XOR RR

equivalentlyequivalently if we divide D2r by G want remainderremainder R

R = remainder[ ]

D2r

G

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

School of Computer Science amp Technology2525

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

ExampleExampleDD=101110 GG = 1001rr =3 and TT

(D000D000)=101110000000TT (DRDR)=101110011011

CRC can detect all burst errors less thanless than r+1 bits r+1 bitsCRC-32( international standard ) =100000100110000010001110110110111

School of Computer Science amp Technology2626

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology2727

Two types of linkslinkspoint-to-pointpoint-to-point

Only Only a sender and a receivera receiver sits at each end PPP for dial-up access

broadcast (shared wire or medium)broadcast (shared wire or medium)Many Many senders and receivers shareshare the link

traditional EthernetWLANUpstream of HFC

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2828

single shared broadcast channel two or more simultaneoussimultaneous transmissions by

nodes will cause interference CollisionCollision-if node receives twotwo oror moremore

signals at the same time

Multiple Access ProblemHow to coordinatecoordinate the access of a

sharedshared broadcastbroadcast channelchannel

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2929

multiple access protocolmultiple access protocoldistributed algorithmdistributed algorithm that determines how

nodes share the channel ie determine whenwhen and whichwhich node can transmit

communication about channel sharing must use channel itself

no out-of-bandout-of-band channel for coordination

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3030

The requirements to multiple access multiple access protocolprotocol for a broadcast channelbroadcast channel of rate RR bpsWhen one node can transmit it send at rate RRWhen M M nodes want to transmit over the channel

each can send at average rate RMRM bpsFully decentralized

no special nodespecial node to coordinate transmissionsno synchronizationsynchronization of clocks slots

Simple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3131

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code)

allocate piece to node for exclusive useRandom AccessRandom Access

channel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3232

TDM (Time Division MultiplexingTime Division Multiplexing)Time divided into FramesFrames and further divides each

Frame into N slotsslots each slot is then assigned to one of the N N nodes

Nodes access to channel in rounds unused slots go idleidle

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3333

TDMA eliminates collisions collisions and is perfectly fairfair but has two drawbacksdrawbacks

each node gets a dedicateddedicated transmission rate of RNRN and the average rate is limited to RNRN

a node mustmust always wait for its turnwait for its turn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

11 TDMA

School of Computer Science amp Technology3434

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

The spectrumspectrum is divided into frequencyfrequency bandsbandseach station assigned fixedfixed frequency bandunused transmission time in each frequency

bands goes idleidle

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3535

advantagesadvantages and drawbacksdrawbacks

can avoids collisionscollisions

shareshare the channel fairlyfairly

a node is limitedlimited to a bandwidthbandwidth of RNRN

a node needneed notnot waitswaits forfor its turnturn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

12 FDMA

frequ

ency

bands

time

School of Computer Science amp Technology3636

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)Assign a different codecode to each node

Each node encodesencodes the data bits using its unique code

Different nodes can transmit simultaneously

Usually used in military systems in early time

Details discussed in wireless networking of Advanced Advanced Computer NetworksComputer Networks

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3737

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Accesschannel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3838

When a node has a packet to send it transmit the packet at fullfull channelchannel datadata raterate R R bpsno a prioripriori coordination coordination among nodes

may cause collisioncollision

Each node involved in the collision repeatedlyrepeatedly retransmitsretransmits its packet until the packet gets through withoutwithout anyany collisioncollisiona node waits some time choosed randomly randomly

before retransmission

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology3939

random access protocol specifies how to detect collisionshow to recover from collisions

Examples of random access protocolsslottedslotted ALOHAALOHA

Pure ALOHAPure ALOHA

CSMACSMA CSMACDCSMACD CSMACACSMACA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology4040

Assumptionsall framesframes have same sizesame size L bitstimetime is divided into equal size slotsequal size slots

time to transmit 1 frame LR

nodes start to transmit frames onlyonly at beginningbeginning of slotsslotsnodes are synchronizedsynchronized

if there 2 or more2 or more nodes transmitting in a slot all nodes can detectdetect the collisioncollision

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4141

Operationwhen node obtains fresh framefresh frame it transmits

in the next slotnext slotIf there is not a collisioncollision node can send new new

frameframe in next slotnext slotThe sending node can detect the collision before

the end of the slot

If there is a collision collision node retransmitsretransmits frame in each subsequentsubsequent slotslot with probability pp until successsuccess

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4242

Advantages single active nodesingle active node can continuously transmit at fullfull

raterate of channelhighly decentralized only slots in nodesnodes needneed to be to be

inin synchronizationsynchronizationsimplesimple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 8: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology88

ReliableReliable deliverydelivery between adjacentadjacent nodesUsing ack ack and retransmissionretransmission as TCP

we have learned how to do this already

seldom used on low bit error link Such as fiber some twisted pair media

wireless links high error rates

Q why both link-levellink-level and end-endend-end reliability

1 Link Layer Services

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology99

Flow ControlFlow Control pacingpacing adjacent sending and receiving nodes

Error Detection and Correction Error Detection and Correction errors caused by signal attenuationattenuation noisenoise receiver detectsdetects presence of errors

informsinforms sender for retransmission or dropsdrops frame receiver identifiesidentifies and correctscorrects bit error (s) without

resorting to retransmission

Full-duplex Half-duplex SimplexFull-duplex Half-duplex Simplexwith half duplexhalf duplex nodes at both ends of a link can

transmit but notnot at same time

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

1 Link Layer Services

School of Computer Science amp Technology1010

link layer protocol implementedimplemented in an adapteradapter

aka Network Interface Card (NICNIC)

Ethernet card PCMCIA card 80211 card

sendingnode

frame

rcvingnode

datagram

frame

adapter adapter

link layer protocol

2 Adapters Communicating

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology1111

sending sidesending sideencapsulates datagramdatagram in a frameframeaddsadds errorerror checkingchecking bits rdtrdt flowflow controlcontrol etc

receiving sidereceiving sidecheckingchecking errorserrors rdtrdt flowflow controlcontrol etcextractsextracts datagram from frame and passespasses it to receiving node

sendingnode

frame

rcvingnode

datagram

frame

adapter adapter

link layer protocol

2 Adapters Communicating

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology1212

2 Adapters Communicating

adapter is a semi-autonomous semi-autonomous system

It can receivereceive a frame checkcheck errorserrors and discarddiscard the corrupted frames withoutwithout notifying other componentsIt interruptsinterrupts the parent node onlyonly ifif it wants to pass

datagram up the protocol stack

The parent node fullyfully delegateddelegated to the adapter the task of transmitting the datagram across the link

The adapter is typically housedhoused in the box as the rest of the node

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology1414

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology1515

EDCEDC= ErrorError DetectionDetection and CorrectionCorrection bits (redundancy)

D D = Data protected by error checking may include header fields

bull Error detection not 100 reliable

bull protocol may miss some errors but rarely

bull larger EDC field yields better detection and correction

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

Error Detection and Correction

School of Computer Science amp Technology1616

Error-Detection amp -Correction Techniques

Parity Checks

Internet Checksumming

Cyclic redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology1717

1Single Bit Parity Single Bit Parity Detect single bit errors

- Can detect odd number bits errorodd number bits error

even

odd

1 Parity Checks

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

1

School of Computer Science amp Technology1818

22 Two Dimensional Bit ParityTwo Dimensional Bit Parity - can detectdetect single bit errors - can correct correct single bit errors

0 0

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

1 Parity Checks

School of Computer Science amp Technology1919

FECFEC The ability of the receiverreceiver to both detectdetect and correctcorrect errors

0 0

1 Parity Checks

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2020

Sendertreat segmentsegment contents as sequencesequence of 16-bit 16-bit

integersintegerschecksumchecksum addition (1rsquos complement sum) of

segment contentssender puts checksumchecksum value into checksumchecksum field

Receiverthe sum of the received data (including the

checksum) = all 1 bitsNO -NO - error detectedYESYES - no error detected

2 Internet Checksum

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2121

Checksumming Checksumming methods require require relatively littlelittle overhead but provideprovide relatively weakweak protection against errors

Why is checksummingchecksumming used at the transporttransport layerTransport layer is typically implemented in

softsoft in a host as a part of OSOS

2 Checksumming

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2222

The data (DD) ) are viewed as a d-bit d-bit binary number

The SenderSender chooses rr additional bits (R CRC bitsR CRC bits) and appends them to the DD such that d+r d+r bits is exactly divisible by GG using modulo-2 modulo-2 arithmetic Sender and receiver both know the (r+1)-bitr+1)-bit generator (G)(G)

The receiver receiver divides (d+r)-bit(d+r)-bit (DRDR) by G G If non-zeronon-zero remainder error detectederror detected

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2323

Modulo-2 algorithmNo addition carriesaddition carries

No subtraction borrows subtraction borrows The addition (+)addition (+) and the subtraction (-)subtraction (-) are identical identical

and both are equivalentare equivalent to the bitwisebitwise exclusive-orexclusive-or (XORXOR)

For example1011 XOR 0101 = 1110

1011 mdash 0101 = 1110

1011 + 0101 = 1110

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2424

How the Sender computes the How the Sender computes the RRWant Want DD22rr XOR RR = nGnG

equivalentlyequivalently DD22rr XOR RR XOR RR = nG nG XOR RR

DD22rr = nG nG XOR RR

equivalentlyequivalently if we divide D2r by G want remainderremainder R

R = remainder[ ]

D2r

G

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

School of Computer Science amp Technology2525

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

ExampleExampleDD=101110 GG = 1001rr =3 and TT

(D000D000)=101110000000TT (DRDR)=101110011011

CRC can detect all burst errors less thanless than r+1 bits r+1 bitsCRC-32( international standard ) =100000100110000010001110110110111

School of Computer Science amp Technology2626

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology2727

Two types of linkslinkspoint-to-pointpoint-to-point

Only Only a sender and a receivera receiver sits at each end PPP for dial-up access

broadcast (shared wire or medium)broadcast (shared wire or medium)Many Many senders and receivers shareshare the link

traditional EthernetWLANUpstream of HFC

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2828

single shared broadcast channel two or more simultaneoussimultaneous transmissions by

nodes will cause interference CollisionCollision-if node receives twotwo oror moremore

signals at the same time

Multiple Access ProblemHow to coordinatecoordinate the access of a

sharedshared broadcastbroadcast channelchannel

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2929

multiple access protocolmultiple access protocoldistributed algorithmdistributed algorithm that determines how

nodes share the channel ie determine whenwhen and whichwhich node can transmit

communication about channel sharing must use channel itself

no out-of-bandout-of-band channel for coordination

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3030

The requirements to multiple access multiple access protocolprotocol for a broadcast channelbroadcast channel of rate RR bpsWhen one node can transmit it send at rate RRWhen M M nodes want to transmit over the channel

each can send at average rate RMRM bpsFully decentralized

no special nodespecial node to coordinate transmissionsno synchronizationsynchronization of clocks slots

Simple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3131

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code)

allocate piece to node for exclusive useRandom AccessRandom Access

channel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3232

TDM (Time Division MultiplexingTime Division Multiplexing)Time divided into FramesFrames and further divides each

Frame into N slotsslots each slot is then assigned to one of the N N nodes

Nodes access to channel in rounds unused slots go idleidle

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3333

TDMA eliminates collisions collisions and is perfectly fairfair but has two drawbacksdrawbacks

each node gets a dedicateddedicated transmission rate of RNRN and the average rate is limited to RNRN

a node mustmust always wait for its turnwait for its turn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

11 TDMA

School of Computer Science amp Technology3434

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

The spectrumspectrum is divided into frequencyfrequency bandsbandseach station assigned fixedfixed frequency bandunused transmission time in each frequency

bands goes idleidle

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3535

advantagesadvantages and drawbacksdrawbacks

can avoids collisionscollisions

shareshare the channel fairlyfairly

a node is limitedlimited to a bandwidthbandwidth of RNRN

a node needneed notnot waitswaits forfor its turnturn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

12 FDMA

frequ

ency

bands

time

School of Computer Science amp Technology3636

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)Assign a different codecode to each node

Each node encodesencodes the data bits using its unique code

Different nodes can transmit simultaneously

Usually used in military systems in early time

Details discussed in wireless networking of Advanced Advanced Computer NetworksComputer Networks

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3737

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Accesschannel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3838

When a node has a packet to send it transmit the packet at fullfull channelchannel datadata raterate R R bpsno a prioripriori coordination coordination among nodes

may cause collisioncollision

Each node involved in the collision repeatedlyrepeatedly retransmitsretransmits its packet until the packet gets through withoutwithout anyany collisioncollisiona node waits some time choosed randomly randomly

before retransmission

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology3939

random access protocol specifies how to detect collisionshow to recover from collisions

Examples of random access protocolsslottedslotted ALOHAALOHA

Pure ALOHAPure ALOHA

CSMACSMA CSMACDCSMACD CSMACACSMACA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology4040

Assumptionsall framesframes have same sizesame size L bitstimetime is divided into equal size slotsequal size slots

time to transmit 1 frame LR

nodes start to transmit frames onlyonly at beginningbeginning of slotsslotsnodes are synchronizedsynchronized

if there 2 or more2 or more nodes transmitting in a slot all nodes can detectdetect the collisioncollision

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4141

Operationwhen node obtains fresh framefresh frame it transmits

in the next slotnext slotIf there is not a collisioncollision node can send new new

frameframe in next slotnext slotThe sending node can detect the collision before

the end of the slot

If there is a collision collision node retransmitsretransmits frame in each subsequentsubsequent slotslot with probability pp until successsuccess

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4242

Advantages single active nodesingle active node can continuously transmit at fullfull

raterate of channelhighly decentralized only slots in nodesnodes needneed to be to be

inin synchronizationsynchronizationsimplesimple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 9: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology99

Flow ControlFlow Control pacingpacing adjacent sending and receiving nodes

Error Detection and Correction Error Detection and Correction errors caused by signal attenuationattenuation noisenoise receiver detectsdetects presence of errors

informsinforms sender for retransmission or dropsdrops frame receiver identifiesidentifies and correctscorrects bit error (s) without

resorting to retransmission

Full-duplex Half-duplex SimplexFull-duplex Half-duplex Simplexwith half duplexhalf duplex nodes at both ends of a link can

transmit but notnot at same time

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

1 Link Layer Services

School of Computer Science amp Technology1010

link layer protocol implementedimplemented in an adapteradapter

aka Network Interface Card (NICNIC)

Ethernet card PCMCIA card 80211 card

sendingnode

frame

rcvingnode

datagram

frame

adapter adapter

link layer protocol

2 Adapters Communicating

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology1111

sending sidesending sideencapsulates datagramdatagram in a frameframeaddsadds errorerror checkingchecking bits rdtrdt flowflow controlcontrol etc

receiving sidereceiving sidecheckingchecking errorserrors rdtrdt flowflow controlcontrol etcextractsextracts datagram from frame and passespasses it to receiving node

sendingnode

frame

rcvingnode

datagram

frame

adapter adapter

link layer protocol

2 Adapters Communicating

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology1212

2 Adapters Communicating

adapter is a semi-autonomous semi-autonomous system

It can receivereceive a frame checkcheck errorserrors and discarddiscard the corrupted frames withoutwithout notifying other componentsIt interruptsinterrupts the parent node onlyonly ifif it wants to pass

datagram up the protocol stack

The parent node fullyfully delegateddelegated to the adapter the task of transmitting the datagram across the link

The adapter is typically housedhoused in the box as the rest of the node

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology1414

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology1515

EDCEDC= ErrorError DetectionDetection and CorrectionCorrection bits (redundancy)

D D = Data protected by error checking may include header fields

bull Error detection not 100 reliable

bull protocol may miss some errors but rarely

bull larger EDC field yields better detection and correction

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

Error Detection and Correction

School of Computer Science amp Technology1616

Error-Detection amp -Correction Techniques

Parity Checks

Internet Checksumming

Cyclic redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology1717

1Single Bit Parity Single Bit Parity Detect single bit errors

- Can detect odd number bits errorodd number bits error

even

odd

1 Parity Checks

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

1

School of Computer Science amp Technology1818

22 Two Dimensional Bit ParityTwo Dimensional Bit Parity - can detectdetect single bit errors - can correct correct single bit errors

0 0

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

1 Parity Checks

School of Computer Science amp Technology1919

FECFEC The ability of the receiverreceiver to both detectdetect and correctcorrect errors

0 0

1 Parity Checks

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2020

Sendertreat segmentsegment contents as sequencesequence of 16-bit 16-bit

integersintegerschecksumchecksum addition (1rsquos complement sum) of

segment contentssender puts checksumchecksum value into checksumchecksum field

Receiverthe sum of the received data (including the

checksum) = all 1 bitsNO -NO - error detectedYESYES - no error detected

2 Internet Checksum

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2121

Checksumming Checksumming methods require require relatively littlelittle overhead but provideprovide relatively weakweak protection against errors

Why is checksummingchecksumming used at the transporttransport layerTransport layer is typically implemented in

softsoft in a host as a part of OSOS

2 Checksumming

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2222

The data (DD) ) are viewed as a d-bit d-bit binary number

The SenderSender chooses rr additional bits (R CRC bitsR CRC bits) and appends them to the DD such that d+r d+r bits is exactly divisible by GG using modulo-2 modulo-2 arithmetic Sender and receiver both know the (r+1)-bitr+1)-bit generator (G)(G)

The receiver receiver divides (d+r)-bit(d+r)-bit (DRDR) by G G If non-zeronon-zero remainder error detectederror detected

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2323

Modulo-2 algorithmNo addition carriesaddition carries

No subtraction borrows subtraction borrows The addition (+)addition (+) and the subtraction (-)subtraction (-) are identical identical

and both are equivalentare equivalent to the bitwisebitwise exclusive-orexclusive-or (XORXOR)

For example1011 XOR 0101 = 1110

1011 mdash 0101 = 1110

1011 + 0101 = 1110

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2424

How the Sender computes the How the Sender computes the RRWant Want DD22rr XOR RR = nGnG

equivalentlyequivalently DD22rr XOR RR XOR RR = nG nG XOR RR

DD22rr = nG nG XOR RR

equivalentlyequivalently if we divide D2r by G want remainderremainder R

R = remainder[ ]

D2r

G

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

School of Computer Science amp Technology2525

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

ExampleExampleDD=101110 GG = 1001rr =3 and TT

(D000D000)=101110000000TT (DRDR)=101110011011

CRC can detect all burst errors less thanless than r+1 bits r+1 bitsCRC-32( international standard ) =100000100110000010001110110110111

School of Computer Science amp Technology2626

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology2727

Two types of linkslinkspoint-to-pointpoint-to-point

Only Only a sender and a receivera receiver sits at each end PPP for dial-up access

broadcast (shared wire or medium)broadcast (shared wire or medium)Many Many senders and receivers shareshare the link

traditional EthernetWLANUpstream of HFC

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2828

single shared broadcast channel two or more simultaneoussimultaneous transmissions by

nodes will cause interference CollisionCollision-if node receives twotwo oror moremore

signals at the same time

Multiple Access ProblemHow to coordinatecoordinate the access of a

sharedshared broadcastbroadcast channelchannel

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2929

multiple access protocolmultiple access protocoldistributed algorithmdistributed algorithm that determines how

nodes share the channel ie determine whenwhen and whichwhich node can transmit

communication about channel sharing must use channel itself

no out-of-bandout-of-band channel for coordination

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3030

The requirements to multiple access multiple access protocolprotocol for a broadcast channelbroadcast channel of rate RR bpsWhen one node can transmit it send at rate RRWhen M M nodes want to transmit over the channel

each can send at average rate RMRM bpsFully decentralized

no special nodespecial node to coordinate transmissionsno synchronizationsynchronization of clocks slots

Simple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3131

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code)

allocate piece to node for exclusive useRandom AccessRandom Access

channel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3232

TDM (Time Division MultiplexingTime Division Multiplexing)Time divided into FramesFrames and further divides each

Frame into N slotsslots each slot is then assigned to one of the N N nodes

Nodes access to channel in rounds unused slots go idleidle

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3333

TDMA eliminates collisions collisions and is perfectly fairfair but has two drawbacksdrawbacks

each node gets a dedicateddedicated transmission rate of RNRN and the average rate is limited to RNRN

a node mustmust always wait for its turnwait for its turn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

11 TDMA

School of Computer Science amp Technology3434

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

The spectrumspectrum is divided into frequencyfrequency bandsbandseach station assigned fixedfixed frequency bandunused transmission time in each frequency

bands goes idleidle

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3535

advantagesadvantages and drawbacksdrawbacks

can avoids collisionscollisions

shareshare the channel fairlyfairly

a node is limitedlimited to a bandwidthbandwidth of RNRN

a node needneed notnot waitswaits forfor its turnturn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

12 FDMA

frequ

ency

bands

time

School of Computer Science amp Technology3636

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)Assign a different codecode to each node

Each node encodesencodes the data bits using its unique code

Different nodes can transmit simultaneously

Usually used in military systems in early time

Details discussed in wireless networking of Advanced Advanced Computer NetworksComputer Networks

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3737

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Accesschannel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3838

When a node has a packet to send it transmit the packet at fullfull channelchannel datadata raterate R R bpsno a prioripriori coordination coordination among nodes

may cause collisioncollision

Each node involved in the collision repeatedlyrepeatedly retransmitsretransmits its packet until the packet gets through withoutwithout anyany collisioncollisiona node waits some time choosed randomly randomly

before retransmission

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology3939

random access protocol specifies how to detect collisionshow to recover from collisions

Examples of random access protocolsslottedslotted ALOHAALOHA

Pure ALOHAPure ALOHA

CSMACSMA CSMACDCSMACD CSMACACSMACA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology4040

Assumptionsall framesframes have same sizesame size L bitstimetime is divided into equal size slotsequal size slots

time to transmit 1 frame LR

nodes start to transmit frames onlyonly at beginningbeginning of slotsslotsnodes are synchronizedsynchronized

if there 2 or more2 or more nodes transmitting in a slot all nodes can detectdetect the collisioncollision

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4141

Operationwhen node obtains fresh framefresh frame it transmits

in the next slotnext slotIf there is not a collisioncollision node can send new new

frameframe in next slotnext slotThe sending node can detect the collision before

the end of the slot

If there is a collision collision node retransmitsretransmits frame in each subsequentsubsequent slotslot with probability pp until successsuccess

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4242

Advantages single active nodesingle active node can continuously transmit at fullfull

raterate of channelhighly decentralized only slots in nodesnodes needneed to be to be

inin synchronizationsynchronizationsimplesimple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 10: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology1010

link layer protocol implementedimplemented in an adapteradapter

aka Network Interface Card (NICNIC)

Ethernet card PCMCIA card 80211 card

sendingnode

frame

rcvingnode

datagram

frame

adapter adapter

link layer protocol

2 Adapters Communicating

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology1111

sending sidesending sideencapsulates datagramdatagram in a frameframeaddsadds errorerror checkingchecking bits rdtrdt flowflow controlcontrol etc

receiving sidereceiving sidecheckingchecking errorserrors rdtrdt flowflow controlcontrol etcextractsextracts datagram from frame and passespasses it to receiving node

sendingnode

frame

rcvingnode

datagram

frame

adapter adapter

link layer protocol

2 Adapters Communicating

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology1212

2 Adapters Communicating

adapter is a semi-autonomous semi-autonomous system

It can receivereceive a frame checkcheck errorserrors and discarddiscard the corrupted frames withoutwithout notifying other componentsIt interruptsinterrupts the parent node onlyonly ifif it wants to pass

datagram up the protocol stack

The parent node fullyfully delegateddelegated to the adapter the task of transmitting the datagram across the link

The adapter is typically housedhoused in the box as the rest of the node

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology1414

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology1515

EDCEDC= ErrorError DetectionDetection and CorrectionCorrection bits (redundancy)

D D = Data protected by error checking may include header fields

bull Error detection not 100 reliable

bull protocol may miss some errors but rarely

bull larger EDC field yields better detection and correction

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

Error Detection and Correction

School of Computer Science amp Technology1616

Error-Detection amp -Correction Techniques

Parity Checks

Internet Checksumming

Cyclic redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology1717

1Single Bit Parity Single Bit Parity Detect single bit errors

- Can detect odd number bits errorodd number bits error

even

odd

1 Parity Checks

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

1

School of Computer Science amp Technology1818

22 Two Dimensional Bit ParityTwo Dimensional Bit Parity - can detectdetect single bit errors - can correct correct single bit errors

0 0

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

1 Parity Checks

School of Computer Science amp Technology1919

FECFEC The ability of the receiverreceiver to both detectdetect and correctcorrect errors

0 0

1 Parity Checks

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2020

Sendertreat segmentsegment contents as sequencesequence of 16-bit 16-bit

integersintegerschecksumchecksum addition (1rsquos complement sum) of

segment contentssender puts checksumchecksum value into checksumchecksum field

Receiverthe sum of the received data (including the

checksum) = all 1 bitsNO -NO - error detectedYESYES - no error detected

2 Internet Checksum

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2121

Checksumming Checksumming methods require require relatively littlelittle overhead but provideprovide relatively weakweak protection against errors

Why is checksummingchecksumming used at the transporttransport layerTransport layer is typically implemented in

softsoft in a host as a part of OSOS

2 Checksumming

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2222

The data (DD) ) are viewed as a d-bit d-bit binary number

The SenderSender chooses rr additional bits (R CRC bitsR CRC bits) and appends them to the DD such that d+r d+r bits is exactly divisible by GG using modulo-2 modulo-2 arithmetic Sender and receiver both know the (r+1)-bitr+1)-bit generator (G)(G)

The receiver receiver divides (d+r)-bit(d+r)-bit (DRDR) by G G If non-zeronon-zero remainder error detectederror detected

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2323

Modulo-2 algorithmNo addition carriesaddition carries

No subtraction borrows subtraction borrows The addition (+)addition (+) and the subtraction (-)subtraction (-) are identical identical

and both are equivalentare equivalent to the bitwisebitwise exclusive-orexclusive-or (XORXOR)

For example1011 XOR 0101 = 1110

1011 mdash 0101 = 1110

1011 + 0101 = 1110

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2424

How the Sender computes the How the Sender computes the RRWant Want DD22rr XOR RR = nGnG

equivalentlyequivalently DD22rr XOR RR XOR RR = nG nG XOR RR

DD22rr = nG nG XOR RR

equivalentlyequivalently if we divide D2r by G want remainderremainder R

R = remainder[ ]

D2r

G

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

School of Computer Science amp Technology2525

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

ExampleExampleDD=101110 GG = 1001rr =3 and TT

(D000D000)=101110000000TT (DRDR)=101110011011

CRC can detect all burst errors less thanless than r+1 bits r+1 bitsCRC-32( international standard ) =100000100110000010001110110110111

School of Computer Science amp Technology2626

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology2727

Two types of linkslinkspoint-to-pointpoint-to-point

Only Only a sender and a receivera receiver sits at each end PPP for dial-up access

broadcast (shared wire or medium)broadcast (shared wire or medium)Many Many senders and receivers shareshare the link

traditional EthernetWLANUpstream of HFC

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2828

single shared broadcast channel two or more simultaneoussimultaneous transmissions by

nodes will cause interference CollisionCollision-if node receives twotwo oror moremore

signals at the same time

Multiple Access ProblemHow to coordinatecoordinate the access of a

sharedshared broadcastbroadcast channelchannel

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2929

multiple access protocolmultiple access protocoldistributed algorithmdistributed algorithm that determines how

nodes share the channel ie determine whenwhen and whichwhich node can transmit

communication about channel sharing must use channel itself

no out-of-bandout-of-band channel for coordination

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3030

The requirements to multiple access multiple access protocolprotocol for a broadcast channelbroadcast channel of rate RR bpsWhen one node can transmit it send at rate RRWhen M M nodes want to transmit over the channel

each can send at average rate RMRM bpsFully decentralized

no special nodespecial node to coordinate transmissionsno synchronizationsynchronization of clocks slots

Simple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3131

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code)

allocate piece to node for exclusive useRandom AccessRandom Access

channel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3232

TDM (Time Division MultiplexingTime Division Multiplexing)Time divided into FramesFrames and further divides each

Frame into N slotsslots each slot is then assigned to one of the N N nodes

Nodes access to channel in rounds unused slots go idleidle

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3333

TDMA eliminates collisions collisions and is perfectly fairfair but has two drawbacksdrawbacks

each node gets a dedicateddedicated transmission rate of RNRN and the average rate is limited to RNRN

a node mustmust always wait for its turnwait for its turn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

11 TDMA

School of Computer Science amp Technology3434

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

The spectrumspectrum is divided into frequencyfrequency bandsbandseach station assigned fixedfixed frequency bandunused transmission time in each frequency

bands goes idleidle

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3535

advantagesadvantages and drawbacksdrawbacks

can avoids collisionscollisions

shareshare the channel fairlyfairly

a node is limitedlimited to a bandwidthbandwidth of RNRN

a node needneed notnot waitswaits forfor its turnturn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

12 FDMA

frequ

ency

bands

time

School of Computer Science amp Technology3636

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)Assign a different codecode to each node

Each node encodesencodes the data bits using its unique code

Different nodes can transmit simultaneously

Usually used in military systems in early time

Details discussed in wireless networking of Advanced Advanced Computer NetworksComputer Networks

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3737

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Accesschannel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3838

When a node has a packet to send it transmit the packet at fullfull channelchannel datadata raterate R R bpsno a prioripriori coordination coordination among nodes

may cause collisioncollision

Each node involved in the collision repeatedlyrepeatedly retransmitsretransmits its packet until the packet gets through withoutwithout anyany collisioncollisiona node waits some time choosed randomly randomly

before retransmission

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology3939

random access protocol specifies how to detect collisionshow to recover from collisions

Examples of random access protocolsslottedslotted ALOHAALOHA

Pure ALOHAPure ALOHA

CSMACSMA CSMACDCSMACD CSMACACSMACA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology4040

Assumptionsall framesframes have same sizesame size L bitstimetime is divided into equal size slotsequal size slots

time to transmit 1 frame LR

nodes start to transmit frames onlyonly at beginningbeginning of slotsslotsnodes are synchronizedsynchronized

if there 2 or more2 or more nodes transmitting in a slot all nodes can detectdetect the collisioncollision

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4141

Operationwhen node obtains fresh framefresh frame it transmits

in the next slotnext slotIf there is not a collisioncollision node can send new new

frameframe in next slotnext slotThe sending node can detect the collision before

the end of the slot

If there is a collision collision node retransmitsretransmits frame in each subsequentsubsequent slotslot with probability pp until successsuccess

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4242

Advantages single active nodesingle active node can continuously transmit at fullfull

raterate of channelhighly decentralized only slots in nodesnodes needneed to be to be

inin synchronizationsynchronizationsimplesimple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 11: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology1111

sending sidesending sideencapsulates datagramdatagram in a frameframeaddsadds errorerror checkingchecking bits rdtrdt flowflow controlcontrol etc

receiving sidereceiving sidecheckingchecking errorserrors rdtrdt flowflow controlcontrol etcextractsextracts datagram from frame and passespasses it to receiving node

sendingnode

frame

rcvingnode

datagram

frame

adapter adapter

link layer protocol

2 Adapters Communicating

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology1212

2 Adapters Communicating

adapter is a semi-autonomous semi-autonomous system

It can receivereceive a frame checkcheck errorserrors and discarddiscard the corrupted frames withoutwithout notifying other componentsIt interruptsinterrupts the parent node onlyonly ifif it wants to pass

datagram up the protocol stack

The parent node fullyfully delegateddelegated to the adapter the task of transmitting the datagram across the link

The adapter is typically housedhoused in the box as the rest of the node

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology1414

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology1515

EDCEDC= ErrorError DetectionDetection and CorrectionCorrection bits (redundancy)

D D = Data protected by error checking may include header fields

bull Error detection not 100 reliable

bull protocol may miss some errors but rarely

bull larger EDC field yields better detection and correction

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

Error Detection and Correction

School of Computer Science amp Technology1616

Error-Detection amp -Correction Techniques

Parity Checks

Internet Checksumming

Cyclic redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology1717

1Single Bit Parity Single Bit Parity Detect single bit errors

- Can detect odd number bits errorodd number bits error

even

odd

1 Parity Checks

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

1

School of Computer Science amp Technology1818

22 Two Dimensional Bit ParityTwo Dimensional Bit Parity - can detectdetect single bit errors - can correct correct single bit errors

0 0

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

1 Parity Checks

School of Computer Science amp Technology1919

FECFEC The ability of the receiverreceiver to both detectdetect and correctcorrect errors

0 0

1 Parity Checks

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2020

Sendertreat segmentsegment contents as sequencesequence of 16-bit 16-bit

integersintegerschecksumchecksum addition (1rsquos complement sum) of

segment contentssender puts checksumchecksum value into checksumchecksum field

Receiverthe sum of the received data (including the

checksum) = all 1 bitsNO -NO - error detectedYESYES - no error detected

2 Internet Checksum

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2121

Checksumming Checksumming methods require require relatively littlelittle overhead but provideprovide relatively weakweak protection against errors

Why is checksummingchecksumming used at the transporttransport layerTransport layer is typically implemented in

softsoft in a host as a part of OSOS

2 Checksumming

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2222

The data (DD) ) are viewed as a d-bit d-bit binary number

The SenderSender chooses rr additional bits (R CRC bitsR CRC bits) and appends them to the DD such that d+r d+r bits is exactly divisible by GG using modulo-2 modulo-2 arithmetic Sender and receiver both know the (r+1)-bitr+1)-bit generator (G)(G)

The receiver receiver divides (d+r)-bit(d+r)-bit (DRDR) by G G If non-zeronon-zero remainder error detectederror detected

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2323

Modulo-2 algorithmNo addition carriesaddition carries

No subtraction borrows subtraction borrows The addition (+)addition (+) and the subtraction (-)subtraction (-) are identical identical

and both are equivalentare equivalent to the bitwisebitwise exclusive-orexclusive-or (XORXOR)

For example1011 XOR 0101 = 1110

1011 mdash 0101 = 1110

1011 + 0101 = 1110

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2424

How the Sender computes the How the Sender computes the RRWant Want DD22rr XOR RR = nGnG

equivalentlyequivalently DD22rr XOR RR XOR RR = nG nG XOR RR

DD22rr = nG nG XOR RR

equivalentlyequivalently if we divide D2r by G want remainderremainder R

R = remainder[ ]

D2r

G

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

School of Computer Science amp Technology2525

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

ExampleExampleDD=101110 GG = 1001rr =3 and TT

(D000D000)=101110000000TT (DRDR)=101110011011

CRC can detect all burst errors less thanless than r+1 bits r+1 bitsCRC-32( international standard ) =100000100110000010001110110110111

School of Computer Science amp Technology2626

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology2727

Two types of linkslinkspoint-to-pointpoint-to-point

Only Only a sender and a receivera receiver sits at each end PPP for dial-up access

broadcast (shared wire or medium)broadcast (shared wire or medium)Many Many senders and receivers shareshare the link

traditional EthernetWLANUpstream of HFC

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2828

single shared broadcast channel two or more simultaneoussimultaneous transmissions by

nodes will cause interference CollisionCollision-if node receives twotwo oror moremore

signals at the same time

Multiple Access ProblemHow to coordinatecoordinate the access of a

sharedshared broadcastbroadcast channelchannel

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2929

multiple access protocolmultiple access protocoldistributed algorithmdistributed algorithm that determines how

nodes share the channel ie determine whenwhen and whichwhich node can transmit

communication about channel sharing must use channel itself

no out-of-bandout-of-band channel for coordination

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3030

The requirements to multiple access multiple access protocolprotocol for a broadcast channelbroadcast channel of rate RR bpsWhen one node can transmit it send at rate RRWhen M M nodes want to transmit over the channel

each can send at average rate RMRM bpsFully decentralized

no special nodespecial node to coordinate transmissionsno synchronizationsynchronization of clocks slots

Simple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3131

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code)

allocate piece to node for exclusive useRandom AccessRandom Access

channel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3232

TDM (Time Division MultiplexingTime Division Multiplexing)Time divided into FramesFrames and further divides each

Frame into N slotsslots each slot is then assigned to one of the N N nodes

Nodes access to channel in rounds unused slots go idleidle

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3333

TDMA eliminates collisions collisions and is perfectly fairfair but has two drawbacksdrawbacks

each node gets a dedicateddedicated transmission rate of RNRN and the average rate is limited to RNRN

a node mustmust always wait for its turnwait for its turn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

11 TDMA

School of Computer Science amp Technology3434

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

The spectrumspectrum is divided into frequencyfrequency bandsbandseach station assigned fixedfixed frequency bandunused transmission time in each frequency

bands goes idleidle

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3535

advantagesadvantages and drawbacksdrawbacks

can avoids collisionscollisions

shareshare the channel fairlyfairly

a node is limitedlimited to a bandwidthbandwidth of RNRN

a node needneed notnot waitswaits forfor its turnturn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

12 FDMA

frequ

ency

bands

time

School of Computer Science amp Technology3636

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)Assign a different codecode to each node

Each node encodesencodes the data bits using its unique code

Different nodes can transmit simultaneously

Usually used in military systems in early time

Details discussed in wireless networking of Advanced Advanced Computer NetworksComputer Networks

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3737

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Accesschannel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3838

When a node has a packet to send it transmit the packet at fullfull channelchannel datadata raterate R R bpsno a prioripriori coordination coordination among nodes

may cause collisioncollision

Each node involved in the collision repeatedlyrepeatedly retransmitsretransmits its packet until the packet gets through withoutwithout anyany collisioncollisiona node waits some time choosed randomly randomly

before retransmission

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology3939

random access protocol specifies how to detect collisionshow to recover from collisions

Examples of random access protocolsslottedslotted ALOHAALOHA

Pure ALOHAPure ALOHA

CSMACSMA CSMACDCSMACD CSMACACSMACA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology4040

Assumptionsall framesframes have same sizesame size L bitstimetime is divided into equal size slotsequal size slots

time to transmit 1 frame LR

nodes start to transmit frames onlyonly at beginningbeginning of slotsslotsnodes are synchronizedsynchronized

if there 2 or more2 or more nodes transmitting in a slot all nodes can detectdetect the collisioncollision

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4141

Operationwhen node obtains fresh framefresh frame it transmits

in the next slotnext slotIf there is not a collisioncollision node can send new new

frameframe in next slotnext slotThe sending node can detect the collision before

the end of the slot

If there is a collision collision node retransmitsretransmits frame in each subsequentsubsequent slotslot with probability pp until successsuccess

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4242

Advantages single active nodesingle active node can continuously transmit at fullfull

raterate of channelhighly decentralized only slots in nodesnodes needneed to be to be

inin synchronizationsynchronizationsimplesimple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 12: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology1212

2 Adapters Communicating

adapter is a semi-autonomous semi-autonomous system

It can receivereceive a frame checkcheck errorserrors and discarddiscard the corrupted frames withoutwithout notifying other componentsIt interruptsinterrupts the parent node onlyonly ifif it wants to pass

datagram up the protocol stack

The parent node fullyfully delegateddelegated to the adapter the task of transmitting the datagram across the link

The adapter is typically housedhoused in the box as the rest of the node

51 Introd

uction

and

51 In

trodu

ction an

d

Services

Services

School of Computer Science amp Technology1414

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology1515

EDCEDC= ErrorError DetectionDetection and CorrectionCorrection bits (redundancy)

D D = Data protected by error checking may include header fields

bull Error detection not 100 reliable

bull protocol may miss some errors but rarely

bull larger EDC field yields better detection and correction

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

Error Detection and Correction

School of Computer Science amp Technology1616

Error-Detection amp -Correction Techniques

Parity Checks

Internet Checksumming

Cyclic redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology1717

1Single Bit Parity Single Bit Parity Detect single bit errors

- Can detect odd number bits errorodd number bits error

even

odd

1 Parity Checks

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

1

School of Computer Science amp Technology1818

22 Two Dimensional Bit ParityTwo Dimensional Bit Parity - can detectdetect single bit errors - can correct correct single bit errors

0 0

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

1 Parity Checks

School of Computer Science amp Technology1919

FECFEC The ability of the receiverreceiver to both detectdetect and correctcorrect errors

0 0

1 Parity Checks

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2020

Sendertreat segmentsegment contents as sequencesequence of 16-bit 16-bit

integersintegerschecksumchecksum addition (1rsquos complement sum) of

segment contentssender puts checksumchecksum value into checksumchecksum field

Receiverthe sum of the received data (including the

checksum) = all 1 bitsNO -NO - error detectedYESYES - no error detected

2 Internet Checksum

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2121

Checksumming Checksumming methods require require relatively littlelittle overhead but provideprovide relatively weakweak protection against errors

Why is checksummingchecksumming used at the transporttransport layerTransport layer is typically implemented in

softsoft in a host as a part of OSOS

2 Checksumming

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2222

The data (DD) ) are viewed as a d-bit d-bit binary number

The SenderSender chooses rr additional bits (R CRC bitsR CRC bits) and appends them to the DD such that d+r d+r bits is exactly divisible by GG using modulo-2 modulo-2 arithmetic Sender and receiver both know the (r+1)-bitr+1)-bit generator (G)(G)

The receiver receiver divides (d+r)-bit(d+r)-bit (DRDR) by G G If non-zeronon-zero remainder error detectederror detected

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2323

Modulo-2 algorithmNo addition carriesaddition carries

No subtraction borrows subtraction borrows The addition (+)addition (+) and the subtraction (-)subtraction (-) are identical identical

and both are equivalentare equivalent to the bitwisebitwise exclusive-orexclusive-or (XORXOR)

For example1011 XOR 0101 = 1110

1011 mdash 0101 = 1110

1011 + 0101 = 1110

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2424

How the Sender computes the How the Sender computes the RRWant Want DD22rr XOR RR = nGnG

equivalentlyequivalently DD22rr XOR RR XOR RR = nG nG XOR RR

DD22rr = nG nG XOR RR

equivalentlyequivalently if we divide D2r by G want remainderremainder R

R = remainder[ ]

D2r

G

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

School of Computer Science amp Technology2525

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

ExampleExampleDD=101110 GG = 1001rr =3 and TT

(D000D000)=101110000000TT (DRDR)=101110011011

CRC can detect all burst errors less thanless than r+1 bits r+1 bitsCRC-32( international standard ) =100000100110000010001110110110111

School of Computer Science amp Technology2626

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology2727

Two types of linkslinkspoint-to-pointpoint-to-point

Only Only a sender and a receivera receiver sits at each end PPP for dial-up access

broadcast (shared wire or medium)broadcast (shared wire or medium)Many Many senders and receivers shareshare the link

traditional EthernetWLANUpstream of HFC

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2828

single shared broadcast channel two or more simultaneoussimultaneous transmissions by

nodes will cause interference CollisionCollision-if node receives twotwo oror moremore

signals at the same time

Multiple Access ProblemHow to coordinatecoordinate the access of a

sharedshared broadcastbroadcast channelchannel

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2929

multiple access protocolmultiple access protocoldistributed algorithmdistributed algorithm that determines how

nodes share the channel ie determine whenwhen and whichwhich node can transmit

communication about channel sharing must use channel itself

no out-of-bandout-of-band channel for coordination

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3030

The requirements to multiple access multiple access protocolprotocol for a broadcast channelbroadcast channel of rate RR bpsWhen one node can transmit it send at rate RRWhen M M nodes want to transmit over the channel

each can send at average rate RMRM bpsFully decentralized

no special nodespecial node to coordinate transmissionsno synchronizationsynchronization of clocks slots

Simple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3131

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code)

allocate piece to node for exclusive useRandom AccessRandom Access

channel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3232

TDM (Time Division MultiplexingTime Division Multiplexing)Time divided into FramesFrames and further divides each

Frame into N slotsslots each slot is then assigned to one of the N N nodes

Nodes access to channel in rounds unused slots go idleidle

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3333

TDMA eliminates collisions collisions and is perfectly fairfair but has two drawbacksdrawbacks

each node gets a dedicateddedicated transmission rate of RNRN and the average rate is limited to RNRN

a node mustmust always wait for its turnwait for its turn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

11 TDMA

School of Computer Science amp Technology3434

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

The spectrumspectrum is divided into frequencyfrequency bandsbandseach station assigned fixedfixed frequency bandunused transmission time in each frequency

bands goes idleidle

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3535

advantagesadvantages and drawbacksdrawbacks

can avoids collisionscollisions

shareshare the channel fairlyfairly

a node is limitedlimited to a bandwidthbandwidth of RNRN

a node needneed notnot waitswaits forfor its turnturn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

12 FDMA

frequ

ency

bands

time

School of Computer Science amp Technology3636

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)Assign a different codecode to each node

Each node encodesencodes the data bits using its unique code

Different nodes can transmit simultaneously

Usually used in military systems in early time

Details discussed in wireless networking of Advanced Advanced Computer NetworksComputer Networks

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3737

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Accesschannel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3838

When a node has a packet to send it transmit the packet at fullfull channelchannel datadata raterate R R bpsno a prioripriori coordination coordination among nodes

may cause collisioncollision

Each node involved in the collision repeatedlyrepeatedly retransmitsretransmits its packet until the packet gets through withoutwithout anyany collisioncollisiona node waits some time choosed randomly randomly

before retransmission

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology3939

random access protocol specifies how to detect collisionshow to recover from collisions

Examples of random access protocolsslottedslotted ALOHAALOHA

Pure ALOHAPure ALOHA

CSMACSMA CSMACDCSMACD CSMACACSMACA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology4040

Assumptionsall framesframes have same sizesame size L bitstimetime is divided into equal size slotsequal size slots

time to transmit 1 frame LR

nodes start to transmit frames onlyonly at beginningbeginning of slotsslotsnodes are synchronizedsynchronized

if there 2 or more2 or more nodes transmitting in a slot all nodes can detectdetect the collisioncollision

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4141

Operationwhen node obtains fresh framefresh frame it transmits

in the next slotnext slotIf there is not a collisioncollision node can send new new

frameframe in next slotnext slotThe sending node can detect the collision before

the end of the slot

If there is a collision collision node retransmitsretransmits frame in each subsequentsubsequent slotslot with probability pp until successsuccess

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4242

Advantages single active nodesingle active node can continuously transmit at fullfull

raterate of channelhighly decentralized only slots in nodesnodes needneed to be to be

inin synchronizationsynchronizationsimplesimple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 13: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology1414

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology1515

EDCEDC= ErrorError DetectionDetection and CorrectionCorrection bits (redundancy)

D D = Data protected by error checking may include header fields

bull Error detection not 100 reliable

bull protocol may miss some errors but rarely

bull larger EDC field yields better detection and correction

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

Error Detection and Correction

School of Computer Science amp Technology1616

Error-Detection amp -Correction Techniques

Parity Checks

Internet Checksumming

Cyclic redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology1717

1Single Bit Parity Single Bit Parity Detect single bit errors

- Can detect odd number bits errorodd number bits error

even

odd

1 Parity Checks

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

1

School of Computer Science amp Technology1818

22 Two Dimensional Bit ParityTwo Dimensional Bit Parity - can detectdetect single bit errors - can correct correct single bit errors

0 0

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

1 Parity Checks

School of Computer Science amp Technology1919

FECFEC The ability of the receiverreceiver to both detectdetect and correctcorrect errors

0 0

1 Parity Checks

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2020

Sendertreat segmentsegment contents as sequencesequence of 16-bit 16-bit

integersintegerschecksumchecksum addition (1rsquos complement sum) of

segment contentssender puts checksumchecksum value into checksumchecksum field

Receiverthe sum of the received data (including the

checksum) = all 1 bitsNO -NO - error detectedYESYES - no error detected

2 Internet Checksum

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2121

Checksumming Checksumming methods require require relatively littlelittle overhead but provideprovide relatively weakweak protection against errors

Why is checksummingchecksumming used at the transporttransport layerTransport layer is typically implemented in

softsoft in a host as a part of OSOS

2 Checksumming

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2222

The data (DD) ) are viewed as a d-bit d-bit binary number

The SenderSender chooses rr additional bits (R CRC bitsR CRC bits) and appends them to the DD such that d+r d+r bits is exactly divisible by GG using modulo-2 modulo-2 arithmetic Sender and receiver both know the (r+1)-bitr+1)-bit generator (G)(G)

The receiver receiver divides (d+r)-bit(d+r)-bit (DRDR) by G G If non-zeronon-zero remainder error detectederror detected

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2323

Modulo-2 algorithmNo addition carriesaddition carries

No subtraction borrows subtraction borrows The addition (+)addition (+) and the subtraction (-)subtraction (-) are identical identical

and both are equivalentare equivalent to the bitwisebitwise exclusive-orexclusive-or (XORXOR)

For example1011 XOR 0101 = 1110

1011 mdash 0101 = 1110

1011 + 0101 = 1110

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2424

How the Sender computes the How the Sender computes the RRWant Want DD22rr XOR RR = nGnG

equivalentlyequivalently DD22rr XOR RR XOR RR = nG nG XOR RR

DD22rr = nG nG XOR RR

equivalentlyequivalently if we divide D2r by G want remainderremainder R

R = remainder[ ]

D2r

G

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

School of Computer Science amp Technology2525

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

ExampleExampleDD=101110 GG = 1001rr =3 and TT

(D000D000)=101110000000TT (DRDR)=101110011011

CRC can detect all burst errors less thanless than r+1 bits r+1 bitsCRC-32( international standard ) =100000100110000010001110110110111

School of Computer Science amp Technology2626

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology2727

Two types of linkslinkspoint-to-pointpoint-to-point

Only Only a sender and a receivera receiver sits at each end PPP for dial-up access

broadcast (shared wire or medium)broadcast (shared wire or medium)Many Many senders and receivers shareshare the link

traditional EthernetWLANUpstream of HFC

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2828

single shared broadcast channel two or more simultaneoussimultaneous transmissions by

nodes will cause interference CollisionCollision-if node receives twotwo oror moremore

signals at the same time

Multiple Access ProblemHow to coordinatecoordinate the access of a

sharedshared broadcastbroadcast channelchannel

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2929

multiple access protocolmultiple access protocoldistributed algorithmdistributed algorithm that determines how

nodes share the channel ie determine whenwhen and whichwhich node can transmit

communication about channel sharing must use channel itself

no out-of-bandout-of-band channel for coordination

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3030

The requirements to multiple access multiple access protocolprotocol for a broadcast channelbroadcast channel of rate RR bpsWhen one node can transmit it send at rate RRWhen M M nodes want to transmit over the channel

each can send at average rate RMRM bpsFully decentralized

no special nodespecial node to coordinate transmissionsno synchronizationsynchronization of clocks slots

Simple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3131

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code)

allocate piece to node for exclusive useRandom AccessRandom Access

channel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3232

TDM (Time Division MultiplexingTime Division Multiplexing)Time divided into FramesFrames and further divides each

Frame into N slotsslots each slot is then assigned to one of the N N nodes

Nodes access to channel in rounds unused slots go idleidle

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3333

TDMA eliminates collisions collisions and is perfectly fairfair but has two drawbacksdrawbacks

each node gets a dedicateddedicated transmission rate of RNRN and the average rate is limited to RNRN

a node mustmust always wait for its turnwait for its turn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

11 TDMA

School of Computer Science amp Technology3434

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

The spectrumspectrum is divided into frequencyfrequency bandsbandseach station assigned fixedfixed frequency bandunused transmission time in each frequency

bands goes idleidle

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3535

advantagesadvantages and drawbacksdrawbacks

can avoids collisionscollisions

shareshare the channel fairlyfairly

a node is limitedlimited to a bandwidthbandwidth of RNRN

a node needneed notnot waitswaits forfor its turnturn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

12 FDMA

frequ

ency

bands

time

School of Computer Science amp Technology3636

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)Assign a different codecode to each node

Each node encodesencodes the data bits using its unique code

Different nodes can transmit simultaneously

Usually used in military systems in early time

Details discussed in wireless networking of Advanced Advanced Computer NetworksComputer Networks

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3737

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Accesschannel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3838

When a node has a packet to send it transmit the packet at fullfull channelchannel datadata raterate R R bpsno a prioripriori coordination coordination among nodes

may cause collisioncollision

Each node involved in the collision repeatedlyrepeatedly retransmitsretransmits its packet until the packet gets through withoutwithout anyany collisioncollisiona node waits some time choosed randomly randomly

before retransmission

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology3939

random access protocol specifies how to detect collisionshow to recover from collisions

Examples of random access protocolsslottedslotted ALOHAALOHA

Pure ALOHAPure ALOHA

CSMACSMA CSMACDCSMACD CSMACACSMACA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology4040

Assumptionsall framesframes have same sizesame size L bitstimetime is divided into equal size slotsequal size slots

time to transmit 1 frame LR

nodes start to transmit frames onlyonly at beginningbeginning of slotsslotsnodes are synchronizedsynchronized

if there 2 or more2 or more nodes transmitting in a slot all nodes can detectdetect the collisioncollision

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4141

Operationwhen node obtains fresh framefresh frame it transmits

in the next slotnext slotIf there is not a collisioncollision node can send new new

frameframe in next slotnext slotThe sending node can detect the collision before

the end of the slot

If there is a collision collision node retransmitsretransmits frame in each subsequentsubsequent slotslot with probability pp until successsuccess

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4242

Advantages single active nodesingle active node can continuously transmit at fullfull

raterate of channelhighly decentralized only slots in nodesnodes needneed to be to be

inin synchronizationsynchronizationsimplesimple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 14: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology1515

EDCEDC= ErrorError DetectionDetection and CorrectionCorrection bits (redundancy)

D D = Data protected by error checking may include header fields

bull Error detection not 100 reliable

bull protocol may miss some errors but rarely

bull larger EDC field yields better detection and correction

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

Error Detection and Correction

School of Computer Science amp Technology1616

Error-Detection amp -Correction Techniques

Parity Checks

Internet Checksumming

Cyclic redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology1717

1Single Bit Parity Single Bit Parity Detect single bit errors

- Can detect odd number bits errorodd number bits error

even

odd

1 Parity Checks

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

1

School of Computer Science amp Technology1818

22 Two Dimensional Bit ParityTwo Dimensional Bit Parity - can detectdetect single bit errors - can correct correct single bit errors

0 0

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

1 Parity Checks

School of Computer Science amp Technology1919

FECFEC The ability of the receiverreceiver to both detectdetect and correctcorrect errors

0 0

1 Parity Checks

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2020

Sendertreat segmentsegment contents as sequencesequence of 16-bit 16-bit

integersintegerschecksumchecksum addition (1rsquos complement sum) of

segment contentssender puts checksumchecksum value into checksumchecksum field

Receiverthe sum of the received data (including the

checksum) = all 1 bitsNO -NO - error detectedYESYES - no error detected

2 Internet Checksum

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2121

Checksumming Checksumming methods require require relatively littlelittle overhead but provideprovide relatively weakweak protection against errors

Why is checksummingchecksumming used at the transporttransport layerTransport layer is typically implemented in

softsoft in a host as a part of OSOS

2 Checksumming

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2222

The data (DD) ) are viewed as a d-bit d-bit binary number

The SenderSender chooses rr additional bits (R CRC bitsR CRC bits) and appends them to the DD such that d+r d+r bits is exactly divisible by GG using modulo-2 modulo-2 arithmetic Sender and receiver both know the (r+1)-bitr+1)-bit generator (G)(G)

The receiver receiver divides (d+r)-bit(d+r)-bit (DRDR) by G G If non-zeronon-zero remainder error detectederror detected

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2323

Modulo-2 algorithmNo addition carriesaddition carries

No subtraction borrows subtraction borrows The addition (+)addition (+) and the subtraction (-)subtraction (-) are identical identical

and both are equivalentare equivalent to the bitwisebitwise exclusive-orexclusive-or (XORXOR)

For example1011 XOR 0101 = 1110

1011 mdash 0101 = 1110

1011 + 0101 = 1110

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2424

How the Sender computes the How the Sender computes the RRWant Want DD22rr XOR RR = nGnG

equivalentlyequivalently DD22rr XOR RR XOR RR = nG nG XOR RR

DD22rr = nG nG XOR RR

equivalentlyequivalently if we divide D2r by G want remainderremainder R

R = remainder[ ]

D2r

G

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

School of Computer Science amp Technology2525

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

ExampleExampleDD=101110 GG = 1001rr =3 and TT

(D000D000)=101110000000TT (DRDR)=101110011011

CRC can detect all burst errors less thanless than r+1 bits r+1 bitsCRC-32( international standard ) =100000100110000010001110110110111

School of Computer Science amp Technology2626

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology2727

Two types of linkslinkspoint-to-pointpoint-to-point

Only Only a sender and a receivera receiver sits at each end PPP for dial-up access

broadcast (shared wire or medium)broadcast (shared wire or medium)Many Many senders and receivers shareshare the link

traditional EthernetWLANUpstream of HFC

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2828

single shared broadcast channel two or more simultaneoussimultaneous transmissions by

nodes will cause interference CollisionCollision-if node receives twotwo oror moremore

signals at the same time

Multiple Access ProblemHow to coordinatecoordinate the access of a

sharedshared broadcastbroadcast channelchannel

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2929

multiple access protocolmultiple access protocoldistributed algorithmdistributed algorithm that determines how

nodes share the channel ie determine whenwhen and whichwhich node can transmit

communication about channel sharing must use channel itself

no out-of-bandout-of-band channel for coordination

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3030

The requirements to multiple access multiple access protocolprotocol for a broadcast channelbroadcast channel of rate RR bpsWhen one node can transmit it send at rate RRWhen M M nodes want to transmit over the channel

each can send at average rate RMRM bpsFully decentralized

no special nodespecial node to coordinate transmissionsno synchronizationsynchronization of clocks slots

Simple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3131

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code)

allocate piece to node for exclusive useRandom AccessRandom Access

channel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3232

TDM (Time Division MultiplexingTime Division Multiplexing)Time divided into FramesFrames and further divides each

Frame into N slotsslots each slot is then assigned to one of the N N nodes

Nodes access to channel in rounds unused slots go idleidle

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3333

TDMA eliminates collisions collisions and is perfectly fairfair but has two drawbacksdrawbacks

each node gets a dedicateddedicated transmission rate of RNRN and the average rate is limited to RNRN

a node mustmust always wait for its turnwait for its turn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

11 TDMA

School of Computer Science amp Technology3434

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

The spectrumspectrum is divided into frequencyfrequency bandsbandseach station assigned fixedfixed frequency bandunused transmission time in each frequency

bands goes idleidle

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3535

advantagesadvantages and drawbacksdrawbacks

can avoids collisionscollisions

shareshare the channel fairlyfairly

a node is limitedlimited to a bandwidthbandwidth of RNRN

a node needneed notnot waitswaits forfor its turnturn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

12 FDMA

frequ

ency

bands

time

School of Computer Science amp Technology3636

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)Assign a different codecode to each node

Each node encodesencodes the data bits using its unique code

Different nodes can transmit simultaneously

Usually used in military systems in early time

Details discussed in wireless networking of Advanced Advanced Computer NetworksComputer Networks

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3737

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Accesschannel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3838

When a node has a packet to send it transmit the packet at fullfull channelchannel datadata raterate R R bpsno a prioripriori coordination coordination among nodes

may cause collisioncollision

Each node involved in the collision repeatedlyrepeatedly retransmitsretransmits its packet until the packet gets through withoutwithout anyany collisioncollisiona node waits some time choosed randomly randomly

before retransmission

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology3939

random access protocol specifies how to detect collisionshow to recover from collisions

Examples of random access protocolsslottedslotted ALOHAALOHA

Pure ALOHAPure ALOHA

CSMACSMA CSMACDCSMACD CSMACACSMACA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology4040

Assumptionsall framesframes have same sizesame size L bitstimetime is divided into equal size slotsequal size slots

time to transmit 1 frame LR

nodes start to transmit frames onlyonly at beginningbeginning of slotsslotsnodes are synchronizedsynchronized

if there 2 or more2 or more nodes transmitting in a slot all nodes can detectdetect the collisioncollision

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4141

Operationwhen node obtains fresh framefresh frame it transmits

in the next slotnext slotIf there is not a collisioncollision node can send new new

frameframe in next slotnext slotThe sending node can detect the collision before

the end of the slot

If there is a collision collision node retransmitsretransmits frame in each subsequentsubsequent slotslot with probability pp until successsuccess

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4242

Advantages single active nodesingle active node can continuously transmit at fullfull

raterate of channelhighly decentralized only slots in nodesnodes needneed to be to be

inin synchronizationsynchronizationsimplesimple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 15: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology1616

Error-Detection amp -Correction Techniques

Parity Checks

Internet Checksumming

Cyclic redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology1717

1Single Bit Parity Single Bit Parity Detect single bit errors

- Can detect odd number bits errorodd number bits error

even

odd

1 Parity Checks

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

1

School of Computer Science amp Technology1818

22 Two Dimensional Bit ParityTwo Dimensional Bit Parity - can detectdetect single bit errors - can correct correct single bit errors

0 0

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

1 Parity Checks

School of Computer Science amp Technology1919

FECFEC The ability of the receiverreceiver to both detectdetect and correctcorrect errors

0 0

1 Parity Checks

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2020

Sendertreat segmentsegment contents as sequencesequence of 16-bit 16-bit

integersintegerschecksumchecksum addition (1rsquos complement sum) of

segment contentssender puts checksumchecksum value into checksumchecksum field

Receiverthe sum of the received data (including the

checksum) = all 1 bitsNO -NO - error detectedYESYES - no error detected

2 Internet Checksum

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2121

Checksumming Checksumming methods require require relatively littlelittle overhead but provideprovide relatively weakweak protection against errors

Why is checksummingchecksumming used at the transporttransport layerTransport layer is typically implemented in

softsoft in a host as a part of OSOS

2 Checksumming

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2222

The data (DD) ) are viewed as a d-bit d-bit binary number

The SenderSender chooses rr additional bits (R CRC bitsR CRC bits) and appends them to the DD such that d+r d+r bits is exactly divisible by GG using modulo-2 modulo-2 arithmetic Sender and receiver both know the (r+1)-bitr+1)-bit generator (G)(G)

The receiver receiver divides (d+r)-bit(d+r)-bit (DRDR) by G G If non-zeronon-zero remainder error detectederror detected

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2323

Modulo-2 algorithmNo addition carriesaddition carries

No subtraction borrows subtraction borrows The addition (+)addition (+) and the subtraction (-)subtraction (-) are identical identical

and both are equivalentare equivalent to the bitwisebitwise exclusive-orexclusive-or (XORXOR)

For example1011 XOR 0101 = 1110

1011 mdash 0101 = 1110

1011 + 0101 = 1110

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2424

How the Sender computes the How the Sender computes the RRWant Want DD22rr XOR RR = nGnG

equivalentlyequivalently DD22rr XOR RR XOR RR = nG nG XOR RR

DD22rr = nG nG XOR RR

equivalentlyequivalently if we divide D2r by G want remainderremainder R

R = remainder[ ]

D2r

G

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

School of Computer Science amp Technology2525

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

ExampleExampleDD=101110 GG = 1001rr =3 and TT

(D000D000)=101110000000TT (DRDR)=101110011011

CRC can detect all burst errors less thanless than r+1 bits r+1 bitsCRC-32( international standard ) =100000100110000010001110110110111

School of Computer Science amp Technology2626

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology2727

Two types of linkslinkspoint-to-pointpoint-to-point

Only Only a sender and a receivera receiver sits at each end PPP for dial-up access

broadcast (shared wire or medium)broadcast (shared wire or medium)Many Many senders and receivers shareshare the link

traditional EthernetWLANUpstream of HFC

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2828

single shared broadcast channel two or more simultaneoussimultaneous transmissions by

nodes will cause interference CollisionCollision-if node receives twotwo oror moremore

signals at the same time

Multiple Access ProblemHow to coordinatecoordinate the access of a

sharedshared broadcastbroadcast channelchannel

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2929

multiple access protocolmultiple access protocoldistributed algorithmdistributed algorithm that determines how

nodes share the channel ie determine whenwhen and whichwhich node can transmit

communication about channel sharing must use channel itself

no out-of-bandout-of-band channel for coordination

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3030

The requirements to multiple access multiple access protocolprotocol for a broadcast channelbroadcast channel of rate RR bpsWhen one node can transmit it send at rate RRWhen M M nodes want to transmit over the channel

each can send at average rate RMRM bpsFully decentralized

no special nodespecial node to coordinate transmissionsno synchronizationsynchronization of clocks slots

Simple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3131

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code)

allocate piece to node for exclusive useRandom AccessRandom Access

channel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3232

TDM (Time Division MultiplexingTime Division Multiplexing)Time divided into FramesFrames and further divides each

Frame into N slotsslots each slot is then assigned to one of the N N nodes

Nodes access to channel in rounds unused slots go idleidle

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3333

TDMA eliminates collisions collisions and is perfectly fairfair but has two drawbacksdrawbacks

each node gets a dedicateddedicated transmission rate of RNRN and the average rate is limited to RNRN

a node mustmust always wait for its turnwait for its turn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

11 TDMA

School of Computer Science amp Technology3434

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

The spectrumspectrum is divided into frequencyfrequency bandsbandseach station assigned fixedfixed frequency bandunused transmission time in each frequency

bands goes idleidle

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3535

advantagesadvantages and drawbacksdrawbacks

can avoids collisionscollisions

shareshare the channel fairlyfairly

a node is limitedlimited to a bandwidthbandwidth of RNRN

a node needneed notnot waitswaits forfor its turnturn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

12 FDMA

frequ

ency

bands

time

School of Computer Science amp Technology3636

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)Assign a different codecode to each node

Each node encodesencodes the data bits using its unique code

Different nodes can transmit simultaneously

Usually used in military systems in early time

Details discussed in wireless networking of Advanced Advanced Computer NetworksComputer Networks

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3737

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Accesschannel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3838

When a node has a packet to send it transmit the packet at fullfull channelchannel datadata raterate R R bpsno a prioripriori coordination coordination among nodes

may cause collisioncollision

Each node involved in the collision repeatedlyrepeatedly retransmitsretransmits its packet until the packet gets through withoutwithout anyany collisioncollisiona node waits some time choosed randomly randomly

before retransmission

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology3939

random access protocol specifies how to detect collisionshow to recover from collisions

Examples of random access protocolsslottedslotted ALOHAALOHA

Pure ALOHAPure ALOHA

CSMACSMA CSMACDCSMACD CSMACACSMACA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology4040

Assumptionsall framesframes have same sizesame size L bitstimetime is divided into equal size slotsequal size slots

time to transmit 1 frame LR

nodes start to transmit frames onlyonly at beginningbeginning of slotsslotsnodes are synchronizedsynchronized

if there 2 or more2 or more nodes transmitting in a slot all nodes can detectdetect the collisioncollision

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4141

Operationwhen node obtains fresh framefresh frame it transmits

in the next slotnext slotIf there is not a collisioncollision node can send new new

frameframe in next slotnext slotThe sending node can detect the collision before

the end of the slot

If there is a collision collision node retransmitsretransmits frame in each subsequentsubsequent slotslot with probability pp until successsuccess

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4242

Advantages single active nodesingle active node can continuously transmit at fullfull

raterate of channelhighly decentralized only slots in nodesnodes needneed to be to be

inin synchronizationsynchronizationsimplesimple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 16: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology1717

1Single Bit Parity Single Bit Parity Detect single bit errors

- Can detect odd number bits errorodd number bits error

even

odd

1 Parity Checks

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

1

School of Computer Science amp Technology1818

22 Two Dimensional Bit ParityTwo Dimensional Bit Parity - can detectdetect single bit errors - can correct correct single bit errors

0 0

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

1 Parity Checks

School of Computer Science amp Technology1919

FECFEC The ability of the receiverreceiver to both detectdetect and correctcorrect errors

0 0

1 Parity Checks

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2020

Sendertreat segmentsegment contents as sequencesequence of 16-bit 16-bit

integersintegerschecksumchecksum addition (1rsquos complement sum) of

segment contentssender puts checksumchecksum value into checksumchecksum field

Receiverthe sum of the received data (including the

checksum) = all 1 bitsNO -NO - error detectedYESYES - no error detected

2 Internet Checksum

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2121

Checksumming Checksumming methods require require relatively littlelittle overhead but provideprovide relatively weakweak protection against errors

Why is checksummingchecksumming used at the transporttransport layerTransport layer is typically implemented in

softsoft in a host as a part of OSOS

2 Checksumming

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2222

The data (DD) ) are viewed as a d-bit d-bit binary number

The SenderSender chooses rr additional bits (R CRC bitsR CRC bits) and appends them to the DD such that d+r d+r bits is exactly divisible by GG using modulo-2 modulo-2 arithmetic Sender and receiver both know the (r+1)-bitr+1)-bit generator (G)(G)

The receiver receiver divides (d+r)-bit(d+r)-bit (DRDR) by G G If non-zeronon-zero remainder error detectederror detected

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2323

Modulo-2 algorithmNo addition carriesaddition carries

No subtraction borrows subtraction borrows The addition (+)addition (+) and the subtraction (-)subtraction (-) are identical identical

and both are equivalentare equivalent to the bitwisebitwise exclusive-orexclusive-or (XORXOR)

For example1011 XOR 0101 = 1110

1011 mdash 0101 = 1110

1011 + 0101 = 1110

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2424

How the Sender computes the How the Sender computes the RRWant Want DD22rr XOR RR = nGnG

equivalentlyequivalently DD22rr XOR RR XOR RR = nG nG XOR RR

DD22rr = nG nG XOR RR

equivalentlyequivalently if we divide D2r by G want remainderremainder R

R = remainder[ ]

D2r

G

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

School of Computer Science amp Technology2525

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

ExampleExampleDD=101110 GG = 1001rr =3 and TT

(D000D000)=101110000000TT (DRDR)=101110011011

CRC can detect all burst errors less thanless than r+1 bits r+1 bitsCRC-32( international standard ) =100000100110000010001110110110111

School of Computer Science amp Technology2626

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology2727

Two types of linkslinkspoint-to-pointpoint-to-point

Only Only a sender and a receivera receiver sits at each end PPP for dial-up access

broadcast (shared wire or medium)broadcast (shared wire or medium)Many Many senders and receivers shareshare the link

traditional EthernetWLANUpstream of HFC

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2828

single shared broadcast channel two or more simultaneoussimultaneous transmissions by

nodes will cause interference CollisionCollision-if node receives twotwo oror moremore

signals at the same time

Multiple Access ProblemHow to coordinatecoordinate the access of a

sharedshared broadcastbroadcast channelchannel

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2929

multiple access protocolmultiple access protocoldistributed algorithmdistributed algorithm that determines how

nodes share the channel ie determine whenwhen and whichwhich node can transmit

communication about channel sharing must use channel itself

no out-of-bandout-of-band channel for coordination

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3030

The requirements to multiple access multiple access protocolprotocol for a broadcast channelbroadcast channel of rate RR bpsWhen one node can transmit it send at rate RRWhen M M nodes want to transmit over the channel

each can send at average rate RMRM bpsFully decentralized

no special nodespecial node to coordinate transmissionsno synchronizationsynchronization of clocks slots

Simple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3131

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code)

allocate piece to node for exclusive useRandom AccessRandom Access

channel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3232

TDM (Time Division MultiplexingTime Division Multiplexing)Time divided into FramesFrames and further divides each

Frame into N slotsslots each slot is then assigned to one of the N N nodes

Nodes access to channel in rounds unused slots go idleidle

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3333

TDMA eliminates collisions collisions and is perfectly fairfair but has two drawbacksdrawbacks

each node gets a dedicateddedicated transmission rate of RNRN and the average rate is limited to RNRN

a node mustmust always wait for its turnwait for its turn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

11 TDMA

School of Computer Science amp Technology3434

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

The spectrumspectrum is divided into frequencyfrequency bandsbandseach station assigned fixedfixed frequency bandunused transmission time in each frequency

bands goes idleidle

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3535

advantagesadvantages and drawbacksdrawbacks

can avoids collisionscollisions

shareshare the channel fairlyfairly

a node is limitedlimited to a bandwidthbandwidth of RNRN

a node needneed notnot waitswaits forfor its turnturn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

12 FDMA

frequ

ency

bands

time

School of Computer Science amp Technology3636

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)Assign a different codecode to each node

Each node encodesencodes the data bits using its unique code

Different nodes can transmit simultaneously

Usually used in military systems in early time

Details discussed in wireless networking of Advanced Advanced Computer NetworksComputer Networks

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3737

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Accesschannel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3838

When a node has a packet to send it transmit the packet at fullfull channelchannel datadata raterate R R bpsno a prioripriori coordination coordination among nodes

may cause collisioncollision

Each node involved in the collision repeatedlyrepeatedly retransmitsretransmits its packet until the packet gets through withoutwithout anyany collisioncollisiona node waits some time choosed randomly randomly

before retransmission

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology3939

random access protocol specifies how to detect collisionshow to recover from collisions

Examples of random access protocolsslottedslotted ALOHAALOHA

Pure ALOHAPure ALOHA

CSMACSMA CSMACDCSMACD CSMACACSMACA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology4040

Assumptionsall framesframes have same sizesame size L bitstimetime is divided into equal size slotsequal size slots

time to transmit 1 frame LR

nodes start to transmit frames onlyonly at beginningbeginning of slotsslotsnodes are synchronizedsynchronized

if there 2 or more2 or more nodes transmitting in a slot all nodes can detectdetect the collisioncollision

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4141

Operationwhen node obtains fresh framefresh frame it transmits

in the next slotnext slotIf there is not a collisioncollision node can send new new

frameframe in next slotnext slotThe sending node can detect the collision before

the end of the slot

If there is a collision collision node retransmitsretransmits frame in each subsequentsubsequent slotslot with probability pp until successsuccess

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4242

Advantages single active nodesingle active node can continuously transmit at fullfull

raterate of channelhighly decentralized only slots in nodesnodes needneed to be to be

inin synchronizationsynchronizationsimplesimple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 17: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology1818

22 Two Dimensional Bit ParityTwo Dimensional Bit Parity - can detectdetect single bit errors - can correct correct single bit errors

0 0

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

1 Parity Checks

School of Computer Science amp Technology1919

FECFEC The ability of the receiverreceiver to both detectdetect and correctcorrect errors

0 0

1 Parity Checks

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2020

Sendertreat segmentsegment contents as sequencesequence of 16-bit 16-bit

integersintegerschecksumchecksum addition (1rsquos complement sum) of

segment contentssender puts checksumchecksum value into checksumchecksum field

Receiverthe sum of the received data (including the

checksum) = all 1 bitsNO -NO - error detectedYESYES - no error detected

2 Internet Checksum

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2121

Checksumming Checksumming methods require require relatively littlelittle overhead but provideprovide relatively weakweak protection against errors

Why is checksummingchecksumming used at the transporttransport layerTransport layer is typically implemented in

softsoft in a host as a part of OSOS

2 Checksumming

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2222

The data (DD) ) are viewed as a d-bit d-bit binary number

The SenderSender chooses rr additional bits (R CRC bitsR CRC bits) and appends them to the DD such that d+r d+r bits is exactly divisible by GG using modulo-2 modulo-2 arithmetic Sender and receiver both know the (r+1)-bitr+1)-bit generator (G)(G)

The receiver receiver divides (d+r)-bit(d+r)-bit (DRDR) by G G If non-zeronon-zero remainder error detectederror detected

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2323

Modulo-2 algorithmNo addition carriesaddition carries

No subtraction borrows subtraction borrows The addition (+)addition (+) and the subtraction (-)subtraction (-) are identical identical

and both are equivalentare equivalent to the bitwisebitwise exclusive-orexclusive-or (XORXOR)

For example1011 XOR 0101 = 1110

1011 mdash 0101 = 1110

1011 + 0101 = 1110

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2424

How the Sender computes the How the Sender computes the RRWant Want DD22rr XOR RR = nGnG

equivalentlyequivalently DD22rr XOR RR XOR RR = nG nG XOR RR

DD22rr = nG nG XOR RR

equivalentlyequivalently if we divide D2r by G want remainderremainder R

R = remainder[ ]

D2r

G

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

School of Computer Science amp Technology2525

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

ExampleExampleDD=101110 GG = 1001rr =3 and TT

(D000D000)=101110000000TT (DRDR)=101110011011

CRC can detect all burst errors less thanless than r+1 bits r+1 bitsCRC-32( international standard ) =100000100110000010001110110110111

School of Computer Science amp Technology2626

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology2727

Two types of linkslinkspoint-to-pointpoint-to-point

Only Only a sender and a receivera receiver sits at each end PPP for dial-up access

broadcast (shared wire or medium)broadcast (shared wire or medium)Many Many senders and receivers shareshare the link

traditional EthernetWLANUpstream of HFC

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2828

single shared broadcast channel two or more simultaneoussimultaneous transmissions by

nodes will cause interference CollisionCollision-if node receives twotwo oror moremore

signals at the same time

Multiple Access ProblemHow to coordinatecoordinate the access of a

sharedshared broadcastbroadcast channelchannel

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2929

multiple access protocolmultiple access protocoldistributed algorithmdistributed algorithm that determines how

nodes share the channel ie determine whenwhen and whichwhich node can transmit

communication about channel sharing must use channel itself

no out-of-bandout-of-band channel for coordination

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3030

The requirements to multiple access multiple access protocolprotocol for a broadcast channelbroadcast channel of rate RR bpsWhen one node can transmit it send at rate RRWhen M M nodes want to transmit over the channel

each can send at average rate RMRM bpsFully decentralized

no special nodespecial node to coordinate transmissionsno synchronizationsynchronization of clocks slots

Simple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3131

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code)

allocate piece to node for exclusive useRandom AccessRandom Access

channel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3232

TDM (Time Division MultiplexingTime Division Multiplexing)Time divided into FramesFrames and further divides each

Frame into N slotsslots each slot is then assigned to one of the N N nodes

Nodes access to channel in rounds unused slots go idleidle

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3333

TDMA eliminates collisions collisions and is perfectly fairfair but has two drawbacksdrawbacks

each node gets a dedicateddedicated transmission rate of RNRN and the average rate is limited to RNRN

a node mustmust always wait for its turnwait for its turn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

11 TDMA

School of Computer Science amp Technology3434

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

The spectrumspectrum is divided into frequencyfrequency bandsbandseach station assigned fixedfixed frequency bandunused transmission time in each frequency

bands goes idleidle

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3535

advantagesadvantages and drawbacksdrawbacks

can avoids collisionscollisions

shareshare the channel fairlyfairly

a node is limitedlimited to a bandwidthbandwidth of RNRN

a node needneed notnot waitswaits forfor its turnturn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

12 FDMA

frequ

ency

bands

time

School of Computer Science amp Technology3636

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)Assign a different codecode to each node

Each node encodesencodes the data bits using its unique code

Different nodes can transmit simultaneously

Usually used in military systems in early time

Details discussed in wireless networking of Advanced Advanced Computer NetworksComputer Networks

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3737

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Accesschannel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3838

When a node has a packet to send it transmit the packet at fullfull channelchannel datadata raterate R R bpsno a prioripriori coordination coordination among nodes

may cause collisioncollision

Each node involved in the collision repeatedlyrepeatedly retransmitsretransmits its packet until the packet gets through withoutwithout anyany collisioncollisiona node waits some time choosed randomly randomly

before retransmission

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology3939

random access protocol specifies how to detect collisionshow to recover from collisions

Examples of random access protocolsslottedslotted ALOHAALOHA

Pure ALOHAPure ALOHA

CSMACSMA CSMACDCSMACD CSMACACSMACA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology4040

Assumptionsall framesframes have same sizesame size L bitstimetime is divided into equal size slotsequal size slots

time to transmit 1 frame LR

nodes start to transmit frames onlyonly at beginningbeginning of slotsslotsnodes are synchronizedsynchronized

if there 2 or more2 or more nodes transmitting in a slot all nodes can detectdetect the collisioncollision

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4141

Operationwhen node obtains fresh framefresh frame it transmits

in the next slotnext slotIf there is not a collisioncollision node can send new new

frameframe in next slotnext slotThe sending node can detect the collision before

the end of the slot

If there is a collision collision node retransmitsretransmits frame in each subsequentsubsequent slotslot with probability pp until successsuccess

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4242

Advantages single active nodesingle active node can continuously transmit at fullfull

raterate of channelhighly decentralized only slots in nodesnodes needneed to be to be

inin synchronizationsynchronizationsimplesimple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 18: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology1919

FECFEC The ability of the receiverreceiver to both detectdetect and correctcorrect errors

0 0

1 Parity Checks

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2020

Sendertreat segmentsegment contents as sequencesequence of 16-bit 16-bit

integersintegerschecksumchecksum addition (1rsquos complement sum) of

segment contentssender puts checksumchecksum value into checksumchecksum field

Receiverthe sum of the received data (including the

checksum) = all 1 bitsNO -NO - error detectedYESYES - no error detected

2 Internet Checksum

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2121

Checksumming Checksumming methods require require relatively littlelittle overhead but provideprovide relatively weakweak protection against errors

Why is checksummingchecksumming used at the transporttransport layerTransport layer is typically implemented in

softsoft in a host as a part of OSOS

2 Checksumming

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2222

The data (DD) ) are viewed as a d-bit d-bit binary number

The SenderSender chooses rr additional bits (R CRC bitsR CRC bits) and appends them to the DD such that d+r d+r bits is exactly divisible by GG using modulo-2 modulo-2 arithmetic Sender and receiver both know the (r+1)-bitr+1)-bit generator (G)(G)

The receiver receiver divides (d+r)-bit(d+r)-bit (DRDR) by G G If non-zeronon-zero remainder error detectederror detected

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2323

Modulo-2 algorithmNo addition carriesaddition carries

No subtraction borrows subtraction borrows The addition (+)addition (+) and the subtraction (-)subtraction (-) are identical identical

and both are equivalentare equivalent to the bitwisebitwise exclusive-orexclusive-or (XORXOR)

For example1011 XOR 0101 = 1110

1011 mdash 0101 = 1110

1011 + 0101 = 1110

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2424

How the Sender computes the How the Sender computes the RRWant Want DD22rr XOR RR = nGnG

equivalentlyequivalently DD22rr XOR RR XOR RR = nG nG XOR RR

DD22rr = nG nG XOR RR

equivalentlyequivalently if we divide D2r by G want remainderremainder R

R = remainder[ ]

D2r

G

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

School of Computer Science amp Technology2525

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

ExampleExampleDD=101110 GG = 1001rr =3 and TT

(D000D000)=101110000000TT (DRDR)=101110011011

CRC can detect all burst errors less thanless than r+1 bits r+1 bitsCRC-32( international standard ) =100000100110000010001110110110111

School of Computer Science amp Technology2626

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology2727

Two types of linkslinkspoint-to-pointpoint-to-point

Only Only a sender and a receivera receiver sits at each end PPP for dial-up access

broadcast (shared wire or medium)broadcast (shared wire or medium)Many Many senders and receivers shareshare the link

traditional EthernetWLANUpstream of HFC

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2828

single shared broadcast channel two or more simultaneoussimultaneous transmissions by

nodes will cause interference CollisionCollision-if node receives twotwo oror moremore

signals at the same time

Multiple Access ProblemHow to coordinatecoordinate the access of a

sharedshared broadcastbroadcast channelchannel

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2929

multiple access protocolmultiple access protocoldistributed algorithmdistributed algorithm that determines how

nodes share the channel ie determine whenwhen and whichwhich node can transmit

communication about channel sharing must use channel itself

no out-of-bandout-of-band channel for coordination

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3030

The requirements to multiple access multiple access protocolprotocol for a broadcast channelbroadcast channel of rate RR bpsWhen one node can transmit it send at rate RRWhen M M nodes want to transmit over the channel

each can send at average rate RMRM bpsFully decentralized

no special nodespecial node to coordinate transmissionsno synchronizationsynchronization of clocks slots

Simple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3131

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code)

allocate piece to node for exclusive useRandom AccessRandom Access

channel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3232

TDM (Time Division MultiplexingTime Division Multiplexing)Time divided into FramesFrames and further divides each

Frame into N slotsslots each slot is then assigned to one of the N N nodes

Nodes access to channel in rounds unused slots go idleidle

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3333

TDMA eliminates collisions collisions and is perfectly fairfair but has two drawbacksdrawbacks

each node gets a dedicateddedicated transmission rate of RNRN and the average rate is limited to RNRN

a node mustmust always wait for its turnwait for its turn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

11 TDMA

School of Computer Science amp Technology3434

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

The spectrumspectrum is divided into frequencyfrequency bandsbandseach station assigned fixedfixed frequency bandunused transmission time in each frequency

bands goes idleidle

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3535

advantagesadvantages and drawbacksdrawbacks

can avoids collisionscollisions

shareshare the channel fairlyfairly

a node is limitedlimited to a bandwidthbandwidth of RNRN

a node needneed notnot waitswaits forfor its turnturn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

12 FDMA

frequ

ency

bands

time

School of Computer Science amp Technology3636

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)Assign a different codecode to each node

Each node encodesencodes the data bits using its unique code

Different nodes can transmit simultaneously

Usually used in military systems in early time

Details discussed in wireless networking of Advanced Advanced Computer NetworksComputer Networks

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3737

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Accesschannel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3838

When a node has a packet to send it transmit the packet at fullfull channelchannel datadata raterate R R bpsno a prioripriori coordination coordination among nodes

may cause collisioncollision

Each node involved in the collision repeatedlyrepeatedly retransmitsretransmits its packet until the packet gets through withoutwithout anyany collisioncollisiona node waits some time choosed randomly randomly

before retransmission

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology3939

random access protocol specifies how to detect collisionshow to recover from collisions

Examples of random access protocolsslottedslotted ALOHAALOHA

Pure ALOHAPure ALOHA

CSMACSMA CSMACDCSMACD CSMACACSMACA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology4040

Assumptionsall framesframes have same sizesame size L bitstimetime is divided into equal size slotsequal size slots

time to transmit 1 frame LR

nodes start to transmit frames onlyonly at beginningbeginning of slotsslotsnodes are synchronizedsynchronized

if there 2 or more2 or more nodes transmitting in a slot all nodes can detectdetect the collisioncollision

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4141

Operationwhen node obtains fresh framefresh frame it transmits

in the next slotnext slotIf there is not a collisioncollision node can send new new

frameframe in next slotnext slotThe sending node can detect the collision before

the end of the slot

If there is a collision collision node retransmitsretransmits frame in each subsequentsubsequent slotslot with probability pp until successsuccess

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4242

Advantages single active nodesingle active node can continuously transmit at fullfull

raterate of channelhighly decentralized only slots in nodesnodes needneed to be to be

inin synchronizationsynchronizationsimplesimple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 19: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology2020

Sendertreat segmentsegment contents as sequencesequence of 16-bit 16-bit

integersintegerschecksumchecksum addition (1rsquos complement sum) of

segment contentssender puts checksumchecksum value into checksumchecksum field

Receiverthe sum of the received data (including the

checksum) = all 1 bitsNO -NO - error detectedYESYES - no error detected

2 Internet Checksum

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2121

Checksumming Checksumming methods require require relatively littlelittle overhead but provideprovide relatively weakweak protection against errors

Why is checksummingchecksumming used at the transporttransport layerTransport layer is typically implemented in

softsoft in a host as a part of OSOS

2 Checksumming

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2222

The data (DD) ) are viewed as a d-bit d-bit binary number

The SenderSender chooses rr additional bits (R CRC bitsR CRC bits) and appends them to the DD such that d+r d+r bits is exactly divisible by GG using modulo-2 modulo-2 arithmetic Sender and receiver both know the (r+1)-bitr+1)-bit generator (G)(G)

The receiver receiver divides (d+r)-bit(d+r)-bit (DRDR) by G G If non-zeronon-zero remainder error detectederror detected

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2323

Modulo-2 algorithmNo addition carriesaddition carries

No subtraction borrows subtraction borrows The addition (+)addition (+) and the subtraction (-)subtraction (-) are identical identical

and both are equivalentare equivalent to the bitwisebitwise exclusive-orexclusive-or (XORXOR)

For example1011 XOR 0101 = 1110

1011 mdash 0101 = 1110

1011 + 0101 = 1110

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2424

How the Sender computes the How the Sender computes the RRWant Want DD22rr XOR RR = nGnG

equivalentlyequivalently DD22rr XOR RR XOR RR = nG nG XOR RR

DD22rr = nG nG XOR RR

equivalentlyequivalently if we divide D2r by G want remainderremainder R

R = remainder[ ]

D2r

G

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

School of Computer Science amp Technology2525

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

ExampleExampleDD=101110 GG = 1001rr =3 and TT

(D000D000)=101110000000TT (DRDR)=101110011011

CRC can detect all burst errors less thanless than r+1 bits r+1 bitsCRC-32( international standard ) =100000100110000010001110110110111

School of Computer Science amp Technology2626

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology2727

Two types of linkslinkspoint-to-pointpoint-to-point

Only Only a sender and a receivera receiver sits at each end PPP for dial-up access

broadcast (shared wire or medium)broadcast (shared wire or medium)Many Many senders and receivers shareshare the link

traditional EthernetWLANUpstream of HFC

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2828

single shared broadcast channel two or more simultaneoussimultaneous transmissions by

nodes will cause interference CollisionCollision-if node receives twotwo oror moremore

signals at the same time

Multiple Access ProblemHow to coordinatecoordinate the access of a

sharedshared broadcastbroadcast channelchannel

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2929

multiple access protocolmultiple access protocoldistributed algorithmdistributed algorithm that determines how

nodes share the channel ie determine whenwhen and whichwhich node can transmit

communication about channel sharing must use channel itself

no out-of-bandout-of-band channel for coordination

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3030

The requirements to multiple access multiple access protocolprotocol for a broadcast channelbroadcast channel of rate RR bpsWhen one node can transmit it send at rate RRWhen M M nodes want to transmit over the channel

each can send at average rate RMRM bpsFully decentralized

no special nodespecial node to coordinate transmissionsno synchronizationsynchronization of clocks slots

Simple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3131

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code)

allocate piece to node for exclusive useRandom AccessRandom Access

channel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3232

TDM (Time Division MultiplexingTime Division Multiplexing)Time divided into FramesFrames and further divides each

Frame into N slotsslots each slot is then assigned to one of the N N nodes

Nodes access to channel in rounds unused slots go idleidle

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3333

TDMA eliminates collisions collisions and is perfectly fairfair but has two drawbacksdrawbacks

each node gets a dedicateddedicated transmission rate of RNRN and the average rate is limited to RNRN

a node mustmust always wait for its turnwait for its turn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

11 TDMA

School of Computer Science amp Technology3434

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

The spectrumspectrum is divided into frequencyfrequency bandsbandseach station assigned fixedfixed frequency bandunused transmission time in each frequency

bands goes idleidle

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3535

advantagesadvantages and drawbacksdrawbacks

can avoids collisionscollisions

shareshare the channel fairlyfairly

a node is limitedlimited to a bandwidthbandwidth of RNRN

a node needneed notnot waitswaits forfor its turnturn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

12 FDMA

frequ

ency

bands

time

School of Computer Science amp Technology3636

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)Assign a different codecode to each node

Each node encodesencodes the data bits using its unique code

Different nodes can transmit simultaneously

Usually used in military systems in early time

Details discussed in wireless networking of Advanced Advanced Computer NetworksComputer Networks

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3737

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Accesschannel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3838

When a node has a packet to send it transmit the packet at fullfull channelchannel datadata raterate R R bpsno a prioripriori coordination coordination among nodes

may cause collisioncollision

Each node involved in the collision repeatedlyrepeatedly retransmitsretransmits its packet until the packet gets through withoutwithout anyany collisioncollisiona node waits some time choosed randomly randomly

before retransmission

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology3939

random access protocol specifies how to detect collisionshow to recover from collisions

Examples of random access protocolsslottedslotted ALOHAALOHA

Pure ALOHAPure ALOHA

CSMACSMA CSMACDCSMACD CSMACACSMACA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology4040

Assumptionsall framesframes have same sizesame size L bitstimetime is divided into equal size slotsequal size slots

time to transmit 1 frame LR

nodes start to transmit frames onlyonly at beginningbeginning of slotsslotsnodes are synchronizedsynchronized

if there 2 or more2 or more nodes transmitting in a slot all nodes can detectdetect the collisioncollision

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4141

Operationwhen node obtains fresh framefresh frame it transmits

in the next slotnext slotIf there is not a collisioncollision node can send new new

frameframe in next slotnext slotThe sending node can detect the collision before

the end of the slot

If there is a collision collision node retransmitsretransmits frame in each subsequentsubsequent slotslot with probability pp until successsuccess

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4242

Advantages single active nodesingle active node can continuously transmit at fullfull

raterate of channelhighly decentralized only slots in nodesnodes needneed to be to be

inin synchronizationsynchronizationsimplesimple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 20: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology2121

Checksumming Checksumming methods require require relatively littlelittle overhead but provideprovide relatively weakweak protection against errors

Why is checksummingchecksumming used at the transporttransport layerTransport layer is typically implemented in

softsoft in a host as a part of OSOS

2 Checksumming

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2222

The data (DD) ) are viewed as a d-bit d-bit binary number

The SenderSender chooses rr additional bits (R CRC bitsR CRC bits) and appends them to the DD such that d+r d+r bits is exactly divisible by GG using modulo-2 modulo-2 arithmetic Sender and receiver both know the (r+1)-bitr+1)-bit generator (G)(G)

The receiver receiver divides (d+r)-bit(d+r)-bit (DRDR) by G G If non-zeronon-zero remainder error detectederror detected

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2323

Modulo-2 algorithmNo addition carriesaddition carries

No subtraction borrows subtraction borrows The addition (+)addition (+) and the subtraction (-)subtraction (-) are identical identical

and both are equivalentare equivalent to the bitwisebitwise exclusive-orexclusive-or (XORXOR)

For example1011 XOR 0101 = 1110

1011 mdash 0101 = 1110

1011 + 0101 = 1110

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2424

How the Sender computes the How the Sender computes the RRWant Want DD22rr XOR RR = nGnG

equivalentlyequivalently DD22rr XOR RR XOR RR = nG nG XOR RR

DD22rr = nG nG XOR RR

equivalentlyequivalently if we divide D2r by G want remainderremainder R

R = remainder[ ]

D2r

G

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

School of Computer Science amp Technology2525

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

ExampleExampleDD=101110 GG = 1001rr =3 and TT

(D000D000)=101110000000TT (DRDR)=101110011011

CRC can detect all burst errors less thanless than r+1 bits r+1 bitsCRC-32( international standard ) =100000100110000010001110110110111

School of Computer Science amp Technology2626

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology2727

Two types of linkslinkspoint-to-pointpoint-to-point

Only Only a sender and a receivera receiver sits at each end PPP for dial-up access

broadcast (shared wire or medium)broadcast (shared wire or medium)Many Many senders and receivers shareshare the link

traditional EthernetWLANUpstream of HFC

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2828

single shared broadcast channel two or more simultaneoussimultaneous transmissions by

nodes will cause interference CollisionCollision-if node receives twotwo oror moremore

signals at the same time

Multiple Access ProblemHow to coordinatecoordinate the access of a

sharedshared broadcastbroadcast channelchannel

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2929

multiple access protocolmultiple access protocoldistributed algorithmdistributed algorithm that determines how

nodes share the channel ie determine whenwhen and whichwhich node can transmit

communication about channel sharing must use channel itself

no out-of-bandout-of-band channel for coordination

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3030

The requirements to multiple access multiple access protocolprotocol for a broadcast channelbroadcast channel of rate RR bpsWhen one node can transmit it send at rate RRWhen M M nodes want to transmit over the channel

each can send at average rate RMRM bpsFully decentralized

no special nodespecial node to coordinate transmissionsno synchronizationsynchronization of clocks slots

Simple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3131

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code)

allocate piece to node for exclusive useRandom AccessRandom Access

channel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3232

TDM (Time Division MultiplexingTime Division Multiplexing)Time divided into FramesFrames and further divides each

Frame into N slotsslots each slot is then assigned to one of the N N nodes

Nodes access to channel in rounds unused slots go idleidle

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3333

TDMA eliminates collisions collisions and is perfectly fairfair but has two drawbacksdrawbacks

each node gets a dedicateddedicated transmission rate of RNRN and the average rate is limited to RNRN

a node mustmust always wait for its turnwait for its turn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

11 TDMA

School of Computer Science amp Technology3434

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

The spectrumspectrum is divided into frequencyfrequency bandsbandseach station assigned fixedfixed frequency bandunused transmission time in each frequency

bands goes idleidle

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3535

advantagesadvantages and drawbacksdrawbacks

can avoids collisionscollisions

shareshare the channel fairlyfairly

a node is limitedlimited to a bandwidthbandwidth of RNRN

a node needneed notnot waitswaits forfor its turnturn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

12 FDMA

frequ

ency

bands

time

School of Computer Science amp Technology3636

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)Assign a different codecode to each node

Each node encodesencodes the data bits using its unique code

Different nodes can transmit simultaneously

Usually used in military systems in early time

Details discussed in wireless networking of Advanced Advanced Computer NetworksComputer Networks

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3737

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Accesschannel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3838

When a node has a packet to send it transmit the packet at fullfull channelchannel datadata raterate R R bpsno a prioripriori coordination coordination among nodes

may cause collisioncollision

Each node involved in the collision repeatedlyrepeatedly retransmitsretransmits its packet until the packet gets through withoutwithout anyany collisioncollisiona node waits some time choosed randomly randomly

before retransmission

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology3939

random access protocol specifies how to detect collisionshow to recover from collisions

Examples of random access protocolsslottedslotted ALOHAALOHA

Pure ALOHAPure ALOHA

CSMACSMA CSMACDCSMACD CSMACACSMACA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology4040

Assumptionsall framesframes have same sizesame size L bitstimetime is divided into equal size slotsequal size slots

time to transmit 1 frame LR

nodes start to transmit frames onlyonly at beginningbeginning of slotsslotsnodes are synchronizedsynchronized

if there 2 or more2 or more nodes transmitting in a slot all nodes can detectdetect the collisioncollision

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4141

Operationwhen node obtains fresh framefresh frame it transmits

in the next slotnext slotIf there is not a collisioncollision node can send new new

frameframe in next slotnext slotThe sending node can detect the collision before

the end of the slot

If there is a collision collision node retransmitsretransmits frame in each subsequentsubsequent slotslot with probability pp until successsuccess

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4242

Advantages single active nodesingle active node can continuously transmit at fullfull

raterate of channelhighly decentralized only slots in nodesnodes needneed to be to be

inin synchronizationsynchronizationsimplesimple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 21: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology2222

The data (DD) ) are viewed as a d-bit d-bit binary number

The SenderSender chooses rr additional bits (R CRC bitsR CRC bits) and appends them to the DD such that d+r d+r bits is exactly divisible by GG using modulo-2 modulo-2 arithmetic Sender and receiver both know the (r+1)-bitr+1)-bit generator (G)(G)

The receiver receiver divides (d+r)-bit(d+r)-bit (DRDR) by G G If non-zeronon-zero remainder error detectederror detected

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2323

Modulo-2 algorithmNo addition carriesaddition carries

No subtraction borrows subtraction borrows The addition (+)addition (+) and the subtraction (-)subtraction (-) are identical identical

and both are equivalentare equivalent to the bitwisebitwise exclusive-orexclusive-or (XORXOR)

For example1011 XOR 0101 = 1110

1011 mdash 0101 = 1110

1011 + 0101 = 1110

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2424

How the Sender computes the How the Sender computes the RRWant Want DD22rr XOR RR = nGnG

equivalentlyequivalently DD22rr XOR RR XOR RR = nG nG XOR RR

DD22rr = nG nG XOR RR

equivalentlyequivalently if we divide D2r by G want remainderremainder R

R = remainder[ ]

D2r

G

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

School of Computer Science amp Technology2525

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

ExampleExampleDD=101110 GG = 1001rr =3 and TT

(D000D000)=101110000000TT (DRDR)=101110011011

CRC can detect all burst errors less thanless than r+1 bits r+1 bitsCRC-32( international standard ) =100000100110000010001110110110111

School of Computer Science amp Technology2626

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology2727

Two types of linkslinkspoint-to-pointpoint-to-point

Only Only a sender and a receivera receiver sits at each end PPP for dial-up access

broadcast (shared wire or medium)broadcast (shared wire or medium)Many Many senders and receivers shareshare the link

traditional EthernetWLANUpstream of HFC

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2828

single shared broadcast channel two or more simultaneoussimultaneous transmissions by

nodes will cause interference CollisionCollision-if node receives twotwo oror moremore

signals at the same time

Multiple Access ProblemHow to coordinatecoordinate the access of a

sharedshared broadcastbroadcast channelchannel

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2929

multiple access protocolmultiple access protocoldistributed algorithmdistributed algorithm that determines how

nodes share the channel ie determine whenwhen and whichwhich node can transmit

communication about channel sharing must use channel itself

no out-of-bandout-of-band channel for coordination

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3030

The requirements to multiple access multiple access protocolprotocol for a broadcast channelbroadcast channel of rate RR bpsWhen one node can transmit it send at rate RRWhen M M nodes want to transmit over the channel

each can send at average rate RMRM bpsFully decentralized

no special nodespecial node to coordinate transmissionsno synchronizationsynchronization of clocks slots

Simple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3131

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code)

allocate piece to node for exclusive useRandom AccessRandom Access

channel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3232

TDM (Time Division MultiplexingTime Division Multiplexing)Time divided into FramesFrames and further divides each

Frame into N slotsslots each slot is then assigned to one of the N N nodes

Nodes access to channel in rounds unused slots go idleidle

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3333

TDMA eliminates collisions collisions and is perfectly fairfair but has two drawbacksdrawbacks

each node gets a dedicateddedicated transmission rate of RNRN and the average rate is limited to RNRN

a node mustmust always wait for its turnwait for its turn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

11 TDMA

School of Computer Science amp Technology3434

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

The spectrumspectrum is divided into frequencyfrequency bandsbandseach station assigned fixedfixed frequency bandunused transmission time in each frequency

bands goes idleidle

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3535

advantagesadvantages and drawbacksdrawbacks

can avoids collisionscollisions

shareshare the channel fairlyfairly

a node is limitedlimited to a bandwidthbandwidth of RNRN

a node needneed notnot waitswaits forfor its turnturn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

12 FDMA

frequ

ency

bands

time

School of Computer Science amp Technology3636

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)Assign a different codecode to each node

Each node encodesencodes the data bits using its unique code

Different nodes can transmit simultaneously

Usually used in military systems in early time

Details discussed in wireless networking of Advanced Advanced Computer NetworksComputer Networks

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3737

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Accesschannel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3838

When a node has a packet to send it transmit the packet at fullfull channelchannel datadata raterate R R bpsno a prioripriori coordination coordination among nodes

may cause collisioncollision

Each node involved in the collision repeatedlyrepeatedly retransmitsretransmits its packet until the packet gets through withoutwithout anyany collisioncollisiona node waits some time choosed randomly randomly

before retransmission

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology3939

random access protocol specifies how to detect collisionshow to recover from collisions

Examples of random access protocolsslottedslotted ALOHAALOHA

Pure ALOHAPure ALOHA

CSMACSMA CSMACDCSMACD CSMACACSMACA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology4040

Assumptionsall framesframes have same sizesame size L bitstimetime is divided into equal size slotsequal size slots

time to transmit 1 frame LR

nodes start to transmit frames onlyonly at beginningbeginning of slotsslotsnodes are synchronizedsynchronized

if there 2 or more2 or more nodes transmitting in a slot all nodes can detectdetect the collisioncollision

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4141

Operationwhen node obtains fresh framefresh frame it transmits

in the next slotnext slotIf there is not a collisioncollision node can send new new

frameframe in next slotnext slotThe sending node can detect the collision before

the end of the slot

If there is a collision collision node retransmitsretransmits frame in each subsequentsubsequent slotslot with probability pp until successsuccess

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4242

Advantages single active nodesingle active node can continuously transmit at fullfull

raterate of channelhighly decentralized only slots in nodesnodes needneed to be to be

inin synchronizationsynchronizationsimplesimple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 22: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology2323

Modulo-2 algorithmNo addition carriesaddition carries

No subtraction borrows subtraction borrows The addition (+)addition (+) and the subtraction (-)subtraction (-) are identical identical

and both are equivalentare equivalent to the bitwisebitwise exclusive-orexclusive-or (XORXOR)

For example1011 XOR 0101 = 1110

1011 mdash 0101 = 1110

1011 + 0101 = 1110

3 Cyclic Redundancy Check

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

School of Computer Science amp Technology2424

How the Sender computes the How the Sender computes the RRWant Want DD22rr XOR RR = nGnG

equivalentlyequivalently DD22rr XOR RR XOR RR = nG nG XOR RR

DD22rr = nG nG XOR RR

equivalentlyequivalently if we divide D2r by G want remainderremainder R

R = remainder[ ]

D2r

G

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

School of Computer Science amp Technology2525

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

ExampleExampleDD=101110 GG = 1001rr =3 and TT

(D000D000)=101110000000TT (DRDR)=101110011011

CRC can detect all burst errors less thanless than r+1 bits r+1 bitsCRC-32( international standard ) =100000100110000010001110110110111

School of Computer Science amp Technology2626

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology2727

Two types of linkslinkspoint-to-pointpoint-to-point

Only Only a sender and a receivera receiver sits at each end PPP for dial-up access

broadcast (shared wire or medium)broadcast (shared wire or medium)Many Many senders and receivers shareshare the link

traditional EthernetWLANUpstream of HFC

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2828

single shared broadcast channel two or more simultaneoussimultaneous transmissions by

nodes will cause interference CollisionCollision-if node receives twotwo oror moremore

signals at the same time

Multiple Access ProblemHow to coordinatecoordinate the access of a

sharedshared broadcastbroadcast channelchannel

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2929

multiple access protocolmultiple access protocoldistributed algorithmdistributed algorithm that determines how

nodes share the channel ie determine whenwhen and whichwhich node can transmit

communication about channel sharing must use channel itself

no out-of-bandout-of-band channel for coordination

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3030

The requirements to multiple access multiple access protocolprotocol for a broadcast channelbroadcast channel of rate RR bpsWhen one node can transmit it send at rate RRWhen M M nodes want to transmit over the channel

each can send at average rate RMRM bpsFully decentralized

no special nodespecial node to coordinate transmissionsno synchronizationsynchronization of clocks slots

Simple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3131

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code)

allocate piece to node for exclusive useRandom AccessRandom Access

channel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3232

TDM (Time Division MultiplexingTime Division Multiplexing)Time divided into FramesFrames and further divides each

Frame into N slotsslots each slot is then assigned to one of the N N nodes

Nodes access to channel in rounds unused slots go idleidle

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3333

TDMA eliminates collisions collisions and is perfectly fairfair but has two drawbacksdrawbacks

each node gets a dedicateddedicated transmission rate of RNRN and the average rate is limited to RNRN

a node mustmust always wait for its turnwait for its turn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

11 TDMA

School of Computer Science amp Technology3434

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

The spectrumspectrum is divided into frequencyfrequency bandsbandseach station assigned fixedfixed frequency bandunused transmission time in each frequency

bands goes idleidle

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3535

advantagesadvantages and drawbacksdrawbacks

can avoids collisionscollisions

shareshare the channel fairlyfairly

a node is limitedlimited to a bandwidthbandwidth of RNRN

a node needneed notnot waitswaits forfor its turnturn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

12 FDMA

frequ

ency

bands

time

School of Computer Science amp Technology3636

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)Assign a different codecode to each node

Each node encodesencodes the data bits using its unique code

Different nodes can transmit simultaneously

Usually used in military systems in early time

Details discussed in wireless networking of Advanced Advanced Computer NetworksComputer Networks

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3737

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Accesschannel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3838

When a node has a packet to send it transmit the packet at fullfull channelchannel datadata raterate R R bpsno a prioripriori coordination coordination among nodes

may cause collisioncollision

Each node involved in the collision repeatedlyrepeatedly retransmitsretransmits its packet until the packet gets through withoutwithout anyany collisioncollisiona node waits some time choosed randomly randomly

before retransmission

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology3939

random access protocol specifies how to detect collisionshow to recover from collisions

Examples of random access protocolsslottedslotted ALOHAALOHA

Pure ALOHAPure ALOHA

CSMACSMA CSMACDCSMACD CSMACACSMACA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology4040

Assumptionsall framesframes have same sizesame size L bitstimetime is divided into equal size slotsequal size slots

time to transmit 1 frame LR

nodes start to transmit frames onlyonly at beginningbeginning of slotsslotsnodes are synchronizedsynchronized

if there 2 or more2 or more nodes transmitting in a slot all nodes can detectdetect the collisioncollision

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4141

Operationwhen node obtains fresh framefresh frame it transmits

in the next slotnext slotIf there is not a collisioncollision node can send new new

frameframe in next slotnext slotThe sending node can detect the collision before

the end of the slot

If there is a collision collision node retransmitsretransmits frame in each subsequentsubsequent slotslot with probability pp until successsuccess

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4242

Advantages single active nodesingle active node can continuously transmit at fullfull

raterate of channelhighly decentralized only slots in nodesnodes needneed to be to be

inin synchronizationsynchronizationsimplesimple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 23: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology2424

How the Sender computes the How the Sender computes the RRWant Want DD22rr XOR RR = nGnG

equivalentlyequivalently DD22rr XOR RR XOR RR = nG nG XOR RR

DD22rr = nG nG XOR RR

equivalentlyequivalently if we divide D2r by G want remainderremainder R

R = remainder[ ]

D2r

G

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

School of Computer Science amp Technology2525

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

ExampleExampleDD=101110 GG = 1001rr =3 and TT

(D000D000)=101110000000TT (DRDR)=101110011011

CRC can detect all burst errors less thanless than r+1 bits r+1 bitsCRC-32( international standard ) =100000100110000010001110110110111

School of Computer Science amp Technology2626

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology2727

Two types of linkslinkspoint-to-pointpoint-to-point

Only Only a sender and a receivera receiver sits at each end PPP for dial-up access

broadcast (shared wire or medium)broadcast (shared wire or medium)Many Many senders and receivers shareshare the link

traditional EthernetWLANUpstream of HFC

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2828

single shared broadcast channel two or more simultaneoussimultaneous transmissions by

nodes will cause interference CollisionCollision-if node receives twotwo oror moremore

signals at the same time

Multiple Access ProblemHow to coordinatecoordinate the access of a

sharedshared broadcastbroadcast channelchannel

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2929

multiple access protocolmultiple access protocoldistributed algorithmdistributed algorithm that determines how

nodes share the channel ie determine whenwhen and whichwhich node can transmit

communication about channel sharing must use channel itself

no out-of-bandout-of-band channel for coordination

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3030

The requirements to multiple access multiple access protocolprotocol for a broadcast channelbroadcast channel of rate RR bpsWhen one node can transmit it send at rate RRWhen M M nodes want to transmit over the channel

each can send at average rate RMRM bpsFully decentralized

no special nodespecial node to coordinate transmissionsno synchronizationsynchronization of clocks slots

Simple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3131

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code)

allocate piece to node for exclusive useRandom AccessRandom Access

channel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3232

TDM (Time Division MultiplexingTime Division Multiplexing)Time divided into FramesFrames and further divides each

Frame into N slotsslots each slot is then assigned to one of the N N nodes

Nodes access to channel in rounds unused slots go idleidle

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3333

TDMA eliminates collisions collisions and is perfectly fairfair but has two drawbacksdrawbacks

each node gets a dedicateddedicated transmission rate of RNRN and the average rate is limited to RNRN

a node mustmust always wait for its turnwait for its turn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

11 TDMA

School of Computer Science amp Technology3434

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

The spectrumspectrum is divided into frequencyfrequency bandsbandseach station assigned fixedfixed frequency bandunused transmission time in each frequency

bands goes idleidle

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3535

advantagesadvantages and drawbacksdrawbacks

can avoids collisionscollisions

shareshare the channel fairlyfairly

a node is limitedlimited to a bandwidthbandwidth of RNRN

a node needneed notnot waitswaits forfor its turnturn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

12 FDMA

frequ

ency

bands

time

School of Computer Science amp Technology3636

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)Assign a different codecode to each node

Each node encodesencodes the data bits using its unique code

Different nodes can transmit simultaneously

Usually used in military systems in early time

Details discussed in wireless networking of Advanced Advanced Computer NetworksComputer Networks

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3737

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Accesschannel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3838

When a node has a packet to send it transmit the packet at fullfull channelchannel datadata raterate R R bpsno a prioripriori coordination coordination among nodes

may cause collisioncollision

Each node involved in the collision repeatedlyrepeatedly retransmitsretransmits its packet until the packet gets through withoutwithout anyany collisioncollisiona node waits some time choosed randomly randomly

before retransmission

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology3939

random access protocol specifies how to detect collisionshow to recover from collisions

Examples of random access protocolsslottedslotted ALOHAALOHA

Pure ALOHAPure ALOHA

CSMACSMA CSMACDCSMACD CSMACACSMACA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology4040

Assumptionsall framesframes have same sizesame size L bitstimetime is divided into equal size slotsequal size slots

time to transmit 1 frame LR

nodes start to transmit frames onlyonly at beginningbeginning of slotsslotsnodes are synchronizedsynchronized

if there 2 or more2 or more nodes transmitting in a slot all nodes can detectdetect the collisioncollision

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4141

Operationwhen node obtains fresh framefresh frame it transmits

in the next slotnext slotIf there is not a collisioncollision node can send new new

frameframe in next slotnext slotThe sending node can detect the collision before

the end of the slot

If there is a collision collision node retransmitsretransmits frame in each subsequentsubsequent slotslot with probability pp until successsuccess

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4242

Advantages single active nodesingle active node can continuously transmit at fullfull

raterate of channelhighly decentralized only slots in nodesnodes needneed to be to be

inin synchronizationsynchronizationsimplesimple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 24: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology2525

52 Error D

etection an

d

52 Error D

etection an

d

Correction

Correction

3 Cyclic Redundancy Check

ExampleExampleDD=101110 GG = 1001rr =3 and TT

(D000D000)=101110000000TT (DRDR)=101110011011

CRC can detect all burst errors less thanless than r+1 bits r+1 bitsCRC-32( international standard ) =100000100110000010001110110110111

School of Computer Science amp Technology2626

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology2727

Two types of linkslinkspoint-to-pointpoint-to-point

Only Only a sender and a receivera receiver sits at each end PPP for dial-up access

broadcast (shared wire or medium)broadcast (shared wire or medium)Many Many senders and receivers shareshare the link

traditional EthernetWLANUpstream of HFC

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2828

single shared broadcast channel two or more simultaneoussimultaneous transmissions by

nodes will cause interference CollisionCollision-if node receives twotwo oror moremore

signals at the same time

Multiple Access ProblemHow to coordinatecoordinate the access of a

sharedshared broadcastbroadcast channelchannel

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2929

multiple access protocolmultiple access protocoldistributed algorithmdistributed algorithm that determines how

nodes share the channel ie determine whenwhen and whichwhich node can transmit

communication about channel sharing must use channel itself

no out-of-bandout-of-band channel for coordination

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3030

The requirements to multiple access multiple access protocolprotocol for a broadcast channelbroadcast channel of rate RR bpsWhen one node can transmit it send at rate RRWhen M M nodes want to transmit over the channel

each can send at average rate RMRM bpsFully decentralized

no special nodespecial node to coordinate transmissionsno synchronizationsynchronization of clocks slots

Simple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3131

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code)

allocate piece to node for exclusive useRandom AccessRandom Access

channel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3232

TDM (Time Division MultiplexingTime Division Multiplexing)Time divided into FramesFrames and further divides each

Frame into N slotsslots each slot is then assigned to one of the N N nodes

Nodes access to channel in rounds unused slots go idleidle

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3333

TDMA eliminates collisions collisions and is perfectly fairfair but has two drawbacksdrawbacks

each node gets a dedicateddedicated transmission rate of RNRN and the average rate is limited to RNRN

a node mustmust always wait for its turnwait for its turn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

11 TDMA

School of Computer Science amp Technology3434

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

The spectrumspectrum is divided into frequencyfrequency bandsbandseach station assigned fixedfixed frequency bandunused transmission time in each frequency

bands goes idleidle

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3535

advantagesadvantages and drawbacksdrawbacks

can avoids collisionscollisions

shareshare the channel fairlyfairly

a node is limitedlimited to a bandwidthbandwidth of RNRN

a node needneed notnot waitswaits forfor its turnturn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

12 FDMA

frequ

ency

bands

time

School of Computer Science amp Technology3636

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)Assign a different codecode to each node

Each node encodesencodes the data bits using its unique code

Different nodes can transmit simultaneously

Usually used in military systems in early time

Details discussed in wireless networking of Advanced Advanced Computer NetworksComputer Networks

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3737

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Accesschannel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3838

When a node has a packet to send it transmit the packet at fullfull channelchannel datadata raterate R R bpsno a prioripriori coordination coordination among nodes

may cause collisioncollision

Each node involved in the collision repeatedlyrepeatedly retransmitsretransmits its packet until the packet gets through withoutwithout anyany collisioncollisiona node waits some time choosed randomly randomly

before retransmission

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology3939

random access protocol specifies how to detect collisionshow to recover from collisions

Examples of random access protocolsslottedslotted ALOHAALOHA

Pure ALOHAPure ALOHA

CSMACSMA CSMACDCSMACD CSMACACSMACA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology4040

Assumptionsall framesframes have same sizesame size L bitstimetime is divided into equal size slotsequal size slots

time to transmit 1 frame LR

nodes start to transmit frames onlyonly at beginningbeginning of slotsslotsnodes are synchronizedsynchronized

if there 2 or more2 or more nodes transmitting in a slot all nodes can detectdetect the collisioncollision

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4141

Operationwhen node obtains fresh framefresh frame it transmits

in the next slotnext slotIf there is not a collisioncollision node can send new new

frameframe in next slotnext slotThe sending node can detect the collision before

the end of the slot

If there is a collision collision node retransmitsretransmits frame in each subsequentsubsequent slotslot with probability pp until successsuccess

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4242

Advantages single active nodesingle active node can continuously transmit at fullfull

raterate of channelhighly decentralized only slots in nodesnodes needneed to be to be

inin synchronizationsynchronizationsimplesimple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 25: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology2626

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology2727

Two types of linkslinkspoint-to-pointpoint-to-point

Only Only a sender and a receivera receiver sits at each end PPP for dial-up access

broadcast (shared wire or medium)broadcast (shared wire or medium)Many Many senders and receivers shareshare the link

traditional EthernetWLANUpstream of HFC

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2828

single shared broadcast channel two or more simultaneoussimultaneous transmissions by

nodes will cause interference CollisionCollision-if node receives twotwo oror moremore

signals at the same time

Multiple Access ProblemHow to coordinatecoordinate the access of a

sharedshared broadcastbroadcast channelchannel

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2929

multiple access protocolmultiple access protocoldistributed algorithmdistributed algorithm that determines how

nodes share the channel ie determine whenwhen and whichwhich node can transmit

communication about channel sharing must use channel itself

no out-of-bandout-of-band channel for coordination

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3030

The requirements to multiple access multiple access protocolprotocol for a broadcast channelbroadcast channel of rate RR bpsWhen one node can transmit it send at rate RRWhen M M nodes want to transmit over the channel

each can send at average rate RMRM bpsFully decentralized

no special nodespecial node to coordinate transmissionsno synchronizationsynchronization of clocks slots

Simple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3131

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code)

allocate piece to node for exclusive useRandom AccessRandom Access

channel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3232

TDM (Time Division MultiplexingTime Division Multiplexing)Time divided into FramesFrames and further divides each

Frame into N slotsslots each slot is then assigned to one of the N N nodes

Nodes access to channel in rounds unused slots go idleidle

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3333

TDMA eliminates collisions collisions and is perfectly fairfair but has two drawbacksdrawbacks

each node gets a dedicateddedicated transmission rate of RNRN and the average rate is limited to RNRN

a node mustmust always wait for its turnwait for its turn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

11 TDMA

School of Computer Science amp Technology3434

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

The spectrumspectrum is divided into frequencyfrequency bandsbandseach station assigned fixedfixed frequency bandunused transmission time in each frequency

bands goes idleidle

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3535

advantagesadvantages and drawbacksdrawbacks

can avoids collisionscollisions

shareshare the channel fairlyfairly

a node is limitedlimited to a bandwidthbandwidth of RNRN

a node needneed notnot waitswaits forfor its turnturn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

12 FDMA

frequ

ency

bands

time

School of Computer Science amp Technology3636

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)Assign a different codecode to each node

Each node encodesencodes the data bits using its unique code

Different nodes can transmit simultaneously

Usually used in military systems in early time

Details discussed in wireless networking of Advanced Advanced Computer NetworksComputer Networks

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3737

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Accesschannel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3838

When a node has a packet to send it transmit the packet at fullfull channelchannel datadata raterate R R bpsno a prioripriori coordination coordination among nodes

may cause collisioncollision

Each node involved in the collision repeatedlyrepeatedly retransmitsretransmits its packet until the packet gets through withoutwithout anyany collisioncollisiona node waits some time choosed randomly randomly

before retransmission

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology3939

random access protocol specifies how to detect collisionshow to recover from collisions

Examples of random access protocolsslottedslotted ALOHAALOHA

Pure ALOHAPure ALOHA

CSMACSMA CSMACDCSMACD CSMACACSMACA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology4040

Assumptionsall framesframes have same sizesame size L bitstimetime is divided into equal size slotsequal size slots

time to transmit 1 frame LR

nodes start to transmit frames onlyonly at beginningbeginning of slotsslotsnodes are synchronizedsynchronized

if there 2 or more2 or more nodes transmitting in a slot all nodes can detectdetect the collisioncollision

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4141

Operationwhen node obtains fresh framefresh frame it transmits

in the next slotnext slotIf there is not a collisioncollision node can send new new

frameframe in next slotnext slotThe sending node can detect the collision before

the end of the slot

If there is a collision collision node retransmitsretransmits frame in each subsequentsubsequent slotslot with probability pp until successsuccess

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4242

Advantages single active nodesingle active node can continuously transmit at fullfull

raterate of channelhighly decentralized only slots in nodesnodes needneed to be to be

inin synchronizationsynchronizationsimplesimple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 26: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology2727

Two types of linkslinkspoint-to-pointpoint-to-point

Only Only a sender and a receivera receiver sits at each end PPP for dial-up access

broadcast (shared wire or medium)broadcast (shared wire or medium)Many Many senders and receivers shareshare the link

traditional EthernetWLANUpstream of HFC

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2828

single shared broadcast channel two or more simultaneoussimultaneous transmissions by

nodes will cause interference CollisionCollision-if node receives twotwo oror moremore

signals at the same time

Multiple Access ProblemHow to coordinatecoordinate the access of a

sharedshared broadcastbroadcast channelchannel

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2929

multiple access protocolmultiple access protocoldistributed algorithmdistributed algorithm that determines how

nodes share the channel ie determine whenwhen and whichwhich node can transmit

communication about channel sharing must use channel itself

no out-of-bandout-of-band channel for coordination

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3030

The requirements to multiple access multiple access protocolprotocol for a broadcast channelbroadcast channel of rate RR bpsWhen one node can transmit it send at rate RRWhen M M nodes want to transmit over the channel

each can send at average rate RMRM bpsFully decentralized

no special nodespecial node to coordinate transmissionsno synchronizationsynchronization of clocks slots

Simple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3131

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code)

allocate piece to node for exclusive useRandom AccessRandom Access

channel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3232

TDM (Time Division MultiplexingTime Division Multiplexing)Time divided into FramesFrames and further divides each

Frame into N slotsslots each slot is then assigned to one of the N N nodes

Nodes access to channel in rounds unused slots go idleidle

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3333

TDMA eliminates collisions collisions and is perfectly fairfair but has two drawbacksdrawbacks

each node gets a dedicateddedicated transmission rate of RNRN and the average rate is limited to RNRN

a node mustmust always wait for its turnwait for its turn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

11 TDMA

School of Computer Science amp Technology3434

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

The spectrumspectrum is divided into frequencyfrequency bandsbandseach station assigned fixedfixed frequency bandunused transmission time in each frequency

bands goes idleidle

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3535

advantagesadvantages and drawbacksdrawbacks

can avoids collisionscollisions

shareshare the channel fairlyfairly

a node is limitedlimited to a bandwidthbandwidth of RNRN

a node needneed notnot waitswaits forfor its turnturn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

12 FDMA

frequ

ency

bands

time

School of Computer Science amp Technology3636

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)Assign a different codecode to each node

Each node encodesencodes the data bits using its unique code

Different nodes can transmit simultaneously

Usually used in military systems in early time

Details discussed in wireless networking of Advanced Advanced Computer NetworksComputer Networks

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3737

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Accesschannel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3838

When a node has a packet to send it transmit the packet at fullfull channelchannel datadata raterate R R bpsno a prioripriori coordination coordination among nodes

may cause collisioncollision

Each node involved in the collision repeatedlyrepeatedly retransmitsretransmits its packet until the packet gets through withoutwithout anyany collisioncollisiona node waits some time choosed randomly randomly

before retransmission

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology3939

random access protocol specifies how to detect collisionshow to recover from collisions

Examples of random access protocolsslottedslotted ALOHAALOHA

Pure ALOHAPure ALOHA

CSMACSMA CSMACDCSMACD CSMACACSMACA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology4040

Assumptionsall framesframes have same sizesame size L bitstimetime is divided into equal size slotsequal size slots

time to transmit 1 frame LR

nodes start to transmit frames onlyonly at beginningbeginning of slotsslotsnodes are synchronizedsynchronized

if there 2 or more2 or more nodes transmitting in a slot all nodes can detectdetect the collisioncollision

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4141

Operationwhen node obtains fresh framefresh frame it transmits

in the next slotnext slotIf there is not a collisioncollision node can send new new

frameframe in next slotnext slotThe sending node can detect the collision before

the end of the slot

If there is a collision collision node retransmitsretransmits frame in each subsequentsubsequent slotslot with probability pp until successsuccess

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4242

Advantages single active nodesingle active node can continuously transmit at fullfull

raterate of channelhighly decentralized only slots in nodesnodes needneed to be to be

inin synchronizationsynchronizationsimplesimple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 27: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology2828

single shared broadcast channel two or more simultaneoussimultaneous transmissions by

nodes will cause interference CollisionCollision-if node receives twotwo oror moremore

signals at the same time

Multiple Access ProblemHow to coordinatecoordinate the access of a

sharedshared broadcastbroadcast channelchannel

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology2929

multiple access protocolmultiple access protocoldistributed algorithmdistributed algorithm that determines how

nodes share the channel ie determine whenwhen and whichwhich node can transmit

communication about channel sharing must use channel itself

no out-of-bandout-of-band channel for coordination

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3030

The requirements to multiple access multiple access protocolprotocol for a broadcast channelbroadcast channel of rate RR bpsWhen one node can transmit it send at rate RRWhen M M nodes want to transmit over the channel

each can send at average rate RMRM bpsFully decentralized

no special nodespecial node to coordinate transmissionsno synchronizationsynchronization of clocks slots

Simple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3131

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code)

allocate piece to node for exclusive useRandom AccessRandom Access

channel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3232

TDM (Time Division MultiplexingTime Division Multiplexing)Time divided into FramesFrames and further divides each

Frame into N slotsslots each slot is then assigned to one of the N N nodes

Nodes access to channel in rounds unused slots go idleidle

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3333

TDMA eliminates collisions collisions and is perfectly fairfair but has two drawbacksdrawbacks

each node gets a dedicateddedicated transmission rate of RNRN and the average rate is limited to RNRN

a node mustmust always wait for its turnwait for its turn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

11 TDMA

School of Computer Science amp Technology3434

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

The spectrumspectrum is divided into frequencyfrequency bandsbandseach station assigned fixedfixed frequency bandunused transmission time in each frequency

bands goes idleidle

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3535

advantagesadvantages and drawbacksdrawbacks

can avoids collisionscollisions

shareshare the channel fairlyfairly

a node is limitedlimited to a bandwidthbandwidth of RNRN

a node needneed notnot waitswaits forfor its turnturn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

12 FDMA

frequ

ency

bands

time

School of Computer Science amp Technology3636

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)Assign a different codecode to each node

Each node encodesencodes the data bits using its unique code

Different nodes can transmit simultaneously

Usually used in military systems in early time

Details discussed in wireless networking of Advanced Advanced Computer NetworksComputer Networks

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3737

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Accesschannel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3838

When a node has a packet to send it transmit the packet at fullfull channelchannel datadata raterate R R bpsno a prioripriori coordination coordination among nodes

may cause collisioncollision

Each node involved in the collision repeatedlyrepeatedly retransmitsretransmits its packet until the packet gets through withoutwithout anyany collisioncollisiona node waits some time choosed randomly randomly

before retransmission

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology3939

random access protocol specifies how to detect collisionshow to recover from collisions

Examples of random access protocolsslottedslotted ALOHAALOHA

Pure ALOHAPure ALOHA

CSMACSMA CSMACDCSMACD CSMACACSMACA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology4040

Assumptionsall framesframes have same sizesame size L bitstimetime is divided into equal size slotsequal size slots

time to transmit 1 frame LR

nodes start to transmit frames onlyonly at beginningbeginning of slotsslotsnodes are synchronizedsynchronized

if there 2 or more2 or more nodes transmitting in a slot all nodes can detectdetect the collisioncollision

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4141

Operationwhen node obtains fresh framefresh frame it transmits

in the next slotnext slotIf there is not a collisioncollision node can send new new

frameframe in next slotnext slotThe sending node can detect the collision before

the end of the slot

If there is a collision collision node retransmitsretransmits frame in each subsequentsubsequent slotslot with probability pp until successsuccess

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4242

Advantages single active nodesingle active node can continuously transmit at fullfull

raterate of channelhighly decentralized only slots in nodesnodes needneed to be to be

inin synchronizationsynchronizationsimplesimple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 28: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology2929

multiple access protocolmultiple access protocoldistributed algorithmdistributed algorithm that determines how

nodes share the channel ie determine whenwhen and whichwhich node can transmit

communication about channel sharing must use channel itself

no out-of-bandout-of-band channel for coordination

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3030

The requirements to multiple access multiple access protocolprotocol for a broadcast channelbroadcast channel of rate RR bpsWhen one node can transmit it send at rate RRWhen M M nodes want to transmit over the channel

each can send at average rate RMRM bpsFully decentralized

no special nodespecial node to coordinate transmissionsno synchronizationsynchronization of clocks slots

Simple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3131

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code)

allocate piece to node for exclusive useRandom AccessRandom Access

channel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3232

TDM (Time Division MultiplexingTime Division Multiplexing)Time divided into FramesFrames and further divides each

Frame into N slotsslots each slot is then assigned to one of the N N nodes

Nodes access to channel in rounds unused slots go idleidle

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3333

TDMA eliminates collisions collisions and is perfectly fairfair but has two drawbacksdrawbacks

each node gets a dedicateddedicated transmission rate of RNRN and the average rate is limited to RNRN

a node mustmust always wait for its turnwait for its turn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

11 TDMA

School of Computer Science amp Technology3434

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

The spectrumspectrum is divided into frequencyfrequency bandsbandseach station assigned fixedfixed frequency bandunused transmission time in each frequency

bands goes idleidle

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3535

advantagesadvantages and drawbacksdrawbacks

can avoids collisionscollisions

shareshare the channel fairlyfairly

a node is limitedlimited to a bandwidthbandwidth of RNRN

a node needneed notnot waitswaits forfor its turnturn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

12 FDMA

frequ

ency

bands

time

School of Computer Science amp Technology3636

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)Assign a different codecode to each node

Each node encodesencodes the data bits using its unique code

Different nodes can transmit simultaneously

Usually used in military systems in early time

Details discussed in wireless networking of Advanced Advanced Computer NetworksComputer Networks

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3737

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Accesschannel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3838

When a node has a packet to send it transmit the packet at fullfull channelchannel datadata raterate R R bpsno a prioripriori coordination coordination among nodes

may cause collisioncollision

Each node involved in the collision repeatedlyrepeatedly retransmitsretransmits its packet until the packet gets through withoutwithout anyany collisioncollisiona node waits some time choosed randomly randomly

before retransmission

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology3939

random access protocol specifies how to detect collisionshow to recover from collisions

Examples of random access protocolsslottedslotted ALOHAALOHA

Pure ALOHAPure ALOHA

CSMACSMA CSMACDCSMACD CSMACACSMACA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology4040

Assumptionsall framesframes have same sizesame size L bitstimetime is divided into equal size slotsequal size slots

time to transmit 1 frame LR

nodes start to transmit frames onlyonly at beginningbeginning of slotsslotsnodes are synchronizedsynchronized

if there 2 or more2 or more nodes transmitting in a slot all nodes can detectdetect the collisioncollision

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4141

Operationwhen node obtains fresh framefresh frame it transmits

in the next slotnext slotIf there is not a collisioncollision node can send new new

frameframe in next slotnext slotThe sending node can detect the collision before

the end of the slot

If there is a collision collision node retransmitsretransmits frame in each subsequentsubsequent slotslot with probability pp until successsuccess

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4242

Advantages single active nodesingle active node can continuously transmit at fullfull

raterate of channelhighly decentralized only slots in nodesnodes needneed to be to be

inin synchronizationsynchronizationsimplesimple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 29: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology3030

The requirements to multiple access multiple access protocolprotocol for a broadcast channelbroadcast channel of rate RR bpsWhen one node can transmit it send at rate RRWhen M M nodes want to transmit over the channel

each can send at average rate RMRM bpsFully decentralized

no special nodespecial node to coordinate transmissionsno synchronizationsynchronization of clocks slots

Simple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3131

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code)

allocate piece to node for exclusive useRandom AccessRandom Access

channel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3232

TDM (Time Division MultiplexingTime Division Multiplexing)Time divided into FramesFrames and further divides each

Frame into N slotsslots each slot is then assigned to one of the N N nodes

Nodes access to channel in rounds unused slots go idleidle

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3333

TDMA eliminates collisions collisions and is perfectly fairfair but has two drawbacksdrawbacks

each node gets a dedicateddedicated transmission rate of RNRN and the average rate is limited to RNRN

a node mustmust always wait for its turnwait for its turn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

11 TDMA

School of Computer Science amp Technology3434

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

The spectrumspectrum is divided into frequencyfrequency bandsbandseach station assigned fixedfixed frequency bandunused transmission time in each frequency

bands goes idleidle

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3535

advantagesadvantages and drawbacksdrawbacks

can avoids collisionscollisions

shareshare the channel fairlyfairly

a node is limitedlimited to a bandwidthbandwidth of RNRN

a node needneed notnot waitswaits forfor its turnturn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

12 FDMA

frequ

ency

bands

time

School of Computer Science amp Technology3636

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)Assign a different codecode to each node

Each node encodesencodes the data bits using its unique code

Different nodes can transmit simultaneously

Usually used in military systems in early time

Details discussed in wireless networking of Advanced Advanced Computer NetworksComputer Networks

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3737

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Accesschannel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3838

When a node has a packet to send it transmit the packet at fullfull channelchannel datadata raterate R R bpsno a prioripriori coordination coordination among nodes

may cause collisioncollision

Each node involved in the collision repeatedlyrepeatedly retransmitsretransmits its packet until the packet gets through withoutwithout anyany collisioncollisiona node waits some time choosed randomly randomly

before retransmission

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology3939

random access protocol specifies how to detect collisionshow to recover from collisions

Examples of random access protocolsslottedslotted ALOHAALOHA

Pure ALOHAPure ALOHA

CSMACSMA CSMACDCSMACD CSMACACSMACA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology4040

Assumptionsall framesframes have same sizesame size L bitstimetime is divided into equal size slotsequal size slots

time to transmit 1 frame LR

nodes start to transmit frames onlyonly at beginningbeginning of slotsslotsnodes are synchronizedsynchronized

if there 2 or more2 or more nodes transmitting in a slot all nodes can detectdetect the collisioncollision

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4141

Operationwhen node obtains fresh framefresh frame it transmits

in the next slotnext slotIf there is not a collisioncollision node can send new new

frameframe in next slotnext slotThe sending node can detect the collision before

the end of the slot

If there is a collision collision node retransmitsretransmits frame in each subsequentsubsequent slotslot with probability pp until successsuccess

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4242

Advantages single active nodesingle active node can continuously transmit at fullfull

raterate of channelhighly decentralized only slots in nodesnodes needneed to be to be

inin synchronizationsynchronizationsimplesimple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 30: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology3131

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code)

allocate piece to node for exclusive useRandom AccessRandom Access

channel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3232

TDM (Time Division MultiplexingTime Division Multiplexing)Time divided into FramesFrames and further divides each

Frame into N slotsslots each slot is then assigned to one of the N N nodes

Nodes access to channel in rounds unused slots go idleidle

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3333

TDMA eliminates collisions collisions and is perfectly fairfair but has two drawbacksdrawbacks

each node gets a dedicateddedicated transmission rate of RNRN and the average rate is limited to RNRN

a node mustmust always wait for its turnwait for its turn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

11 TDMA

School of Computer Science amp Technology3434

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

The spectrumspectrum is divided into frequencyfrequency bandsbandseach station assigned fixedfixed frequency bandunused transmission time in each frequency

bands goes idleidle

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3535

advantagesadvantages and drawbacksdrawbacks

can avoids collisionscollisions

shareshare the channel fairlyfairly

a node is limitedlimited to a bandwidthbandwidth of RNRN

a node needneed notnot waitswaits forfor its turnturn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

12 FDMA

frequ

ency

bands

time

School of Computer Science amp Technology3636

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)Assign a different codecode to each node

Each node encodesencodes the data bits using its unique code

Different nodes can transmit simultaneously

Usually used in military systems in early time

Details discussed in wireless networking of Advanced Advanced Computer NetworksComputer Networks

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3737

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Accesschannel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3838

When a node has a packet to send it transmit the packet at fullfull channelchannel datadata raterate R R bpsno a prioripriori coordination coordination among nodes

may cause collisioncollision

Each node involved in the collision repeatedlyrepeatedly retransmitsretransmits its packet until the packet gets through withoutwithout anyany collisioncollisiona node waits some time choosed randomly randomly

before retransmission

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology3939

random access protocol specifies how to detect collisionshow to recover from collisions

Examples of random access protocolsslottedslotted ALOHAALOHA

Pure ALOHAPure ALOHA

CSMACSMA CSMACDCSMACD CSMACACSMACA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology4040

Assumptionsall framesframes have same sizesame size L bitstimetime is divided into equal size slotsequal size slots

time to transmit 1 frame LR

nodes start to transmit frames onlyonly at beginningbeginning of slotsslotsnodes are synchronizedsynchronized

if there 2 or more2 or more nodes transmitting in a slot all nodes can detectdetect the collisioncollision

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4141

Operationwhen node obtains fresh framefresh frame it transmits

in the next slotnext slotIf there is not a collisioncollision node can send new new

frameframe in next slotnext slotThe sending node can detect the collision before

the end of the slot

If there is a collision collision node retransmitsretransmits frame in each subsequentsubsequent slotslot with probability pp until successsuccess

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4242

Advantages single active nodesingle active node can continuously transmit at fullfull

raterate of channelhighly decentralized only slots in nodesnodes needneed to be to be

inin synchronizationsynchronizationsimplesimple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 31: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology3232

TDM (Time Division MultiplexingTime Division Multiplexing)Time divided into FramesFrames and further divides each

Frame into N slotsslots each slot is then assigned to one of the N N nodes

Nodes access to channel in rounds unused slots go idleidle

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3333

TDMA eliminates collisions collisions and is perfectly fairfair but has two drawbacksdrawbacks

each node gets a dedicateddedicated transmission rate of RNRN and the average rate is limited to RNRN

a node mustmust always wait for its turnwait for its turn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

11 TDMA

School of Computer Science amp Technology3434

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

The spectrumspectrum is divided into frequencyfrequency bandsbandseach station assigned fixedfixed frequency bandunused transmission time in each frequency

bands goes idleidle

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3535

advantagesadvantages and drawbacksdrawbacks

can avoids collisionscollisions

shareshare the channel fairlyfairly

a node is limitedlimited to a bandwidthbandwidth of RNRN

a node needneed notnot waitswaits forfor its turnturn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

12 FDMA

frequ

ency

bands

time

School of Computer Science amp Technology3636

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)Assign a different codecode to each node

Each node encodesencodes the data bits using its unique code

Different nodes can transmit simultaneously

Usually used in military systems in early time

Details discussed in wireless networking of Advanced Advanced Computer NetworksComputer Networks

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3737

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Accesschannel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3838

When a node has a packet to send it transmit the packet at fullfull channelchannel datadata raterate R R bpsno a prioripriori coordination coordination among nodes

may cause collisioncollision

Each node involved in the collision repeatedlyrepeatedly retransmitsretransmits its packet until the packet gets through withoutwithout anyany collisioncollisiona node waits some time choosed randomly randomly

before retransmission

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology3939

random access protocol specifies how to detect collisionshow to recover from collisions

Examples of random access protocolsslottedslotted ALOHAALOHA

Pure ALOHAPure ALOHA

CSMACSMA CSMACDCSMACD CSMACACSMACA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology4040

Assumptionsall framesframes have same sizesame size L bitstimetime is divided into equal size slotsequal size slots

time to transmit 1 frame LR

nodes start to transmit frames onlyonly at beginningbeginning of slotsslotsnodes are synchronizedsynchronized

if there 2 or more2 or more nodes transmitting in a slot all nodes can detectdetect the collisioncollision

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4141

Operationwhen node obtains fresh framefresh frame it transmits

in the next slotnext slotIf there is not a collisioncollision node can send new new

frameframe in next slotnext slotThe sending node can detect the collision before

the end of the slot

If there is a collision collision node retransmitsretransmits frame in each subsequentsubsequent slotslot with probability pp until successsuccess

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4242

Advantages single active nodesingle active node can continuously transmit at fullfull

raterate of channelhighly decentralized only slots in nodesnodes needneed to be to be

inin synchronizationsynchronizationsimplesimple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 32: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology3333

TDMA eliminates collisions collisions and is perfectly fairfair but has two drawbacksdrawbacks

each node gets a dedicateddedicated transmission rate of RNRN and the average rate is limited to RNRN

a node mustmust always wait for its turnwait for its turn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

11 TDMA

School of Computer Science amp Technology3434

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

The spectrumspectrum is divided into frequencyfrequency bandsbandseach station assigned fixedfixed frequency bandunused transmission time in each frequency

bands goes idleidle

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3535

advantagesadvantages and drawbacksdrawbacks

can avoids collisionscollisions

shareshare the channel fairlyfairly

a node is limitedlimited to a bandwidthbandwidth of RNRN

a node needneed notnot waitswaits forfor its turnturn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

12 FDMA

frequ

ency

bands

time

School of Computer Science amp Technology3636

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)Assign a different codecode to each node

Each node encodesencodes the data bits using its unique code

Different nodes can transmit simultaneously

Usually used in military systems in early time

Details discussed in wireless networking of Advanced Advanced Computer NetworksComputer Networks

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3737

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Accesschannel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3838

When a node has a packet to send it transmit the packet at fullfull channelchannel datadata raterate R R bpsno a prioripriori coordination coordination among nodes

may cause collisioncollision

Each node involved in the collision repeatedlyrepeatedly retransmitsretransmits its packet until the packet gets through withoutwithout anyany collisioncollisiona node waits some time choosed randomly randomly

before retransmission

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology3939

random access protocol specifies how to detect collisionshow to recover from collisions

Examples of random access protocolsslottedslotted ALOHAALOHA

Pure ALOHAPure ALOHA

CSMACSMA CSMACDCSMACD CSMACACSMACA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology4040

Assumptionsall framesframes have same sizesame size L bitstimetime is divided into equal size slotsequal size slots

time to transmit 1 frame LR

nodes start to transmit frames onlyonly at beginningbeginning of slotsslotsnodes are synchronizedsynchronized

if there 2 or more2 or more nodes transmitting in a slot all nodes can detectdetect the collisioncollision

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4141

Operationwhen node obtains fresh framefresh frame it transmits

in the next slotnext slotIf there is not a collisioncollision node can send new new

frameframe in next slotnext slotThe sending node can detect the collision before

the end of the slot

If there is a collision collision node retransmitsretransmits frame in each subsequentsubsequent slotslot with probability pp until successsuccess

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4242

Advantages single active nodesingle active node can continuously transmit at fullfull

raterate of channelhighly decentralized only slots in nodesnodes needneed to be to be

inin synchronizationsynchronizationsimplesimple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 33: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology3434

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

The spectrumspectrum is divided into frequencyfrequency bandsbandseach station assigned fixedfixed frequency bandunused transmission time in each frequency

bands goes idleidle

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3535

advantagesadvantages and drawbacksdrawbacks

can avoids collisionscollisions

shareshare the channel fairlyfairly

a node is limitedlimited to a bandwidthbandwidth of RNRN

a node needneed notnot waitswaits forfor its turnturn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

12 FDMA

frequ

ency

bands

time

School of Computer Science amp Technology3636

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)Assign a different codecode to each node

Each node encodesencodes the data bits using its unique code

Different nodes can transmit simultaneously

Usually used in military systems in early time

Details discussed in wireless networking of Advanced Advanced Computer NetworksComputer Networks

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3737

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Accesschannel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3838

When a node has a packet to send it transmit the packet at fullfull channelchannel datadata raterate R R bpsno a prioripriori coordination coordination among nodes

may cause collisioncollision

Each node involved in the collision repeatedlyrepeatedly retransmitsretransmits its packet until the packet gets through withoutwithout anyany collisioncollisiona node waits some time choosed randomly randomly

before retransmission

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology3939

random access protocol specifies how to detect collisionshow to recover from collisions

Examples of random access protocolsslottedslotted ALOHAALOHA

Pure ALOHAPure ALOHA

CSMACSMA CSMACDCSMACD CSMACACSMACA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology4040

Assumptionsall framesframes have same sizesame size L bitstimetime is divided into equal size slotsequal size slots

time to transmit 1 frame LR

nodes start to transmit frames onlyonly at beginningbeginning of slotsslotsnodes are synchronizedsynchronized

if there 2 or more2 or more nodes transmitting in a slot all nodes can detectdetect the collisioncollision

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4141

Operationwhen node obtains fresh framefresh frame it transmits

in the next slotnext slotIf there is not a collisioncollision node can send new new

frameframe in next slotnext slotThe sending node can detect the collision before

the end of the slot

If there is a collision collision node retransmitsretransmits frame in each subsequentsubsequent slotslot with probability pp until successsuccess

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4242

Advantages single active nodesingle active node can continuously transmit at fullfull

raterate of channelhighly decentralized only slots in nodesnodes needneed to be to be

inin synchronizationsynchronizationsimplesimple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 34: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology3535

advantagesadvantages and drawbacksdrawbacks

can avoids collisionscollisions

shareshare the channel fairlyfairly

a node is limitedlimited to a bandwidthbandwidth of RNRN

a node needneed notnot waitswaits forfor its turnturn

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

12 FDMA

frequ

ency

bands

time

School of Computer Science amp Technology3636

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)Assign a different codecode to each node

Each node encodesencodes the data bits using its unique code

Different nodes can transmit simultaneously

Usually used in military systems in early time

Details discussed in wireless networking of Advanced Advanced Computer NetworksComputer Networks

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3737

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Accesschannel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3838

When a node has a packet to send it transmit the packet at fullfull channelchannel datadata raterate R R bpsno a prioripriori coordination coordination among nodes

may cause collisioncollision

Each node involved in the collision repeatedlyrepeatedly retransmitsretransmits its packet until the packet gets through withoutwithout anyany collisioncollisiona node waits some time choosed randomly randomly

before retransmission

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology3939

random access protocol specifies how to detect collisionshow to recover from collisions

Examples of random access protocolsslottedslotted ALOHAALOHA

Pure ALOHAPure ALOHA

CSMACSMA CSMACDCSMACD CSMACACSMACA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology4040

Assumptionsall framesframes have same sizesame size L bitstimetime is divided into equal size slotsequal size slots

time to transmit 1 frame LR

nodes start to transmit frames onlyonly at beginningbeginning of slotsslotsnodes are synchronizedsynchronized

if there 2 or more2 or more nodes transmitting in a slot all nodes can detectdetect the collisioncollision

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4141

Operationwhen node obtains fresh framefresh frame it transmits

in the next slotnext slotIf there is not a collisioncollision node can send new new

frameframe in next slotnext slotThe sending node can detect the collision before

the end of the slot

If there is a collision collision node retransmitsretransmits frame in each subsequentsubsequent slotslot with probability pp until successsuccess

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4242

Advantages single active nodesingle active node can continuously transmit at fullfull

raterate of channelhighly decentralized only slots in nodesnodes needneed to be to be

inin synchronizationsynchronizationsimplesimple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 35: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology3636

TDM (Time Division MultiplexingTime Division Multiplexing)

FDM (Frequency Division MultiplexingFrequency Division Multiplexing)

CDMA (Code Division Multiplexing AccessCode Division Multiplexing Access)Assign a different codecode to each node

Each node encodesencodes the data bits using its unique code

Different nodes can transmit simultaneously

Usually used in military systems in early time

Details discussed in wireless networking of Advanced Advanced Computer NetworksComputer Networks

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

1 Channel Partitioning Protocols

School of Computer Science amp Technology3737

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Accesschannel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3838

When a node has a packet to send it transmit the packet at fullfull channelchannel datadata raterate R R bpsno a prioripriori coordination coordination among nodes

may cause collisioncollision

Each node involved in the collision repeatedlyrepeatedly retransmitsretransmits its packet until the packet gets through withoutwithout anyany collisioncollisiona node waits some time choosed randomly randomly

before retransmission

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology3939

random access protocol specifies how to detect collisionshow to recover from collisions

Examples of random access protocolsslottedslotted ALOHAALOHA

Pure ALOHAPure ALOHA

CSMACSMA CSMACDCSMACD CSMACACSMACA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology4040

Assumptionsall framesframes have same sizesame size L bitstimetime is divided into equal size slotsequal size slots

time to transmit 1 frame LR

nodes start to transmit frames onlyonly at beginningbeginning of slotsslotsnodes are synchronizedsynchronized

if there 2 or more2 or more nodes transmitting in a slot all nodes can detectdetect the collisioncollision

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4141

Operationwhen node obtains fresh framefresh frame it transmits

in the next slotnext slotIf there is not a collisioncollision node can send new new

frameframe in next slotnext slotThe sending node can detect the collision before

the end of the slot

If there is a collision collision node retransmitsretransmits frame in each subsequentsubsequent slotslot with probability pp until successsuccess

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4242

Advantages single active nodesingle active node can continuously transmit at fullfull

raterate of channelhighly decentralized only slots in nodesnodes needneed to be to be

inin synchronizationsynchronizationsimplesimple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 36: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology3737

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Accesschannel not divided allow collisionsldquorecoverrdquo from collisions

Taking turnsTaking turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology3838

When a node has a packet to send it transmit the packet at fullfull channelchannel datadata raterate R R bpsno a prioripriori coordination coordination among nodes

may cause collisioncollision

Each node involved in the collision repeatedlyrepeatedly retransmitsretransmits its packet until the packet gets through withoutwithout anyany collisioncollisiona node waits some time choosed randomly randomly

before retransmission

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology3939

random access protocol specifies how to detect collisionshow to recover from collisions

Examples of random access protocolsslottedslotted ALOHAALOHA

Pure ALOHAPure ALOHA

CSMACSMA CSMACDCSMACD CSMACACSMACA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology4040

Assumptionsall framesframes have same sizesame size L bitstimetime is divided into equal size slotsequal size slots

time to transmit 1 frame LR

nodes start to transmit frames onlyonly at beginningbeginning of slotsslotsnodes are synchronizedsynchronized

if there 2 or more2 or more nodes transmitting in a slot all nodes can detectdetect the collisioncollision

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4141

Operationwhen node obtains fresh framefresh frame it transmits

in the next slotnext slotIf there is not a collisioncollision node can send new new

frameframe in next slotnext slotThe sending node can detect the collision before

the end of the slot

If there is a collision collision node retransmitsretransmits frame in each subsequentsubsequent slotslot with probability pp until successsuccess

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4242

Advantages single active nodesingle active node can continuously transmit at fullfull

raterate of channelhighly decentralized only slots in nodesnodes needneed to be to be

inin synchronizationsynchronizationsimplesimple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 37: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology3838

When a node has a packet to send it transmit the packet at fullfull channelchannel datadata raterate R R bpsno a prioripriori coordination coordination among nodes

may cause collisioncollision

Each node involved in the collision repeatedlyrepeatedly retransmitsretransmits its packet until the packet gets through withoutwithout anyany collisioncollisiona node waits some time choosed randomly randomly

before retransmission

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology3939

random access protocol specifies how to detect collisionshow to recover from collisions

Examples of random access protocolsslottedslotted ALOHAALOHA

Pure ALOHAPure ALOHA

CSMACSMA CSMACDCSMACD CSMACACSMACA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology4040

Assumptionsall framesframes have same sizesame size L bitstimetime is divided into equal size slotsequal size slots

time to transmit 1 frame LR

nodes start to transmit frames onlyonly at beginningbeginning of slotsslotsnodes are synchronizedsynchronized

if there 2 or more2 or more nodes transmitting in a slot all nodes can detectdetect the collisioncollision

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4141

Operationwhen node obtains fresh framefresh frame it transmits

in the next slotnext slotIf there is not a collisioncollision node can send new new

frameframe in next slotnext slotThe sending node can detect the collision before

the end of the slot

If there is a collision collision node retransmitsretransmits frame in each subsequentsubsequent slotslot with probability pp until successsuccess

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4242

Advantages single active nodesingle active node can continuously transmit at fullfull

raterate of channelhighly decentralized only slots in nodesnodes needneed to be to be

inin synchronizationsynchronizationsimplesimple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 38: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology3939

random access protocol specifies how to detect collisionshow to recover from collisions

Examples of random access protocolsslottedslotted ALOHAALOHA

Pure ALOHAPure ALOHA

CSMACSMA CSMACDCSMACD CSMACACSMACA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

2 Random Access Protocols

School of Computer Science amp Technology4040

Assumptionsall framesframes have same sizesame size L bitstimetime is divided into equal size slotsequal size slots

time to transmit 1 frame LR

nodes start to transmit frames onlyonly at beginningbeginning of slotsslotsnodes are synchronizedsynchronized

if there 2 or more2 or more nodes transmitting in a slot all nodes can detectdetect the collisioncollision

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4141

Operationwhen node obtains fresh framefresh frame it transmits

in the next slotnext slotIf there is not a collisioncollision node can send new new

frameframe in next slotnext slotThe sending node can detect the collision before

the end of the slot

If there is a collision collision node retransmitsretransmits frame in each subsequentsubsequent slotslot with probability pp until successsuccess

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4242

Advantages single active nodesingle active node can continuously transmit at fullfull

raterate of channelhighly decentralized only slots in nodesnodes needneed to be to be

inin synchronizationsynchronizationsimplesimple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 39: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology4040

Assumptionsall framesframes have same sizesame size L bitstimetime is divided into equal size slotsequal size slots

time to transmit 1 frame LR

nodes start to transmit frames onlyonly at beginningbeginning of slotsslotsnodes are synchronizedsynchronized

if there 2 or more2 or more nodes transmitting in a slot all nodes can detectdetect the collisioncollision

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4141

Operationwhen node obtains fresh framefresh frame it transmits

in the next slotnext slotIf there is not a collisioncollision node can send new new

frameframe in next slotnext slotThe sending node can detect the collision before

the end of the slot

If there is a collision collision node retransmitsretransmits frame in each subsequentsubsequent slotslot with probability pp until successsuccess

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4242

Advantages single active nodesingle active node can continuously transmit at fullfull

raterate of channelhighly decentralized only slots in nodesnodes needneed to be to be

inin synchronizationsynchronizationsimplesimple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 40: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology4141

Operationwhen node obtains fresh framefresh frame it transmits

in the next slotnext slotIf there is not a collisioncollision node can send new new

frameframe in next slotnext slotThe sending node can detect the collision before

the end of the slot

If there is a collision collision node retransmitsretransmits frame in each subsequentsubsequent slotslot with probability pp until successsuccess

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4242

Advantages single active nodesingle active node can continuously transmit at fullfull

raterate of channelhighly decentralized only slots in nodesnodes needneed to be to be

inin synchronizationsynchronizationsimplesimple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 41: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology4242

Advantages single active nodesingle active node can continuously transmit at fullfull

raterate of channelhighly decentralized only slots in nodesnodes needneed to be to be

inin synchronizationsynchronizationsimplesimple

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 42: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology4343

Drawbacksmany wasted slotswasted slots because of collisioncollision

successful slotsuccessful slot The slot which only one node transmitidle slotsidle slots because of the probabilistic policy probabilistic policy

nodes must must detect the collision in less than time to transmit a packet

clock synchronizationsynchronization used to determine the startend of one slot

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

21 Slotted ALOHA

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 43: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology4444

21 Slotted ALOHA

Suppose NN nodes with many frames to send each transmits in each slot with probability p pProb that any node has a success = Np(1-p)Np(1-p)N-1N-1

EfficiencyEfficiency of slotted ALOHA is the long-long-run fractionrun fraction of successful slots when there are many nodes each with many frames to send

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol 3701)1( 1lim

ePNP N

N

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 44: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology4545

1)1()( NpNppE21 )1)(1()1()( NN pNNppNpE

))1()1(()1( 2 NpppN N

NppE

10)(

N

NNNN

NpE

N

NN

11

)1

1()

11()

11(

1)( 11

1)1

1(lim NN

eNN

N

1)

11(lim

epE

N

1)(lim

21 Slotted ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 45: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology4646

unslotted ALOHAunslotted ALOHA - no synchronizationsynchronizationwhen frame first arrives transmit immediately collision probability increasesincreases

frame sent at t0 collides with other frames sent in [t0-Lrt0+LR]

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 46: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology4747

P(success by given node) =

P(node transmits) P(no other node transmits in [t0-LRt0] P(no other node transmits in [t0t0+ L R ] = p (1-p)N-1 (1-p)N-1= p (1-p)2(N-1)

)1(2)1()( NpNppE)3(2)2(2 )1)(1(2)1()( NN pNNppNpE

))1(2)1(()1( )3(2 NpppN N

12

10)(

NppE

)1(2)12

11(

12)(

N

NN

NpE

eepE

N 2

11

2

1)(lim

22 Pure (un-Slotted) ALOHA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 47: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology4848

CSMACSMA CCarrier SSense MMultiple AAccess

listenlisten beforebefore transmittingtransmitting

If channel sensed idleidle then transmits entire frame immediately

If channel sensed busybusy then waits waits a random amount of time time and then sensessenses the channel

23 CSMA

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 48: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology4949

If all nodes perform If all nodes perform carrier sensingcarrier sensing do do collisions occur all the samecollisions occur all the same

collision entire packet transmission time wasted

note the role of distance amp propagation delay in determining collision probability

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

spatial layout of nodes collisions can still occur

propagation delaypropagation delay means two nodes may not hear each otherrsquos transmission

23 CSMA

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 49: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology5050

CSMACD carrier sensingsensing and deferraldeferral as in CSMAcollisions detectedcollisions detected within short timecolliding transmissions abortedcolliding transmissions aborted

reducing channel wastage

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 50: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology5151

collision detection easyeasy in wired LANs

measure signal strengths compare transmitted received signals

but difficultdifficult in wireless LANsreceiver shut off while transmitting for saving

energy

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 51: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology5252

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

24 CSMACD (collision detection)

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 52: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology5353

CategoriesCategories of Multiple Access ProtocolMultiple Access ProtocolChannel PartitioningChannel Partitioning

Random AccessRandom Access

Taking turnsTaking turnsNodes take turns but nodes with more to send

can take longer turns

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

Introduction

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 53: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology5454

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

3 Taking-Turns Protocols

PollingPolling master node ldquoinvitesinvitesrdquo slave nodes to transmit in turnconcerns

polling overheadoverhead and polling latencylatencysingle point of failuresingle point of failure (master)

Token passingToken passing control tokentoken passed from one node to next sequentially concerns

token overheadoverhead and latencylatencysingle point of failure (token)single point of failure (token)

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 54: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology5555

What do you do with a shared mediashared mediaChannel PartitioningChannel Partitioning by time frequency or

codeRandom partitioningRandom partitioning (dynamic)

ALOHA S-ALOHA CSMA CSMACDCSMACD used in EthernetCSMACA used in 80211 WLAN (Wireless LAN)

carrier sensingcarrier sensing easy in some technologies (wire) hard in others (wireless)

Taking TurnsTaking Turnspolling from a central site or token passing

53 Mu

ltiple A

ccess Protocol

53 Mu

ltiple A

ccess Protocol

4 Summary

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 55: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology5656

LAN technologies

Categories of NetworksLAN-Local Area NetworkWAN-Wide Area NetworkMAN-Metropolitan Area Network

Data Link layer so farservices error detectioncorrection multiple access

Next LAN technologiesaddressingEthernethubs switchesPPP

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 56: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology5757

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 57: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology5858

1 MAC Addresses32-bit IP address

network-layernetwork-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-connectedphysically-connected interface (same network)48 bit48 bit MAC address MAC address (for most LANs) is burned burned in the

ROM ROM of NICof NICfor example 1A-2F-BB-76-09-AD

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 58: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology5959

1 MAC Addresses

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 59: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology6262

1 MAC Addresses (more)MAC flatflat address portability

can move LAN card from one LAN to another

Like an ID cardIP hierarchicalhierarchical address NOT portable

depends on IP subnet to which node is attached

Like a postal address

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 60: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology6363

QuestionQuestion how to determine MAC address of B if a node knows 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

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 61: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology6464

Each IP node on LAN has an ARP ARP table

ARP Table IPMAC address mappings

for some nodes sited on the same LAN

lt IP address MAC address TTLgt

TTL typically 20 min

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 62: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology6565

2 ARP Address Resolution Protocol

AA wants to send datagram to BB and BBrsquos MAC address not in AArsquos ARP tableARP table

AA broadcastsbroadcasts ARP request ARP request packet packet is sent which containing Bs IP address ARP Packet=src_ip src_mac des_ipdes_macARP packet is encapsulated in a frame whose dest MAC

address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP queryARP query request

B receives ARP frameARP frame replies to A with its (Bs) MAC addressframe sent to Arsquos MAC address (unicast)why

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 63: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology6666

ARP Packet

2 ARP Address Resolution Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 64: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology6767

A caches (saves) IP-to-MAC address pair in its

ARP table until information becomes oldbecomes old (times

out)

soft state information that times out (goes away) unless

refreshed

ARP is ldquoplug-and-playplug-and-playrdquo

nodes create their ARP tables without

intervention from net administrator

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

2 ARP Address Resolution Protocol

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 65: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology6868

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

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

A

RB

2 Routing to another LAN

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 66: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology6969

A creates datagram with source A destination B A uses ARP to get Rrsquos 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 itrsquos

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

2 Routing to another LAN

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 67: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology7070

3 Dynamic Host Configuration Protocol

DHCP is a ClientServerClientServer protocolThe clientclient is typically a newly arriving host

wanting to obtain network configuration information

each subnetsubnet will have a DHCP server at least

runs over UDPUDP

plug and play

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 68: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology7171

Operationserver discovery server discovery msg

Dest IP255255255255 Source IP0000Dest MACFF-FF-FF-FF-FF-FF

server offer server offer msgDHCP offer msg including IP address Subnet Mask

Address lease time DNS Server Default GatewayRouter etc

DHCP request DHCP request msgchoose one from multiple offers may be come from

different DHCP serversDHCP ACK DHCP ACK msg

server ack

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 69: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology7272

3 Dynamic Host Configuration Protocol

54 Lin

k-L

ayer Ad

dressin

g54 L

ink

-Layer A

dd

ressing

UDP Port Number

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 70: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology7373

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 71: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology7474

Introductionldquodominantdominantrdquo wired LAN technology

cheap $200 for 100Mbs

first widely used LAN technology

Simpler cheaper than token LANs and ATM

Kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 72: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology7575

Bus topologyBus topology popular through mid 90s

Now starstar topologytopology prevails

Connection choices hubhub or switchswitch (more later)

hub orswitch

Introduction

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 73: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology7676

1 Ethernet Frame Structure

Sending adapter encapsulatesencapsulates IP datagram (or other network layer protocol packet) in Ethernet frameEthernet frame

Preamble(8 bytes) 7 bytes with pattern 1010101010101010 followed by one byte with

pattern 1010101110101011

used to synchronize receiver sender clock rates

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 74: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology7777

Addresses 6 bytesmatching destination MAC address or with broadcast

address (eg ARP packet) to net-layer protocolotherwise adapter discards frame

Typeindicates the higher layer protocol (mostly IP but Novell

IPX and AppleTalk)CRC

checked at receiver if error is detected the frame is simply dropped

55 Eth

ernet

55 Eth

ernet

1 Ethernet Frame Structure

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 75: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology7878

11 Manchester Encoding

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 76: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology7979

12 Unreliable and connectionless service

Connectionlessno handshakinghandshaking between sending and receiving

adapter

Unreliablereceiving adapter doesnrsquot send ACKsNAKs to the

sending adapterstream of datagrams passed to network layer can

have gapsgaps will be filled if app is using TCPotherwise app will see the gaps

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 77: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology8080

2 Ethernet uses CSMACD (P460)

No slotsadapter doesnrsquot transmit if it senses that

some other adapter is transmitting that is carrier sensecarrier sense

transmitting adapter abortsaborts when it senses that another adapter is transmitting that is collision detectioncollision detection

Before attempting a retransmission adapter waits a random time that is random accessrandom access

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 78: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology8181

2 Ethernetlsquos CSMACD (P461)

1 Adapter receives datagram from net layer amp creates framecreates frame

2 If an adapter sensessenses channel idleidle it starts to transmit frame If it senses channel busybusy waitswaits untiluntil channelchannel idleidle and then transmits(96-bit times96-bit times)

3 If adapter transmits entire frame withoutwithout detecting another transmission the adapter is done with frame

4 If adapter detects another transmission while transmitting abortsaborts and sendssends jamjam signal(48-bit stream)signal(48-bit stream)

5 After aborting adapter enters exponentialexponential backoffbackoff after the mmthth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 79: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology8282

2 Ethernetlsquos CSMACD (P461-462)

Exponential BackoffExponential Backoff GoalGoal

adapt retransmission attempts to estimated current load

heavy load random wait will be longerfirst collisionfirst collision choose K from 01 after second collisionsecond collision choose K from 0123hellipafter tententhth or more or more collisionscollisions choose K from

01234hellip1023delay is K512 bit-time

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 80: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology8383

2 Ethernetlsquos CSMACD

Bit time Bit time 1 microsec for 10 Mbps Ethernet

for K=1023 wait time is about 50 msec

Jam SignalJam Signal make sure all other transmitters are aware of

collision 48 bits

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 81: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology8484

CSMACD Example

Ethernet 网络中的只有只有两个节点 A 和 B 活动相距 225bit-time 假设 A 和 B 同时发送Frame 造成冲突并且 A 和 B 选择不同的 K 值退后重传两节点重传的 Frame 会不会再一次造成冲突 t=0 时 A 和 B 同时开始发送 Frame t=225bit-time 时两者均检测到冲突 A 和 B 在 t=225+48 = 273bit-time 结束传输 jam 信号 假设 KA=0 KB=1

何时 A 开始重传何时 A 重传信号到达 B

何时 B 计划开始重传B 计划的重传会不会延后进行

55 Eth

ernet

55 Eth

ernet

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 82: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology8585

CSMACD Example (contdhellip)

55 Eth

ernet

55 Eth

ernet

时间 t (bit-time) 事 件0 A 和 B 均开始发送 Frame

225 A 和 B 均检测到冲突225 + 48 = 273 A 和 B 结束传输 Jam 信号273+225 = 498 498+ 96 = 594

B 的最后一位 Jam 信道到达 A A 检测到信道空闲

273+512 = 785785+ 96 = 881

B 计划重新侦测信道是否空闲B 计划开始重传 Frame

594+225 = 819 881gt819

A 重传 Frame 的第一位到达 BB 将自己的重传计划推后进行

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 83: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology8787

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 84: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology8888

1 Hubs (P465) Hubs are essentially physical-layer physical-layer repeaters

bits bits coming from one link go out all all other links at the same rate

no frame bufferingbufferingno CSMACDCSMACD at hub adapters detect collisionsmay provide net management functionality

twisted pair

hub

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 85: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology8989

Backbone hubBackbone hub interconnects LAN segmentssegments ExtendsExtends max distance between nodes But individual segment collisioncollision domainsdomains become one large

collisioncollision domaindomain Canrsquot interconnect 10BaseT amp 100BaseT

hub

hubhub

backbone hub

1 Hubs (P465)

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 86: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology9090

2 Switch (P467)

Link layer deviceLink layer devicestores and forwardsstores and forwards Ethernet framesexaminesexamines frame header and selectively

forwardsforwards frame based on dest MAC addresswhen frame is to be forwarded on segment

uses CSMACDCSMACD to access segmenttransparenttransparent

hosts are unaware of presence of switches

plug-and-play self-learningplug-and-play self-learning

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 87: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology9292

21 Forwarding Filtering (P468)

A switch has a switch tableswitch table(MAC Address Interface Time Stamp)(MAC Address Interface Time Stamp)

stalestale entries in table dropped (TTL can be 60 min)

switch learnslearns which hosts can be reached through which interfaceswhen frame received switch ldquolearnslearnsrdquo

location of sender incoming LAN segment

records senderlocation pair in switch table

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 88: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology9393

Switch example (P469)

Suppose C sends a frame to D

Switch receives frame from Cnotes in switch table that C is on interface 1because D is not in table switch forwards frame into interfaces 2

and 3 (broadcasting)(broadcasting)frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

address interface

ABEGC

11231

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 89: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology9494

Switch example (P469)

Suppose D replies back with frame to C

Switch receives frame from Dnotes in switch table that D is on interface 2because C is in table switch forwards frame only to interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 90: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology9595

22 Self-Learning (P471)

Switch Table is built automaticallyautomatically dynamicallydynamically autonomously mdash autonomously mdash without any intervention from a network administrator or or from a configuration protocol

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 91: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology9696

22 Self-Learning (P471)

switch table is initially initially emptyempty if framersquos dest address is not in the Switch table

switch forwardedforwarded thethe frameframe toto allall otherother interfacesinterfaces otherwise the frameframe is forwardedforwarded toto thethe interfaceinterface

for each incoming frame switch stores in its tableMAC address in framersquos source address field interface that the frame comes fromarrival time

switch deletes deletes an address in the table if no frames are received with that address as the source address after a period of time

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 92: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology9797

23 Switch traffic isolationswitch installation breaks subnet into LAN segmentsbreaks subnet into LAN segmentsswitch can filter can filter packets

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 93: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology9898

24 Switches dedicated access

Switch with many interfacesHosts have direct connection

to switchNo collisions full duplex

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

switch

A

Arsquo

B

Brsquo

C

Crsquo

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 94: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology9999

More on Switches (P473)

cut-through switchingcut-through switching

frame forwarded from input to output port

without first collecting entire frame

slight reduction in latency

combinations of shareddedicated

101001000 Mbps interfaces

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 95: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology100100

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 96: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology101101

Switches vs Routers (P475)

both store-and-forwardstore-and-forward devicesrouters network layer devices switches link layer devices

routers maintain routing tablesrouting tables implement routingrouting algorithmsalgorithms switches maintain switchingswitching tablestables implement filtering filtering self-self-

learninglearning algorithmsalgorithms

switch

56 Intercon

nection

s56 In

terconn

ections

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 97: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology102102

Summary comparison (P476)

hubs routers switches

traffi c isolation

no yes yes

plug amp play yes no yes

optimal routing

no yes no

cut through

yes no yes

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 98: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology103103

Roadmap

51 Link Layer Introduction and Services52 Error-Detection and -Correction 53 Multiple Access Protocols54 Link-Layer Addressing55 Ethernet56 Hubs and Switches57 PPP58 Link Virtualization ATM and MPLS

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1
Page 99: Computer Networking Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色 Chapter5 The Link Layer and Local Area Networks

School of Computer Science amp Technology114114

Homeworks

P495

Problem 141112

Ch

apter 5

Ch

apter 5

  • Slide 1