Top Banner
Chapter 5 Link Layer Computer Networking: A Top Down Approach 4 th edition. Jim Kurose, Keith Ross Addison-Wesley, July 2007.
36

Week15 lec1

Jan 13, 2015

Download

Education

syedhaiderraza

Computer Networks
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Week15 lec1

Chapter 5 Link Layer

Computer Networking: A Top Down Approach 4th edition. Jim Kurose, Keith RossAddison-Wesley, July

2007.

Page 2: Week15 lec1

Link Layer: Introduction Layer-2 packet is a frame,

encapsulates datagram Link layer has responsibility

of transferring datagram from one node to adjacent node over a link

Datagram may be carried by different link-layer protocols on different links in the path. Services provided by link layer

protocols may be different May or may not provide

reliable data transfer over link

Page 3: Week15 lec1

Link layer and Network Layer

Transportation Analogy

Travel Agent planning a trip for a tourist Trip from Princeton to Lausanne

Car: Princeton to JFK Plane: JFK to Geneva Train: Geneva to Lausanne

Tourist = Datagram Transportation Mode = Link layer protocol Travel Agent = Routing Algorithm

Page 4: Week15 lec1

Link Layer Services Framing:

Encapsulate datagram into frame, adding header, trailer

The structure of the frame is specified by the Link Layer Protocol

Link Access Channel access if shared medium Medium Access Control (MAC) protocol specifies the

rules by which a frame is transmitted onto the link Reliable Delivery between Adjacent Nodes

Link Layer like Transport Layer provides reliability with ACKs and retransmissions.

Wireless links: high error rates Seldom used on low bit-error link (fiber, some twisted

pair)

Page 5: Week15 lec1

Link Layer Services

Flow Control: Pacing between adjacent sending and receiving

nodes

Error Detection: Errors caused by signal attenuation, noise. Receiver detects presence of errors

Error correction: Receiver identifies and corrects bit error(s) without

resorting to retransmissions Transport layer provides reliable delivery between

processes on an end-to-end basis Link layer provides reliability between two nodes

connected by a single link.

Page 6: Week15 lec1

Where is the link layer implemented? In each and every host Link layer implemented in

“adaptor” ( Network Interface Card NIC)

Attaches into host’s system buses

Network Adaptor Link Layer controller

Single special purpose chip Implements many of the

link layer services Mostly in hardware (Framing,

flow control, error detection etc)

Software Component Receiving the datagram,

addressing, activating the controller hardware

controller

physicaltransmission

cpu memory

host bus (e.g., PCI)

network adapter card

host

applicationtransportnetwork

link

linkphysical

Page 7: Week15 lec1

Adaptors Communicating

Sending Side: Encapsulates datagram

in frame Adds error checking

bits, flow control, etc.

Receiving Side looks for errors, flow

control, etc extracts datagram,

passes to upper layer at receiving side

frame

controller controller

sending host receiving host

datagram datagram

datagram

Page 8: Week15 lec1

Error Detection

EDC= Error Detection and Correction bits D = Data protected by error checking, including header fields

otherwise

Page 9: Week15 lec1

Parity Checking Simplest Technique (Even or Odd) Even Parity

Sender simply includes one bit such that Total number of ones d+1 is even

Receiver counts the number of 1s in d+1 bits Detect single bit errors

Two Dimensional Parity and Cyclic Redundancy Check (CRC) Assignment 3

Page 10: Week15 lec1

Multiple Access Links and Protocols

Two types of “links”: Point-to-Point

Single sender at one end and single receiver at the other end of the link

Many link layer protocols are designed for point-to-point links e.g. PPP, HDLC etc.

Broadcast link: All nodes connected to same single, shared, broadcast

channel When one node transmits a frame, the channel

broadcasts it and every node receives a copy. Ethernet and wireless LANs

How to coordinate the access of multiple sending and receiving nodes to a shared broadcast medium?

Human analogy for a broadcast channel is classroom or a party room Who gets to talk and when

Page 11: Week15 lec1

Multiple Access Links and Protocols

Collision

Page 12: Week15 lec1

Multiple Access Links and Protocols

Computer Networks similarly have protocols called Multiple Access Control (MAC) protocols.oWired /wireless local area networks

All nodes are capable of transmitting frameso More than two nodes can transmit

frames at the same timeo Collision: None of the receiving nodes can

make any sense of frames that were transmittedoFrames involved in the collision are lostoBroadcast channel is wasted during the

collision interval Coordinate the transmission of active nodes

oResponsibility of multiple access protocol

Page 13: Week15 lec1

MAC Protocols:

Three broad classes: Channel Partitioning

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

Allocate piece to node for exclusive use Random Access

Channel not divided, allow collisions “Recover” from collisions

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

take longer turns

Page 14: Week15 lec1

Ideal Multiple Access Protocol

Broadcast channel of rate R bps

1. When one node wants to transmit, it can send at rate R bps.

2. When M nodes want to transmit, each can send at average rate of R/M bps

3. Fully decentralized: There is no master node that can fail and bring down

the entire system

4. Simple and inexpensive to implement

Page 15: Week15 lec1

Channel Partitioning MAC protocols: TDMA

TDMA: Time Division Multiple Access TDMA divides time into slots and each slot is

assigned to one of the N nodes. Slot size are chosen so that a single packet

can be transmitted during a slot time. TDMA eliminates collision and is perfectly fair Drawbacks

Wasteful during silent periods A node must always wait for its turn in the

transmission sequence.

Page 16: Week15 lec1

Channel Partitioning MAC protocols: FDMA

FDMA: Frequency Division Multiple Access

Channel spectrum divided into frequency bands

Each station assigned fixed frequency band

FDMA eliminates collision and is fair Drawback

Wasteful during silent periods

Page 17: Week15 lec1

Random Access Protocols When node has packet to send

Transmit at full channel data rate R. Two or more transmitting nodes ➜ “collision”, When collision each node

Repeatedly retransmit until it gets through Doesn’t retransmit the frame right away Waits for a random delay before retransmitting

Examples of random access MAC protocols: Slotted ALOHA ALOHA CSMA, CSMA/CD

Page 18: Week15 lec1

Slotted ALOHA

All frames of exactly L bits

Time divided into equal size slots (time to transmit one frame)

Nodes start to transmit only at the beginning of the slot

Nodes are synchronized so that each node knows when the slot begins

Operation: When node obtains

fresh frame, waits until the beginning of the next slot If there is no collision:

Node has successfully transmittedCan send new frame in

next slot If collision: Node

retransmits frame in each subsequent slot until success

Page 19: Week15 lec1

Slotted Aloha

Page 20: Week15 lec1

Slotted ALOHA

Pros Single active node

can continuously transmit at full rate of channel

Decentralized: Each node detects collision and independently decides when to retransmit

Cons Collisions, wasting slots Idle slots Slotted Aloha is inefficient

(and rude!): doesn't listen before talking!

Page 21: Week15 lec1

Slotted ALOHA

1 2&3 2Time

Collision

Retransmission Retransmission

3

Slot

Node 1 Packet

Nodes 2 & 3 Packets

Collision mechanism in Slotted ALOHA

Page 22: Week15 lec1

Pure (unslotted) ALOHA Unslotted Aloha: Simpler, no synchronization

Unslotted and fully decentralized

When frame first arrives Transmit immediately

Collision probability increases

Inefficient than Slotted Aloha Slotted Aloha does not allow the nodes to transmit any

time The nodes have to wait for the beginning of the next slot The wasted time is confined to one time slot

Page 23: Week15 lec1

Pure Aloha

Page 24: Week15 lec1

Pure ALOHA

1 2 3 3 2Time

Collision

Retransmission Retransmission

Node 1 Packet

Collision mechanism in ALOHA

Waiting a random time

Node 2 Packet

Node 3 Packet

Page 25: Week15 lec1

CSMA Collisions

If all nodes performs carrier sensing, do collision occurs in the first place? oCollisions can still occur:

o Propagation delay means two nodes may not hear each other’s transmission

oAdding collision detection oHelps improve performance by not

transmitting a useless frame in its entirety.

oCSMA/CD used in EthernetoCover in later slides

Page 26: Week15 lec1

“Taking Turns” MAC protocols

Polling Protocol: Master node

“invites” slave nodes to transmit in turn

Concerns: Polling overhead latency single point of

failure (master)

master

slaves

poll

data

data

Page 27: Week15 lec1

“Taking Turns” MAC protocolsToken Passing Protocol: No master node Special frame called

token is exchanged among the nodes in a fixed order.

Node receives a token Holds only if has

something to transmit

Otherwise forwards token to the next node

Concerns: Token overhead Accidently neglects to

release the token

T

data

(nothingto send)

T

Page 28: Week15 lec1

Switch Link-layer Device

Store, forward Ethernet frames Examine incoming frame’s MAC address Selectively forward frame to the outgoing

link Switch itself is transparent to the nodes

Nodes are unaware of presence of switches Plug-and-Play

Switches do not need to be configured Two important functions:

Filtering• Determines whether a frame should be forwarded

to some interface or should be dropped. Forwarding

• Determine the interface to which a frame should be directed

Page 29: Week15 lec1

Switch: Allows Multiple Simultaneous Transmissions

Hosts have dedicated, direct connection to switch

Switches buffer packets Ethernet protocol used on

each incoming link, but no collisions; full duplex

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

A

A’

B

B’

C

C’

switch with six interfaces(1,2,3,4,5,6)

1 23

45

6

Page 30: Week15 lec1

Switch Table

Q: How does switch know that A’ reachable via interface 4, B’ reachable via interface 5?

A: Each switch has a switch table, each entry: MAC address of a host Interface that leads

towards the host Time at which the entry

for the node as placed in the table

How is the table created?

A

A’

B

B’

C

C’

switch with six interfaces(1,2,3,4,5,6)

1 23

45

6

Page 31: Week15 lec1

Switch: 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

A

A’

B

B’

C

C’

1 23

45

6

A A’

Source: ADest: A’

MAC addr interface TTL

Switch table (initially empty)

A 1 60

Page 32: Week15 lec1

Self-Learning,Forwarding:Example

A

A’

B

B’

C

C’

1 23

45

6

A A’

Source: ADest: A’

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A A’A A’A A’A A’A A’

frame destination unknown:flood

A’ A

destination A location known:

A’ 4 60

selective send

Page 33: Week15 lec1

Switch: Frame Filtering/Forwarding

When frame received:

1. Record link associated with sending host2. Index switch table using MAC destination address3. if entry found for destination

then {forward the frame on interface indicated

} else flood

forward on all but the interface on which the frame arrived

Page 34: Week15 lec1

Interconnecting Switches

switches can be connected together

A

B

Q: sending from A to G - how does S1 know to forward frame destined to G via S4 and S3?

A: self learning! (works exactly the same as in single-switch case!)

S1

C D

E

FS2

S4

S3

H

I

G

Page 35: Week15 lec1

Institutional Network

to externalinternet

router

mail server

web server

Page 36: Week15 lec1

Switch: Advantages Elimination of Collisions:

Switches buffer frames and never transmit more than one frame on any segment at one time

Modern switches are Full Duplex Heterogeneous Links

Switch isolates one link from anotherDifferent links can operate at different

speeds and over different media

Difference between Hubs and Switches?

Difference between Switches and Routers? (Home Assignment)