+ All Categories
Home > Documents > Data Link Layer part two

Data Link Layer part two

Date post: 03-Feb-2016
Category:
Upload: byron
View: 34 times
Download: 0 times
Share this document with a friend
Description:
Data Link Layer part two. How LANs work Switching The ARP protocol Data link reliability Interconnecting LANs Hubs, bridges, routers. LAN technologies. LAN Addresses and ARP - 1. 32-bit IP address: network-layer address used to get datagram to destination network - PowerPoint PPT Presentation
Popular Tags:
46
1 Data Link Layer part two How LANs work • Switching The ARP protocol Data link reliability Interconnecting LANs Hubs, bridges, routers
Transcript
Page 1: Data Link Layer part two

1

Data Link Layer part two

• How LANs work• Switching

• The ARP protocol• Data link reliability• Interconnecting LANs

• Hubs, bridges, routers

Page 2: Data Link Layer part two

2

LAN technologies

Page 3: Data Link Layer part two

3

LAN Addresses and ARP - 1

32-bit IP address: • network-layer address• used to get datagram to destination network • E.g. 138.23.169.129

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

another physically-connected interface (same network)

• 48 bit MAC address (for most LANs) burned in the adapter ROM

• E.g. 20:30:65:25:5a:93

Page 4: Data Link Layer part two

4

LAN Addresses and ARP - 2

Each adapter on LAN has unique LAN address

Page 5: Data Link Layer part two

5

LAN Address (more)

• MAC address allocation administered by IEEE• manufacturer buys portion of MAC address

space (to assure uniqueness)• Analogy: (a) MAC address: like Social Security Number (b) IP address: like postal address• MAC flat address => portability

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

• depends on network to which one attaches

Page 6: Data Link Layer part two

6

IP vs MAC address

• IP address refers to communicating end points• used in network layer to find path

• MAC or physical address refers to physically connected machines• Data link layer to find next hop

Page 7: Data Link Layer part two

7

Data Link and Routing223.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

datagram

frame

frame source,dest address

datagram source,dest address

Page 8: Data Link Layer part two

8

ARP: Address Resolution Protocol

• Each IP node (Host, Router) on LAN has ARP module, 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 min)

Question: how to determineMAC address of Bgiven B’s IP address?

Page 9: Data Link Layer part two

9

ARP protocol: in one LAN• A knows B's IP address, wants to learn

physical address of B • A 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

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

away) unless refreshed

Page 10: Data Link Layer part two

10

Routing to another LAN - 1

Walkthrough: routing from A to B via R

Page 11: Data Link Layer part two

11

Routing to another LAN - 2

• A creates IP packet with source A, destination B• Routing: A finds that R is next hop • A uses ARP to get R’s physical layer address for

111.111.111.110• A creates Ethernet frame with

• R's physical address as dest, • A, B IP datagram

• A’s data link layer sends Ethernet frame

Page 12: Data Link Layer part two

12

Routing to another LAN - 3• R’s data link layer receives Ethernet frame • R removes IP datagram from Ethernet frame,

sees its destined to B• R uses ARP to get B’s physical layer address • R creates frame containing A-to-B IP

datagram sends to B

Page 13: Data Link Layer part two

13

Data Link Reliability

Page 14: Data Link Layer part two

14

Why retransmissions ?

• Error correction although feasible, is not enough to handle all kinds of errors -- especially burst errors.

• Corrupt frames cannot be deciphered and are therefore dropped.

• Retransmissions needed to provide reliability.• Note this is reliability at the data link layer• Similar considerations appear at the transport layer

• TCP has reliability

Page 15: Data Link Layer part two

15

ACKs and Time-outs• When frames are sent piggyback an acknowledgement (ACK)

for received packets onto sent packets.• If no ACK received up to a preset time-out, resend frame.• Called ARQ -- Automatic Repeat request.

1

100Ack 1

Page 16: Data Link Layer part two

16

Stop and Wait

• Allow only one outstanding packet at any given time.

• If ACK not received within time-out, send again.

Sender Receiver

Frame

ACK

Sender Receiver

Frame

ACK

Frame

ACK

Sender Receiver

Frame

ACK

Frame

ACK

Sender Receiver

Frame

Frame

ACK

(a) (c)

(b) (d)

Page 17: Data Link Layer part two

17

How efficient is Stop and Wait?

• Consider a 1.5 Mbps link with 45 ms RTT.• BW - Delay product = 67.5 Kb = 8KB.• You can fill 8 Kbytes of data prior to receiving an

ACK.• However, if your frame size is 1 KB, you are using

only 1/8 of the capacity.• Inefficient.

Page 18: Data Link Layer part two

18

Sliding Window• What we really like is that the 9th frame

be transmitted when ACK for the first frame arrives :).

• Sliding window:• A window of packets sent• as ACKs are received window slides

i.e., more packets sent.

• Now what do we need in addition ?• Need to know which packets have been

received and which have not.• Packets labeled using sequence

numbers.

Sender Receiver

Page 19: Data Link Layer part two

19

Some definitions

• We have a window of packets sent -- Send Window Size or SWS.

• Last Acknowledgement received is denoted LAR.

• LFS represents the last frame sent.• NOTE: LFS - LAR <= SWS• NOTE 2: Initially we will consider “cumulative

ACKs”• ACK frame seq-no=15 means I have received all

packets including 15.

Page 20: Data Link Layer part two

20

Sender Functions

< SWS

LAR LFS

■ ■ ■ ■ ■ ■ ─

• When an ACK is received, the LAR moves to the right.

• This allows for the transmission of an additional frames.

k k+1

Page 21: Data Link Layer part two

21

Receiver functions

• When frame with Seq_Num arrives:1. If frame is outside window discard.

– Seq_Num <= LFR or Seq Num > LAF

2. If frame within window, accept frame.– LFR < Seq_Num < LAF.

3. Send an ACK, if needed• Let Seq_Num_to_Ack be the largest seq-number

• That I can ACK , (all frames <= Seq_Num_to_Ack have been received)• yet to be acked.

• If have not sent ACK yet, send an ACK

4. Adjust parameters:1. LFR = Seq_Num_to_Ack2. Adjust LAF = LFR + RWS.

RWS

LFR LAF

■ ■ ■ ■ ■ ■

< ─

Notation:

RWS -- Receive Window Size

LAF -- Largest Acceptable Frame.

LFR -- Last Frame Received.

Page 22: Data Link Layer part two

22

An Example• Let LFR =5 and RWS = 4.• This implies LAF = 9• If packets 7 and 8 arrive (not 6), they are buffered.

• Note that they are out of order.

• Typically, Receiver will resend an ACK for packet 5.• When 6 arrives, it can cumulatively ACK all buffered

packets i.e., it ACKs 8 and moves LFR to 8 and LAF to 12.

Page 23: Data Link Layer part two

23

Other possibilities

• Send NAK (negative acknowledgement) for lost packets -- example for 6, when 7 is received.

• Duplicate ACKs -- send an ACK for 5 again when 7 is received to trigger retransmission of 6.

• Selective ACKs : Explicitly ACK frames that are received -- more complex.

Page 24: Data Link Layer part two

24

Setting the Window Size

• Sender window: SWS, set considering the BW delay product and link quality• How many packets should be “on flight”?

• Receiver window: RWS, set to something appropriate -- may depend on buffering resources.• If RWS = 1 what happens to out of order frames ?

Page 25: Data Link Layer part two

25

Sequence number wrapping

• Sequence numbers are finite -- thus there is a need to reuse -- called wrap around.

• What is the relationship between the SWS and MaxSeqNum ?

Page 26: Data Link Layer part two

26

Maximum Sequence Number and SWS

• Should it not be SWS <= MaxSeqNum + 1 ?• Let us consider an example:

• Sender has eight Seq Nums from 0 to 7.• Assume SWS = RWS = 7.• Sender transmits frames 0-6 • Receiver gets them, ACKs but ACKs get lost.• Receiver expects 7 and next 0...5. But sender sends the

previous 0..5. • When the receiver gets these, he cannot distinguish.

• Thus, when RWS = SWS, SWS < (MaxSeqNum+1)/2. • Example: consider MaxSeqNum = 1 (one bit)

• I can only send one packet at a time, alternating between 1 and 0

Page 27: Data Link Layer part two

27

Sequence Numbers and SWS

• For other cases i.e., when RWS is not equal to SWS, other rules may apply.

• Depends on the specific case.• A different way with TCP -- we will see later.• Easy solution -- large Sequence number space.

Page 28: Data Link Layer part two

28

Interconnecting LANs

• Hubs• Bridges• Routers

Page 29: Data Link Layer part two

29

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 30: Data Link Layer part two

30

Overview: Order of increasing “intelligence’

• Hubs: • repeat everything to all ports except the incoming• only on tree topologies (otherwise -> loops)

• Bridges: even with non-tree topologies • Select a tree structure and use only that• Default: behave like a hub• Learn: if known, forward only towards destination

• Routers:• Handle arbitrary topologies• Perform complex routing decisions

Page 31: Data Link Layer part two

31

Hubs - 1• Physical Layer devices: essentially repeaters

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

• 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

Page 32: Data Link Layer part two

32

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)

Page 33: Data Link Layer part two

33

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 34: Data Link Layer part two

34

Bridges - 1

• Link Layer devices: operate on Ethernet frames, examining frame header and selectively forwarding frame based on its destination

• Bridge isolates collision domains since it buffers frames

• When frame is to be forwarded on segment, bridge uses CSMA/CD to access segment and transmit

Page 35: Data Link Layer part two

35

Bridges - 2

• Bridge 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

• Transparent: no need for any change to hosts LAN adapters

Page 36: Data Link Layer part two

36

Bridges: frame filtering, forwarding

• Bridges filter packets • Same-LAN -segment frames not

forwarded onto other LAN segments

• Forwarding: • How to know which LAN segment on

which to forward frame?• Looks like a routing problem (more

shortly!)

Page 37: Data Link Layer part two

37

Backbone Bridge

Page 38: Data Link Layer part two

38

Bridge Filtering - 1

• Bridges learn which hosts can be reached through which interfaces: maintain filtering tables• when frame received, bridge “learns” location

of sender: incoming LAN segment• records sender location in filtering table

• Filtering table entry: • (Node LAN Address, Bridge Interface, Time

Stamp)• stale entries in Filtering Table dropped (TTL

can be 60 minutes)

Page 39: Data Link Layer part two

39

Bridge Filtering - 2• Filtering procedure:

if destination is on LAN on which frame was receivedthen drop the frameelse { lookup filtering table 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 40: Data Link Layer part two

40

Bridge Learning: example - 1

Suppose C sends frame to D and D replies back with frame to C

• C sends frame, bridge has no info about D, so floods to both LANs • bridge notes that C is on port 1 • frame ignored on upper LAN • frame received by D

Page 41: Data Link Layer part two

41

• D generates reply to C, sends • bridge sees frame from D • bridge notes that D is on interface 2 • bridge knows C on interface 1, so selectively

forwards frame out via interface 1

Bridge Learning: example - 2

C | 1

Page 42: Data Link Layer part two

42

Bridges Spanning Tree• For increased reliability, desirable to have redundant,

alternate paths from source to dest• With multiple simultaneous paths, cycles result - bridges

may multiply and forward frame forever• Solution: organize bridges in a spanning tree by

disabling subset of interfaces

Disabled

Page 43: Data Link Layer part two

43

The Spanning Tree Algorithm

• Purpose: select a subset of ports for fwd-ing• Root bridge election: lowest ID wins• Each bridge: select one port towards root

• Shortest path to root (break ties)

• In each LAN: select designated bridge - select port• Root is designated for all adjacent LANs• Designated bridge: fwds frames towards root• Select the bridge closest to root (IDs to break ties)

• Note: a bridge can be designated for many LANs• Active ports: the selected ones, others are stand by

PetDavie 3.2.2 for more details

Page 44: Data Link Layer part two

44

WWF Bridges vs. Routers• Both store-and-forward devices

• routers: network layer devices (examine network layer headers)

• bridges are Link Layer devices• Routers maintain routing tables, implement routing algorithms• Bridges maintain filtering tables, implement filtering, learning

and spanning tree algorithms

Page 45: Data Link Layer part two

45

Routers vs. Bridges - 1

Bridges + and -

+ Bridge operation is simpler requiring less processing bandwidth

- Topologies are restricted with bridges: a spanning tree must be built to avoid cycles

- Bridges do not offer protection from broadcast storms (endless broadcasting by a host will be forwarded by a bridge)

Page 46: Data Link Layer part two

46

Routers vs. Bridges - 2

Routers + and -+ arbitrary topologies can be supported, cycling is

limited by TTL counters (and good routing protocols)

+ provide firewall protection against broadcast storms

- require IP address configuration (not plug and play)- require higher processing bandwidth• Bridges do well in small (few hundred hosts) while

routers used in large networks (thousands of hosts)


Recommended