Computer Networks Lecture ch05a

80
Link Layer 5(a)- 1 Chapter 5: The Data Link Layer Our goals: understand principles behind data link layer services: error detection, correction sharing a broadcast channel: multiple access link layer addressing reliable data transfer, flow control: done! instantiation and implementation of various link layer technologies

description

 

Transcript of Computer Networks Lecture ch05a

Page 1: Computer Networks Lecture ch05a

Link Layer 5(a)-1

Chapter 5: The Data Link Layer

Our goals: understand principles behind data link layer

services: error detection, correction sharing a broadcast channel: multiple access link layer addressing reliable data transfer, flow control: done!

instantiation and implementation of various link layer technologies

Page 2: Computer Networks Lecture ch05a

Link Layer 5(a)-2

Link Layer

5.1 Introduction and services

5.2 Error detection and correction

5.3Multiple access protocols

5.4 Link-Layer Addressing

5.5 Ethernet

5.6 Hubs and switches 5.7 PPP 5.8 Link Virtualization:

ATM and MPLS

Page 3: Computer Networks Lecture ch05a

Link Layer 5(a)-3

Link Layer: Introduction

Some terminology: hosts and routers are nodes communication channels that

connect adjacent nodes along communication path are links wired links wireless links LANs

2-PDU is a frame, encapsulates datagram

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

Page 4: Computer Networks Lecture ch05a

Link Layer 5(a)-4

Link layer: context

Datagram transferred by different link protocols over different links: e.g., Ethernet on first link,

frame relay on intermediate links, 802.11 on last link

Each link protocol provides different services e.g., may or may not

provide rdt over link

transportation analogy trip from Princeton to

Lausanne limo: Princeton to JFK plane: JFK to Geneva train: Geneva to

Lausanne tourist = datagram transport segment =

communication link transportation mode = link

layer protocol travel agent = routing

algorithm

Page 5: Computer Networks Lecture ch05a

Link Layer 5(a)-5

Link Layer Services framing:

encapsulate datagram into frame, adding header, trailer link access:

implement channel access if shared medium, physical addresses used in frame headers to identify

source, dest different from IP address!

reliable delivery between two physically connected devices: we learned how to do this already (chapter 3) seldom used on low bit error link (fiber, some twisted

pair) wireless links: high error rates

Q: why both link-level and end-end reliability?

Page 6: Computer Networks Lecture ch05a

Link Layer 5(a)-6

Link Layer Services (cont.) flow control:

pacing between sender and receivers error detection:

errors caused by signal attenuation, noise receiver detects presence of errors

signals sender for retransmission or drops frame error detection is a very common service among link-layer

protocols error correction:

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

ATM provides link-layer error correction for the packet header rather than for the entire packet

half-duplex and full-duplex: with half duplex, nodes at both ends of link can transmit, but

not at same time

Page 7: Computer Networks Lecture ch05a

Link Layer 5(a)-7

Adaptors Communicating

link layer implemented in “adaptor” (aka NIC) Ethernet card, PCMCI card,

802.11 card sending side:

encapsulates datagram in a frame

adds error checking bits, rdt, flow control, etc.

receiving side looks for errors, rdt, flow

control, etc extracts datagram, passes

to rcving node adapter is semi-

autonomous link & physical layers

sendingnode

frame

rcvingnode

datagram

frame

adapter adapter

link layer protocol

Page 8: Computer Networks Lecture ch05a

Link Layer 5(a)-8

Link Layer

5.1 Introduction and services

5.2 Error detection and correction

5.3Multiple access protocols

5.4 Link-Layer Addressing

5.5 Ethernet

5.6 Hubs and switches 5.7 PPP 5.8 Link Virtualization:

ATM

Page 9: Computer Networks Lecture ch05a

Link Layer 5(a)-9

Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking, may include header

fields

Error detection not 100% reliable! protocol may miss some errors, but rarely larger EDC field yields better detection and correction

Page 10: Computer Networks Lecture ch05a

Link Layer 5(a)-10

Parity Checkingsingle bit parity: odd parity, even parity detect single bit errors e.g., one-bit even parity

two dimensional bit parity: detect and correct single bit errors can also detect (but not correct!) any

combination of two errors e.g., two-dimensional even parity

forward error correction (FEC) ability of the receiver to both detect

and correct errors potentially important advantage for

real-time network applications

Page 11: Computer Networks Lecture ch05a

Link Layer 5(a)-11

Internet checksum

Sender: treat segment contents

as sequence of 16-bit integers

checksum: addition (1’s complement sum) of segment contents

sender puts 1's complement of this sum into checksum field

Goal: detect “errors” (e.g., flipped bits) in transmitted segment used at TCP, UDP, IP header

Receiver: 1's complement sum is

computed over the same set of octets, including the checksum field.

if the result is all 1 bits (- 0 in 1's complement arithmetic), NO - error detected YES - no error detected. But

maybe errors nonetheless?

Page 12: Computer Networks Lecture ch05a

Link Layer 5(a)-12

Cyclic Redundancy Check (CRC) a.k.a. polynomial codes view data bits, D, as a binary number choose r+1 bit pattern (generator), G goal: choose r CRC bits, R, such that

<D,R> exactly divisible by G receiver knows G, divides <D,R> by G. if non-zero remainder: error detected! can detect all burst errors less than r+1 bits and any odd

number of bit errors modulo 2 arithmetic widely used in practice (ATM, HDLC)

Page 13: Computer Networks Lecture ch05a

Link Layer 5(a)-13

CRC Examplewant:

D.2r XOR R = nG

equivalently:D.2r = nG XOR R

equivalently: if we divide D.2r by G,

want reminder R

R = remainder D.2r

G

8-bit CRC is used to protect the 5-byte header in ATM cells

CRC-32 32-bit standard, which has been adopted in a number of link-level IEEE protocols, uses a generator

GCRC-32 = 100000100110000010001110110110111

Page 14: Computer Networks Lecture ch05a

Link Layer 5(a)-14

Link Layer

5.1 Introduction and services

5.2 Error detection and correction

5.3Multiple access protocols

5.4 Link-Layer Addressing

5.5 Ethernet

5.6 Hubs and switches 5.7 PPP 5.8 Link Virtualization:

ATM

Page 15: Computer Networks Lecture ch05a

Link Layer 5(a)-15

Multiple Access Links and Protocols

Two types of “links”: point-to-point link

PPP for dial-up access point-to-point link between

Ethernet switch and host broadcast link: shared wire or

medium traditional Ethernet upstream HFC 802.11 wireless LAN

Page 16: Computer Networks Lecture ch05a

Link Layer 5(a)-16

Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes: interference

only one node can send successfully at a time collision if node receives two or more signals at the same time multiple access problem: how to coordinate the access of multiple

sending and receiving nodes to a shared broadcast channel

multiple access protocol distributed algorithm that determines how nodes share channel,

i.e., determine when node can transmit communication about channel sharing must use channel itself!

no out-of-band channel for coordination what to look for in multiple access protocols:

synchronous or asynchronous information needed about other stations robustness (e.g., to channel errors) performance

Page 17: Computer Networks Lecture ch05a

Link Layer 5(a)-17

Multiple Access Protocols (cont.)

claim: humans use multiple access protocols all the time as humans, we've evolved an elaborate set of protocols for

sharing the broadcast channel: give everyone a chance to speak don't speak until you are spoken to don't monopolize the conversation raise your hand if you have a question don't interrupt when someone is speaking don't fall asleep when someone else is talking

you can also "guess" multiple access protocols

Page 18: Computer Networks Lecture ch05a

Link Layer 5(a)-18

MAC Protocols: a taxonomy

Three broad classes: Channel partitioning protocols

divide channel into smaller “pieces” (time slots, frequency, code)

allocate piece to node for exclusive use Random access protocols

channel not divided, allow collisions “recover” from collisions

Taking-turns protocols Nodes take turns, but nodes with more to send can take

longer turns

Page 19: Computer Networks Lecture ch05a

Link Layer 5(a)-19

Ideal Multiple Access Protocol

desirable characteristics

assume broadcast channel of rate R bps

when only one node has data to send, that node has a throughput of R bps

when M nodes have data to send, each of these nodes has a throughput of R/M bps

protocol is fully decentralized no special node to coordinate transmissions no synchronization of clocks, slots

protocol is simple, so that it is inexpensive to implement

Page 20: Computer Networks Lecture ch05a

Link Layer 5(a)-20

Channel Partitioning MAC Protocols: TDM

partition of broadcast channel's bandwidth TDM (Time Division Multiplexing): channel divided into N time

slots, one per user FDM (Frequency Division Multiplexing): frequency subdivided

TDM: time division multiplexing each station gets fixed length slot (length = packet trans

time) in each round it eliminates collisions and is perfectly fair node must always wait for its turn in the transmission

sequence unused slots go idle example: 6-station LAN, 1,3,4 have pkt, slots 2,5,6 idle

time slot

Page 21: Computer Networks Lecture ch05a

Link Layer 5(a)-21

Channel Partitioning MAC Protocols: FDM

FDM: frequency division multiplexing channel spectrum divided into frequency bandwidth each station assigned fixed frequency bandwidth unused transmission time in frequency bands go idle example: 6-station LAN, 1,3,4 have packet, frequency

bandwidth 2,5,6 idle

frequ

ency

bands

time

Page 22: Computer Networks Lecture ch05a

Link Layer 5(a)-22

Random Access Protocols

When node has packet to send transmit at full channel data rate R. no a priori coordination among nodes

two or more transmitting nodes ➜ “collision” each node waits a random delay before retransmitting the

frame random access MAC protocol specifies:

how to detect collisions how to recover from collisions (e.g., via delayed

retransmissions) examples of random access MAC protocols:

slotted ALOHA ALOHA CSMA, CSMA/CD, CSMA/CA

Page 23: Computer Networks Lecture ch05a

Link Layer 5(a)-23

Slotted ALOHA

Assumptions all frames same size time is divided into equal

size slots, time to transmit 1 frame

nodes start to transmit frames only at beginning of slots

nodes are synchronized if 2 or more nodes

transmit in slot, all nodes detect collision

Operation when node obtains fresh

frame, it transmits in next slot

no collision, node can send new frame in next slot

if collision, node retransmits frame in each subsequent slot with prob. p until success

Page 24: Computer Networks Lecture ch05a

Link Layer 5(a)-24

Slotted ALOHA

Pros single active node can

continuously transmit at full rate of channel

highly decentralized only slots in nodes need

to be in sync simple

Cons collisions, wasting slots idle slots nodes may be able to

detect collision in less than time to transmit packet

clock synchronization

Page 25: Computer Networks Lecture ch05a

Link Layer 5(a)-25

Slotted Aloha efficiency

Q: what is max fraction of successful slots?A: suppose N stations have packets to send

each transmits in slot with probability p probability that a single node has a success is S = p (1-p)N-1

because there are N nodes, the probability that an arbitrary node has a success is

S = Prob (only one transmits) = N p (1-p)N-1

p* that maximizes the efficiency for N nodes: S = N p* (1-p*)N-1 = (1 - 1/N)N-1

= 1/e = 0.37 as N infinity 37% of slots do useful work. thus the effective transmission

rate of the channel is not R bps but only 0.37 R bps! 37% of the slots go empty and 26% of slots have collisions

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

Page 26: Computer Networks Lecture ch05a

Link Layer 5(a)-26

Pure (unslotted) ALOHA

unslotted Aloha: simpler, no synchronization when frame first arrives

transmit immediately without waiting for beginning of slot

collision probability increases: frame sent at t0 collides with other frames sent in [t0-1,t0+1]

Page 27: Computer Networks Lecture ch05a

Link Layer 5(a)-27

Pure Aloha (cont.) P(success by a given node) = P(node transmits) • P(no other node transmits in [p0-1, p0]) •

P(no other node transmits in [p0, p0+1])

= p • (1 - p)N-1 • (1 - p)N-1 = p • (1 - p)2(N-1)

P(success by any of N nodes) = N p . (1 - p)2(N-1) 1/(2e) = 0.18 . . . choosing optimum p as N infinity

S =

thro

ughput

(s

ucc

ess

rate

)

G = offered load = Np0.5 1.0 1.5 2.0

0.1

0.2

0.3

0.4

Pure Aloha

Slotted Alohaprotocol constrainseffective channelthroughput!

Page 28: Computer Networks Lecture ch05a

Link Layer 5(a)-28

CSMA: Carrier Sense Multiple Access

CSMA: listen before transmit: if channel sensed idle: transmit entire pkt if channel sensed busy, defer transmission

1-persistent CSMA: when a station has data to send, it first listens to the channel to see if anyone else is transmitting at that moment. if the channel is busy, the station waits until it becomes idle. when the station detects an idle channel, it transmits a frame. if a collision occurs, the station waits a random amount of time and starts all over again.

non-persistent CSMA: retry after random interval if the channel is already busy

p-persistent CSMA: retry immediately with probability p when channel becomes idle. it applies to slotted channels

human analogy: don’t interrupt others!

Page 29: Computer Networks Lecture ch05a

Link Layer 5(a)-29

CSMA collisions

collisions can still occur:propagation delay means two nodes may not heareach other’s transmissioncollision:entire packet transmission time wasted

spatial layout of nodes

note:role of distance & propagation delay in determining collision probability

Page 30: Computer Networks Lecture ch05a

Link Layer 5(a)-30

CSMA/CD (Collision Detection) CSMA/CD: carrier sense multiple access with

collision detection carrier sensing, deferral as in CSMA collisions detected within short time colliding transmissions aborted, reducing channel

wastage persistent or non-persistent retransmission

collision detection: easy in wired LANs: measure signal strengths, compare

transmitted, received signals difficult in wireless LANs: receiver shut off while

transmitting

human analogy: the polite conversationalist

Page 31: Computer Networks Lecture ch05a

Link Layer 5(a)-31

CSMA/CD collision detection

Page 32: Computer Networks Lecture ch05a

Link Layer 5(a)-32

Taking-turns protocols

channel partitioning MAC protocols: share channel efficiently at high load inefficient at low load: delay in channel access, 1/N

bandwidth allocated even if only 1 active node!

random access MAC protocols efficient at low load: single node can fully utilize

channel high load: collision overhead

taking-turns protocols look for best of both worlds!

Page 33: Computer Networks Lecture ch05a

Link Layer 5(a)-33

“Taking Turns” MAC protocols

Polling: master node “invites”

slave nodes to transmit in turn

Request to Send, Clear to Send msgs

concerns: polling overhead latency single point of failure

(master)

Token passing: control token passed from one

node to next sequentially. token message concerns:

token overhead latency single point of failure (token)

Page 34: Computer Networks Lecture ch05a

Link Layer 5(a)-34

Reservation-based protocolsDistributed Polling: time divided into slots begins with N short reservation slots

reservation slot time equal to channel end-end propagation delay

station with message to send post reservation reservation seen by all stations

after reservation slots, message transmissions ordered by known priority

Page 35: Computer Networks Lecture ch05a

Link Layer 5(a)-35

Summary of MAC Protocols

what do you do with a shared media? channel partitioning, by time, frequency, or code

time division, frequency division, code division, random access (dynamic)

ALOHA, S-ALOHA, CSMA, CSMA/CD carrier sensing: easy in some technologies

(wire), hard in others (wireless) CSMA/CD used in Ethernet

taking turns polling from a central site, token passing

Page 36: Computer Networks Lecture ch05a

Link Layer 5(a)-36

LAN technologies

Data link layer so far: services, error detection/correction, multiple access

Next: LAN technologies addressing Ethernet hubs, switches PPP

Page 37: Computer Networks Lecture ch05a

Link Layer 5(a)-37

Link Layer

5.1 Introduction and services

5.2 Error detection and correction

5.3Multiple access protocols

5.4 Link-Layer Addressing

5.5 Ethernet

5.6 Hubs and switches 5.7 PPP 5.8 Link Virtualization:

ATM

Page 38: Computer Networks Lecture ch05a

Link Layer 5(a)-38

LAN Addresses and ARP32-bit IP address: network-layer address used to get datagram to destination network (recall IP

network definition)

LAN address: it is variously called physical address, Ethernet address, or

MAC (media access control) address used to get datagram from one adapter to another

physically-connected adapter (same network) six-bytes long (for most LANs), giving 248 possible LAN

addresses these six-byte addresses are typically expressed in

hexadecimal notation: e.g., 49-BD-D2-C7-56-2A adapter's LAN address is permanent -- when an adapter is

manufactured, a LAN address is burned into the adapter's ROM.

Page 39: Computer Networks Lecture ch05a

Link Layer 5(a)-39

LAN Addresses and ARP (cont.)Each adapter on LAN has unique LAN address

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

= adapter

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

58-23-D7-FA-20-B0

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

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

LAN(wired orwireless)

Page 40: Computer Networks Lecture ch05a

Link Layer 5(a)-40

LAN Addresses and ARP (cont.) MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(to assure uniqueness) analogy:

MAC address: like social security number IP address: like postal address

MAC flat address --> portability can move LAN card from one LAN to another

IP hierarchical address NOT portable depends on network to which one attaches

LAN broadcast address is a string of 48 consecutive 1s: FF-FF-FF-FF-FF-FF

Page 41: Computer Networks Lecture ch05a

Link Layer 5(a)-41

Recall earlier routing discussion

223.1.1.1

223.1.1.2

223.1.1.3

223.1.1.4 223.1.2.9

223.1.2.2

223.1.2.1

223.1.3.2223.1.3.1

223.1.3.27

A

BE

starting at A, given IP datagram addressed to B:

look up net. address of B, find B on same net. as A

link layer send datagram to B inside link-layer frame

B’s MACaddr

A’s MACaddr

A’s IPaddr

B’s IPaddr

IP payload

datagramframe

frame dest,source address

datagram source,dest address

Page 42: Computer Networks Lecture ch05a

Link Layer 5(a)-42

ARP: Address Resolution Protocol

each IP node (host, router) on LAN has ARP module and table

ARP table: IP/MAC address mappings for some LAN nodes

< IP address1; MAC address1; TTL1>

< IP address2; MAC address2; TTL2>

TTL (time to live): time after which address mapping will be forgotten (typically 20 min)

Question: how to determine MAC address of B given B’s IP address?

Page 43: Computer Networks Lecture ch05a

Link Layer 5(a)-43

ARP Protocol A wants to send datagram to B, and A knows B’s IP

address. sppose B’s MAC address is not in A’s ARP table. A passes an ARP query packet to the adapter along with an

indication that the adapter should send the packet to the LAN broadcast address (FF-FF-FF-FF-FF-FF)

broadcasts ARP query pkt, containing B's IP address all machines on LAN receive ARP query

B receives ARP packet, replies to A with its (B's) physical layer address frame sent to A’s MAC address (unicast)

A caches (saves) IP-to-physical address pairs until information becomes old (times out) soft state: information that times out (goes away) unless

refreshed ARP is plug-and-play

nodes create their ARP tables without intervention from net administrator

Page 44: Computer Networks Lecture ch05a

Link Layer 5(a)-44

Routing to another LANwalkthrough: send datagram from A to B via Rassume A know’s B IP address A creates IP packet with source A, destination B in routing table at source host, find router 111.111.111.110 A uses ARP to get R’s LAN address for 111.111.111.110

A

R

B

Page 45: Computer Networks Lecture ch05a

Link Layer 5(a)-45

in ARP table at source, find LAN address E6-E9-00-17-BB-4B A creates Ethernet frame with R's physical address as dest,

Ethernet frame contains A-to-B IP datagram A’s data link layer sends Ethernet frame to R R’s data link layer receives Ethernet frame from A R removes IP datagram from Ethernet frame, sees it is

destined to B R uses ARP to get B’s physical address

two ARP tables in router R, one for each IP network (LAN) R creates frame containing A-to-B IP datagram R’s data link layer sends Ethernet frame to B

A

R

B

Page 46: Computer Networks Lecture ch05a

Link Layer 5(a)-46

DHCP: Dynamic Host Configuration ProtocolGoal: allow host to dynamically obtain its IP address from

network server when it joins network can renew its lease on address in use allows reuse of addresses support for mobile users who want to join network (more

shortly) dynamically get address: “plug-and-play”

DHCP overview: 4-step process DHCP sever discovery: client broadcasts to locate available

servers DHCP server offer(s): server to client in response to DHCP

discover with offer of configuration parameters. client receives one or more DHCP offer messages from one or more servers

DHCP request: client message to servers either (a) requesting offered parameters from one server and implicitly declining offers from all others, (b) confirming correctness of previously allocated address after, e.g., system reboot, or (c) extending the lease on a particular network address.

DHCPACK: server to client with configuration parameters, including committed network address

Page 47: Computer Networks Lecture ch05a

Link Layer 5(a)-47

DHCP client-server scenario

223.1.1.1

223.1.1.2

223.1.1.3

223.1.1.4 223.1.2.9

223.1.2.2

223.1.2.1

223.1.3.2223.1.3.1

223.1.3.27

A

BE

DHCP server

arriving DHCP client needsaddress in thisnetwork

Page 48: Computer Networks Lecture ch05a

Link Layer 5(a)-48

DHCP client-server scenarioDHCP server:

223.1.2.5arriving client

time

DHCP discover

src : 0.0.0.0, 68 dest.: 255.255.255.255,67yiaddr: 0.0.0.0transaction ID: 654

DHCP offer

src: 223.1.2.5, 67 dest: 255.255.255.255, 68yiaddrr: 223.1.2.4transaction ID: 654Lifetime: 3600 secs

DHCP request

src: 0.0.0.0, 68 dest:: 255.255.255.255, 67yiaddrr: 223.1.2.4transaction ID: 655Lifetime: 3600 secs

DHCP ACK

src: 223.1.2.5, 67 dest: 255.255.255.255, 68yiaddrr: 223.1.2.4transaction ID: 655Lifetime: 3600 secs time

Page 49: Computer Networks Lecture ch05a

Link Layer 5(a)-49

Link Layer

5.1 Introduction and services

5.2 Error detection and correction

5.3Multiple access protocols

5.4 Link-Layer Addressing

5.5 Ethernet

5.6 Hubs and switches 5.7 PPP 5.8 Link Virtualization:

ATM

Page 50: Computer Networks Lecture ch05a

Link Layer 5(a)-50

Ethernet dominant LAN technology, first widely deployed high-speed LAN

technology token ring, FDDI, and ATM are more complex and expensive than

Ethernet kept up with speed race: 10 – 10Gbps since it has been so popular, Ethernet hardware has become a

commodity and is remarkably cheap ($20 for 100Mbs!) the low cost is also due to the fact that Ethernet's multiple access

protocol, CSMA/CD, is completely decentralized, which has contributed to a simple design

Metcalfe’s Etheretsketch

Page 51: Computer Networks Lecture ch05a

Link Layer 5(a)-51

Star topology Bus topology popular through mid 90s Now star topology prevails Connection choices: hub or switch (more later)

Page 52: Computer Networks Lecture ch05a

Link Layer 5(a)-52

Ethernet Frame Structure

sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

preamble (8 bytes): 7 bytes with pattern 10101010 followed by one byte with

pattern 10101011 used to synchronize receiver, sender clock rates

data field (46 to 1500 bytes) this field carries IP datagram the maximum transfer unit (MTU) of Ethernet is 1500 bytes the minimum size of the data field is 46 bytes. if the IP

datagram is less than 46 bytes, the data field has to be "stuffed" to fill it out to 46 bytes. the network layer uses the length field in the IP datagram header to remove the stuffing

Page 53: Computer Networks Lecture ch05a

Link Layer 5(a)-53

Ethernet Frame Structure (more) destination address (6 bytes): frame is received by all

adapters on a LAN and dropped if address does not match source address (6 bytes) type (2 bytes):

indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)

ARP protocol also has its own type number cyclic redundancy check (CRC) (4 bytes): checked at

receiver, if error is detected, the frame is simply dropped

Page 54: Computer Networks Lecture ch05a

Link Layer 5(a)-54

Ethernet: Unreliable, connectionless service

Connectionless: no handshaking between sending and receiving

adapter.

Unreliable: receiving adapter doesn’t send acks or nacks to sending

adapter stream of datagrams passed to network layer can have

gaps gaps will be filled if app is using TCP otherwise, app will see the gaps

Page 55: Computer Networks Lecture ch05a

Link Layer 5(a)-55

Ethernet: services and transmission

provide connectionless and unreliable service to the network layer baseband transmission Manchester encoding

used in 10BaseT, 10Base2 each bit has a transition allows clocks in sending and receiving nodes to synchronize to each

other no need for a centralized, global clock among nodes!

Page 56: Computer Networks Lecture ch05a

Link Layer 5(a)-56

Ethernet uses CSMA/CD

no slots adapter doesn’t

transmit if it senses that some other adapter is transmitting, that is, carrier sense

transmitting adapter aborts when it senses that another adapter is transmitting, that is, collision detection

before attempting a retransmission, adapter waits a random time, that is, random access

Page 57: Computer Networks Lecture ch05a

Link Layer 5(a)-57

Ethernet’s CSMA/CD1. adapter obtains a network-layer PDU, prepares an Ethernet

frame, and puts the frame in an adapter buffer. 2. if the adapter senses that the channel is idle, it starts to

transmit the frame. If the channel is busy, it waits until it senses no signal energy (plus 96 bit times) and then starts to transmit the frame.

3. while transmitting, the adapter monitors for the presence of signal energy coming from other adapters. If the adapter transmits the entire frame without detecting signal energy from other adapters, the adapter is done with the frame.

4. if the adapter detects signal energy from other adapters, it stops transmitting its frame and instead transmits a 48-bit jam signal.

5. after aborting (that is, transmitting the jam signal), the adapter enters an exponential backoff phase. The adapter then waits K • 512 bit times and then returns to step 2.

Page 58: Computer Networks Lecture ch05a

Link Layer 5(a)-58

Ethernet’s CSMA/CD (more) jam signal:

make sure all other transmitters are aware of collision 48-bit random bit pattern

exponential backoff: Goal: adapt retransmission attempts to estimated current load after experiencing the nth collision in a row, the adapter chooses

a value for K at random from {0,1,2, . . ., 2m - 1} where m = min(n,10). the adapter then waits K • 512 bit times

1) first collision: choose K from {0,1}; delay is K * 512 bit transmission times

2) after second collision: choose K from {0,1,2,3}3) after ten or more collisions, choose K from {0,1,2,3,4,

…,1023} if many adapters are involved in the collision, it makes sense to

choose K from a larger, more dispersed set of values heavy load: random wait will be longer

bit time: 0.1 microsec for 10 Mbps Ethernet for K=1023, wait time is about 50 msec

Page 59: Computer Networks Lecture ch05a

Link Layer 5(a)-59

CSMA/CD efficiency Tprop = max prop between 2 nodes in LAN

ttrans = time to transmit max-size frame

transprop tt /51

1efficiency

See/interact with Java applet on AWL Web site: highly recommended !

efficiency goes to 1 as tprop goes to 0

goes to 1 as ttrans goes to infinity much better than ALOHA, but still decentralized, simple,

and cheap

Page 60: Computer Networks Lecture ch05a

Link Layer 5(a)-60

Ethernet Technologies: 10Base2 10: 10Mbps; 2: under 200 meters max cable length thin coaxial cable in a bus topology repeaters used to connect up to multiple segments repeater repeats bits it hears on one interface to its other

interfaces: physical layer device only! without a repeater, the maximum length is 185 meters, the

maximum number of nodes is 30

10Base2 Ethernet

Page 61: Computer Networks Lecture ch05a

Link Layer 5(a)-61

10BaseT and 100BaseT 10/100 Mbps rate; latter called “fast Ethernet” T stands for twisted pair hub to which nodes are connected by twisted pair, thus “star

topology” 4B5B encoding: used in 100BaseT. data byte is first broken into two

nibbles. if the byte is 0E, the first nibble is 0 and the second nibble is E. next each nibble is remapped according to the following table:0000--11110 0001--01001 0010--10100 0011--10101 0100—010100101--01011 0110--01110 0111--01111 1000--10010 1001—100111010--10110 1011--10111 1100--11010 1101--11011 1110—111001111--11101

star topology for 10BaseT and 100BaseT

Page 62: Computer Networks Lecture ch05a

Link Layer 5(a)-62

10BaseT and 100BaseT (cont.) max distance from node to hub is 100 meters hubs are essentially physical-layer repeaters:

bits coming in one link go out all other links no frame buffering no CSMA/CD at hub: adapters detect collisions

provides net management functionality hub can disconnect “jabbering adapter” hub can gather monitoring information, statistics for display to

LAN administrators

Page 63: Computer Networks Lecture ch05a

Link Layer 5(a)-63

Gigabit Ethernet Uses the standard Ethernet frame format, and is

backward compatible with 10BaseT and 100BaseT technologies. This allows for easy integration of Gigabit Ethernet with the existing installed base of Ethernet equipment.

Allows for point-to-point links as well as shared broadcast channels. Point-to-point links use switches (see Section 5.6) whereas broadcast channels use hubs. In Gigabit Ethernet jargon, hubs are called "buffered distributors"

Uses CSMA/CD for shared broadcast channels. In order to have acceptable efficiency, the maximum distance between nodes must be severely restricted.

Allows for full-duplex operation at 1 Gbps in both directions for point-to-point channels.

10 Gbps now !

Page 64: Computer Networks Lecture ch05a

Link Layer 5(a)-64

Link Layer

5.1 Introduction and services

5.2 Error detection and correction

5.3Multiple access protocols

5.4 Link-Layer Addressing

5.5 Ethernet

5.6 Interconnections: Hubs and switches

5.7 PPP 5.8 Link Virtualization:

ATM

Page 65: Computer Networks Lecture ch05a

Link Layer 5(a)-65

Token Ring: IEEE802.5 standard 4 Mbps, 16 Mbps max token holding time: 10 ms, which limits frame length

SD (starting delimiter), ED (ending delimiter) mark start, end of packet

AC (access control): token bit: value 0 means token can be seized, value 1 means

data follows FC priority bits: priority of packet reservation bits: station can write these bits to prevent

stations with lower priority packet from seizing token after token becomes free

ED

Page 66: Computer Networks Lecture ch05a

Link Layer 5(a)-66

Token Ring: IEEE802.5 standard (cont.)

FC: frame control used for monitoring and maintenance source, destination address: 48 bit physical address, as in

Ethernet data: packet from network layer checksum: CRC FS (frame status): set by dest., read by sender

set to indicate destination up, frame copied OK from ring DLC-level ACKing

ED

Page 67: Computer Networks Lecture ch05a

Link Layer 5(a)-67

Hubs physical layer devices: essentially repeaters operating

at bit levels: repeat received bits on one interface to all other interfaces

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

each connected LAN referred to as LAN segment hubs do not isolate collision domains: node may collide

with any node residing at any segment in LAN

three departmental Ethernets interconnected with a hub

Page 68: Computer Networks Lecture ch05a

Link Layer 5(a)-68

Hubs (cont.)

hub advantages: simple, inexpensive device multi-tier provides graceful degradation: portions of the LAN

continue to operate if one hub malfunctions extends maximum distance between node pairs (100m per Hub)

hub limitations: single collision domain results in no increase in max throughput

multi-tier throughput same as single segment throughput individual LAN restrictions pose limits on number of nodes in

same collision domain and on total allowed geographical coverage

cannot connect different Ethernet types (e.g., 10BaseT and 100baseT)

Page 69: Computer Networks Lecture ch05a

Link Layer 5(a)-69

Link-layer switches link layer device

stores and forwards Ethernet frames examines frame header and selectively forwards frame based

on MAC dest address when frame is to be forwarded on segment, uses CSMA/CD to

access segment transparent: hosts are unaware of presence of switches plug-and-play, self-learning

switches do not need to be configured

three departmental LANs interconnected with a switch

Page 70: Computer Networks Lecture ch05a

Link Layer 5(a)-70

Switch forwarding and filtering

filtering: ability to determine whether a frame should be forwarded to some interface or should be just dropped

forwarding: ability to determine the interface to which a frame should be directed

hub

hubhub

switch1

2 3

How do determine onto which LAN segment to forward frame?

Looks like a routing problem...

Page 71: Computer Networks Lecture ch05a

Link Layer 5(a)-71

Self learning

A switch has a switch table entry in switch table:

(MAC address, Interface, Time stamp) stale entries in table dropped (TTL can be 60 min)

self-learning: switch learns which hosts can be reached through which

interfaces when frame received, switch “learns” location of sender:

incoming LAN segment records sender/location pair in switch table

Page 72: Computer Networks Lecture ch05a

Link Layer 5(a)-72

Filtering/Forwarding

When switch receives a frame:

index switch table using MAC dest addressif entry found for destination

then { if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated } else flood

forward on all but the interface on which the frame arrived

Page 73: Computer Networks Lecture ch05a

Link Layer 5(a)-73

Switch example (1)

Suppose C sends a frame to D

switch receives frame from from C switch notes that C is on interface 1 because D is not in table, switch forwards frame into

interfaces 2 and 3 frame is received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

Page 74: Computer Networks Lecture ch05a

Link Layer 5(a)-74

Switch example (2)Suppose D replies back with frame to C.

switch receives frame from from D switch notes that D is on interface 2 because C is in the table, switch selectively forwards frame

only to interface 1 frame received by C switches are plug-and-play devices

address interface

ABEGCD

112312

hub

hub hub

switch

A

B CD

EF

G H

I

1

2 3

Page 75: Computer Networks Lecture ch05a

Link Layer 5(a)-75

Switches: traffic isolation filtering:

same-LAN-segment frames not forwarded onto other LAN segments segments become separate collision domains

forwarding: know the LAN segment on which to forward frame

switch advantages: isolates collision domains resulting in higher total max throughput,

and does not limit the number of nodes nor geographical coverage can connect different type Ethernet since it is a store and forward

device

hub hub hub

switch

collision domain collision domain

collision domain

Page 76: Computer Networks Lecture ch05a

Link Layer 5(a)-76

Switches: dedicated access switch with many interfaces hosts have direct connection to

switch no collisions; full duplex cut-through switching: frame is

forwarded from input to output port before the entire packet has arrived if the buffer becomes empty slight reduction in latency

combinations of shared/dedicated, 10/100/1000 Mbps interfaces

Switching: A-to-A’ and B-to-B’ simultaneously, no collisions

switch

A

A’

B

B’

C

C’

Page 77: Computer Networks Lecture ch05a

Link Layer 5(a)-77

Institutional network

switch

Page 78: Computer Networks Lecture ch05a

Link Layer 5(a)-78

Switches vs. Routers both store-and-forward devices

routers: network layer devices (examine network layer headers) switches are link layer devices

routers maintain routing tables, implement routing algorithms switches maintain switch tables, implement filtering, learning

algorithms

Page 79: Computer Networks Lecture ch05a

Link Layer 5(a)-79

Routers vs. Bridges: pros and cons

Switches: (+) switches are plug and play(+) switches operation is simpler, has relatively high packet filtering

and forwarding rates(-) topologies are restricted with switches: a spanning tree must be

built to avoid cycles since bridges do not offer protection against broadcast storms

(-) spanning tree restriction also concentrates the traffic on the spanning tree links

Routers:(+) arbitrary topologies can be supported, cycling is limited by TTL

counters (and good routing protocols)(+) provide firewall protection against layer 2 broadcast storms(-) require IP address configuration (not plug and play)(-) require larger per-packet processing time

switches do well in small (few hundred hosts) while routers used in large networks (thousands of hosts)

Page 80: Computer Networks Lecture ch05a

Link Layer 5(a)-80

Summary comparison

hubs routers switches

traffic isolation no yes yes

plug & play yes no yes

optimal routing no yes no

cut through yes no yes