Sie sind auf Seite 1von 79

Outline

3.1 3.2 3.3 3.4 3.5 Introduction Framing and Error Control Flow Control and Retransmission Medium Access Control LAN

Two types of links:


1- Point-to-point: A link connects two nodes 2- Broadcast (shared wire or wireless medium) - Inexpensive: radio over air; copper or coaxial cable - Multiple users communicate by broadcasting into medium - Single shared broadcast channel: All nodes receive all frames - There is collision if more than one node sends at the same time only one node can send successfully at a time

Shared wire (e.g., cabled Ethernet)

Shared RF (e.g., 802.11 WiFi)

103 3 -98

- When a "collision" occurs, the signals will get distorted and the frame will be lost the link bandwidth is wasted during collision - Question: How to coordinate the access of multiple sending and receiving nodes to the shared link??? - Solution: We need a protocol to determine how nodes share channel Medium Access control (MAC) protocol - The main task of a MAC protocol is to minimize collisions in order to utilize the bandwidth by: - Determining when a node can use the link (medium) - What a node should do when the link is busy - What the node should do when it is involved in collision
3 -99

Two broad classes of MAC protocols:


1- Controlled access protocols Nodes reserve or are assigned channel, no collisions 1.1 Channel Partitioning - Divide channel into smaller pieces (time slots, frequency) - Allocate a piece to a node for exclusive use 1.2 Taking turns - Nodes are scheduled and take turns to transmit - Nodes with more to send can take longer turns 2- Random access protocols Channel is not divided - nodes contend for channel collisions are possible determine how to recover from collisions Ex. ALOHA and carrier sense multiple access (CSMA)
3 -100

Ideal Multiple Access Protocol


1. When one node wants to transmit, it can send at rate R bps, where R is the channel rate. 2. When M nodes want to transmit, each can send at average rate R/M (fair) 3. fully decentralized: - No special node to coordinate transmissions - No synchronization of clocks, slots 4. Simple Does not exist!!
3 -101

1- Controlled access protocols: Channel Partitioning


1- TDMA: time division multiple access - Channel divided into N time slots, one per user - Access to channel in "rounds" - Each node gets fixed length slot (= packet transmission time) in each round - Unused slots go idle - Example: 6 nodes 1, 3, 4 have packets, slots 2,5,6 idle - Needs clock synchronization
6-slot frame 1 3 4 1 3 4 3 -102

2- FDMA: frequency division multiple access - Channel spectrum is divided into N frequency bands, one per user - Each node is assigned fixed frequency band - If the channel rate is R bps and number of users is N, each user gets R/N - All nodes can access the channel at the same time without collision - Unused transmission time in frequency bands go idle - Example: 6 nodes, if only nodes 1, 3, and 4 have frames, frequency bands 2, 5, and 6 go idle
frequency bands

FDM cable

3 -103

TDMA & FDMA: Performance


Suppose that a channel supports N nodes, with transmission rate of R bps - Single user throughput = R/N even if it is the only node with frames to send (bad utilization of channel) - Fairness: Each user gets the same allocation - depends on maximum number of users - Decentralized: Requires resource division - Simple: avoids collisions - Disadvantage: Poor bandwidth utilization - Unused transmission time in frequency bands go idle - inefficient with low duty cycle users and at light load
3 -104

1- Controlled access protocols: Taking turns


- Nodes take turns accessing the medium - Nodes that take turn transmitting a single frame at a full rate (R) bps - Two models: Centralized (polling protocol) and distributed (token passing)

1- Polling Protocol:
- A master (central) node coordinates which node uses the channel - Master node invites slave nodes to transmit in turn - Request to Send, Clear to Send messages
data

data poll

master

slaves

3 -105

Master is sending to slave

Slave is sending to master

- All data exchanges are done through the master - When the master has a frame to send, it sends a select frame that includes the address of the intended slave - When the master is ready to receive data, it send a Poll frame for each node to ask if it has data to send or not. If yes, data will be transmitted, otherwise NAK is sent. - Concerns: polling overhead and latency - single point of failure (master) 3 -106

2- Token passing: - Control token passed from one node to next sequentially. - To transmit: - Wait for a token - Capture (or hold) the token - Begin transmitting data (while holding token) - If allocated time is expired or data transmission finishes, release the token (send it to the next node), i.e., passes the access right - If the next node has no data to send, it just passes the token to the next node 3 -107
T

3 -108

- Concerns: Token overhead - latency - single point of failure

2- Random Access (or contention) Protocols


- Distributed protocol: No node is superior to another node and none is assigned the control over another. - Nodes transmit at full channel data rate without a priori coordination among nodes - Two or more transmitting nodes collision - Random access MAC protocol specifies: - How to detect collisions - How to recover from collisions - Examples of random access MAC protocols: ALOHA - slotted ALOHA - CSMA - CSMA/CD
Common Bus Crash!!

3 -109

1- ALOHA (or Pure or unslotted) ALOHA)


1- Whenever a node has a frame to transmit, it transmits immediately 2- The node waits for an ACK for time out equals to the maximum round-trip propagation delay = 2* tprop 3- If no ACK was received, sender assumes that the frame or ACK has suffered collision 4- The node resends the frame immediately with probability p, otherwise, it waits (backs off) for a frame time with probability 1-p nodes involved in collision resend at different times to avoid repeated collisions.
First transmission

Backoff period B t0+X+2tprop

Retransmission

t0

t0+X

t0+X+2tprop+ B

3 -110

Throughput Analysis

t0 X

t0

t0 + X

- X: frame transmission time, assuming constant time, i.e., fixed frame length - S: throughput, average number of successful frame transmissions per second - G: load, average number of transmission attempts by all nodes during one frame transmission time - Psuccess : Probability that a frame transmission is successful = the probability that there are no additional transmissions in the vulnerable period (2X seconds). 3 -111

- Any transmission that begins during the vulnerable period leads to collision - If node A starts transmission at time t0, A can guarantee that its transmission is successful (collision-free) if no other node starts transmission during [t0 - X, t0 + X], i.e., X sec before and X sec after As transmission. - The users frame transmissions during period X (either new or retransmissions) is a Poisson process with average rate of G transmission-attempts per frame-time - The probability of k transmission-attempts during the vulnerable period (2X):

( 2G ) e 2G P(k ) =
k

k!

k = 0, 1, 2, 3 on average 2G transmissions per 2X seconds


3 -112

- Channel utilization or efficiency or throughput (S) is: the long-run percentage of the transmitted frames that arrive successfully (without collisions) or the percentage of the channel bandwidth that will be used for transmitting frames without collisions - Note: S < G because of collisions S = rate of frame transmissions * P(successful transmission) = G * P(0 other transmissions in 2 X) = G * P(k = 0)

S = GPsuccess

2G 2G 2G = GP(0) = G e = Ge 0!

N is the number of nodes, P is the probability a node transmits in period X G = NP = the average number of transmissions in X (binomial 3 -113 distribution)

S = throughput = goodput (success rate)

0.4 0.3 0.2 0.1

0.36

0.184

Slotted Aloha

Pure Aloha
0.5 1.0 1.5 2.0

G = offered load = Np

- Throughput S reaches a peak value of 0.5/e at load G = 0.5, and then declines back toward 0 - For a given value of S, there are two corresponding values for G: 1- For small G: S G, there is nearly no collision, S is small because the load is small (there are few transmissions) 2- For large G: G >> S, there are many backlogged users, S is small because there are many collisions 3 -114

- Given N and G = 0.5, we can compute optimal P - ALOHA protocol cannot achieve throughput higher than 18.4 percent - If there are F frames/s, then 0.18 * F frames will arrive successfully on average without the need for retransmission. - The maximum channel utilization is 18.4% of the physical channel capacity you buy 1 Mb link, throughput will never be more than 180Kb! - MAC protocol constrains the effective channel throughput Simple improvement but big impact - Why vulnerable for 2 time slots?
3 -115

- Send only at the beginnings of time slots vulnerable for one time slots less collision probability higher efficiency

2- Slotted ALOHA

Success (S), Collision (C), Empty (E) slots

- Time is divided into slots equal to frame transmission time - Nodes are synchronized - A node can transmit at the beginning of a slot only - If a node misses the beginning of a slot, it has to wait until the beginning of the next slot and transmits the entire frame in the slot, i.e., packets overlap completely or not at all 3 -116

- If there is a collision, the node retransmits its frame in each subsequent slot with probability p until the frame is successfully transmitted - In unslotted ALOHA: Collision probability frame sent at t0 collides with other frames sent in [t0-X, t0+X] - In slotted ALOHA: Collision probability frame sent at t0 collides with other frames sent in [t0, t0+X]

Throughput Analysis
S = GP ( no collision ) = GP ( no other tran smissions in the slot )

( G) =G
0!

e G = G e G
3 -117

S = throughput = goodput (success rate)

0.4 0.3 0.2 0.1

0.368

Ge-G
Slotted Aloha

0.184

Ge-2G
Pure Aloha
0.5 1.0 1.5 2.0

Throughput S reaches a peak value of 1/e = 0.368 at load G = 1

G = offered load = Np

- When G = PN < 1, as P (or N) increases - Probability of empty slots reduces - Probability of collision is still low, thus S increases - When G > 1, as P (or N) increases: - Probability of empty slots does not reduce much, but - Probability of collision increases, thus S decreases - S is optimal when G = 1
3 -118

- At its best: channel use for successful transmissions is 37% of the time. - e.g. For a network with 100 Mbps, the successful throughput < 37 Mbps using Slotted ALOHA protocol. - The probability that no other transmission is sent during the same time slot is e-G (= The probability that a frame avoid collision) - The collision probability is 1-e-G. - The probability that k attempts are required for a successful transmission is

Pk = e (1 e )

G k 1

Geometric distribution one success after k-1 failures

- Expected number of transmissions per frame time,

E = kPk = ke G (1 e G )k 1 = eG
k =1 k =1

3 -119

ALOHA: Evaluation
Pros - A node can transmit frames continuously at the full rate of channel if it is the only node with frames - Highly decentralized: only nodes need to be synchronized - Simple to be implemented - Decentralized: No master station is needed to control the medium robust against failure of a host Cons - Collisions wasting slots low channel utilization only 0.37 and 0.18 of the channel rate - Slotted ALOHA needs slot synchronization - High load implicates low utilization of the channel and high delays
3 -120

3- CSMA (Carrier Sense Multiple Access)


- To improve performance, avoid transmissions that are certain to cause collisions - ALOHA is inefficient (and rude!): doesn't listen before talking! - CSMA: Listen before transmit - A node should sense the medium for the presence of another transmission (carrier) before it starts its own transmission - Sense medium Sense the voltage level on the medium

- If medium is idle (no voltage sensed): transmit entire frame - If medium is busy, defer transmission and wait (or backoff) and retry again - Collision: entire frame transmission time is wasted
3 -121

- CSM can reduce the possibility of collision but it cannot eliminate it: Collision can only happen when more than one node begin transmitting within a short time (the propagation time period) - Propagation delay means two nodes may not hear each others transmission - The longest collision detection time occurs when node A at one end of the cable starts transmitting and node B at the other end of the cable starts its transmission just before the signal from A has reached it.
A begins to transmit at t=0 A detects collision at t= 2 tprop-

A A

B B
B begins to transmit at t = tprop- B detects collision at t = tprop 3 -122

- Node A detects the collision when the signal from B reaches it, i.e., about one round trip propagation time after node A starts transmission. - Maximum propagation delay (tprop): the taken time for a bit to travel between the two most widely separated stations. - tprop = d/V seconds, d is the distance between the two most widely nodes and V is the speed of the signal - i.e., in the worst case, it takes 2tprop to find out if channel has been captured - Vulnerable period is 2tprop (due to channel capture effect) - If A sends a frame at time t0, A can guarantee that its transmission is collision free if there is no other node starts transmission in [t0-tprop, t0+tprop], because all the nodes should know about As transmission and will not send

3 -123

- The longer the propagation delay the larger the collision probability the worse the performance of the protocol - Can you guess why there is a restriction on the bus length? - Distance & signal propagation speed play important role in determining collision probability - If 2tprop > 2 X (or if a = tprop/X > 1), no gain compared to ALOHA - If 2tprop > X (or if a = tprop/X > 0.5), no gain compared to slotted ALOHA - Remember: X = frame length/link bit rate THINK How cable length signal speed frame length link bit rate affect the performance? These applets explain different protocols in this course http://wps.aw.com/aw_kurose_network_3/0,9212,140634 6-,00.html 3 -124

- Three options when a node has a frame to transmit but the channel is busy 1) 1-Persistent CSMA (most greedy): - Start transmission as soon as the medium becomes idle - Nodes continuously sense the medium - Send frame as soon as the medium is idle low delay - Avoid idle channel time - A medium is used once it is idle - Large collision probability: If two nodes become ready in the middle of the transmission of a third one, both with start transmitting as soon as they find the channel idle after the 3rd nodes transmission is over collision guaranteed

3 -125

2- Non-persistent CSMA (least greedy) - A node with frames to be sent should:1- Sense the medium, if it is idle, send; otherwise, go to 2 2- The node waits for a random time (a backoff period) then go to step 1 - Fewer collisions: Random delays reduces probability of collisions because nodes with data will send at different times - Longer delay to transmit
Random Waiting times Wasted time

3 -126

- Bandwidth is wasted if waiting time is large because medium will remain idle following end of transmission even if only one node has frames to send 3) p-persistent CSMA (adjustable greedy): - When a node has data to send, it senses the medium: 1- If the medium is idle: the node sends with probability p. 2- Otherwise, wait one time slot (= maximum propagation delay) & re-sense with probability 1-p then go to step 1 - Reduces the possibility of collisions like nonpersistent and reduces channel idle time like 1-persistent

3 -127

CSMA/CD (CSMA with Collision Detection)


- In CSMA and ALOHA(slotted and pure), if a collision occurs, the channel is useless until colliding frames are fully sent - Comparing to CSMA, CSMA/CD does not reduce collision probability but aims to reduce channel waste when collision occurs, i.e., resolve collision as soon as possible. - Nodes performs collision detection while transmitting, if a collision is detected it aborts transmission and sends a jam signal to notify other nodes of collision so that they will abort the transmission. - After receiving the jam signal, all involved nodes backs off (wait) for a random time, then transmit the frame again - If a node does not detect collision during 2tprop of its transmission, it can guarantee that the transmission will succeed because every node will sense busy medium and 3 -128 thus they will not transmit

- Collision Detecting: if the sensed power is more than the transmitted power, it means collision occurs - Easy in wired LANs but difficult in wireless LANs why? 1- In wireless LANs: received signal strength is overwhelmed by the senders signal strength due to weak received signals 2- Can not detect collisions in case of hidden terminal. - We care about the collision at the receiver, sender cannot detect collision at receiver if there is transmission from hidden terminal because neighborhood of sender and receiver are not the same (its not a shared wire). The sender can not hear all transmissions received by receiver
Hidden terminal problem: A and C can each communicate with B, but are hidden from each other A cannot detect collision with C because it cannot hear its transmission 3 -129

CSMA/CD Minimum Frame Size


- Must detect a collision before finishing transmission - If A finishes transmission before receiving the signal of B it will not detect the collision - The transmission must continue at least 2*tprop - ttran: A frame transmission time = frame length/bit rate - ttran > 2 tprop = 2 cable length/signal speed, otherwise, CSMA/CD does not have an advantage over CSMA - The propagation delay determines the min. frame size to prevent undetected collisions restriction on cable length - Frame length > 2 cable length bit rate /signal speed Higher bit rate or Larger cable length length larger min. frame length larger min. frame

more dummy bits are sent

3 -130

CSMA/CD channel efficiency

- Efficiency: the long-run fraction of time during which frames are sent without collisions when there is a large number of active nodes, with each node having a large number of frames to send - Channel efficiency = ttran/(contention period + ttran) - Contention period = number of contention slots x time of one contention slot - Time of one contention slot = 2tprop
3 -131

- The probability that a node gets the channel is e-G see 3-119

- The max. probability that a node gets the channel is e-1 see 3-119 when G = PN = 1 - Average number of contention slots = e (geometric distribution) we try approximately e times before each successful transmission

Efficiency( ) =

1 1 + 5t ' prop / ttran

- Efficiency goes to 1 as tprop goes to 0 collisions are detected within short time and colliding transmissions aborted faster, reducing channel wastage - Efficiency goes to 1 as ttran goes to infinity - ttran = frame length/bit rate better efficiency as bit rate decrease or frame length increase - For the same efficiency, increasing bit rate frame length decreasing the
3 -132

The effect of a = tprop/ttran


S
0.53 0.45

1-Persistent CSMA

a = 0.01
0.16

a =0.1 a=1 G

- a has important impact on the throughput - When a approaches 1, CSMA is worse than ALOHAs, why? - At low value of G, a has little effect on S because collision probability is low 3 -133

Maximum Achievable Throughput


CSMA/CD 1-P CSMA Non-P CSMA

1 0.8

Smax

0.6

Slotted ALOHA
0.4

ALOHA
0.2 0 0.01 0.1 1

a = tprop/ttran

- For small a: CSMA-CD has best throughput - For larger a: Aloha & slotted Aloha better throughput
3 -134

Persistent and Nonpersistent CSMA


Can avoid collisions very well

Low due to impact of collisions

Comparison of the channel utilization versus load for various random access protocols.

3 -135

Random Access Protocols


Simple and easy to implement Decentralized (no central device that can fail and bring down the entire system) In low-traffic, packet transfer has low-delay However, limited throughput in heavier traffic, packet delay has no limit. In some cases, a station may never have a chance to transfer its packet. (unfair protocol) A node that has frames to be transmitted can transmit continuously at the full rate of channel (R) if it is the only node with frames If (M) nodes want to transmit, many collisions can occur and the rate for each node will not be on average R/M
3 -136

Outline
3.1 Introduction 3.2 Framing and Error Control 3.3 3.4 3.5 Flow Control and Retransmission Medium Access Control LAN

LANs
- Key idea: reduce number of links by sharing links among many computers reduces the cost - But ... attached computers compete for use of shared link - Often a shared medium when a computer transmits, other computers can receive the transmission - Key features of a LAN - High throughput - Relatively low cost - Limited to short distance - Most dominant technology is Ethernet.
3 -137

MAC (LAN, physical, or Ethernet) Addresses


- Each adapter on LAN has unique LAN address - 48 bits for most LANs

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

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

LAN (wired or wireless)


71-65-F7-2B-08-53 58-23-D7-FA-20-B0

= adapter

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

3 -138

Comparison of IP address and MAC Address


1: - IP address is hierarchically organized for routing scalability - MAC address is flat (not hierarchical) - Burned in NIC ROM, manufacturer buys portion of MAC address space (to assure uniqueness) (sometimes software settable) 2: - IP address needs to be globally unique - MAC address should be unique in the LAN - does not need to be globally unique, but the current assignment ensures uniqueness 3: - IP address depends on IP subnet to which a node is attached -- NOT portable must change when a node moves from the network

3 -139

- MAC address is assigned to a device portable it does not change when a card moves from one LAN to another

4: - IP address is used by network layer to get datagram to the destination IP subnet - MAC address is used by link layer to get frame from one node to another physically-connected node in the same network 5: - IP address is like postal address changes when you move also hierarchical (country city street ---) - MAC address like social insurance number related to a person the same address when you move

- Why separate IP and MAC addresses? - Assign adapters an IP address hardware only works for IP cannot be used for other protocols (no IPX, DECNET) - Use MAC address as network address aggregation No route
3 -140

ARP: Address Resolution Protocol


Question: how to determine MAC address of B knowing Bs IP address? ARP table resolves LAN address to IP - Each IP node (host, router) on LAN has ARP table - ARP table: IP/MAC address mappings for some LAN nodes one entry: < IP address; MAC address; TTL>
137.196.7.78 1A-2F-BB-76-09-AD 137.196.7.23 LAN 71-65-F7-2B-08-53 58-23-D7-FA-20-B0 137.196.7.14

- TTL (Time To Live): time after which address mapping will be forgotten (typically 20 min)

0C-C4-11-6F-E3-98 137.196.7.88
3 -141

- A wants to send a datagram to B, and Bs MAC address not in As ARP table. - To find the MAC address of B, A broadcasts ARP query packet, containing B's IP address - Destination MAC address = FF-FF-FF-FF-FF-FF - All machines on LAN will process ARP query - B receives ARP packet, replies to A with its (B's) MAC address. Frame is sent to As MAC address (unicast) - A stores IP-to-MAC address pair in its ARP table until the information becomes old TTL expires - ARP is plug-and-play: - Nodes create their ARP tables without intervention from net administrator
3 -142

Routing on a LAN
- Send directly to the destination if it is determined to be on the same LAN - Send to a default router otherwise - Either case, the host must know the MAC address of the destination or the default router - Given a nodes IP address, how can a host determine its MAC address? ARP table or ask a server. - Given a nodes IP address, how can a host determine if it is in the same network or different? Using the subnet mask as we will discuss next chapter - Does a sender need the destination MAC if it resides in a different network? No
3 -143

Routing to another LAN


Send datagram from A to B via R. - Focus on addressing - at both IP (datagram) and MAC layer (frame) - Assume A knows Bs IP address - Assume A knows MAC address of first hop router interface (R) - Assume R knows Bs MAC address - Router R has two ARP tables: one for each LAN.

A
111.111.111.111 74-29-9C-E8-FF-55

B R
222.222.222.222 49-BD-D2-C7-56-2A 222.222.222.220 1A-23-F9-CD-06-9B 111.111.111.112 CC-49-DE-D0-AB-7D 111.111.111.110 E6-E9-00-17-BB-4B 222.222.222.221 88-B2-2F-54-1A-0F

3 -144

- A creates IP datagram with IP source A, destination B - A creates link-layer frame with R's MAC address as destination, frame contains A-to-B IP datagram - As adaptor sends frame to R
MAC src: 74-29-9C-E8-FF-55 MAC dest: E6-E9-00-17-BB-4B IP src: 111.111.111.111 IP dest: 222.222.222.222

IP Eth Phy

A
111.111.111.111 74-29-9C-E8-FF-55

B R
222.222.222.222 49-BD-D2-C7-56-2A 222.222.222.220 1A-23-F9-CD-06-9B 111.111.111.112 CC-49-DE-D0-AB-7D 111.111.111.110 E6-E9-00-17-BB-4B 222.222.222.221 88-B2-2F-54-1A-0F

3 -145

- Rs adaptor receives the frame, extracts IP datagram from the frame and passes it up to IP layer - R sees that the destination is B that is in its LAN, uses ARP to get Bs MAC address, and creates a new frame containing A-to-B IP datagram with MAC destination address set to Bs.
MAC src: 1A-23-F9-CD-06-9B MAC dest: 49-BD-D2-C7-56-2A IP src: 111.111.111.111 IP dest: 222.222.222.222

IP Eth Phy

IP Eth Phy

A
111.111.111.111 74-29-9C-E8-FF-55

B R
222.222.222.222 49-BD-D2-C7-56-2A 222.222.222.220 1A-23-F9-CD-06-9B 111.111.111.112 CC-49-DE-D0-AB-7D 111.111.111.110 E6-E9-00-17-BB-4B 222.222.222.221 88-B2-2F-54-1A-0F

3 -146

- R forwards the frame to B - At B: the link layer can know that the frame is sent from R, and the network layer can know that the datagram was sent from A.
MAC src: 1A-23-F9-CD-06-9B MAC dest: 49-BD-D2-C7-56-2A IP src: 111.111.111.111 IP dest: 222.222.222.222

IP Eth Phy

A
111.111.111.111 74-29-9C-E8-FF-55

B R
222.222.222.222 49-BD-D2-C7-56-2A 222.222.222.220 1A-23-F9-CD-06-9B 111.111.111.112 CC-49-DE-D0-AB-7D 111.111.111.110 E6-E9-00-17-BB-4B 222.222.222.221 88-B2-2F-54-1A-0F

3 -147

LAN topology
- Bus topology popular through mid 90s - All nodes in same collision domain (can collide with each other) - Today: star topology prevails - Active switch in center (instead of hub) - Each node runs a (separate) Ethernet protocol (nodes transmissions do not collide with each other)
3 -148

Hubs (Multiport repeaters and bus in a box)


- Physical-layer devices - Repeaters operating at bit levels: repeat received bits on one interface to all other interfaces - No frame buffering - All nodes connected to a hub can collide with one another - No CSMA/CD at hub: host NICs detect collisions - Restrictions on max. number of nodes in a collision domain, max distance between two nodes. - Hubs can be arranged in a hierarchy (or multi-tier design), with backbone hub at its top
hub

twisted pair

3 -149

- Each connected LAN referred to as LAN segment - Cant connect different Ethernet types (e.g., 10BaseT & 100BaseT) because segments dont share the same rate. - Single collision domain: Hubs do not isolate collision domains a node may collide with any node residing at any segment in LAN - Hub advantages: simple, inexpensive, extend max distance between nodes, but all the segments become one large collision domain Backbone hub

10BaseT

10BaseT

10BaseT

156

Computer science

Electrical Engineering

System Engineering

3 -150

Switch
- Link layer device - Stores and forwards Ethernet frames different types of Ethernet can be connected since it is a store and forward device. - Examines incoming frame header and selectively forwards frame to one-or-more outgoing links based on MAC destination address - Uses CSMA/CD to forward a frame on a segment - Transparent: hosts are unaware of presence of switches no need for any change to hosts LAN adapters - Switch isolates collision domains since it buffers frames higher total max throughput comparing to hubs
3 -151

- Plug-and-play: self-learning configured

switches do not need to be

- Smarter than hubs, take active role - No limit on number of nodes or on geographical coverage - Hosts have dedicated and direct connection to switch - Switch allows multiple simultaneous transmissions, e.g., A-to-A and B-to-B, without collisions. Not possible with hub - How does switch know that A reachable via interface 4, B reachable via interface 5? Switch Table
3 -152

Switch Table
- Each switch has a switch table, each entry: <MAC address of host, interface to reach host, time stamp> - Stale entries in table dropped (TTL can be 60 min) - How are entries created and maintained in switch table? - Self-learning: Switch learns which hosts can be reached through which interfaces How? - When a frame is received, switch learns location of sender - Records sender/location pair in switch table - Frame destination location is unknown: flood - Destination location is known: selectively send on just one link 3 -153

Interconnecting switches
S4 S1 A B C S2 F D E G H I

S3

- Individual LAN restrictions pose limits on number of nodes in same collision domain and on geographical coverage - Switches can be connected together Q: sending from A to G: how does S1 know to forward frame destined to F via S4 and S3? A: self learning! (exactly the same as in single-switch case!)

3 -154

Traffic isolation
- Switch installation breaks subnet into LAN segments - Forwarding is selective: If destination on segment from which frame arrived then drop frame do not forward onto other LAN segments All connected segments can work independently in parallel - Segments become separate collision domains

3 -155

Interconnecting LANs
Q: Why not just one big LAN? Why we need to use switch - Limited amount of supportable traffic: on single LAN, all nodes must share bandwidth - Limited cable length: Ethernet specifies maximum cable length - Large collision domain (can collide with many nodes) - Limited number of nodes, e.g., token ring has token passing delays at each node

3 -156

Switches vs. routers


Both are store-and-forward:
applicatio - Routers: network-layer devices n (examine network-layer headers) datagram transport - Switches: link-layer devices frame network (examine link-layer headers) link

Both have forwarding tables: - Routers: compute tables using routing algorithms, IP addresses - Switches: learn forwarding table using flooding, learning, MAC addresses - Switches: Good in small networks (few hundred hosts) - Routers: Good in large networks (thousands of hosts)

physical switch

frame link physical

network datagram link frame physical applicatio n transport network link physical

3 -157

Institutional network
mail server router web server

to external network

IP subnet

3 -158

Ethernet
- dominant wired LAN technology - Cheap $20 for NIC - Bus or star - Uses CSMA/CD medium access control mechanism to detect and recover from a collision. - 10 Mbps 10 Gbps - Connectionless service: No handshaking between sending and receiving NICs - Unreliable service: receiving NIC doesnt send ACKs or NACKs to sending NIC - gaps can be filled using TCP - Ethernet Address: 6-bytes (48 bits) embedded into the Network Interface Card (NIC). Each Ethernet card has a globally unique address (IEEE and vendor assigned).

3 -159

Ethernet Frame Structure

- Preamble: 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 - used to denote start of frame - Source/destination addresses: 6 bytes (48 bit) Destination address all 1's for broadcast packet - Type of protocol data unit (PDU): 2 bytes - indicates higher layer protocol (IP, Novell IPX, AppleTalk, etc) - CRC: 4 bytes. Checked at receiver, if error is detected, frame is dropped
3 -160

- Data: contains datagram handed down from upper layer - max packet length is 1500 bytes - min. data length is 46 bytes - padding (dummy bits) is used to ensure data plus padding at least 46 bytes

How two nodes in an Ethernet network communicate? - The sender broadcasts Ethernet frame. The destination is specified in the frame using its Ethernet (MAC) address. - All the nodes in the network listen for an Ethernet frame with their Ethernet address in it. - Only the destination processes the frame and sends it to 3 -161 the higher layers for further processing.

Ethernet technologies
- Different Ethernet standards have different speeds (2 Mbps to 10G bps) and different physical layer media (fiber, cable) - 10Base2: bus topology, 10 Mbps, repeaters (amplifies and retransmits bits) used to connect up to multiple segments collision detection excess current no two nodes can be separated by more than 0.925 km (how many segments?) - 10BaseT: Star topology, 10Mbps. - 1000Base-FX: Gigabit Ethernet - 1Gbps over Fiber Optics

185
2 3 -162

Limitation on packet size and length (distance of hosts)


- The rule is: ttran > 2 * tprop ttran: frame transmission time, tprop: Max. propagation time 2 * tprop is the worst case collision detection time, i.e., to ensure that all collisions will be detected by sender - In Ethernet: the maximum round trip time (2 * tprop) is about 50 microsec all frame transmissions must take more than 50 microsec - With 10Mbps bandwidth, 1 bit time = 0.1 microsec minimum frame size at least 500 bits = (2 * tprop * bandwidth), choose 512 bits to add some margin of safety tprop = Max. cable length/signal speed As the bit rate goes up, the minimum frame length must go up or the maximum cable length must come down 1Gbps minimum frame size > 50,000 bits
3 -163

- The cots for higher bit rate - Increasing the minimum frame length because many dummy bits will be sent - Decreasing the maximum cable length - solution for 100BaseT is not good smaller network

- Why is the maximum cable length of a 10Mbps ethernet cable 10 times longer than the maximum cable length of a 100Mbps ethernet? The minimum frame length in Ethernet is independent of bit-rate. - Modern 10Mb Ethernet: 500m maximum segment length - can add repeaters up to a maximum 5 segments (2500m) tprop = 2500m/1.8 x 108 m/s ~ 12.5us one-way delay - add repeater and tranceiver delay 2 tprop = 51.2us
5-170

3 -164

Ethernet CSMA/CD algorithm


1. NIC receives datagram from network layer, creates an ethernet frame 2. If NIC senses channel idle, starts frame transmission. If NIC senses channel busy, waits until channel idle, then transmits. 3. If NIC transmits entire frame without detecting another transmission, NIC is done with frame. 4. While transmitting, the adapter monitors for the presence of signal energy from other adaptors. If NIC detects another transmission from other sources before completing its transmission while transmitting, it aborts and sends a 48 bit jam signal. After aborting, NIC backs off - waits a logarithmic time-out period (random time), then go to 2. 3 -165

- This process is repeated till the frame is transmitted successfully, for a maximum of 16 times. The frame is discarded after the 16th retry. - Ethernet uses the exponential backoff algorithm to determine the best duration of the random waiting period after the collision happens Exponential Backoff Algorithm - After experiencing Kth collision for a frame, NIC selects a random number R from {0, 1, , 2K-1} backoff period = R x min. frame transmission time (= 512 x 0.1 = 51.2 usec for Ethernet 10-Mbps LAN) After first collision (K=1): choose R from {0 ,1} After second collision: choose R from {0, 1, 2, 3} after ten collisions, choose R from {0, 1, 2, 3, 4,, 1023}
3 -166

Advantages of Exponential Backoff Algorithm: - Reduces the chance of two waiting nodes picking the same random waiting time to avoid repeated collisions (different hosts will have different values of R) - Backoff interval dynamically adjusts to load - When network traffic is light, it results in minimum waiting time before transmission small values of K - As traffic is high, collisions increase the waiting times are larger to reduce the probability of collision. larger K longer backoff interval

3 -167

PPP (Point-to-Point) Data Link Protocol


- The Internet uses PPP (Point-to-Point) as the primary data link protocol over point-to-point lines between routers. - One sender, one receiver, one link: easier than broadcast link: - No Medium Access Control - No need for explicit MAC addressing - Error detection (no correction/recovery)

- No flow control Error recovery, flow control, data re-ordering all delegated to higher layers!
3 -168

PPP Data Frame

1- Flag: delimiter (framing) - determine the end of one frame and the start of the next one. 2- Address: does nothing (only one option) 3- Control: does nothing; in the future possible multiple control fields 4- Protocol: upper layer protocol to which frame delivered (eg, PPP-LCP, IP, IPCP, etc) 5- Payload: upper layer data being carried, default maximum is 1500 bytes 6- Checksum: cyclic redundancy check for error detection
3 -169

IEEE 802.11 Wireless LAN


- Wireless host communicates with base station (= access point (AP)) - Basic Service Set (BSS) (aka cell): contains - Wireless hosts - Access point (AP)
BSS 1 AP hub, switch or router

Internet

- Hosts can communicate to AP if they are in its coverage area. - 802.11g: 2.4-5 GHz range - up to 54 Mbps - 802.11n (multiple antennae): 2.4-5 GHz range up to 200 Mbps

AP

BSS 2
3 -170

Wireless LAN: CSMA


Sender senses channel: - If channel is busy, backs off - If idle for DISF sec, then transmit entire frame Receiver - If received frame is OK return ACK after SIFS - ACK is needed due to collisions caused by hidden terminal problem

3 -171

- Collision detection is difficult in wireless networks, why? see slide 3-129. How to reduce collision due to hidden terminal?

Wireless LAN: CSMA/CA (collision avoidance)


- Sender transmits short RTS (request to send) frame: indicates duration of transmission NAV (Network Allocation Vector) - Receiver replies with short CTS (clear to send) packet to notify (possibly hidden) nodes - Hidden nodes will not transmit for specified duration - RTS and CTS need short duration collision is less likely end result similar to collision detection
3 -172

- Nodes hearing CTS should remain silent to not interfere with data frame - By this way, RTS and CTS are used to reserve the medium

Hidden terminal

3 -173

Questions

Mohamed M E A Mahmoud

Das könnte Ihnen auch gefallen