Chapter5b

54
5: DataLink Layer 5b-1 Chapter 5 Outline Data link layer principles so far: services, error detection/correction, multiple access Next: LAN technologies addressing Ethernet hubs, bridges, switches 802.11 PPP ATM

description

 

Transcript of Chapter5b

Page 1: Chapter5b

5: DataLink Layer 5b-1

Chapter 5 Outline

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

access

Next: LAN technologies addressing Ethernet hubs, bridges, switches 802.11 PPP ATM

Page 2: Chapter5b

5: DataLink Layer 5b-2

LAN Addresses

32-bit IP address: network-layer address used to get a datagram to a destination network

(recall definition of an IP network)

LAN (or MAC, or physical) address: used to get a datagram from one interface to

another physically-connected interface (same network)

48 bit MAC address (for most LANs): permanent address, burned into the adapter ROM

Q: How many possible LAN/Physical addresses?

A: 246 70 trillion

Page 3: Chapter5b

5: DataLink Layer 5b-3

LAN AddressesEach adapter on a LAN has a unique LAN address

Page 4: Chapter5b

5: DataLink Layer 5b-4

LAN Address (more)

MAC address allocation administered by IEEE manufacturer buys the leading 3 bytes of the

MAC address space (to assure uniqueness) see current assignments

Analogy: (a) MAC address: like Social Security Number (b) IP address: like postal address MAC flat address => portability

can move LAN card from one LAN to another IP hierarchical address NOT portable

depends on network to which one attaches

Page 5: Chapter5b

5: DataLink Layer 5b-5

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 an IP datagram addressed to B:

look up network address of B, find B on same network as A

link layer sends a datagram to B inside link-layer frame

B’s MACaddress

A’s MACaddress

A’s IPaddress

B’s IPaddress

IP payload

datagramframe

frame source,destination address

datagram source,destination address

Page 6: Chapter5b

5: DataLink Layer 5b-6

ARP: Address Resolution Protocol

Each IP node (Hosts & Routers) on a LAN has an ARP module and table

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

< IP address; MAC address; TTL> TTL (Time To Live):

time after which address mapping will be forgotten (typically < 20 minutes)

Question: how can we determine the MAC address of B given B’s IP address?

Page 7: Chapter5b

5: DataLink Layer 5b-7

ARP protocol (RFC 826)

Side effects… performance implications?

A wants to send datagram to B, and A knows B’s IP address.

Suppose B’s MAC address is not in A’s ARP table.

A broadcasts ARP query packet, containing B's IP address all machines on LAN

receive ARP query B receives ARP packet,

replies to A with its (B's) MAC address frame sent to A’s MAC

address (unicast)

A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state: information

that times out goes away unless refreshed

ARP is “plug-and-play”: nodes create their

ARP tables without manual intervention

Page 8: Chapter5b

5: DataLink Layer 5b-8

Routing to another LAN

walk-through: routing from A to B via R

A

RB

111.111.111.0 222.222.222.0

Page 9: Chapter5b

5: DataLink Layer 5b-9

LAN to LAN Walk-through: A creates an IP packet with IP addresses of source A and

destination B A determines next hop to get to B is router R (from routing table) A uses ARP to get R’s physical layer address for IP 111.111.111.110 A creates a LAN1 frame with R's physical address as destination,

the frame contains A-to-B IP datagram A’s data link layer sends LAN1 frame R’s data link layer receives LAN1 frame R removes IP datagram from LAN1 frame, sees it is destined to B R determines next hop, local in this case, to B (from routing table) R uses ARP to get B’s physical layer address R creates a LAN2 frame containing A-to-B IP datagram and sends it

to B

A

RB

111.111.111.0 222.222.222.0

Page 10: Chapter5b

5: DataLink Layer 5b-10

Chapter 5 outline

5.1 Introduction and services

5.2 Error detection and correction

5.3Multiple access protocols

5.4 LAN addresses and ARP

5.5 Ethernet

5.6 Hubs, bridges, and switches

5.7 Wireless links and LANs

5.8 PPP 5.9 ATM 5.10 Frame Relay

Page 11: Chapter5b

5: DataLink Layer 5b-11

Ethernet“dominant” LAN technology: cheap <$4 for 100Mbs! first widely used LAN technology Simpler, cheaper than token LANs and ATM Kept up the pace: 10 Mbps, 100 Mbps, 1 Gbps

Metcalfe’s EthernetSketch (10Base5)

Page 12: Chapter5b

5: DataLink Layer 5b-12

LAN Cost Trends

Fort Worth Star-TelegramJuly 27, 2005

$39

9$199

9

Page 13: Chapter5b

5: DataLink Layer 5b-13

Ethernet Frame Structure

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

Preamble: 7 bytes with pattern 10101010, followed by one

byte with pattern 10101011 (frame delimiter) used to synchronize receiver, sender clock rates

(802.3 Data Length)

Note: IEEE 802.3 specifies that frame length, excluding preamble, must be between 64 and 1518 bytes. Data is padded, if necessary, to 46 bytes to ensure minimum length is achieved.

Page 14: Chapter5b

5: DataLink Layer 5b-14

Ethernet Frame Structure (more) Addresses: 6 bytes, frame is received by all

adapters on a LAN and dropped if address does not match

Type (Length): 2 bytes, indicates the higher layer protocol, mostly IP but others may be supported such as Novell IPX and AppleTalk). If 802.3 compliant, this field is length of data segment (min. 46 bytes)

CRC: 4 bytes, checked at receiver, if error detected, the frame is simply dropped

Page 15: Chapter5b

5: DataLink Layer 5b-15

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 16: Chapter5b

5: DataLink Layer 5b-16

Ethernet uses CSMA/CD

No slots (only “pseudo-slots”)

Manchester encoding at bit-level

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 17: Chapter5b

5: DataLink Layer 5b-17

Ethernet CSMA/CD algorithm

1. Adaptor gets datagram from IP and creates frame

2. If adapter senses channel idle, it starts to transmit the frame. If it senses channel busy, it waits until the channel is idle (+ 96 bit times) and then transmits

3. If adapter transmits the entire frame without detecting another transmission, the adapter is done with that frame !

4. If adapter detects another transmission while transmitting, it aborts and sends a jam signal

5. After aborting, adapter enters exponential backoff: after the mth collision, adapter chooses a value K at random from {0,1,2,…,2m-1}. The adapter then waits K*512 bit times and returns to Step 2

Page 18: Chapter5b

5: DataLink Layer 5b-18

Ethernet’s CSMA/CD (more)

Q: What is the relationship between minimum backoff time of Q: What is the relationship between minimum backoff time of 51.2 51.2 sec, minimum frame size and max distance allowed and max distance allowed between nodes?between nodes?

Jam Signal: make sure all other transmitters are aware of collision; 48 bits;

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

Exponential Backoff: Goal: adapt

retransmission attempts to estimated current load heavy load: random

wait will be longer first collision: choose K

from {0,1}; delay is K x 512 bit transmission times

after second collision: choose K from {0,1,2,3}…

after ten collisions, choose K from {0,1,2,3,4,…,1023}, after 15 tries, abort

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

Page 19: Chapter5b

5: DataLink Layer 5b-19

Course Wrap-up Plan Quiz 6 (now 7/31)

Exam 2 (100’s around) Project/Paper (8/2)

Wrap-up/Review (8/2)

Comprehensive Final Exam Tuesday, 8/7/2007

NH 229 (this room)

Page 20: Chapter5b

5: DataLink Layer 5b-20

A

Station A begins transmission at t=0

A

Station A captureschannelat t=tprop

Ethernet’s CSMA/CD (more)

Page 21: Chapter5b

5: DataLink Layer 5b-21

A begins to transmit at t=0

A BB begins to transmit at t= tprop-B detectscollision at t= tprop

A B

A B

A detectscollision at t= 2 tprop-

It takes 2 tprop to find out if channel has been captured

Ethernet’s CSMA/CD (more)

An Ethernet “slot” can be defined as 2tprop

Page 22: Chapter5b

5: DataLink Layer 5b-22

Probability of 1 successful transmission:

frame contention frame

Psuccess np(1 p)n 1

Psuccess is maximized at p=1/n:

Psuccess

max n(11

n)n 1

1

e

00.10.20.30.40.50.6

2 4 6 8 10 12 14 16

n

Pmax

Ethernet’s CSMA/CD Efficiency

Page 23: Chapter5b

5: DataLink Layer 5b-23

Ethernet’s CSMA/CD Efficiency Recall that the probability of successful transmission in

a slotted protocol with n stations always ready to transmit is: P = np(1-p)(n-1)

which yields a mean probability of success (efficiency) of P = 1/e, for an optimal p = 1/n as n -> infinity.

Note that each 802.3 “slot” has a duration of the one-bit RTT (max) for the LAN (51.2 sec) = 2*tprop

(1)

The average contention interval length (i.e., how long you must wait) is the duration of the interval (or, slot) divided by the probability, or: 2*tprop / 1/e = 2e*tprop

Taking tframe to be the time it takes to transmit an average frame, channel efficiency can then be expressed as:

tframe

tframe + tprop + 2e

tprop

1

1 + 6.4 tprop /tframe

(1) tprop accounts for delays associated with 2500m trip, traversing 4 repeaters in each direction(2) Try this for 10Mbps Ethernet: max extent, max frame size, end to propagation speed of 2x108 m/sec

(2)

Page 24: Chapter5b

5: DataLink Layer 5b-24

Ethernet’s CSMA/CD EfficiencyC

han

nel Effi

cie

ncy

Ch

an

nel Effi

cie

ncy

Number of Stations Trying to SendNumber of Stations Trying to Send

0 1 2 4 8 16 32 64 128 256 512

1.0

0.9

0.8

0,7

0.6

0.5

0.4

0.3

0.2

0.1

1024 byte frames

512 byte frames

128 byte frames

256 byte frames

64 byte frames

Page 25: Chapter5b

5: DataLink Layer 5b-25

Chapter 5 outline

5.1 Introduction and services

5.2 Error detection and correction

5.3Multiple access protocols

5.4 LAN addresses and ARP

5.5 Ethernet Principles Technologies

5.6 Hubs, bridges, and switches

5.7 Wireless links and LANs

5.8 PPP 5.9 ATM 5.10 Frame Relay

Page 26: Chapter5b

5: DataLink Layer 5b-26

Ethernet Technologies: 10Base2 10: 10Mbps; 2: under 200 meters (actually 185) max. cable length per segment thin coaxial cable in a bus topology

repeaters used to connect up to five segments repeater repeats bits it hears on one interface to its other interfaces: physical layer device only!

Page 27: Chapter5b

5: DataLink Layer 5b-27

Ethernet Technologies: 10Base2

Page 28: Chapter5b

5: DataLink Layer 5b-28

Ethernet Technologies: 10Base2

Page 29: Chapter5b

5: DataLink Layer 5b-29

10BaseT and 100BaseT

10/100 Mbps rate; latter called “fast ethernet” T stands for Twisted Pair Nodes are connected to hubs by twisted pair,

thus “star topology” CSMA/CD monitoring can be implemented at

hub

Page 30: Chapter5b

5: DataLink Layer 5b-30

10BaseT and 100BaseT (more) Max. distance from node to Hub is 100 meters

max. between any two nodes connected to same hub is 200 meters

Some hubs can disconnect “jabbering” adapter Some hubs can gather monitoring information,

statistics for display to LAN administrators (so-called “intelligent” hub)

Fiber links can be used to expand geographical reach (per IEEE 802)

Q: How do you calculate the time it takes to send a datagram from one node to another via a hub?

Page 31: Chapter5b

5: DataLink Layer 5b-31

10BaseT and 100BaseT (more)

Page 32: Chapter5b

5: DataLink Layer 5b-32

Gigabit Ethernet

IEEE 802.3z use standard Ethernet frame format allows for point-to-point links (via switches)

and shared broadcast channels (hubs) in shared mode, CSMA/CD is used; short

distances between nodes to be efficient uses hubs, called here “Buffered Distributors” Full-Duplex at 1 Gbps for point-to-point links

Page 33: Chapter5b

5: DataLink Layer 5b-35

Interconnecting LANs

Q: Why not just one big LAN? Limited amount of supportable traffic: on

single LAN, all stations must share bandwidth limited length: 802.3 specifies maximum cable

length large “collision domain” (can collide with many

stations) limited number of stations: 802.5 have token

passing delays at each station

Page 34: Chapter5b

5: DataLink Layer 5b-36

Devices for Interconnecting LANs

Hubs (repeaters) physical-layer bit-level replication (possibly

amplified) extend physical reach of a LAN 10/100BaseT interconnection (repeaters for

10Base2)

Bridges link-layer, frame switches extend physical reach and scale of a LAN allow logical segregation of a LAN

Switches Link-layer, high performance bridge

Page 35: Chapter5b

5: DataLink Layer 5b-37

Hubs Physical Layer devices (repeaters: “active”

hub) 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 a backbone hub at its top

Page 36: Chapter5b

5: DataLink Layer 5b-38

Hubs (more)

Each connected LAN referred to as LAN segment Hubs do not isolate collision domains: a node’s

frames may collide with any other node’s residing at any segment in LAN

Hub Advantages: simple, inexpensive device multi-tier provides graceful degradation:

portions of the LAN continue to operate if one hub malfunctions

troubleshooting made easier extends maximum distance between node

pairs (100m per Hub)

Page 37: Chapter5b

5: DataLink Layer 5b-39

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 speeds (e.g., 10BaseT and 100baseT

Hub: “Bit In, Bit Out”Hub: “Bit In, Bit Out”

Page 38: Chapter5b

5: DataLink Layer 5b-40

Hubs and repeaters LAN segment can be connected by

repeaters Maximum distance between nodes is

2500 meters for 10BaseT (IEEE 802.3) 5-4-3 rule

For Fiber optic backbone: 7-6-5 rule applies

Page 39: Chapter5b

5: DataLink Layer 5b-41

Hubs and repeaters

Page 40: Chapter5b

5: DataLink Layer 5b-42

Hubs and repeaters

Page 41: Chapter5b

5: DataLink Layer 5b-43

Interconnecting with hubs Backbone hub interconnects LAN segments Extends maximum distance between nodes (how far?) HOWEVER, individual segment collision domains become one large

collision domain Can’t interconnect 10BaseT & 100BaseT (and, generally, cannot

connect dissimilar media types)

hub

hubhub

hub

Page 42: Chapter5b

5: DataLink Layer 5b-44

Switch Formerly a “bridge,” or bridging device Layer-2 (data 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 Host-transparent bridging

hosts are unaware of presence of switches Transparent “bridging” between devices

Plug-and-play, self-learning switches do not need to be configured

Page 43: Chapter5b

5: DataLink Layer 5b-45

Switches

Page 44: Chapter5b

5: DataLink Layer 5b-46

Forwarding

• How does the switch determine onto which LAN segment to forward a frame?

• Looks like a routing problem, but …

hub

hubhub

switch1

2 3

Frame

?

Page 45: Chapter5b

5: DataLink Layer 5b-47

Self learning

A switch has a switch (bridging) table entry in switch table:

{MAC Address, Interface, Time Stamp} stale entries in table dropped (TTL usually 20-60

minutes) switch learns which hosts can be reached through

which interfaces when a frame is received, switch “learns”

location of sender: incoming LAN segment Switch records sender(MAC address)/location

(output adapter) pair in its switch table

Page 46: Chapter5b

5: DataLink Layer 5b-48

Filtering/ForwardingWhen 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 47: Chapter5b

5: DataLink Layer 5b-49

Switch example

Suppose C sends frame to D

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

interfaces 2 and 3

frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

12 3

Page 48: Chapter5b

5: DataLink Layer 5b-50

Switch example

Suppose D replies back with frame to C.

Switch receives reply/ack frame from node D notes in bridge table that D is on interface 2 because 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

ABEGCD

112312

12 3

Page 49: Chapter5b

5: DataLink Layer 5b-51

Switch: traffic isolation switch installation breaks subnet into LAN segments switch filters packets:

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

segments become separate collision domains (i.e frames sent for destinations on same segment are not sent onto other segments – most of the time)

hub hub hub

switch

collision domain 3

collision domain 2

collision domain 1

Page 50: Chapter5b

5: DataLink Layer 5b-52

Switches: dedicated access Switches can have many

interfaces Hosts have direct

connection to switch Switch provides dedicated

paths between pairs of hosts

No collisions; full duplex

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

switch

A

A’

B

B’

C

C’

Page 51: Chapter5b

5: DataLink Layer 5b-53

More on Switches

cut-through switching: frame forwarded from input to output port without first collecting entire frameslight reduction in latency

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

Page 52: Chapter5b

5: DataLink Layer 5b-54

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

Page 53: Chapter5b

5: DataLink Layer 5b-55

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 54: Chapter5b

5: DataLink Layer 5b-56

Summary comparison

HubsHubs SwitchesSwitches RoutersRouters

traffic traffic isolationisolation

no yes yes

plug & playplug & play yes yes no

optimal optimal routingrouting

no no yes

cut-cut-throughthrough

yes yes no