Top Banner
1 MAC Layer Survey
53

MAC Layer Survey

Feb 22, 2016

Download

Documents

brosh

MAC Layer Survey. The Medium Access Sublayer. MAC: Medium Access Control As opposed to “high access control” or “low access control”? NO! It means: controlling access to the medium. provides arbitration mechanism for shared medium What are arbitration mechanisms in this classroom? - PowerPoint PPT Presentation
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: MAC Layer Survey

1

MAC Layer Survey

Page 2: MAC Layer Survey

2

The Medium Access Sublayer

MAC: Medium Access Control– As opposed to “high access control” or “low access control”?– NO!– It means: controlling access to the medium.– provides arbitration mechanism for shared medium

What are arbitration mechanisms in this classroom?– Raising your hand– Verbal cues, e.g. “go ahead, Fred”.– Eye contact

Background: review of:– Broadcast vs. Point-to-Point media– Topologies: Bus, Ring

Then: Static vs. Dynamic channel allocation Finally: ALOHA, and CSMA/CD (Ethernet)

Page 3: MAC Layer Survey

3

Broadcast Networks vs. Point to Point networks typically use a “shared cable”typically are LAN technologiesexamples:

–Ethernet–Cable Modems

built from cables connecting single machines.

often used to connect LANs into an internetwork (internet)

a special case: Token Ring•wiring is point to point, •but treated like broadcast

Page 4: MAC Layer Survey

4

The Channel Allocation Problem (continued)

Statistical multiplexing is preferred to FDM and TDM.– Arrange all the packets in a giant central queue,

and share the bandwidth on a first come first served basis.– Don’t pre-allocate bandwidth for users that may just waste it.– For details, need to review some basic queuing theory,

and know what an exponential and poisson distribution are.

Page 5: MAC Layer Survey

5

Dynamic channel allocation

Five characteristics of channel allocation models:1) Station model: stations independent2) Single channel assumption3) Collisions4) Continuous (free-for-all, pure Aloha) vs

Discrete Time (time is slotted)5) Carrier sense (polite, listen first) vs.

no Carrier Sense (just blurt out)

Page 6: MAC Layer Survey

6

Aloha

1970s Norman Abramson et. al, University of Hawaii

Send packets on shared channel; if collisions occur,wait random amount of time, and try again.

Original purpose: – host to terminal communication (very bursty)– ground-based radio channel; want to share it.

However, basic ideas have application to any environmentwhere there is a shared medium, and uncoordinated users– a bus-topology LAN– the up-link part of a Satellite channel

Page 7: MAC Layer Survey

7

Two variationsof Aloha

Slotted– transmit

at start ofnext slot

– improvesefficiency,because thereare fewercollisions.

A

B

CDE

User

=packet arrival =packet xmission

Time

A

B

CDE

User

Pure (unslotted)– transmit

wheneveryou like

Page 8: MAC Layer Survey

8

Efficiency of pure aloha...

When does frame X suffer no collisions? When there are no frames that overlap with frame X…i.e., only one frame starts in an interval of 2t. (Frames that start after t0 + 2t are ok).

Forbidden region: frames that start in this region will collide.

Page 9: MAC Layer Survey

9

Tannenbaum discussestwenty-eight of them! some are abstract schemes others are actual systems

Channel allocationmethods... Pure ALOHA

Slotted ALOHA

TDMFDM

1-persistent CSMANonpersistent CSMAP-persistent CSMACSMA/CD

So far, we’ve discussedfour abstract schemes

We’ll next briefly coverfour more abstract schemes

then an actual product:that applies CSMA/CD:

Ethernet

Ethernet

Page 10: MAC Layer Survey

10

Carrier Sense Multiple Access

Listen the channel before you transmit! If the channel is busy don’t transmit; if it’s idle, transmit. Most basic form: 1-persistent CSMA

– If busy, listen persistently until channel is idle, then transmit immediately with probability 1.

Problem with 1-persistent CSMA:

– Q: If any two stations B,C become “ready” during A’s transmission, what happens

– A: guaranteed collision!

Page 11: MAC Layer Survey

11

Carrier Sense Multiple Access

Time

A

B

C

User

Listen the channel before you transmit! Most basic form: 1-persistent CSMA

– Sense the channel first;

– then transmit immediately with probability 1.

– When station becomes ready (has a frame to send)

– If busy, listen persistently until channel is idleif idle, transmit immediately.

Page 12: MAC Layer Survey

12

Problem with 1-persistent CSMA

Time

A

B

C

User

Q: If any two stations B,C become “ready” during A’s transmission, what happens?

A: Collision is guaranteed!

To address this problem, researchers have proposed: non-persistent CSMA p-persistent CSMA (for slotted channels).

Page 13: MAC Layer Survey

13

Non-persistent and p-persistent CSMA

p-persistent CSMA (for slotted channels).when idle, transmit with probability p; w/ prob (1-p), wait for next slot.

A

B

CH

T

T

T

H

T

As an illustration,consider p=0.5,or equivalently,flipping a coin:tails: transmitheads: defer.

THTime

A

B

C

non-persistent CSMAif channel is busy, wait a random amount of time before sensing again.

Do we expect fewer collisions with these methods?What is the tradeoff?

Page 14: MAC Layer Survey

14

Performance of CSMA protocols vs. Aloha

Tanenbaum doesn’t say where this analysis comes from, or what the assumptions are. But it does make the tradeoff clear:– less aggressive transmission means higher throughput,

because there are fewer collisions,– but also higher delay!

Page 15: MAC Layer Survey

15

Collision detection All of the previous protocol (ALOHA, CSMA) assume

collision = a total loss. CSMA with Collision Detection (CSMA/CD)

makes a different assumption:– we can detect a collision,and abort immediately,

so we don’t waste an entire slot.– So, use 1-persistent CSMA, but if there is a collision,

immediately stop, and wait a random period of time before trying again.

Time

ABC

User

Ethernet and 802.3 use CSMA/CD.

Page 16: MAC Layer Survey

16

Detecting collisions on a Bus network...

If is the maximum propagation time on a bus network, then it can take up to twice that long (2) for a collision to be detected.

This turns out to be a an important design parameter, as we will see.

Page 17: MAC Layer Survey

17

If you need 2 to detect collisions... … then you need to make sure that a frame isn’t shorter then 2 Otherwise, a station might send an entire frame,

and not realize that it had collided with something! Thus, the minimum frame size

in classic 10Mbps Ethernet = 64bytes. What about 100Mbps Ethernet…? If minimum frame size is the same, and bit rate is 10 times higher,

and you still need 2 to detect collisions, then what must havechanged?– the maximum cable length has to be 10 times shorter.

Page 18: MAC Layer Survey

18

Ethernet and 802.3

Ethernet came first, invented at Xerox PARC (Palo Alto Research Center).(Bob Metcalfe was key figure; later went on to be a founder of 3COM.)

Xerox, Digital, and Intel were the “partners” in original commercial Ethernet spec.

Later, IEEE make 802.3 a standard– lots of variations at various bit rates using various media, – changed packet type field to a length field.

(packet type values are all illegal lengths, so its easy to distinguish) For most purposes of our discussion, we’ll consider them one and the

same, although purists would insist that they are different standards.

Page 19: MAC Layer Survey

19

802.3 Collision Detection is analog process

Station must read voltage on wire to see if it is the same aswhat the station is sending out.

Collision of two “0 volt signals” would be hard to detect! This is a motivation for Manchester Encoding…

Voltage is either 0.85 or -0.85, so if you add two signals together, with very high probability you will get an illegal voltage within a few bits.

Page 20: MAC Layer Survey

20

Ethernet

“dominant” LAN technology: cheap $20 for 100Mbs! first widely used LAN technology Simpler, cheaper than token LANs and ATM Kept up with speed race: 10, 100, 1000 Mbps

Metcalfe’s Ethernetsketch

Page 21: MAC Layer Survey

21

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 used to synchronize receiver, sender clock rates

Page 22: MAC Layer Survey

22

Ethernet Frame Structure (more)

Addresses: 6 bytes, frame is received by all adapters on a LAN and dropped if address does not match

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

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

Page 23: MAC Layer Survey

23

Ethernet: uses CSMA/CD

A: sense channel, if idle then {

transmit and monitor the channel; If detect another transmission then { abort and send jam signal;

update # collisions; delay as required by exponential backoff

algorithm; goto A}

else {done with the frame; set collisions to zero}}

else {wait until ongoing transmission is over and goto A}

Page 24: MAC Layer Survey

24

Ethernet’s CSMA/CD (more)

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

Exponential Backoff: Goal: adapt retransmission attemtps 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 or more collisions, choose K from {0,1,2,3,4,…,1023}

Page 25: MAC Layer Survey

25

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!

Page 26: MAC Layer Survey

26

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”

Page 27: MAC Layer Survey

27

LAN Addresses and ARP

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

network definition)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

Page 28: MAC Layer Survey

28

LAN Addresses and ARP

Each adapter on LAN has unique LAN address

Page 29: MAC Layer Survey

29

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 30: MAC Layer Survey

30

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 source,dest address

datagram source,dest address

Page 31: MAC Layer Survey

31

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 32: MAC Layer Survey

32

ARP protocol

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 33: MAC Layer Survey

33

Routing to another LANwalkthrough: routing from A to B via R

In routing table at source Host, find router 111.111.111.110 In ARP table at source, find MAC address E6-E9-00-17-BB-4B, etc

A

RB

Page 34: MAC Layer Survey

34

A creates IP packet with source A, destination B 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, Ethernet frame

contains A-to-B IP datagram A’s data link layer sends Ethernet frame 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

A

R B

Page 35: MAC Layer Survey

35

Bridges, Internetworking

Before talking about bridges in the context of the MAC sub-layer, lets briefly skip ahead, and cover the differences among:

repeaters

bridges

routers

gateways

Page 36: MAC Layer Survey

36

Repeaters

Copy individual bits between cable segments, and that is all. Operate at physical layer only.

Repeater

host

Ph

DNTA

mac

host

Ph

DNTA

mac

Page 37: MAC Layer Survey

37

Bridges Operate at Data link layer, and may connect two similar LANs,

or two dissimilar, but at least partially compatible LANs. For dissimilar LANs (e.g. 802.x to 802.y, where xy)

differences in frame size, priority schemes, etc. create headachesand incompatibilities.

host

Ph

D

NTA

mac

host

Ph

D

NTA

mac

bridge

Ph

Dmac mac

Ph

Page 38: MAC Layer Survey

38

Routers Operate at Network layer. Usually connect two networks using same

network layer. Tanenbaum discusses “multiprotocol routers”;

– Often these connect two networks that have multiple network protocols, but don’t do conversions from one to another.(This is how I have seen them used.)

– Tanenbaum implies: sometimes they convert from one network layer to another.

host

Ph

DNTA

mac

host

Ph

DNTA

mac

router

Ph Ph

ND

macD

mac

Page 39: MAC Layer Survey

39

Gateways Operate at Transport and/or Application Layer Examples:

– a gateway between Internet (TCP/IP) SMTP-based email and a proprietary email system like IBM’s “PROFS” (based on SNA) or Digital’s (DECs) “All-in-one” or VAX/VMS Mail (based on DECnet).

– a gateway between SNA’s 3270 terminals and TCP/IP Telnet style terminal sessions.

– Proxy server

host

Ph

DNTA

mac

host

Ph

DNTA

mac

gateway

Ph Ph

Dmac

Dmac

NT

A

NT

Page 40: MAC Layer Survey

40

Summary: Repeaters, Bridges, Routers, Gateways

host

Ph

DNTA

m

host

Ph

DNTA

m

bridge

Ph

Dm m

Ph

host

Ph

DNTA

m

host

Ph

DNTA

m

router

Ph Ph

NDm

Dm

host

Ph

DNTA

m

host

Ph

DNTA

m

gateway

Ph Ph

Dm

Dm

NT

A

NT

host

Ph

DNTA

m

host

Ph

DNTA

mrepeate

rPh Ph

The distinction lies mainly in the “highest” layer at which each operates. Although this terminology is fairly standard, and the preferred common usage, the

term “gateway” is sometimes used in the Internet community as a synonym for “router”. (for example, in the name of the “Exterior Gateway Protocol”.)

Now let’s turn our attention back to a possibly confusing questions about bridges… – do bridges do routing?

Page 41: MAC Layer Survey

41

Ethernet Bridges for collisions/noise/traffic each segment looks like a separate Ethernet

BUT, for forwarding frames to destination Ethernet addresses the entire network seems to bea single large Ethernet

The bridges handle routing

Ethernet Repeaterseach segment can be 500mno more than 4 repeaters

between any two computersmaximum distance 2500ma 10BaseT hub counts

as a repeater.

segment 1 on floor 3 segment 2 on floor 3

segment 1 on floor 2 segment 2 on floor 2

segment 1 on floor 1 segment 2 on floor 1

verticalsegment

LAN 1 LAN 2

u v w x y z

Page 42: MAC Layer Survey

42

LAN 3 LAN 4 LAN 5

LAN 6

We can build an extended LAN by connecting up smaller LANs through bridges

Goal:– (LAN3, LAN4, LAN5, LAN6) separate for collisions, local traffic– (LAN3, LAN4, LAN5, LAN6) all one LAN for sending, addressing– Bridges functions as data-link layer routers

Routing tables are self-configuring. Four (equiv.) names for this:– adaptive bridges – backwards-learning bridges– learning bridges – transparent bridges

Bridges can connect more than one LAN

Page 43: MAC Layer Survey

43

segment 1 segment 2

u v w x y z

How adaptive bridges learn

The bridge B has this goal: only forward frames when necessary!– don’t forward local traffic between hosts on seg. 1 to seg. 2, and vice-versa– e.g., traffic between u and w should stay local to seg. 1

How is this achieved?– At first forwarding every incoming frame onto every destination lan (flooding)– As the bridge “learns” where hosts are, it only forwards the frame if necessary.

How does it learn where hosts “live”? By “backward learning”– We figure out the destination seg. for packets going to y,

by looking at the source seg. for packets coming from y.

seg. 2seg. 1

Page 44: MAC Layer Survey

44

LAN 1 LAN 2

u v w x y z

Startup/Steady State

The startup behavior is to forward every frame everywhere (flooding) The steady state is to forward frames ONLY where they belong.

LAN 2LAN 1

LAN 3 LAN 4 LAN 5

LAN 6

Page 45: MAC Layer Survey

45

Do Bridges Do Routing?Where the confusion can arise...

In discussing bridge design, we may talk about “routing tables” in the bridges and how “routing” is done.– e.g. sending a frame DA vs. DC vs. DH.

We’re talking about routings packets at the Data Link Layer through an interconnection of LAN segments that make up an “extended LAN”.

This is similar in function (in some ways) to routing at the network layer, but it is NOT the network layer; the network layer sits “above” all this.

Page 46: MAC Layer Survey

46

Planning A Bridged Network

Bridges allow parallelism, and isolate traffic.– Simultaneously: (AB) (ED) (FH) without any collision.

Exploit “locality of reference”; idea is that most accesses are to – local file servers– local printers

So put users of a server/printer on the same bridged segment – keep local traffic local

Page 47: MAC Layer Survey

47

Bridging Between Buildings:Goal is to keep local traffic local!

optical fibers

fiber modemfiber modem

EthernetEthernet

Bad: Traffic from both

sides goes across the fiber optic link

Good: local trafficstays local

fiber modem

fiber modem

optical fibers between buildings

bridge

building 1 building 2

building 1 building 2

Page 48: MAC Layer Survey

48

Bridging Across Longer Distances: Keep local traffic off the long-distance link

bridge bridge

satellite

LAN 1 LAN 2

Page 49: MAC Layer Survey

49

A Cycle Of Bridges In transparent bridging: the idea is,

you just plug and play– the bridges configure themselves!– but what if you put in a cycle?– What will happen?

Page 50: MAC Layer Survey

50

Problems with a cycle of bridges

The fear: – more than one bridge may forward a frame, creating wasteful duplicates – loops may cause frames to be forwarded forever

Example:– Suppose that frame F is going to an “unknown” destination, – Both bridge B1 and bridge B2 use flooding (send it everywhere)– Now what happens when B1 sees frame F2, and B2 sees frame F1?– They will forward it back to LAN1, creating frames F3 and F4…– etc. etc. etc.

Page 51: MAC Layer Survey

51

Easy solution for LANs: Create a Spanning Tree

Lowest serial number bridge becomes the root of the tree (leader election problem). Perlman’s algorithm used to do computation.

Note that this does not scale up to WANs; it would be wasteful to not usethe capacity of the “non-tree” links.

An example of how LAN routing (data link layer) differs from WAN routing (network layer)

Interconnected LANs The Resulting Spanning Tree

Page 52: MAC Layer Survey

52

Backward Learning in Transparent Bridges

Transparency idea: “plug and play”; no configuration needed!Review of the algorithm:

– Build a hash table where key is Ethernet address, data is LAN id. (initially empty)– When packet arrives, put source address in table along with LAN it came in on.

(this is the backward learning part; we learn destinations, by looking at sources!)– Look up destination address in table.

• if (found) if (source LAN==dest LAN) do nothing; frame is already where it needs to be else send out on destination LAN.

• else {we don’t know where it is, so send out on every interface (flooding.) } – Periodically purge entries from table (“soft-state”) in case hosts move

or LAN configuration changes.

Page 53: MAC Layer Survey

53

Source Routing Bridges (used in IBM Token Ring, 802.5)

Source chooses the route the host. Route chosen by using “discovery packets”

– broadcast packet from x saying “what is route to y”?– bridges record route taken; use info to get reply back to x.– x receives a reply for every possible route to y,

and picks the best one. Advantage: can use the bandwidth more effectively.

Transparent bridges only use the spanning tree. Disadvantages:

– Not transparent.(not “plug and play”).Administrator must configure bridge addresses to be unique among all bridges attached to a particular LAN

– Frame explosion problem; # discovery frames can grow exponentially. (only linear growth with flooding in spanning tree bridges.)