Upload
seif-eddin-alhawamdeh
View
399
Download
2
Embed Size (px)
Citation preview
5 DataLink Layer 5-1
Chapter 5Link Layer and LANs
Computer Networking A Top Down Approach Featuring the Internet 3rd edition Jim Kurose Keith RossAddison-Wesley July 2004
A note on the use of these ppt slidesWersquore making these slides freely available to all (faculty students readers) Theyrsquore in PowerPoint form so you can add modify and delete slides (including this one) and slide content to suit your needs They obviously represent a lot of work on our part In return for use we only ask the following
If you use these slides (eg in a class) in substantially unaltered form that you mention their source (after all wersquod like people to use our book)
If you post any slides in substantially unaltered form on a www site that you note that they are adapted from (or perhaps identical to) our slides and note our copyright of this material
Thanks and enjoy JFKKWR
All material copyright 1996-2004JF Kurose and KW Ross All Rights Reserved
5 DataLink Layer 5-2
Chapter 5 The Data Link LayerOur goals
understand principles behind data link layer serviceserror detection correction done (Data Communications)sharing a broadcast channel multiple accesslink layer addressingreliable data transfer flow control done
instantiation and implementation of various link layer technologies
5 DataLink Layer 5-3
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM and MPLS
5 DataLink Layer 5-4
Link Layer IntroductionSome terminology
hosts and routers are nodescommunication channels that connect adjacent nodes along communication path are links
wired linkswireless linksLANs
layer-2 packet is a frame thatencapsulates a datagram
ldquolinkrdquo
data-link layer has the responsibility of transferring a datagram from one node to an adjacent node over a link
5 DataLink Layer 5-5
Link layer context
Datagrams are transferred by different link-layer protocols over different links
eg Ethernet on first link frame relay on intermediate links 80211 on last link
Each link-layer protocol may provide different services from others
eg it may or may not provide rdt over the link
5 DataLink Layer 5-6
Link Layer ServicesFraming link access
encapsulate datagram into frame adding headertrailercoordinate channel access if the medium is sharedldquoMACrdquo (Medium Access Control) addresses are used in frame headers to identify the source and destination
bull different from IP addressReliable delivery between adjacent nodes
we learned how to do this already (chapter 3)seldom used on low bit error link (fiber some twisted pair)wireless links usually have high error rates
bull Q why both link-level and end-end reliabilityndash not all protocols provide itndash faster and more efficient if provided locally at a lower layerndash some errors may not be detected during transition (eg router buffer)
5 DataLink Layer 5-7
Link Layer Services (more)Flow Control
pacing between adjacent sending and receiving nodesnodes and each side of the link have limited buffering
Error Detectionerrors may be caused by signal attenuation or noise receiver detects presence of errors
bull signals the sender for retransmission or drops the frame
Error Correctionreceiver node may identify andor correct bit error(s) without resorting to retransmissionusually more sophisticated and hardware-based methods
Half-duplex and full-duplexwith half duplex nodes at both ends of link can transmit but not at same time
5 DataLink Layer 5-8
Adapters Communicating
link layer implemented in ldquoadapterrdquo (aka NIC)
Ethernet card PCMCI card 80211 card
sending sideencapsulates datagram in a frameadds error checking bits rdt flow control etc
receiving sidelooks for errors rdt flow control etcextracts datagram and passes to receiving node
adapter is semi-autonomousunder the control of the nodeshares housing power amp buses
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
physical link
5 DataLink Layer 5-9
Link Layer
51 Introduction and services52 Error detection and correction53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-10
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
5 DataLink Layer 5-11
Parity CheckingSingle Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
detects odd number of errorsefficient only if the bit error probability is low andor bit errors are independentbut in fact errors are dependent and occur in burstswith burst errors amp single parity bit the probability of undetected errors is ~50FEC (Forward Error Correction) can reduce the number of retransmissions with ARQ protocols
5 DataLink Layer 5-12
Internet checksum
Sendertreat segment contents as sequence of 16-bit integerschecksum addition (1rsquos complement sum) of segment contentssender puts checksum value into checksum field
Receivercompute checksum of received segmentcheck if computed checksum equals checksum field value
NO - error detectedYES - no error detected But maybe errors nonethelessMore later hellip
Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted segment (note used at transport layer only)
Checksum methods have little packet overhead However they provide relatively weak protection against errors
5 DataLink Layer 5-13
Checksumming Cyclic Redundancy Checkview data bits D as a binary numberchoose r+1 bit pattern (generator) Ggoal choose r CRC bits R such that
ltDRgt exactly divisible by G (in modulo 2 arithmetic or XOR) receiver knows G divides ltDRgt by G If non-zero remainder error is detectedcan detect all burst errors less than r+1 bits amp all odd number of errorslarger burst errors of length r can be detected with prob of 1-05^r
widely used in practice (eg ATM)
5 DataLink Layer 5-14
CRC ExampleWant
D2r XOR R = Gequivalently
D2r = G XOR R equivalently
if we divide D2r by G want remainder R
R = remainder[ ]D2r
GTransmit D2r XOR R = 10111011
5 DataLink Layer 5-15
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-16
Multiple Access Links and ProtocolsTwo types of ldquolinksrdquo
point-to-pointPPP (Point-to-Point Protocol) for dial-up accesspoint-to-point link between Ethernet switch and host
broadcast (shared wire or medium)traditional Ethernet80211 wireless LAN
5 DataLink Layer 5-17
Multiple Access protocolsconsider a single shared broadcast channel two or more simultaneous transmissions by nodes cause an interference which causes a packet collision
collision if a node receives two or more signals at the same timethe collision happens at all the nodes sharing the channelcollisions waste some of the broadcast channel bandwidth
multiple access protocoldistributed algorithm that determines how nodes can share a channel ie determine when nodes can transmitcommunication about the channel sharing must use the channel itself
no out-of-band channel for coordination
5 DataLink Layer 5-18
Ideal Multiple Access ProtocolBroadcast channel of rate R bps1 When only one node wants to transmit it
can send at rate R2 When M nodes want to transmit each can
send on average at rate RM3 Fully decentralized
no special node to coordinate transmissionsno synchronization of clocks or time-slots
4 Simple and cost-effective to implement
5 DataLink Layer 5-19
MAC Protocols a taxonomy
Three broad classesChannel Partitioning
divide the channel into smaller ldquopiecesrdquo such as time slots (eg TDMA) frequency bands (eg FDMA) codes (eg CDMA)allocate each piece to a node for exclusive use
Random Accessthe channel is not divided but shared allowing collisionsthere is a mechanism to ldquorecoverrdquo from collisions
ldquoTaking turnsrdquonodes take turns but nodes with more to send can take longer turns
5 DataLink Layer 5-20
Channel Partitioning MAC protocols TDMATDMA Time Division Multiple Access
access to channel in rounds each station gets fixed length slot (length = packet transmission time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
Two major drawbacks1 a node is limited to average BW of RN even if it is the only one 2 a node must always wait for its turn even if it is the only one
5 DataLink Layer 5-21
Channel Partitioning MAC protocols FDMAFDMA Frequency Division Multiple Access
the channel spectrum is divided into frequency bandseach station is assigned a fixed frequency bandunused transmission time in frequency bands go idlethe same limited BW drawback as the TDMAexample 6-station LAN 134 have pkt frequency bands 256 idle
freq
uenc
y ba
nds
time
5 DataLink Layer 5-22
Channel Partitioning MAC protocols CDMACDMA Code Division Multiple Access
each node is assigned a unique codeeach node uses its code to encode the data bits it sendsthe codes are orthogonal (ie different codes cancel or flatten each other at the receiver)all other signals behave as background noise to one anotherthe receiver node knows the code of the sender nodethe receiver decodes the intended signal using its sender codeall nodes can use the channel simultaneouslymay need a separate code for control signaling
drawbacks1 requires strict synchronization for codingdecoding2 fairly complex implementation
5 DataLink Layer 5-23
Random Access Protocolswhen a node has a packet to send
transmit at full channel data rate Rno a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquorandom access MAC protocol specifies
how to detect (or avoid) collisionshow to recover from collisions (eg via delayed retransmissions)
examples of random access MAC protocolsslotted ALOHApure (unslotted) ALOHACSMA CSMACD CSMACA
5 DataLink Layer 5-24
Slotted ALOHAAssumptions
all frames have the same sizetime is divided into equal size slots each equals the time to transmit 1 framenodes start to transmit frames only at the beginning of the slotsnodes are synchronizedif 2 or more nodes transmit within the same slot all nodes detect the collision
Operationwhen a node obtains a fresh frame it transmits in next slotif no collision occurs the node can send a new frame in the next slotif a collision occurs the node retransmits the frame in each subsequent slot with a probability p until success
5 DataLink Layer 5-25
Slotted ALOHA
Pros (advantages)a single active node can continuously transmit at the full rate of channelhighly decentralized only the slots in the nodes need to be in syncsimple
Cons (disadvantages)collisions wasting slotsidle slots due to random back offclock synchronization among nodes for the start of the slot
5 DataLink Layer 5-26
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in the slot with probability p
The probability that one node has success in a slot = p(1-p)N-1
The probability that any node has a success in a slot = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1 as N goes to infinity
max efficiency = 1e = 37
Efficiency in the long-run when there are many nodes each with many frames to send only a fraction of successful slots
At best a channel is used for useful transmissions only 37 of time
5 DataLink Layer 5-27
Pure (unslotted) ALOHAunslotted Aloha simpler as there is no synchronizationwhen a frame first arrives transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
5 DataLink Layer 5-28
Pure Aloha efficiencyP(success by given node) = P(node transmits)
P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]
= p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
hellip finding optimum p as N infinity
max efficiency = 1(2e) = 18
Even worse than slotted ALOHA
5 DataLink Layer 5-29
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmittingif the channel is sensed idle transmit the entire frameif the channel is sensed busy defer transmission
human analogy donrsquot interrupt others
can this prevents collisions
5 DataLink Layer 5-30
CSMA collisionscollisions can still occurdue to the propagation delay between nodes one node may not hear the otherrsquos transmission early enough
collisionthe entire packet transmission time is wasted (the nodes keep transmitting regardless)
spatial layout of nodes
notethe important role of distance amp propagation delay in determining collision probability
5 DataLink Layer 5-31
CSMACD (Collision Detection)CSMACD carrier sensing amp deferral as in CSMA
collisions are detected within a short timecolliding transmissions are aborted reducing the channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted and received signalsdifficult in wireless LANs receiver shut off while transmitting (hence WLAN uses collision avoidance)
human analogy the polite conversationalist
5 DataLink Layer 5-32
CSMACD collision detection
5 DataLink Layer 5-33
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high loadinefficient at low load there is delay in channel access and only 1N of the bandwidth is allocated even if there is only 1 active node
Random access MAC protocolsefficient at low load a single node can fully utilize the channelDecreasing efficiency at high load collision overhead
ldquotaking turnsrdquo protocolslook for the best of both worlds
5 DataLink Layer 5-34
ldquoTaking Turnsrdquo MAC protocolsPolling
a master node ldquoinvitesrdquo slave nodes to transmit in turnconcerns
polling overhead latencysingle point of failure (the master)
Token passinga control token is passed from one node to the next sequentiallydecentralized and efficient concerns
token overhead latencysingle point of failure
bull token not passedbull failure of one node can break
the channel
5 DataLink Layer 5-35
Summary of MAC protocolsWhat do you do with a shared medium
Channel Partitioning by time frequency or codebull Time Division Frequency Division Code Division
Random Partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard
in others (wireless)bull CSMACD used in IEEE 8023 Ethernetbull CSMACA used in IEEE 80211 WLAN
Taking Turnsbull polling from a central nodebull token passingbull Token Ring used in IEEE 8025
5 DataLink Layer 5-36
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-37
MAC Addresses and ARPIP address
network-layer address32128-bit logical address assigned to an interfaceused to get the datagram to the destination IP subnethierarchical structure
MAC (or LAN or physical or Ethernet) addresslink-layer addressunique 48-bit physical address burned in the adapterrsquos ROMused to get the frame from one to another physically-connected interfaces (within the same network)flat structure
5 DataLink Layer 5-38
LAN Addresses and ARPEach adapter on the LAN has a unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
5 DataLink Layer 5-39
LAN Address (more)MAC address allocation is administered by IEEEmanufacturer buys portion of MAC address space (16 million block) in order to assure uniquenessAnalogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC is a flat address insures portability can move the same adapter from one LAN to another
IP hierarchical address is NOT portabledepends on the IP subnet to which node is attached to
5 DataLink Layer 5-40
ARP Address Resolution ProtocolARP protocol provides IP-to-MAC translation mechanism ARP is similar to DNS except that it is used within the same subnetEach IP node (Host Router) on the LAN has an ARP tableARP Table IPMAC address mappings for someLAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time after which address mapping will be removed (typically 20 min)
Question how to determine MAC address of B knowing Brsquos IP address
Possible ARP table in node 222222222220
5 DataLink Layer 5-41
ARP protocol Same LAN (network)A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP tableA broadcasts ARP query packet containing Bs IP address
Dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP query
B receives the ARP query replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address is a standard or unicast frame
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 ldquoplug-and-playrdquonodes create their ARP tables without intervention from net administrator
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-2
Chapter 5 The Data Link LayerOur goals
understand principles behind data link layer serviceserror detection correction done (Data Communications)sharing a broadcast channel multiple accesslink layer addressingreliable data transfer flow control done
instantiation and implementation of various link layer technologies
5 DataLink Layer 5-3
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM and MPLS
5 DataLink Layer 5-4
Link Layer IntroductionSome terminology
hosts and routers are nodescommunication channels that connect adjacent nodes along communication path are links
wired linkswireless linksLANs
layer-2 packet is a frame thatencapsulates a datagram
ldquolinkrdquo
data-link layer has the responsibility of transferring a datagram from one node to an adjacent node over a link
5 DataLink Layer 5-5
Link layer context
Datagrams are transferred by different link-layer protocols over different links
eg Ethernet on first link frame relay on intermediate links 80211 on last link
Each link-layer protocol may provide different services from others
eg it may or may not provide rdt over the link
5 DataLink Layer 5-6
Link Layer ServicesFraming link access
encapsulate datagram into frame adding headertrailercoordinate channel access if the medium is sharedldquoMACrdquo (Medium Access Control) addresses are used in frame headers to identify the source and destination
bull different from IP addressReliable delivery between adjacent nodes
we learned how to do this already (chapter 3)seldom used on low bit error link (fiber some twisted pair)wireless links usually have high error rates
bull Q why both link-level and end-end reliabilityndash not all protocols provide itndash faster and more efficient if provided locally at a lower layerndash some errors may not be detected during transition (eg router buffer)
5 DataLink Layer 5-7
Link Layer Services (more)Flow Control
pacing between adjacent sending and receiving nodesnodes and each side of the link have limited buffering
Error Detectionerrors may be caused by signal attenuation or noise receiver detects presence of errors
bull signals the sender for retransmission or drops the frame
Error Correctionreceiver node may identify andor correct bit error(s) without resorting to retransmissionusually more sophisticated and hardware-based methods
Half-duplex and full-duplexwith half duplex nodes at both ends of link can transmit but not at same time
5 DataLink Layer 5-8
Adapters Communicating
link layer implemented in ldquoadapterrdquo (aka NIC)
Ethernet card PCMCI card 80211 card
sending sideencapsulates datagram in a frameadds error checking bits rdt flow control etc
receiving sidelooks for errors rdt flow control etcextracts datagram and passes to receiving node
adapter is semi-autonomousunder the control of the nodeshares housing power amp buses
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
physical link
5 DataLink Layer 5-9
Link Layer
51 Introduction and services52 Error detection and correction53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-10
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
5 DataLink Layer 5-11
Parity CheckingSingle Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
detects odd number of errorsefficient only if the bit error probability is low andor bit errors are independentbut in fact errors are dependent and occur in burstswith burst errors amp single parity bit the probability of undetected errors is ~50FEC (Forward Error Correction) can reduce the number of retransmissions with ARQ protocols
5 DataLink Layer 5-12
Internet checksum
Sendertreat segment contents as sequence of 16-bit integerschecksum addition (1rsquos complement sum) of segment contentssender puts checksum value into checksum field
Receivercompute checksum of received segmentcheck if computed checksum equals checksum field value
NO - error detectedYES - no error detected But maybe errors nonethelessMore later hellip
Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted segment (note used at transport layer only)
Checksum methods have little packet overhead However they provide relatively weak protection against errors
5 DataLink Layer 5-13
Checksumming Cyclic Redundancy Checkview data bits D as a binary numberchoose r+1 bit pattern (generator) Ggoal choose r CRC bits R such that
ltDRgt exactly divisible by G (in modulo 2 arithmetic or XOR) receiver knows G divides ltDRgt by G If non-zero remainder error is detectedcan detect all burst errors less than r+1 bits amp all odd number of errorslarger burst errors of length r can be detected with prob of 1-05^r
widely used in practice (eg ATM)
5 DataLink Layer 5-14
CRC ExampleWant
D2r XOR R = Gequivalently
D2r = G XOR R equivalently
if we divide D2r by G want remainder R
R = remainder[ ]D2r
GTransmit D2r XOR R = 10111011
5 DataLink Layer 5-15
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-16
Multiple Access Links and ProtocolsTwo types of ldquolinksrdquo
point-to-pointPPP (Point-to-Point Protocol) for dial-up accesspoint-to-point link between Ethernet switch and host
broadcast (shared wire or medium)traditional Ethernet80211 wireless LAN
5 DataLink Layer 5-17
Multiple Access protocolsconsider a single shared broadcast channel two or more simultaneous transmissions by nodes cause an interference which causes a packet collision
collision if a node receives two or more signals at the same timethe collision happens at all the nodes sharing the channelcollisions waste some of the broadcast channel bandwidth
multiple access protocoldistributed algorithm that determines how nodes can share a channel ie determine when nodes can transmitcommunication about the channel sharing must use the channel itself
no out-of-band channel for coordination
5 DataLink Layer 5-18
Ideal Multiple Access ProtocolBroadcast channel of rate R bps1 When only one node wants to transmit it
can send at rate R2 When M nodes want to transmit each can
send on average at rate RM3 Fully decentralized
no special node to coordinate transmissionsno synchronization of clocks or time-slots
4 Simple and cost-effective to implement
5 DataLink Layer 5-19
MAC Protocols a taxonomy
Three broad classesChannel Partitioning
divide the channel into smaller ldquopiecesrdquo such as time slots (eg TDMA) frequency bands (eg FDMA) codes (eg CDMA)allocate each piece to a node for exclusive use
Random Accessthe channel is not divided but shared allowing collisionsthere is a mechanism to ldquorecoverrdquo from collisions
ldquoTaking turnsrdquonodes take turns but nodes with more to send can take longer turns
5 DataLink Layer 5-20
Channel Partitioning MAC protocols TDMATDMA Time Division Multiple Access
access to channel in rounds each station gets fixed length slot (length = packet transmission time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
Two major drawbacks1 a node is limited to average BW of RN even if it is the only one 2 a node must always wait for its turn even if it is the only one
5 DataLink Layer 5-21
Channel Partitioning MAC protocols FDMAFDMA Frequency Division Multiple Access
the channel spectrum is divided into frequency bandseach station is assigned a fixed frequency bandunused transmission time in frequency bands go idlethe same limited BW drawback as the TDMAexample 6-station LAN 134 have pkt frequency bands 256 idle
freq
uenc
y ba
nds
time
5 DataLink Layer 5-22
Channel Partitioning MAC protocols CDMACDMA Code Division Multiple Access
each node is assigned a unique codeeach node uses its code to encode the data bits it sendsthe codes are orthogonal (ie different codes cancel or flatten each other at the receiver)all other signals behave as background noise to one anotherthe receiver node knows the code of the sender nodethe receiver decodes the intended signal using its sender codeall nodes can use the channel simultaneouslymay need a separate code for control signaling
drawbacks1 requires strict synchronization for codingdecoding2 fairly complex implementation
5 DataLink Layer 5-23
Random Access Protocolswhen a node has a packet to send
transmit at full channel data rate Rno a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquorandom access MAC protocol specifies
how to detect (or avoid) collisionshow to recover from collisions (eg via delayed retransmissions)
examples of random access MAC protocolsslotted ALOHApure (unslotted) ALOHACSMA CSMACD CSMACA
5 DataLink Layer 5-24
Slotted ALOHAAssumptions
all frames have the same sizetime is divided into equal size slots each equals the time to transmit 1 framenodes start to transmit frames only at the beginning of the slotsnodes are synchronizedif 2 or more nodes transmit within the same slot all nodes detect the collision
Operationwhen a node obtains a fresh frame it transmits in next slotif no collision occurs the node can send a new frame in the next slotif a collision occurs the node retransmits the frame in each subsequent slot with a probability p until success
5 DataLink Layer 5-25
Slotted ALOHA
Pros (advantages)a single active node can continuously transmit at the full rate of channelhighly decentralized only the slots in the nodes need to be in syncsimple
Cons (disadvantages)collisions wasting slotsidle slots due to random back offclock synchronization among nodes for the start of the slot
5 DataLink Layer 5-26
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in the slot with probability p
The probability that one node has success in a slot = p(1-p)N-1
The probability that any node has a success in a slot = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1 as N goes to infinity
max efficiency = 1e = 37
Efficiency in the long-run when there are many nodes each with many frames to send only a fraction of successful slots
At best a channel is used for useful transmissions only 37 of time
5 DataLink Layer 5-27
Pure (unslotted) ALOHAunslotted Aloha simpler as there is no synchronizationwhen a frame first arrives transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
5 DataLink Layer 5-28
Pure Aloha efficiencyP(success by given node) = P(node transmits)
P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]
= p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
hellip finding optimum p as N infinity
max efficiency = 1(2e) = 18
Even worse than slotted ALOHA
5 DataLink Layer 5-29
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmittingif the channel is sensed idle transmit the entire frameif the channel is sensed busy defer transmission
human analogy donrsquot interrupt others
can this prevents collisions
5 DataLink Layer 5-30
CSMA collisionscollisions can still occurdue to the propagation delay between nodes one node may not hear the otherrsquos transmission early enough
collisionthe entire packet transmission time is wasted (the nodes keep transmitting regardless)
spatial layout of nodes
notethe important role of distance amp propagation delay in determining collision probability
5 DataLink Layer 5-31
CSMACD (Collision Detection)CSMACD carrier sensing amp deferral as in CSMA
collisions are detected within a short timecolliding transmissions are aborted reducing the channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted and received signalsdifficult in wireless LANs receiver shut off while transmitting (hence WLAN uses collision avoidance)
human analogy the polite conversationalist
5 DataLink Layer 5-32
CSMACD collision detection
5 DataLink Layer 5-33
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high loadinefficient at low load there is delay in channel access and only 1N of the bandwidth is allocated even if there is only 1 active node
Random access MAC protocolsefficient at low load a single node can fully utilize the channelDecreasing efficiency at high load collision overhead
ldquotaking turnsrdquo protocolslook for the best of both worlds
5 DataLink Layer 5-34
ldquoTaking Turnsrdquo MAC protocolsPolling
a master node ldquoinvitesrdquo slave nodes to transmit in turnconcerns
polling overhead latencysingle point of failure (the master)
Token passinga control token is passed from one node to the next sequentiallydecentralized and efficient concerns
token overhead latencysingle point of failure
bull token not passedbull failure of one node can break
the channel
5 DataLink Layer 5-35
Summary of MAC protocolsWhat do you do with a shared medium
Channel Partitioning by time frequency or codebull Time Division Frequency Division Code Division
Random Partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard
in others (wireless)bull CSMACD used in IEEE 8023 Ethernetbull CSMACA used in IEEE 80211 WLAN
Taking Turnsbull polling from a central nodebull token passingbull Token Ring used in IEEE 8025
5 DataLink Layer 5-36
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-37
MAC Addresses and ARPIP address
network-layer address32128-bit logical address assigned to an interfaceused to get the datagram to the destination IP subnethierarchical structure
MAC (or LAN or physical or Ethernet) addresslink-layer addressunique 48-bit physical address burned in the adapterrsquos ROMused to get the frame from one to another physically-connected interfaces (within the same network)flat structure
5 DataLink Layer 5-38
LAN Addresses and ARPEach adapter on the LAN has a unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
5 DataLink Layer 5-39
LAN Address (more)MAC address allocation is administered by IEEEmanufacturer buys portion of MAC address space (16 million block) in order to assure uniquenessAnalogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC is a flat address insures portability can move the same adapter from one LAN to another
IP hierarchical address is NOT portabledepends on the IP subnet to which node is attached to
5 DataLink Layer 5-40
ARP Address Resolution ProtocolARP protocol provides IP-to-MAC translation mechanism ARP is similar to DNS except that it is used within the same subnetEach IP node (Host Router) on the LAN has an ARP tableARP Table IPMAC address mappings for someLAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time after which address mapping will be removed (typically 20 min)
Question how to determine MAC address of B knowing Brsquos IP address
Possible ARP table in node 222222222220
5 DataLink Layer 5-41
ARP protocol Same LAN (network)A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP tableA broadcasts ARP query packet containing Bs IP address
Dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP query
B receives the ARP query replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address is a standard or unicast frame
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 ldquoplug-and-playrdquonodes create their ARP tables without intervention from net administrator
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-3
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM and MPLS
5 DataLink Layer 5-4
Link Layer IntroductionSome terminology
hosts and routers are nodescommunication channels that connect adjacent nodes along communication path are links
wired linkswireless linksLANs
layer-2 packet is a frame thatencapsulates a datagram
ldquolinkrdquo
data-link layer has the responsibility of transferring a datagram from one node to an adjacent node over a link
5 DataLink Layer 5-5
Link layer context
Datagrams are transferred by different link-layer protocols over different links
eg Ethernet on first link frame relay on intermediate links 80211 on last link
Each link-layer protocol may provide different services from others
eg it may or may not provide rdt over the link
5 DataLink Layer 5-6
Link Layer ServicesFraming link access
encapsulate datagram into frame adding headertrailercoordinate channel access if the medium is sharedldquoMACrdquo (Medium Access Control) addresses are used in frame headers to identify the source and destination
bull different from IP addressReliable delivery between adjacent nodes
we learned how to do this already (chapter 3)seldom used on low bit error link (fiber some twisted pair)wireless links usually have high error rates
bull Q why both link-level and end-end reliabilityndash not all protocols provide itndash faster and more efficient if provided locally at a lower layerndash some errors may not be detected during transition (eg router buffer)
5 DataLink Layer 5-7
Link Layer Services (more)Flow Control
pacing between adjacent sending and receiving nodesnodes and each side of the link have limited buffering
Error Detectionerrors may be caused by signal attenuation or noise receiver detects presence of errors
bull signals the sender for retransmission or drops the frame
Error Correctionreceiver node may identify andor correct bit error(s) without resorting to retransmissionusually more sophisticated and hardware-based methods
Half-duplex and full-duplexwith half duplex nodes at both ends of link can transmit but not at same time
5 DataLink Layer 5-8
Adapters Communicating
link layer implemented in ldquoadapterrdquo (aka NIC)
Ethernet card PCMCI card 80211 card
sending sideencapsulates datagram in a frameadds error checking bits rdt flow control etc
receiving sidelooks for errors rdt flow control etcextracts datagram and passes to receiving node
adapter is semi-autonomousunder the control of the nodeshares housing power amp buses
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
physical link
5 DataLink Layer 5-9
Link Layer
51 Introduction and services52 Error detection and correction53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-10
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
5 DataLink Layer 5-11
Parity CheckingSingle Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
detects odd number of errorsefficient only if the bit error probability is low andor bit errors are independentbut in fact errors are dependent and occur in burstswith burst errors amp single parity bit the probability of undetected errors is ~50FEC (Forward Error Correction) can reduce the number of retransmissions with ARQ protocols
5 DataLink Layer 5-12
Internet checksum
Sendertreat segment contents as sequence of 16-bit integerschecksum addition (1rsquos complement sum) of segment contentssender puts checksum value into checksum field
Receivercompute checksum of received segmentcheck if computed checksum equals checksum field value
NO - error detectedYES - no error detected But maybe errors nonethelessMore later hellip
Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted segment (note used at transport layer only)
Checksum methods have little packet overhead However they provide relatively weak protection against errors
5 DataLink Layer 5-13
Checksumming Cyclic Redundancy Checkview data bits D as a binary numberchoose r+1 bit pattern (generator) Ggoal choose r CRC bits R such that
ltDRgt exactly divisible by G (in modulo 2 arithmetic or XOR) receiver knows G divides ltDRgt by G If non-zero remainder error is detectedcan detect all burst errors less than r+1 bits amp all odd number of errorslarger burst errors of length r can be detected with prob of 1-05^r
widely used in practice (eg ATM)
5 DataLink Layer 5-14
CRC ExampleWant
D2r XOR R = Gequivalently
D2r = G XOR R equivalently
if we divide D2r by G want remainder R
R = remainder[ ]D2r
GTransmit D2r XOR R = 10111011
5 DataLink Layer 5-15
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-16
Multiple Access Links and ProtocolsTwo types of ldquolinksrdquo
point-to-pointPPP (Point-to-Point Protocol) for dial-up accesspoint-to-point link between Ethernet switch and host
broadcast (shared wire or medium)traditional Ethernet80211 wireless LAN
5 DataLink Layer 5-17
Multiple Access protocolsconsider a single shared broadcast channel two or more simultaneous transmissions by nodes cause an interference which causes a packet collision
collision if a node receives two or more signals at the same timethe collision happens at all the nodes sharing the channelcollisions waste some of the broadcast channel bandwidth
multiple access protocoldistributed algorithm that determines how nodes can share a channel ie determine when nodes can transmitcommunication about the channel sharing must use the channel itself
no out-of-band channel for coordination
5 DataLink Layer 5-18
Ideal Multiple Access ProtocolBroadcast channel of rate R bps1 When only one node wants to transmit it
can send at rate R2 When M nodes want to transmit each can
send on average at rate RM3 Fully decentralized
no special node to coordinate transmissionsno synchronization of clocks or time-slots
4 Simple and cost-effective to implement
5 DataLink Layer 5-19
MAC Protocols a taxonomy
Three broad classesChannel Partitioning
divide the channel into smaller ldquopiecesrdquo such as time slots (eg TDMA) frequency bands (eg FDMA) codes (eg CDMA)allocate each piece to a node for exclusive use
Random Accessthe channel is not divided but shared allowing collisionsthere is a mechanism to ldquorecoverrdquo from collisions
ldquoTaking turnsrdquonodes take turns but nodes with more to send can take longer turns
5 DataLink Layer 5-20
Channel Partitioning MAC protocols TDMATDMA Time Division Multiple Access
access to channel in rounds each station gets fixed length slot (length = packet transmission time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
Two major drawbacks1 a node is limited to average BW of RN even if it is the only one 2 a node must always wait for its turn even if it is the only one
5 DataLink Layer 5-21
Channel Partitioning MAC protocols FDMAFDMA Frequency Division Multiple Access
the channel spectrum is divided into frequency bandseach station is assigned a fixed frequency bandunused transmission time in frequency bands go idlethe same limited BW drawback as the TDMAexample 6-station LAN 134 have pkt frequency bands 256 idle
freq
uenc
y ba
nds
time
5 DataLink Layer 5-22
Channel Partitioning MAC protocols CDMACDMA Code Division Multiple Access
each node is assigned a unique codeeach node uses its code to encode the data bits it sendsthe codes are orthogonal (ie different codes cancel or flatten each other at the receiver)all other signals behave as background noise to one anotherthe receiver node knows the code of the sender nodethe receiver decodes the intended signal using its sender codeall nodes can use the channel simultaneouslymay need a separate code for control signaling
drawbacks1 requires strict synchronization for codingdecoding2 fairly complex implementation
5 DataLink Layer 5-23
Random Access Protocolswhen a node has a packet to send
transmit at full channel data rate Rno a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquorandom access MAC protocol specifies
how to detect (or avoid) collisionshow to recover from collisions (eg via delayed retransmissions)
examples of random access MAC protocolsslotted ALOHApure (unslotted) ALOHACSMA CSMACD CSMACA
5 DataLink Layer 5-24
Slotted ALOHAAssumptions
all frames have the same sizetime is divided into equal size slots each equals the time to transmit 1 framenodes start to transmit frames only at the beginning of the slotsnodes are synchronizedif 2 or more nodes transmit within the same slot all nodes detect the collision
Operationwhen a node obtains a fresh frame it transmits in next slotif no collision occurs the node can send a new frame in the next slotif a collision occurs the node retransmits the frame in each subsequent slot with a probability p until success
5 DataLink Layer 5-25
Slotted ALOHA
Pros (advantages)a single active node can continuously transmit at the full rate of channelhighly decentralized only the slots in the nodes need to be in syncsimple
Cons (disadvantages)collisions wasting slotsidle slots due to random back offclock synchronization among nodes for the start of the slot
5 DataLink Layer 5-26
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in the slot with probability p
The probability that one node has success in a slot = p(1-p)N-1
The probability that any node has a success in a slot = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1 as N goes to infinity
max efficiency = 1e = 37
Efficiency in the long-run when there are many nodes each with many frames to send only a fraction of successful slots
At best a channel is used for useful transmissions only 37 of time
5 DataLink Layer 5-27
Pure (unslotted) ALOHAunslotted Aloha simpler as there is no synchronizationwhen a frame first arrives transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
5 DataLink Layer 5-28
Pure Aloha efficiencyP(success by given node) = P(node transmits)
P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]
= p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
hellip finding optimum p as N infinity
max efficiency = 1(2e) = 18
Even worse than slotted ALOHA
5 DataLink Layer 5-29
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmittingif the channel is sensed idle transmit the entire frameif the channel is sensed busy defer transmission
human analogy donrsquot interrupt others
can this prevents collisions
5 DataLink Layer 5-30
CSMA collisionscollisions can still occurdue to the propagation delay between nodes one node may not hear the otherrsquos transmission early enough
collisionthe entire packet transmission time is wasted (the nodes keep transmitting regardless)
spatial layout of nodes
notethe important role of distance amp propagation delay in determining collision probability
5 DataLink Layer 5-31
CSMACD (Collision Detection)CSMACD carrier sensing amp deferral as in CSMA
collisions are detected within a short timecolliding transmissions are aborted reducing the channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted and received signalsdifficult in wireless LANs receiver shut off while transmitting (hence WLAN uses collision avoidance)
human analogy the polite conversationalist
5 DataLink Layer 5-32
CSMACD collision detection
5 DataLink Layer 5-33
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high loadinefficient at low load there is delay in channel access and only 1N of the bandwidth is allocated even if there is only 1 active node
Random access MAC protocolsefficient at low load a single node can fully utilize the channelDecreasing efficiency at high load collision overhead
ldquotaking turnsrdquo protocolslook for the best of both worlds
5 DataLink Layer 5-34
ldquoTaking Turnsrdquo MAC protocolsPolling
a master node ldquoinvitesrdquo slave nodes to transmit in turnconcerns
polling overhead latencysingle point of failure (the master)
Token passinga control token is passed from one node to the next sequentiallydecentralized and efficient concerns
token overhead latencysingle point of failure
bull token not passedbull failure of one node can break
the channel
5 DataLink Layer 5-35
Summary of MAC protocolsWhat do you do with a shared medium
Channel Partitioning by time frequency or codebull Time Division Frequency Division Code Division
Random Partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard
in others (wireless)bull CSMACD used in IEEE 8023 Ethernetbull CSMACA used in IEEE 80211 WLAN
Taking Turnsbull polling from a central nodebull token passingbull Token Ring used in IEEE 8025
5 DataLink Layer 5-36
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-37
MAC Addresses and ARPIP address
network-layer address32128-bit logical address assigned to an interfaceused to get the datagram to the destination IP subnethierarchical structure
MAC (or LAN or physical or Ethernet) addresslink-layer addressunique 48-bit physical address burned in the adapterrsquos ROMused to get the frame from one to another physically-connected interfaces (within the same network)flat structure
5 DataLink Layer 5-38
LAN Addresses and ARPEach adapter on the LAN has a unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
5 DataLink Layer 5-39
LAN Address (more)MAC address allocation is administered by IEEEmanufacturer buys portion of MAC address space (16 million block) in order to assure uniquenessAnalogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC is a flat address insures portability can move the same adapter from one LAN to another
IP hierarchical address is NOT portabledepends on the IP subnet to which node is attached to
5 DataLink Layer 5-40
ARP Address Resolution ProtocolARP protocol provides IP-to-MAC translation mechanism ARP is similar to DNS except that it is used within the same subnetEach IP node (Host Router) on the LAN has an ARP tableARP Table IPMAC address mappings for someLAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time after which address mapping will be removed (typically 20 min)
Question how to determine MAC address of B knowing Brsquos IP address
Possible ARP table in node 222222222220
5 DataLink Layer 5-41
ARP protocol Same LAN (network)A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP tableA broadcasts ARP query packet containing Bs IP address
Dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP query
B receives the ARP query replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address is a standard or unicast frame
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 ldquoplug-and-playrdquonodes create their ARP tables without intervention from net administrator
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-4
Link Layer IntroductionSome terminology
hosts and routers are nodescommunication channels that connect adjacent nodes along communication path are links
wired linkswireless linksLANs
layer-2 packet is a frame thatencapsulates a datagram
ldquolinkrdquo
data-link layer has the responsibility of transferring a datagram from one node to an adjacent node over a link
5 DataLink Layer 5-5
Link layer context
Datagrams are transferred by different link-layer protocols over different links
eg Ethernet on first link frame relay on intermediate links 80211 on last link
Each link-layer protocol may provide different services from others
eg it may or may not provide rdt over the link
5 DataLink Layer 5-6
Link Layer ServicesFraming link access
encapsulate datagram into frame adding headertrailercoordinate channel access if the medium is sharedldquoMACrdquo (Medium Access Control) addresses are used in frame headers to identify the source and destination
bull different from IP addressReliable delivery between adjacent nodes
we learned how to do this already (chapter 3)seldom used on low bit error link (fiber some twisted pair)wireless links usually have high error rates
bull Q why both link-level and end-end reliabilityndash not all protocols provide itndash faster and more efficient if provided locally at a lower layerndash some errors may not be detected during transition (eg router buffer)
5 DataLink Layer 5-7
Link Layer Services (more)Flow Control
pacing between adjacent sending and receiving nodesnodes and each side of the link have limited buffering
Error Detectionerrors may be caused by signal attenuation or noise receiver detects presence of errors
bull signals the sender for retransmission or drops the frame
Error Correctionreceiver node may identify andor correct bit error(s) without resorting to retransmissionusually more sophisticated and hardware-based methods
Half-duplex and full-duplexwith half duplex nodes at both ends of link can transmit but not at same time
5 DataLink Layer 5-8
Adapters Communicating
link layer implemented in ldquoadapterrdquo (aka NIC)
Ethernet card PCMCI card 80211 card
sending sideencapsulates datagram in a frameadds error checking bits rdt flow control etc
receiving sidelooks for errors rdt flow control etcextracts datagram and passes to receiving node
adapter is semi-autonomousunder the control of the nodeshares housing power amp buses
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
physical link
5 DataLink Layer 5-9
Link Layer
51 Introduction and services52 Error detection and correction53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-10
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
5 DataLink Layer 5-11
Parity CheckingSingle Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
detects odd number of errorsefficient only if the bit error probability is low andor bit errors are independentbut in fact errors are dependent and occur in burstswith burst errors amp single parity bit the probability of undetected errors is ~50FEC (Forward Error Correction) can reduce the number of retransmissions with ARQ protocols
5 DataLink Layer 5-12
Internet checksum
Sendertreat segment contents as sequence of 16-bit integerschecksum addition (1rsquos complement sum) of segment contentssender puts checksum value into checksum field
Receivercompute checksum of received segmentcheck if computed checksum equals checksum field value
NO - error detectedYES - no error detected But maybe errors nonethelessMore later hellip
Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted segment (note used at transport layer only)
Checksum methods have little packet overhead However they provide relatively weak protection against errors
5 DataLink Layer 5-13
Checksumming Cyclic Redundancy Checkview data bits D as a binary numberchoose r+1 bit pattern (generator) Ggoal choose r CRC bits R such that
ltDRgt exactly divisible by G (in modulo 2 arithmetic or XOR) receiver knows G divides ltDRgt by G If non-zero remainder error is detectedcan detect all burst errors less than r+1 bits amp all odd number of errorslarger burst errors of length r can be detected with prob of 1-05^r
widely used in practice (eg ATM)
5 DataLink Layer 5-14
CRC ExampleWant
D2r XOR R = Gequivalently
D2r = G XOR R equivalently
if we divide D2r by G want remainder R
R = remainder[ ]D2r
GTransmit D2r XOR R = 10111011
5 DataLink Layer 5-15
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-16
Multiple Access Links and ProtocolsTwo types of ldquolinksrdquo
point-to-pointPPP (Point-to-Point Protocol) for dial-up accesspoint-to-point link between Ethernet switch and host
broadcast (shared wire or medium)traditional Ethernet80211 wireless LAN
5 DataLink Layer 5-17
Multiple Access protocolsconsider a single shared broadcast channel two or more simultaneous transmissions by nodes cause an interference which causes a packet collision
collision if a node receives two or more signals at the same timethe collision happens at all the nodes sharing the channelcollisions waste some of the broadcast channel bandwidth
multiple access protocoldistributed algorithm that determines how nodes can share a channel ie determine when nodes can transmitcommunication about the channel sharing must use the channel itself
no out-of-band channel for coordination
5 DataLink Layer 5-18
Ideal Multiple Access ProtocolBroadcast channel of rate R bps1 When only one node wants to transmit it
can send at rate R2 When M nodes want to transmit each can
send on average at rate RM3 Fully decentralized
no special node to coordinate transmissionsno synchronization of clocks or time-slots
4 Simple and cost-effective to implement
5 DataLink Layer 5-19
MAC Protocols a taxonomy
Three broad classesChannel Partitioning
divide the channel into smaller ldquopiecesrdquo such as time slots (eg TDMA) frequency bands (eg FDMA) codes (eg CDMA)allocate each piece to a node for exclusive use
Random Accessthe channel is not divided but shared allowing collisionsthere is a mechanism to ldquorecoverrdquo from collisions
ldquoTaking turnsrdquonodes take turns but nodes with more to send can take longer turns
5 DataLink Layer 5-20
Channel Partitioning MAC protocols TDMATDMA Time Division Multiple Access
access to channel in rounds each station gets fixed length slot (length = packet transmission time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
Two major drawbacks1 a node is limited to average BW of RN even if it is the only one 2 a node must always wait for its turn even if it is the only one
5 DataLink Layer 5-21
Channel Partitioning MAC protocols FDMAFDMA Frequency Division Multiple Access
the channel spectrum is divided into frequency bandseach station is assigned a fixed frequency bandunused transmission time in frequency bands go idlethe same limited BW drawback as the TDMAexample 6-station LAN 134 have pkt frequency bands 256 idle
freq
uenc
y ba
nds
time
5 DataLink Layer 5-22
Channel Partitioning MAC protocols CDMACDMA Code Division Multiple Access
each node is assigned a unique codeeach node uses its code to encode the data bits it sendsthe codes are orthogonal (ie different codes cancel or flatten each other at the receiver)all other signals behave as background noise to one anotherthe receiver node knows the code of the sender nodethe receiver decodes the intended signal using its sender codeall nodes can use the channel simultaneouslymay need a separate code for control signaling
drawbacks1 requires strict synchronization for codingdecoding2 fairly complex implementation
5 DataLink Layer 5-23
Random Access Protocolswhen a node has a packet to send
transmit at full channel data rate Rno a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquorandom access MAC protocol specifies
how to detect (or avoid) collisionshow to recover from collisions (eg via delayed retransmissions)
examples of random access MAC protocolsslotted ALOHApure (unslotted) ALOHACSMA CSMACD CSMACA
5 DataLink Layer 5-24
Slotted ALOHAAssumptions
all frames have the same sizetime is divided into equal size slots each equals the time to transmit 1 framenodes start to transmit frames only at the beginning of the slotsnodes are synchronizedif 2 or more nodes transmit within the same slot all nodes detect the collision
Operationwhen a node obtains a fresh frame it transmits in next slotif no collision occurs the node can send a new frame in the next slotif a collision occurs the node retransmits the frame in each subsequent slot with a probability p until success
5 DataLink Layer 5-25
Slotted ALOHA
Pros (advantages)a single active node can continuously transmit at the full rate of channelhighly decentralized only the slots in the nodes need to be in syncsimple
Cons (disadvantages)collisions wasting slotsidle slots due to random back offclock synchronization among nodes for the start of the slot
5 DataLink Layer 5-26
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in the slot with probability p
The probability that one node has success in a slot = p(1-p)N-1
The probability that any node has a success in a slot = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1 as N goes to infinity
max efficiency = 1e = 37
Efficiency in the long-run when there are many nodes each with many frames to send only a fraction of successful slots
At best a channel is used for useful transmissions only 37 of time
5 DataLink Layer 5-27
Pure (unslotted) ALOHAunslotted Aloha simpler as there is no synchronizationwhen a frame first arrives transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
5 DataLink Layer 5-28
Pure Aloha efficiencyP(success by given node) = P(node transmits)
P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]
= p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
hellip finding optimum p as N infinity
max efficiency = 1(2e) = 18
Even worse than slotted ALOHA
5 DataLink Layer 5-29
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmittingif the channel is sensed idle transmit the entire frameif the channel is sensed busy defer transmission
human analogy donrsquot interrupt others
can this prevents collisions
5 DataLink Layer 5-30
CSMA collisionscollisions can still occurdue to the propagation delay between nodes one node may not hear the otherrsquos transmission early enough
collisionthe entire packet transmission time is wasted (the nodes keep transmitting regardless)
spatial layout of nodes
notethe important role of distance amp propagation delay in determining collision probability
5 DataLink Layer 5-31
CSMACD (Collision Detection)CSMACD carrier sensing amp deferral as in CSMA
collisions are detected within a short timecolliding transmissions are aborted reducing the channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted and received signalsdifficult in wireless LANs receiver shut off while transmitting (hence WLAN uses collision avoidance)
human analogy the polite conversationalist
5 DataLink Layer 5-32
CSMACD collision detection
5 DataLink Layer 5-33
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high loadinefficient at low load there is delay in channel access and only 1N of the bandwidth is allocated even if there is only 1 active node
Random access MAC protocolsefficient at low load a single node can fully utilize the channelDecreasing efficiency at high load collision overhead
ldquotaking turnsrdquo protocolslook for the best of both worlds
5 DataLink Layer 5-34
ldquoTaking Turnsrdquo MAC protocolsPolling
a master node ldquoinvitesrdquo slave nodes to transmit in turnconcerns
polling overhead latencysingle point of failure (the master)
Token passinga control token is passed from one node to the next sequentiallydecentralized and efficient concerns
token overhead latencysingle point of failure
bull token not passedbull failure of one node can break
the channel
5 DataLink Layer 5-35
Summary of MAC protocolsWhat do you do with a shared medium
Channel Partitioning by time frequency or codebull Time Division Frequency Division Code Division
Random Partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard
in others (wireless)bull CSMACD used in IEEE 8023 Ethernetbull CSMACA used in IEEE 80211 WLAN
Taking Turnsbull polling from a central nodebull token passingbull Token Ring used in IEEE 8025
5 DataLink Layer 5-36
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-37
MAC Addresses and ARPIP address
network-layer address32128-bit logical address assigned to an interfaceused to get the datagram to the destination IP subnethierarchical structure
MAC (or LAN or physical or Ethernet) addresslink-layer addressunique 48-bit physical address burned in the adapterrsquos ROMused to get the frame from one to another physically-connected interfaces (within the same network)flat structure
5 DataLink Layer 5-38
LAN Addresses and ARPEach adapter on the LAN has a unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
5 DataLink Layer 5-39
LAN Address (more)MAC address allocation is administered by IEEEmanufacturer buys portion of MAC address space (16 million block) in order to assure uniquenessAnalogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC is a flat address insures portability can move the same adapter from one LAN to another
IP hierarchical address is NOT portabledepends on the IP subnet to which node is attached to
5 DataLink Layer 5-40
ARP Address Resolution ProtocolARP protocol provides IP-to-MAC translation mechanism ARP is similar to DNS except that it is used within the same subnetEach IP node (Host Router) on the LAN has an ARP tableARP Table IPMAC address mappings for someLAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time after which address mapping will be removed (typically 20 min)
Question how to determine MAC address of B knowing Brsquos IP address
Possible ARP table in node 222222222220
5 DataLink Layer 5-41
ARP protocol Same LAN (network)A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP tableA broadcasts ARP query packet containing Bs IP address
Dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP query
B receives the ARP query replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address is a standard or unicast frame
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 ldquoplug-and-playrdquonodes create their ARP tables without intervention from net administrator
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-5
Link layer context
Datagrams are transferred by different link-layer protocols over different links
eg Ethernet on first link frame relay on intermediate links 80211 on last link
Each link-layer protocol may provide different services from others
eg it may or may not provide rdt over the link
5 DataLink Layer 5-6
Link Layer ServicesFraming link access
encapsulate datagram into frame adding headertrailercoordinate channel access if the medium is sharedldquoMACrdquo (Medium Access Control) addresses are used in frame headers to identify the source and destination
bull different from IP addressReliable delivery between adjacent nodes
we learned how to do this already (chapter 3)seldom used on low bit error link (fiber some twisted pair)wireless links usually have high error rates
bull Q why both link-level and end-end reliabilityndash not all protocols provide itndash faster and more efficient if provided locally at a lower layerndash some errors may not be detected during transition (eg router buffer)
5 DataLink Layer 5-7
Link Layer Services (more)Flow Control
pacing between adjacent sending and receiving nodesnodes and each side of the link have limited buffering
Error Detectionerrors may be caused by signal attenuation or noise receiver detects presence of errors
bull signals the sender for retransmission or drops the frame
Error Correctionreceiver node may identify andor correct bit error(s) without resorting to retransmissionusually more sophisticated and hardware-based methods
Half-duplex and full-duplexwith half duplex nodes at both ends of link can transmit but not at same time
5 DataLink Layer 5-8
Adapters Communicating
link layer implemented in ldquoadapterrdquo (aka NIC)
Ethernet card PCMCI card 80211 card
sending sideencapsulates datagram in a frameadds error checking bits rdt flow control etc
receiving sidelooks for errors rdt flow control etcextracts datagram and passes to receiving node
adapter is semi-autonomousunder the control of the nodeshares housing power amp buses
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
physical link
5 DataLink Layer 5-9
Link Layer
51 Introduction and services52 Error detection and correction53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-10
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
5 DataLink Layer 5-11
Parity CheckingSingle Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
detects odd number of errorsefficient only if the bit error probability is low andor bit errors are independentbut in fact errors are dependent and occur in burstswith burst errors amp single parity bit the probability of undetected errors is ~50FEC (Forward Error Correction) can reduce the number of retransmissions with ARQ protocols
5 DataLink Layer 5-12
Internet checksum
Sendertreat segment contents as sequence of 16-bit integerschecksum addition (1rsquos complement sum) of segment contentssender puts checksum value into checksum field
Receivercompute checksum of received segmentcheck if computed checksum equals checksum field value
NO - error detectedYES - no error detected But maybe errors nonethelessMore later hellip
Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted segment (note used at transport layer only)
Checksum methods have little packet overhead However they provide relatively weak protection against errors
5 DataLink Layer 5-13
Checksumming Cyclic Redundancy Checkview data bits D as a binary numberchoose r+1 bit pattern (generator) Ggoal choose r CRC bits R such that
ltDRgt exactly divisible by G (in modulo 2 arithmetic or XOR) receiver knows G divides ltDRgt by G If non-zero remainder error is detectedcan detect all burst errors less than r+1 bits amp all odd number of errorslarger burst errors of length r can be detected with prob of 1-05^r
widely used in practice (eg ATM)
5 DataLink Layer 5-14
CRC ExampleWant
D2r XOR R = Gequivalently
D2r = G XOR R equivalently
if we divide D2r by G want remainder R
R = remainder[ ]D2r
GTransmit D2r XOR R = 10111011
5 DataLink Layer 5-15
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-16
Multiple Access Links and ProtocolsTwo types of ldquolinksrdquo
point-to-pointPPP (Point-to-Point Protocol) for dial-up accesspoint-to-point link between Ethernet switch and host
broadcast (shared wire or medium)traditional Ethernet80211 wireless LAN
5 DataLink Layer 5-17
Multiple Access protocolsconsider a single shared broadcast channel two or more simultaneous transmissions by nodes cause an interference which causes a packet collision
collision if a node receives two or more signals at the same timethe collision happens at all the nodes sharing the channelcollisions waste some of the broadcast channel bandwidth
multiple access protocoldistributed algorithm that determines how nodes can share a channel ie determine when nodes can transmitcommunication about the channel sharing must use the channel itself
no out-of-band channel for coordination
5 DataLink Layer 5-18
Ideal Multiple Access ProtocolBroadcast channel of rate R bps1 When only one node wants to transmit it
can send at rate R2 When M nodes want to transmit each can
send on average at rate RM3 Fully decentralized
no special node to coordinate transmissionsno synchronization of clocks or time-slots
4 Simple and cost-effective to implement
5 DataLink Layer 5-19
MAC Protocols a taxonomy
Three broad classesChannel Partitioning
divide the channel into smaller ldquopiecesrdquo such as time slots (eg TDMA) frequency bands (eg FDMA) codes (eg CDMA)allocate each piece to a node for exclusive use
Random Accessthe channel is not divided but shared allowing collisionsthere is a mechanism to ldquorecoverrdquo from collisions
ldquoTaking turnsrdquonodes take turns but nodes with more to send can take longer turns
5 DataLink Layer 5-20
Channel Partitioning MAC protocols TDMATDMA Time Division Multiple Access
access to channel in rounds each station gets fixed length slot (length = packet transmission time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
Two major drawbacks1 a node is limited to average BW of RN even if it is the only one 2 a node must always wait for its turn even if it is the only one
5 DataLink Layer 5-21
Channel Partitioning MAC protocols FDMAFDMA Frequency Division Multiple Access
the channel spectrum is divided into frequency bandseach station is assigned a fixed frequency bandunused transmission time in frequency bands go idlethe same limited BW drawback as the TDMAexample 6-station LAN 134 have pkt frequency bands 256 idle
freq
uenc
y ba
nds
time
5 DataLink Layer 5-22
Channel Partitioning MAC protocols CDMACDMA Code Division Multiple Access
each node is assigned a unique codeeach node uses its code to encode the data bits it sendsthe codes are orthogonal (ie different codes cancel or flatten each other at the receiver)all other signals behave as background noise to one anotherthe receiver node knows the code of the sender nodethe receiver decodes the intended signal using its sender codeall nodes can use the channel simultaneouslymay need a separate code for control signaling
drawbacks1 requires strict synchronization for codingdecoding2 fairly complex implementation
5 DataLink Layer 5-23
Random Access Protocolswhen a node has a packet to send
transmit at full channel data rate Rno a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquorandom access MAC protocol specifies
how to detect (or avoid) collisionshow to recover from collisions (eg via delayed retransmissions)
examples of random access MAC protocolsslotted ALOHApure (unslotted) ALOHACSMA CSMACD CSMACA
5 DataLink Layer 5-24
Slotted ALOHAAssumptions
all frames have the same sizetime is divided into equal size slots each equals the time to transmit 1 framenodes start to transmit frames only at the beginning of the slotsnodes are synchronizedif 2 or more nodes transmit within the same slot all nodes detect the collision
Operationwhen a node obtains a fresh frame it transmits in next slotif no collision occurs the node can send a new frame in the next slotif a collision occurs the node retransmits the frame in each subsequent slot with a probability p until success
5 DataLink Layer 5-25
Slotted ALOHA
Pros (advantages)a single active node can continuously transmit at the full rate of channelhighly decentralized only the slots in the nodes need to be in syncsimple
Cons (disadvantages)collisions wasting slotsidle slots due to random back offclock synchronization among nodes for the start of the slot
5 DataLink Layer 5-26
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in the slot with probability p
The probability that one node has success in a slot = p(1-p)N-1
The probability that any node has a success in a slot = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1 as N goes to infinity
max efficiency = 1e = 37
Efficiency in the long-run when there are many nodes each with many frames to send only a fraction of successful slots
At best a channel is used for useful transmissions only 37 of time
5 DataLink Layer 5-27
Pure (unslotted) ALOHAunslotted Aloha simpler as there is no synchronizationwhen a frame first arrives transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
5 DataLink Layer 5-28
Pure Aloha efficiencyP(success by given node) = P(node transmits)
P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]
= p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
hellip finding optimum p as N infinity
max efficiency = 1(2e) = 18
Even worse than slotted ALOHA
5 DataLink Layer 5-29
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmittingif the channel is sensed idle transmit the entire frameif the channel is sensed busy defer transmission
human analogy donrsquot interrupt others
can this prevents collisions
5 DataLink Layer 5-30
CSMA collisionscollisions can still occurdue to the propagation delay between nodes one node may not hear the otherrsquos transmission early enough
collisionthe entire packet transmission time is wasted (the nodes keep transmitting regardless)
spatial layout of nodes
notethe important role of distance amp propagation delay in determining collision probability
5 DataLink Layer 5-31
CSMACD (Collision Detection)CSMACD carrier sensing amp deferral as in CSMA
collisions are detected within a short timecolliding transmissions are aborted reducing the channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted and received signalsdifficult in wireless LANs receiver shut off while transmitting (hence WLAN uses collision avoidance)
human analogy the polite conversationalist
5 DataLink Layer 5-32
CSMACD collision detection
5 DataLink Layer 5-33
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high loadinefficient at low load there is delay in channel access and only 1N of the bandwidth is allocated even if there is only 1 active node
Random access MAC protocolsefficient at low load a single node can fully utilize the channelDecreasing efficiency at high load collision overhead
ldquotaking turnsrdquo protocolslook for the best of both worlds
5 DataLink Layer 5-34
ldquoTaking Turnsrdquo MAC protocolsPolling
a master node ldquoinvitesrdquo slave nodes to transmit in turnconcerns
polling overhead latencysingle point of failure (the master)
Token passinga control token is passed from one node to the next sequentiallydecentralized and efficient concerns
token overhead latencysingle point of failure
bull token not passedbull failure of one node can break
the channel
5 DataLink Layer 5-35
Summary of MAC protocolsWhat do you do with a shared medium
Channel Partitioning by time frequency or codebull Time Division Frequency Division Code Division
Random Partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard
in others (wireless)bull CSMACD used in IEEE 8023 Ethernetbull CSMACA used in IEEE 80211 WLAN
Taking Turnsbull polling from a central nodebull token passingbull Token Ring used in IEEE 8025
5 DataLink Layer 5-36
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-37
MAC Addresses and ARPIP address
network-layer address32128-bit logical address assigned to an interfaceused to get the datagram to the destination IP subnethierarchical structure
MAC (or LAN or physical or Ethernet) addresslink-layer addressunique 48-bit physical address burned in the adapterrsquos ROMused to get the frame from one to another physically-connected interfaces (within the same network)flat structure
5 DataLink Layer 5-38
LAN Addresses and ARPEach adapter on the LAN has a unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
5 DataLink Layer 5-39
LAN Address (more)MAC address allocation is administered by IEEEmanufacturer buys portion of MAC address space (16 million block) in order to assure uniquenessAnalogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC is a flat address insures portability can move the same adapter from one LAN to another
IP hierarchical address is NOT portabledepends on the IP subnet to which node is attached to
5 DataLink Layer 5-40
ARP Address Resolution ProtocolARP protocol provides IP-to-MAC translation mechanism ARP is similar to DNS except that it is used within the same subnetEach IP node (Host Router) on the LAN has an ARP tableARP Table IPMAC address mappings for someLAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time after which address mapping will be removed (typically 20 min)
Question how to determine MAC address of B knowing Brsquos IP address
Possible ARP table in node 222222222220
5 DataLink Layer 5-41
ARP protocol Same LAN (network)A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP tableA broadcasts ARP query packet containing Bs IP address
Dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP query
B receives the ARP query replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address is a standard or unicast frame
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 ldquoplug-and-playrdquonodes create their ARP tables without intervention from net administrator
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-6
Link Layer ServicesFraming link access
encapsulate datagram into frame adding headertrailercoordinate channel access if the medium is sharedldquoMACrdquo (Medium Access Control) addresses are used in frame headers to identify the source and destination
bull different from IP addressReliable delivery between adjacent nodes
we learned how to do this already (chapter 3)seldom used on low bit error link (fiber some twisted pair)wireless links usually have high error rates
bull Q why both link-level and end-end reliabilityndash not all protocols provide itndash faster and more efficient if provided locally at a lower layerndash some errors may not be detected during transition (eg router buffer)
5 DataLink Layer 5-7
Link Layer Services (more)Flow Control
pacing between adjacent sending and receiving nodesnodes and each side of the link have limited buffering
Error Detectionerrors may be caused by signal attenuation or noise receiver detects presence of errors
bull signals the sender for retransmission or drops the frame
Error Correctionreceiver node may identify andor correct bit error(s) without resorting to retransmissionusually more sophisticated and hardware-based methods
Half-duplex and full-duplexwith half duplex nodes at both ends of link can transmit but not at same time
5 DataLink Layer 5-8
Adapters Communicating
link layer implemented in ldquoadapterrdquo (aka NIC)
Ethernet card PCMCI card 80211 card
sending sideencapsulates datagram in a frameadds error checking bits rdt flow control etc
receiving sidelooks for errors rdt flow control etcextracts datagram and passes to receiving node
adapter is semi-autonomousunder the control of the nodeshares housing power amp buses
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
physical link
5 DataLink Layer 5-9
Link Layer
51 Introduction and services52 Error detection and correction53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-10
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
5 DataLink Layer 5-11
Parity CheckingSingle Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
detects odd number of errorsefficient only if the bit error probability is low andor bit errors are independentbut in fact errors are dependent and occur in burstswith burst errors amp single parity bit the probability of undetected errors is ~50FEC (Forward Error Correction) can reduce the number of retransmissions with ARQ protocols
5 DataLink Layer 5-12
Internet checksum
Sendertreat segment contents as sequence of 16-bit integerschecksum addition (1rsquos complement sum) of segment contentssender puts checksum value into checksum field
Receivercompute checksum of received segmentcheck if computed checksum equals checksum field value
NO - error detectedYES - no error detected But maybe errors nonethelessMore later hellip
Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted segment (note used at transport layer only)
Checksum methods have little packet overhead However they provide relatively weak protection against errors
5 DataLink Layer 5-13
Checksumming Cyclic Redundancy Checkview data bits D as a binary numberchoose r+1 bit pattern (generator) Ggoal choose r CRC bits R such that
ltDRgt exactly divisible by G (in modulo 2 arithmetic or XOR) receiver knows G divides ltDRgt by G If non-zero remainder error is detectedcan detect all burst errors less than r+1 bits amp all odd number of errorslarger burst errors of length r can be detected with prob of 1-05^r
widely used in practice (eg ATM)
5 DataLink Layer 5-14
CRC ExampleWant
D2r XOR R = Gequivalently
D2r = G XOR R equivalently
if we divide D2r by G want remainder R
R = remainder[ ]D2r
GTransmit D2r XOR R = 10111011
5 DataLink Layer 5-15
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-16
Multiple Access Links and ProtocolsTwo types of ldquolinksrdquo
point-to-pointPPP (Point-to-Point Protocol) for dial-up accesspoint-to-point link between Ethernet switch and host
broadcast (shared wire or medium)traditional Ethernet80211 wireless LAN
5 DataLink Layer 5-17
Multiple Access protocolsconsider a single shared broadcast channel two or more simultaneous transmissions by nodes cause an interference which causes a packet collision
collision if a node receives two or more signals at the same timethe collision happens at all the nodes sharing the channelcollisions waste some of the broadcast channel bandwidth
multiple access protocoldistributed algorithm that determines how nodes can share a channel ie determine when nodes can transmitcommunication about the channel sharing must use the channel itself
no out-of-band channel for coordination
5 DataLink Layer 5-18
Ideal Multiple Access ProtocolBroadcast channel of rate R bps1 When only one node wants to transmit it
can send at rate R2 When M nodes want to transmit each can
send on average at rate RM3 Fully decentralized
no special node to coordinate transmissionsno synchronization of clocks or time-slots
4 Simple and cost-effective to implement
5 DataLink Layer 5-19
MAC Protocols a taxonomy
Three broad classesChannel Partitioning
divide the channel into smaller ldquopiecesrdquo such as time slots (eg TDMA) frequency bands (eg FDMA) codes (eg CDMA)allocate each piece to a node for exclusive use
Random Accessthe channel is not divided but shared allowing collisionsthere is a mechanism to ldquorecoverrdquo from collisions
ldquoTaking turnsrdquonodes take turns but nodes with more to send can take longer turns
5 DataLink Layer 5-20
Channel Partitioning MAC protocols TDMATDMA Time Division Multiple Access
access to channel in rounds each station gets fixed length slot (length = packet transmission time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
Two major drawbacks1 a node is limited to average BW of RN even if it is the only one 2 a node must always wait for its turn even if it is the only one
5 DataLink Layer 5-21
Channel Partitioning MAC protocols FDMAFDMA Frequency Division Multiple Access
the channel spectrum is divided into frequency bandseach station is assigned a fixed frequency bandunused transmission time in frequency bands go idlethe same limited BW drawback as the TDMAexample 6-station LAN 134 have pkt frequency bands 256 idle
freq
uenc
y ba
nds
time
5 DataLink Layer 5-22
Channel Partitioning MAC protocols CDMACDMA Code Division Multiple Access
each node is assigned a unique codeeach node uses its code to encode the data bits it sendsthe codes are orthogonal (ie different codes cancel or flatten each other at the receiver)all other signals behave as background noise to one anotherthe receiver node knows the code of the sender nodethe receiver decodes the intended signal using its sender codeall nodes can use the channel simultaneouslymay need a separate code for control signaling
drawbacks1 requires strict synchronization for codingdecoding2 fairly complex implementation
5 DataLink Layer 5-23
Random Access Protocolswhen a node has a packet to send
transmit at full channel data rate Rno a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquorandom access MAC protocol specifies
how to detect (or avoid) collisionshow to recover from collisions (eg via delayed retransmissions)
examples of random access MAC protocolsslotted ALOHApure (unslotted) ALOHACSMA CSMACD CSMACA
5 DataLink Layer 5-24
Slotted ALOHAAssumptions
all frames have the same sizetime is divided into equal size slots each equals the time to transmit 1 framenodes start to transmit frames only at the beginning of the slotsnodes are synchronizedif 2 or more nodes transmit within the same slot all nodes detect the collision
Operationwhen a node obtains a fresh frame it transmits in next slotif no collision occurs the node can send a new frame in the next slotif a collision occurs the node retransmits the frame in each subsequent slot with a probability p until success
5 DataLink Layer 5-25
Slotted ALOHA
Pros (advantages)a single active node can continuously transmit at the full rate of channelhighly decentralized only the slots in the nodes need to be in syncsimple
Cons (disadvantages)collisions wasting slotsidle slots due to random back offclock synchronization among nodes for the start of the slot
5 DataLink Layer 5-26
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in the slot with probability p
The probability that one node has success in a slot = p(1-p)N-1
The probability that any node has a success in a slot = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1 as N goes to infinity
max efficiency = 1e = 37
Efficiency in the long-run when there are many nodes each with many frames to send only a fraction of successful slots
At best a channel is used for useful transmissions only 37 of time
5 DataLink Layer 5-27
Pure (unslotted) ALOHAunslotted Aloha simpler as there is no synchronizationwhen a frame first arrives transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
5 DataLink Layer 5-28
Pure Aloha efficiencyP(success by given node) = P(node transmits)
P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]
= p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
hellip finding optimum p as N infinity
max efficiency = 1(2e) = 18
Even worse than slotted ALOHA
5 DataLink Layer 5-29
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmittingif the channel is sensed idle transmit the entire frameif the channel is sensed busy defer transmission
human analogy donrsquot interrupt others
can this prevents collisions
5 DataLink Layer 5-30
CSMA collisionscollisions can still occurdue to the propagation delay between nodes one node may not hear the otherrsquos transmission early enough
collisionthe entire packet transmission time is wasted (the nodes keep transmitting regardless)
spatial layout of nodes
notethe important role of distance amp propagation delay in determining collision probability
5 DataLink Layer 5-31
CSMACD (Collision Detection)CSMACD carrier sensing amp deferral as in CSMA
collisions are detected within a short timecolliding transmissions are aborted reducing the channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted and received signalsdifficult in wireless LANs receiver shut off while transmitting (hence WLAN uses collision avoidance)
human analogy the polite conversationalist
5 DataLink Layer 5-32
CSMACD collision detection
5 DataLink Layer 5-33
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high loadinefficient at low load there is delay in channel access and only 1N of the bandwidth is allocated even if there is only 1 active node
Random access MAC protocolsefficient at low load a single node can fully utilize the channelDecreasing efficiency at high load collision overhead
ldquotaking turnsrdquo protocolslook for the best of both worlds
5 DataLink Layer 5-34
ldquoTaking Turnsrdquo MAC protocolsPolling
a master node ldquoinvitesrdquo slave nodes to transmit in turnconcerns
polling overhead latencysingle point of failure (the master)
Token passinga control token is passed from one node to the next sequentiallydecentralized and efficient concerns
token overhead latencysingle point of failure
bull token not passedbull failure of one node can break
the channel
5 DataLink Layer 5-35
Summary of MAC protocolsWhat do you do with a shared medium
Channel Partitioning by time frequency or codebull Time Division Frequency Division Code Division
Random Partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard
in others (wireless)bull CSMACD used in IEEE 8023 Ethernetbull CSMACA used in IEEE 80211 WLAN
Taking Turnsbull polling from a central nodebull token passingbull Token Ring used in IEEE 8025
5 DataLink Layer 5-36
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-37
MAC Addresses and ARPIP address
network-layer address32128-bit logical address assigned to an interfaceused to get the datagram to the destination IP subnethierarchical structure
MAC (or LAN or physical or Ethernet) addresslink-layer addressunique 48-bit physical address burned in the adapterrsquos ROMused to get the frame from one to another physically-connected interfaces (within the same network)flat structure
5 DataLink Layer 5-38
LAN Addresses and ARPEach adapter on the LAN has a unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
5 DataLink Layer 5-39
LAN Address (more)MAC address allocation is administered by IEEEmanufacturer buys portion of MAC address space (16 million block) in order to assure uniquenessAnalogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC is a flat address insures portability can move the same adapter from one LAN to another
IP hierarchical address is NOT portabledepends on the IP subnet to which node is attached to
5 DataLink Layer 5-40
ARP Address Resolution ProtocolARP protocol provides IP-to-MAC translation mechanism ARP is similar to DNS except that it is used within the same subnetEach IP node (Host Router) on the LAN has an ARP tableARP Table IPMAC address mappings for someLAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time after which address mapping will be removed (typically 20 min)
Question how to determine MAC address of B knowing Brsquos IP address
Possible ARP table in node 222222222220
5 DataLink Layer 5-41
ARP protocol Same LAN (network)A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP tableA broadcasts ARP query packet containing Bs IP address
Dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP query
B receives the ARP query replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address is a standard or unicast frame
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 ldquoplug-and-playrdquonodes create their ARP tables without intervention from net administrator
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-7
Link Layer Services (more)Flow Control
pacing between adjacent sending and receiving nodesnodes and each side of the link have limited buffering
Error Detectionerrors may be caused by signal attenuation or noise receiver detects presence of errors
bull signals the sender for retransmission or drops the frame
Error Correctionreceiver node may identify andor correct bit error(s) without resorting to retransmissionusually more sophisticated and hardware-based methods
Half-duplex and full-duplexwith half duplex nodes at both ends of link can transmit but not at same time
5 DataLink Layer 5-8
Adapters Communicating
link layer implemented in ldquoadapterrdquo (aka NIC)
Ethernet card PCMCI card 80211 card
sending sideencapsulates datagram in a frameadds error checking bits rdt flow control etc
receiving sidelooks for errors rdt flow control etcextracts datagram and passes to receiving node
adapter is semi-autonomousunder the control of the nodeshares housing power amp buses
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
physical link
5 DataLink Layer 5-9
Link Layer
51 Introduction and services52 Error detection and correction53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-10
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
5 DataLink Layer 5-11
Parity CheckingSingle Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
detects odd number of errorsefficient only if the bit error probability is low andor bit errors are independentbut in fact errors are dependent and occur in burstswith burst errors amp single parity bit the probability of undetected errors is ~50FEC (Forward Error Correction) can reduce the number of retransmissions with ARQ protocols
5 DataLink Layer 5-12
Internet checksum
Sendertreat segment contents as sequence of 16-bit integerschecksum addition (1rsquos complement sum) of segment contentssender puts checksum value into checksum field
Receivercompute checksum of received segmentcheck if computed checksum equals checksum field value
NO - error detectedYES - no error detected But maybe errors nonethelessMore later hellip
Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted segment (note used at transport layer only)
Checksum methods have little packet overhead However they provide relatively weak protection against errors
5 DataLink Layer 5-13
Checksumming Cyclic Redundancy Checkview data bits D as a binary numberchoose r+1 bit pattern (generator) Ggoal choose r CRC bits R such that
ltDRgt exactly divisible by G (in modulo 2 arithmetic or XOR) receiver knows G divides ltDRgt by G If non-zero remainder error is detectedcan detect all burst errors less than r+1 bits amp all odd number of errorslarger burst errors of length r can be detected with prob of 1-05^r
widely used in practice (eg ATM)
5 DataLink Layer 5-14
CRC ExampleWant
D2r XOR R = Gequivalently
D2r = G XOR R equivalently
if we divide D2r by G want remainder R
R = remainder[ ]D2r
GTransmit D2r XOR R = 10111011
5 DataLink Layer 5-15
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-16
Multiple Access Links and ProtocolsTwo types of ldquolinksrdquo
point-to-pointPPP (Point-to-Point Protocol) for dial-up accesspoint-to-point link between Ethernet switch and host
broadcast (shared wire or medium)traditional Ethernet80211 wireless LAN
5 DataLink Layer 5-17
Multiple Access protocolsconsider a single shared broadcast channel two or more simultaneous transmissions by nodes cause an interference which causes a packet collision
collision if a node receives two or more signals at the same timethe collision happens at all the nodes sharing the channelcollisions waste some of the broadcast channel bandwidth
multiple access protocoldistributed algorithm that determines how nodes can share a channel ie determine when nodes can transmitcommunication about the channel sharing must use the channel itself
no out-of-band channel for coordination
5 DataLink Layer 5-18
Ideal Multiple Access ProtocolBroadcast channel of rate R bps1 When only one node wants to transmit it
can send at rate R2 When M nodes want to transmit each can
send on average at rate RM3 Fully decentralized
no special node to coordinate transmissionsno synchronization of clocks or time-slots
4 Simple and cost-effective to implement
5 DataLink Layer 5-19
MAC Protocols a taxonomy
Three broad classesChannel Partitioning
divide the channel into smaller ldquopiecesrdquo such as time slots (eg TDMA) frequency bands (eg FDMA) codes (eg CDMA)allocate each piece to a node for exclusive use
Random Accessthe channel is not divided but shared allowing collisionsthere is a mechanism to ldquorecoverrdquo from collisions
ldquoTaking turnsrdquonodes take turns but nodes with more to send can take longer turns
5 DataLink Layer 5-20
Channel Partitioning MAC protocols TDMATDMA Time Division Multiple Access
access to channel in rounds each station gets fixed length slot (length = packet transmission time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
Two major drawbacks1 a node is limited to average BW of RN even if it is the only one 2 a node must always wait for its turn even if it is the only one
5 DataLink Layer 5-21
Channel Partitioning MAC protocols FDMAFDMA Frequency Division Multiple Access
the channel spectrum is divided into frequency bandseach station is assigned a fixed frequency bandunused transmission time in frequency bands go idlethe same limited BW drawback as the TDMAexample 6-station LAN 134 have pkt frequency bands 256 idle
freq
uenc
y ba
nds
time
5 DataLink Layer 5-22
Channel Partitioning MAC protocols CDMACDMA Code Division Multiple Access
each node is assigned a unique codeeach node uses its code to encode the data bits it sendsthe codes are orthogonal (ie different codes cancel or flatten each other at the receiver)all other signals behave as background noise to one anotherthe receiver node knows the code of the sender nodethe receiver decodes the intended signal using its sender codeall nodes can use the channel simultaneouslymay need a separate code for control signaling
drawbacks1 requires strict synchronization for codingdecoding2 fairly complex implementation
5 DataLink Layer 5-23
Random Access Protocolswhen a node has a packet to send
transmit at full channel data rate Rno a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquorandom access MAC protocol specifies
how to detect (or avoid) collisionshow to recover from collisions (eg via delayed retransmissions)
examples of random access MAC protocolsslotted ALOHApure (unslotted) ALOHACSMA CSMACD CSMACA
5 DataLink Layer 5-24
Slotted ALOHAAssumptions
all frames have the same sizetime is divided into equal size slots each equals the time to transmit 1 framenodes start to transmit frames only at the beginning of the slotsnodes are synchronizedif 2 or more nodes transmit within the same slot all nodes detect the collision
Operationwhen a node obtains a fresh frame it transmits in next slotif no collision occurs the node can send a new frame in the next slotif a collision occurs the node retransmits the frame in each subsequent slot with a probability p until success
5 DataLink Layer 5-25
Slotted ALOHA
Pros (advantages)a single active node can continuously transmit at the full rate of channelhighly decentralized only the slots in the nodes need to be in syncsimple
Cons (disadvantages)collisions wasting slotsidle slots due to random back offclock synchronization among nodes for the start of the slot
5 DataLink Layer 5-26
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in the slot with probability p
The probability that one node has success in a slot = p(1-p)N-1
The probability that any node has a success in a slot = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1 as N goes to infinity
max efficiency = 1e = 37
Efficiency in the long-run when there are many nodes each with many frames to send only a fraction of successful slots
At best a channel is used for useful transmissions only 37 of time
5 DataLink Layer 5-27
Pure (unslotted) ALOHAunslotted Aloha simpler as there is no synchronizationwhen a frame first arrives transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
5 DataLink Layer 5-28
Pure Aloha efficiencyP(success by given node) = P(node transmits)
P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]
= p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
hellip finding optimum p as N infinity
max efficiency = 1(2e) = 18
Even worse than slotted ALOHA
5 DataLink Layer 5-29
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmittingif the channel is sensed idle transmit the entire frameif the channel is sensed busy defer transmission
human analogy donrsquot interrupt others
can this prevents collisions
5 DataLink Layer 5-30
CSMA collisionscollisions can still occurdue to the propagation delay between nodes one node may not hear the otherrsquos transmission early enough
collisionthe entire packet transmission time is wasted (the nodes keep transmitting regardless)
spatial layout of nodes
notethe important role of distance amp propagation delay in determining collision probability
5 DataLink Layer 5-31
CSMACD (Collision Detection)CSMACD carrier sensing amp deferral as in CSMA
collisions are detected within a short timecolliding transmissions are aborted reducing the channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted and received signalsdifficult in wireless LANs receiver shut off while transmitting (hence WLAN uses collision avoidance)
human analogy the polite conversationalist
5 DataLink Layer 5-32
CSMACD collision detection
5 DataLink Layer 5-33
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high loadinefficient at low load there is delay in channel access and only 1N of the bandwidth is allocated even if there is only 1 active node
Random access MAC protocolsefficient at low load a single node can fully utilize the channelDecreasing efficiency at high load collision overhead
ldquotaking turnsrdquo protocolslook for the best of both worlds
5 DataLink Layer 5-34
ldquoTaking Turnsrdquo MAC protocolsPolling
a master node ldquoinvitesrdquo slave nodes to transmit in turnconcerns
polling overhead latencysingle point of failure (the master)
Token passinga control token is passed from one node to the next sequentiallydecentralized and efficient concerns
token overhead latencysingle point of failure
bull token not passedbull failure of one node can break
the channel
5 DataLink Layer 5-35
Summary of MAC protocolsWhat do you do with a shared medium
Channel Partitioning by time frequency or codebull Time Division Frequency Division Code Division
Random Partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard
in others (wireless)bull CSMACD used in IEEE 8023 Ethernetbull CSMACA used in IEEE 80211 WLAN
Taking Turnsbull polling from a central nodebull token passingbull Token Ring used in IEEE 8025
5 DataLink Layer 5-36
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-37
MAC Addresses and ARPIP address
network-layer address32128-bit logical address assigned to an interfaceused to get the datagram to the destination IP subnethierarchical structure
MAC (or LAN or physical or Ethernet) addresslink-layer addressunique 48-bit physical address burned in the adapterrsquos ROMused to get the frame from one to another physically-connected interfaces (within the same network)flat structure
5 DataLink Layer 5-38
LAN Addresses and ARPEach adapter on the LAN has a unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
5 DataLink Layer 5-39
LAN Address (more)MAC address allocation is administered by IEEEmanufacturer buys portion of MAC address space (16 million block) in order to assure uniquenessAnalogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC is a flat address insures portability can move the same adapter from one LAN to another
IP hierarchical address is NOT portabledepends on the IP subnet to which node is attached to
5 DataLink Layer 5-40
ARP Address Resolution ProtocolARP protocol provides IP-to-MAC translation mechanism ARP is similar to DNS except that it is used within the same subnetEach IP node (Host Router) on the LAN has an ARP tableARP Table IPMAC address mappings for someLAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time after which address mapping will be removed (typically 20 min)
Question how to determine MAC address of B knowing Brsquos IP address
Possible ARP table in node 222222222220
5 DataLink Layer 5-41
ARP protocol Same LAN (network)A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP tableA broadcasts ARP query packet containing Bs IP address
Dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP query
B receives the ARP query replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address is a standard or unicast frame
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 ldquoplug-and-playrdquonodes create their ARP tables without intervention from net administrator
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-8
Adapters Communicating
link layer implemented in ldquoadapterrdquo (aka NIC)
Ethernet card PCMCI card 80211 card
sending sideencapsulates datagram in a frameadds error checking bits rdt flow control etc
receiving sidelooks for errors rdt flow control etcextracts datagram and passes to receiving node
adapter is semi-autonomousunder the control of the nodeshares housing power amp buses
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
physical link
5 DataLink Layer 5-9
Link Layer
51 Introduction and services52 Error detection and correction53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-10
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
5 DataLink Layer 5-11
Parity CheckingSingle Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
detects odd number of errorsefficient only if the bit error probability is low andor bit errors are independentbut in fact errors are dependent and occur in burstswith burst errors amp single parity bit the probability of undetected errors is ~50FEC (Forward Error Correction) can reduce the number of retransmissions with ARQ protocols
5 DataLink Layer 5-12
Internet checksum
Sendertreat segment contents as sequence of 16-bit integerschecksum addition (1rsquos complement sum) of segment contentssender puts checksum value into checksum field
Receivercompute checksum of received segmentcheck if computed checksum equals checksum field value
NO - error detectedYES - no error detected But maybe errors nonethelessMore later hellip
Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted segment (note used at transport layer only)
Checksum methods have little packet overhead However they provide relatively weak protection against errors
5 DataLink Layer 5-13
Checksumming Cyclic Redundancy Checkview data bits D as a binary numberchoose r+1 bit pattern (generator) Ggoal choose r CRC bits R such that
ltDRgt exactly divisible by G (in modulo 2 arithmetic or XOR) receiver knows G divides ltDRgt by G If non-zero remainder error is detectedcan detect all burst errors less than r+1 bits amp all odd number of errorslarger burst errors of length r can be detected with prob of 1-05^r
widely used in practice (eg ATM)
5 DataLink Layer 5-14
CRC ExampleWant
D2r XOR R = Gequivalently
D2r = G XOR R equivalently
if we divide D2r by G want remainder R
R = remainder[ ]D2r
GTransmit D2r XOR R = 10111011
5 DataLink Layer 5-15
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-16
Multiple Access Links and ProtocolsTwo types of ldquolinksrdquo
point-to-pointPPP (Point-to-Point Protocol) for dial-up accesspoint-to-point link between Ethernet switch and host
broadcast (shared wire or medium)traditional Ethernet80211 wireless LAN
5 DataLink Layer 5-17
Multiple Access protocolsconsider a single shared broadcast channel two or more simultaneous transmissions by nodes cause an interference which causes a packet collision
collision if a node receives two or more signals at the same timethe collision happens at all the nodes sharing the channelcollisions waste some of the broadcast channel bandwidth
multiple access protocoldistributed algorithm that determines how nodes can share a channel ie determine when nodes can transmitcommunication about the channel sharing must use the channel itself
no out-of-band channel for coordination
5 DataLink Layer 5-18
Ideal Multiple Access ProtocolBroadcast channel of rate R bps1 When only one node wants to transmit it
can send at rate R2 When M nodes want to transmit each can
send on average at rate RM3 Fully decentralized
no special node to coordinate transmissionsno synchronization of clocks or time-slots
4 Simple and cost-effective to implement
5 DataLink Layer 5-19
MAC Protocols a taxonomy
Three broad classesChannel Partitioning
divide the channel into smaller ldquopiecesrdquo such as time slots (eg TDMA) frequency bands (eg FDMA) codes (eg CDMA)allocate each piece to a node for exclusive use
Random Accessthe channel is not divided but shared allowing collisionsthere is a mechanism to ldquorecoverrdquo from collisions
ldquoTaking turnsrdquonodes take turns but nodes with more to send can take longer turns
5 DataLink Layer 5-20
Channel Partitioning MAC protocols TDMATDMA Time Division Multiple Access
access to channel in rounds each station gets fixed length slot (length = packet transmission time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
Two major drawbacks1 a node is limited to average BW of RN even if it is the only one 2 a node must always wait for its turn even if it is the only one
5 DataLink Layer 5-21
Channel Partitioning MAC protocols FDMAFDMA Frequency Division Multiple Access
the channel spectrum is divided into frequency bandseach station is assigned a fixed frequency bandunused transmission time in frequency bands go idlethe same limited BW drawback as the TDMAexample 6-station LAN 134 have pkt frequency bands 256 idle
freq
uenc
y ba
nds
time
5 DataLink Layer 5-22
Channel Partitioning MAC protocols CDMACDMA Code Division Multiple Access
each node is assigned a unique codeeach node uses its code to encode the data bits it sendsthe codes are orthogonal (ie different codes cancel or flatten each other at the receiver)all other signals behave as background noise to one anotherthe receiver node knows the code of the sender nodethe receiver decodes the intended signal using its sender codeall nodes can use the channel simultaneouslymay need a separate code for control signaling
drawbacks1 requires strict synchronization for codingdecoding2 fairly complex implementation
5 DataLink Layer 5-23
Random Access Protocolswhen a node has a packet to send
transmit at full channel data rate Rno a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquorandom access MAC protocol specifies
how to detect (or avoid) collisionshow to recover from collisions (eg via delayed retransmissions)
examples of random access MAC protocolsslotted ALOHApure (unslotted) ALOHACSMA CSMACD CSMACA
5 DataLink Layer 5-24
Slotted ALOHAAssumptions
all frames have the same sizetime is divided into equal size slots each equals the time to transmit 1 framenodes start to transmit frames only at the beginning of the slotsnodes are synchronizedif 2 or more nodes transmit within the same slot all nodes detect the collision
Operationwhen a node obtains a fresh frame it transmits in next slotif no collision occurs the node can send a new frame in the next slotif a collision occurs the node retransmits the frame in each subsequent slot with a probability p until success
5 DataLink Layer 5-25
Slotted ALOHA
Pros (advantages)a single active node can continuously transmit at the full rate of channelhighly decentralized only the slots in the nodes need to be in syncsimple
Cons (disadvantages)collisions wasting slotsidle slots due to random back offclock synchronization among nodes for the start of the slot
5 DataLink Layer 5-26
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in the slot with probability p
The probability that one node has success in a slot = p(1-p)N-1
The probability that any node has a success in a slot = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1 as N goes to infinity
max efficiency = 1e = 37
Efficiency in the long-run when there are many nodes each with many frames to send only a fraction of successful slots
At best a channel is used for useful transmissions only 37 of time
5 DataLink Layer 5-27
Pure (unslotted) ALOHAunslotted Aloha simpler as there is no synchronizationwhen a frame first arrives transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
5 DataLink Layer 5-28
Pure Aloha efficiencyP(success by given node) = P(node transmits)
P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]
= p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
hellip finding optimum p as N infinity
max efficiency = 1(2e) = 18
Even worse than slotted ALOHA
5 DataLink Layer 5-29
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmittingif the channel is sensed idle transmit the entire frameif the channel is sensed busy defer transmission
human analogy donrsquot interrupt others
can this prevents collisions
5 DataLink Layer 5-30
CSMA collisionscollisions can still occurdue to the propagation delay between nodes one node may not hear the otherrsquos transmission early enough
collisionthe entire packet transmission time is wasted (the nodes keep transmitting regardless)
spatial layout of nodes
notethe important role of distance amp propagation delay in determining collision probability
5 DataLink Layer 5-31
CSMACD (Collision Detection)CSMACD carrier sensing amp deferral as in CSMA
collisions are detected within a short timecolliding transmissions are aborted reducing the channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted and received signalsdifficult in wireless LANs receiver shut off while transmitting (hence WLAN uses collision avoidance)
human analogy the polite conversationalist
5 DataLink Layer 5-32
CSMACD collision detection
5 DataLink Layer 5-33
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high loadinefficient at low load there is delay in channel access and only 1N of the bandwidth is allocated even if there is only 1 active node
Random access MAC protocolsefficient at low load a single node can fully utilize the channelDecreasing efficiency at high load collision overhead
ldquotaking turnsrdquo protocolslook for the best of both worlds
5 DataLink Layer 5-34
ldquoTaking Turnsrdquo MAC protocolsPolling
a master node ldquoinvitesrdquo slave nodes to transmit in turnconcerns
polling overhead latencysingle point of failure (the master)
Token passinga control token is passed from one node to the next sequentiallydecentralized and efficient concerns
token overhead latencysingle point of failure
bull token not passedbull failure of one node can break
the channel
5 DataLink Layer 5-35
Summary of MAC protocolsWhat do you do with a shared medium
Channel Partitioning by time frequency or codebull Time Division Frequency Division Code Division
Random Partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard
in others (wireless)bull CSMACD used in IEEE 8023 Ethernetbull CSMACA used in IEEE 80211 WLAN
Taking Turnsbull polling from a central nodebull token passingbull Token Ring used in IEEE 8025
5 DataLink Layer 5-36
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-37
MAC Addresses and ARPIP address
network-layer address32128-bit logical address assigned to an interfaceused to get the datagram to the destination IP subnethierarchical structure
MAC (or LAN or physical or Ethernet) addresslink-layer addressunique 48-bit physical address burned in the adapterrsquos ROMused to get the frame from one to another physically-connected interfaces (within the same network)flat structure
5 DataLink Layer 5-38
LAN Addresses and ARPEach adapter on the LAN has a unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
5 DataLink Layer 5-39
LAN Address (more)MAC address allocation is administered by IEEEmanufacturer buys portion of MAC address space (16 million block) in order to assure uniquenessAnalogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC is a flat address insures portability can move the same adapter from one LAN to another
IP hierarchical address is NOT portabledepends on the IP subnet to which node is attached to
5 DataLink Layer 5-40
ARP Address Resolution ProtocolARP protocol provides IP-to-MAC translation mechanism ARP is similar to DNS except that it is used within the same subnetEach IP node (Host Router) on the LAN has an ARP tableARP Table IPMAC address mappings for someLAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time after which address mapping will be removed (typically 20 min)
Question how to determine MAC address of B knowing Brsquos IP address
Possible ARP table in node 222222222220
5 DataLink Layer 5-41
ARP protocol Same LAN (network)A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP tableA broadcasts ARP query packet containing Bs IP address
Dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP query
B receives the ARP query replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address is a standard or unicast frame
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 ldquoplug-and-playrdquonodes create their ARP tables without intervention from net administrator
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-9
Link Layer
51 Introduction and services52 Error detection and correction53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-10
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
5 DataLink Layer 5-11
Parity CheckingSingle Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
detects odd number of errorsefficient only if the bit error probability is low andor bit errors are independentbut in fact errors are dependent and occur in burstswith burst errors amp single parity bit the probability of undetected errors is ~50FEC (Forward Error Correction) can reduce the number of retransmissions with ARQ protocols
5 DataLink Layer 5-12
Internet checksum
Sendertreat segment contents as sequence of 16-bit integerschecksum addition (1rsquos complement sum) of segment contentssender puts checksum value into checksum field
Receivercompute checksum of received segmentcheck if computed checksum equals checksum field value
NO - error detectedYES - no error detected But maybe errors nonethelessMore later hellip
Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted segment (note used at transport layer only)
Checksum methods have little packet overhead However they provide relatively weak protection against errors
5 DataLink Layer 5-13
Checksumming Cyclic Redundancy Checkview data bits D as a binary numberchoose r+1 bit pattern (generator) Ggoal choose r CRC bits R such that
ltDRgt exactly divisible by G (in modulo 2 arithmetic or XOR) receiver knows G divides ltDRgt by G If non-zero remainder error is detectedcan detect all burst errors less than r+1 bits amp all odd number of errorslarger burst errors of length r can be detected with prob of 1-05^r
widely used in practice (eg ATM)
5 DataLink Layer 5-14
CRC ExampleWant
D2r XOR R = Gequivalently
D2r = G XOR R equivalently
if we divide D2r by G want remainder R
R = remainder[ ]D2r
GTransmit D2r XOR R = 10111011
5 DataLink Layer 5-15
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-16
Multiple Access Links and ProtocolsTwo types of ldquolinksrdquo
point-to-pointPPP (Point-to-Point Protocol) for dial-up accesspoint-to-point link between Ethernet switch and host
broadcast (shared wire or medium)traditional Ethernet80211 wireless LAN
5 DataLink Layer 5-17
Multiple Access protocolsconsider a single shared broadcast channel two or more simultaneous transmissions by nodes cause an interference which causes a packet collision
collision if a node receives two or more signals at the same timethe collision happens at all the nodes sharing the channelcollisions waste some of the broadcast channel bandwidth
multiple access protocoldistributed algorithm that determines how nodes can share a channel ie determine when nodes can transmitcommunication about the channel sharing must use the channel itself
no out-of-band channel for coordination
5 DataLink Layer 5-18
Ideal Multiple Access ProtocolBroadcast channel of rate R bps1 When only one node wants to transmit it
can send at rate R2 When M nodes want to transmit each can
send on average at rate RM3 Fully decentralized
no special node to coordinate transmissionsno synchronization of clocks or time-slots
4 Simple and cost-effective to implement
5 DataLink Layer 5-19
MAC Protocols a taxonomy
Three broad classesChannel Partitioning
divide the channel into smaller ldquopiecesrdquo such as time slots (eg TDMA) frequency bands (eg FDMA) codes (eg CDMA)allocate each piece to a node for exclusive use
Random Accessthe channel is not divided but shared allowing collisionsthere is a mechanism to ldquorecoverrdquo from collisions
ldquoTaking turnsrdquonodes take turns but nodes with more to send can take longer turns
5 DataLink Layer 5-20
Channel Partitioning MAC protocols TDMATDMA Time Division Multiple Access
access to channel in rounds each station gets fixed length slot (length = packet transmission time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
Two major drawbacks1 a node is limited to average BW of RN even if it is the only one 2 a node must always wait for its turn even if it is the only one
5 DataLink Layer 5-21
Channel Partitioning MAC protocols FDMAFDMA Frequency Division Multiple Access
the channel spectrum is divided into frequency bandseach station is assigned a fixed frequency bandunused transmission time in frequency bands go idlethe same limited BW drawback as the TDMAexample 6-station LAN 134 have pkt frequency bands 256 idle
freq
uenc
y ba
nds
time
5 DataLink Layer 5-22
Channel Partitioning MAC protocols CDMACDMA Code Division Multiple Access
each node is assigned a unique codeeach node uses its code to encode the data bits it sendsthe codes are orthogonal (ie different codes cancel or flatten each other at the receiver)all other signals behave as background noise to one anotherthe receiver node knows the code of the sender nodethe receiver decodes the intended signal using its sender codeall nodes can use the channel simultaneouslymay need a separate code for control signaling
drawbacks1 requires strict synchronization for codingdecoding2 fairly complex implementation
5 DataLink Layer 5-23
Random Access Protocolswhen a node has a packet to send
transmit at full channel data rate Rno a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquorandom access MAC protocol specifies
how to detect (or avoid) collisionshow to recover from collisions (eg via delayed retransmissions)
examples of random access MAC protocolsslotted ALOHApure (unslotted) ALOHACSMA CSMACD CSMACA
5 DataLink Layer 5-24
Slotted ALOHAAssumptions
all frames have the same sizetime is divided into equal size slots each equals the time to transmit 1 framenodes start to transmit frames only at the beginning of the slotsnodes are synchronizedif 2 or more nodes transmit within the same slot all nodes detect the collision
Operationwhen a node obtains a fresh frame it transmits in next slotif no collision occurs the node can send a new frame in the next slotif a collision occurs the node retransmits the frame in each subsequent slot with a probability p until success
5 DataLink Layer 5-25
Slotted ALOHA
Pros (advantages)a single active node can continuously transmit at the full rate of channelhighly decentralized only the slots in the nodes need to be in syncsimple
Cons (disadvantages)collisions wasting slotsidle slots due to random back offclock synchronization among nodes for the start of the slot
5 DataLink Layer 5-26
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in the slot with probability p
The probability that one node has success in a slot = p(1-p)N-1
The probability that any node has a success in a slot = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1 as N goes to infinity
max efficiency = 1e = 37
Efficiency in the long-run when there are many nodes each with many frames to send only a fraction of successful slots
At best a channel is used for useful transmissions only 37 of time
5 DataLink Layer 5-27
Pure (unslotted) ALOHAunslotted Aloha simpler as there is no synchronizationwhen a frame first arrives transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
5 DataLink Layer 5-28
Pure Aloha efficiencyP(success by given node) = P(node transmits)
P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]
= p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
hellip finding optimum p as N infinity
max efficiency = 1(2e) = 18
Even worse than slotted ALOHA
5 DataLink Layer 5-29
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmittingif the channel is sensed idle transmit the entire frameif the channel is sensed busy defer transmission
human analogy donrsquot interrupt others
can this prevents collisions
5 DataLink Layer 5-30
CSMA collisionscollisions can still occurdue to the propagation delay between nodes one node may not hear the otherrsquos transmission early enough
collisionthe entire packet transmission time is wasted (the nodes keep transmitting regardless)
spatial layout of nodes
notethe important role of distance amp propagation delay in determining collision probability
5 DataLink Layer 5-31
CSMACD (Collision Detection)CSMACD carrier sensing amp deferral as in CSMA
collisions are detected within a short timecolliding transmissions are aborted reducing the channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted and received signalsdifficult in wireless LANs receiver shut off while transmitting (hence WLAN uses collision avoidance)
human analogy the polite conversationalist
5 DataLink Layer 5-32
CSMACD collision detection
5 DataLink Layer 5-33
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high loadinefficient at low load there is delay in channel access and only 1N of the bandwidth is allocated even if there is only 1 active node
Random access MAC protocolsefficient at low load a single node can fully utilize the channelDecreasing efficiency at high load collision overhead
ldquotaking turnsrdquo protocolslook for the best of both worlds
5 DataLink Layer 5-34
ldquoTaking Turnsrdquo MAC protocolsPolling
a master node ldquoinvitesrdquo slave nodes to transmit in turnconcerns
polling overhead latencysingle point of failure (the master)
Token passinga control token is passed from one node to the next sequentiallydecentralized and efficient concerns
token overhead latencysingle point of failure
bull token not passedbull failure of one node can break
the channel
5 DataLink Layer 5-35
Summary of MAC protocolsWhat do you do with a shared medium
Channel Partitioning by time frequency or codebull Time Division Frequency Division Code Division
Random Partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard
in others (wireless)bull CSMACD used in IEEE 8023 Ethernetbull CSMACA used in IEEE 80211 WLAN
Taking Turnsbull polling from a central nodebull token passingbull Token Ring used in IEEE 8025
5 DataLink Layer 5-36
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-37
MAC Addresses and ARPIP address
network-layer address32128-bit logical address assigned to an interfaceused to get the datagram to the destination IP subnethierarchical structure
MAC (or LAN or physical or Ethernet) addresslink-layer addressunique 48-bit physical address burned in the adapterrsquos ROMused to get the frame from one to another physically-connected interfaces (within the same network)flat structure
5 DataLink Layer 5-38
LAN Addresses and ARPEach adapter on the LAN has a unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
5 DataLink Layer 5-39
LAN Address (more)MAC address allocation is administered by IEEEmanufacturer buys portion of MAC address space (16 million block) in order to assure uniquenessAnalogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC is a flat address insures portability can move the same adapter from one LAN to another
IP hierarchical address is NOT portabledepends on the IP subnet to which node is attached to
5 DataLink Layer 5-40
ARP Address Resolution ProtocolARP protocol provides IP-to-MAC translation mechanism ARP is similar to DNS except that it is used within the same subnetEach IP node (Host Router) on the LAN has an ARP tableARP Table IPMAC address mappings for someLAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time after which address mapping will be removed (typically 20 min)
Question how to determine MAC address of B knowing Brsquos IP address
Possible ARP table in node 222222222220
5 DataLink Layer 5-41
ARP protocol Same LAN (network)A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP tableA broadcasts ARP query packet containing Bs IP address
Dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP query
B receives the ARP query replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address is a standard or unicast frame
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 ldquoplug-and-playrdquonodes create their ARP tables without intervention from net administrator
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-10
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
5 DataLink Layer 5-11
Parity CheckingSingle Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
detects odd number of errorsefficient only if the bit error probability is low andor bit errors are independentbut in fact errors are dependent and occur in burstswith burst errors amp single parity bit the probability of undetected errors is ~50FEC (Forward Error Correction) can reduce the number of retransmissions with ARQ protocols
5 DataLink Layer 5-12
Internet checksum
Sendertreat segment contents as sequence of 16-bit integerschecksum addition (1rsquos complement sum) of segment contentssender puts checksum value into checksum field
Receivercompute checksum of received segmentcheck if computed checksum equals checksum field value
NO - error detectedYES - no error detected But maybe errors nonethelessMore later hellip
Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted segment (note used at transport layer only)
Checksum methods have little packet overhead However they provide relatively weak protection against errors
5 DataLink Layer 5-13
Checksumming Cyclic Redundancy Checkview data bits D as a binary numberchoose r+1 bit pattern (generator) Ggoal choose r CRC bits R such that
ltDRgt exactly divisible by G (in modulo 2 arithmetic or XOR) receiver knows G divides ltDRgt by G If non-zero remainder error is detectedcan detect all burst errors less than r+1 bits amp all odd number of errorslarger burst errors of length r can be detected with prob of 1-05^r
widely used in practice (eg ATM)
5 DataLink Layer 5-14
CRC ExampleWant
D2r XOR R = Gequivalently
D2r = G XOR R equivalently
if we divide D2r by G want remainder R
R = remainder[ ]D2r
GTransmit D2r XOR R = 10111011
5 DataLink Layer 5-15
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-16
Multiple Access Links and ProtocolsTwo types of ldquolinksrdquo
point-to-pointPPP (Point-to-Point Protocol) for dial-up accesspoint-to-point link between Ethernet switch and host
broadcast (shared wire or medium)traditional Ethernet80211 wireless LAN
5 DataLink Layer 5-17
Multiple Access protocolsconsider a single shared broadcast channel two or more simultaneous transmissions by nodes cause an interference which causes a packet collision
collision if a node receives two or more signals at the same timethe collision happens at all the nodes sharing the channelcollisions waste some of the broadcast channel bandwidth
multiple access protocoldistributed algorithm that determines how nodes can share a channel ie determine when nodes can transmitcommunication about the channel sharing must use the channel itself
no out-of-band channel for coordination
5 DataLink Layer 5-18
Ideal Multiple Access ProtocolBroadcast channel of rate R bps1 When only one node wants to transmit it
can send at rate R2 When M nodes want to transmit each can
send on average at rate RM3 Fully decentralized
no special node to coordinate transmissionsno synchronization of clocks or time-slots
4 Simple and cost-effective to implement
5 DataLink Layer 5-19
MAC Protocols a taxonomy
Three broad classesChannel Partitioning
divide the channel into smaller ldquopiecesrdquo such as time slots (eg TDMA) frequency bands (eg FDMA) codes (eg CDMA)allocate each piece to a node for exclusive use
Random Accessthe channel is not divided but shared allowing collisionsthere is a mechanism to ldquorecoverrdquo from collisions
ldquoTaking turnsrdquonodes take turns but nodes with more to send can take longer turns
5 DataLink Layer 5-20
Channel Partitioning MAC protocols TDMATDMA Time Division Multiple Access
access to channel in rounds each station gets fixed length slot (length = packet transmission time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
Two major drawbacks1 a node is limited to average BW of RN even if it is the only one 2 a node must always wait for its turn even if it is the only one
5 DataLink Layer 5-21
Channel Partitioning MAC protocols FDMAFDMA Frequency Division Multiple Access
the channel spectrum is divided into frequency bandseach station is assigned a fixed frequency bandunused transmission time in frequency bands go idlethe same limited BW drawback as the TDMAexample 6-station LAN 134 have pkt frequency bands 256 idle
freq
uenc
y ba
nds
time
5 DataLink Layer 5-22
Channel Partitioning MAC protocols CDMACDMA Code Division Multiple Access
each node is assigned a unique codeeach node uses its code to encode the data bits it sendsthe codes are orthogonal (ie different codes cancel or flatten each other at the receiver)all other signals behave as background noise to one anotherthe receiver node knows the code of the sender nodethe receiver decodes the intended signal using its sender codeall nodes can use the channel simultaneouslymay need a separate code for control signaling
drawbacks1 requires strict synchronization for codingdecoding2 fairly complex implementation
5 DataLink Layer 5-23
Random Access Protocolswhen a node has a packet to send
transmit at full channel data rate Rno a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquorandom access MAC protocol specifies
how to detect (or avoid) collisionshow to recover from collisions (eg via delayed retransmissions)
examples of random access MAC protocolsslotted ALOHApure (unslotted) ALOHACSMA CSMACD CSMACA
5 DataLink Layer 5-24
Slotted ALOHAAssumptions
all frames have the same sizetime is divided into equal size slots each equals the time to transmit 1 framenodes start to transmit frames only at the beginning of the slotsnodes are synchronizedif 2 or more nodes transmit within the same slot all nodes detect the collision
Operationwhen a node obtains a fresh frame it transmits in next slotif no collision occurs the node can send a new frame in the next slotif a collision occurs the node retransmits the frame in each subsequent slot with a probability p until success
5 DataLink Layer 5-25
Slotted ALOHA
Pros (advantages)a single active node can continuously transmit at the full rate of channelhighly decentralized only the slots in the nodes need to be in syncsimple
Cons (disadvantages)collisions wasting slotsidle slots due to random back offclock synchronization among nodes for the start of the slot
5 DataLink Layer 5-26
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in the slot with probability p
The probability that one node has success in a slot = p(1-p)N-1
The probability that any node has a success in a slot = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1 as N goes to infinity
max efficiency = 1e = 37
Efficiency in the long-run when there are many nodes each with many frames to send only a fraction of successful slots
At best a channel is used for useful transmissions only 37 of time
5 DataLink Layer 5-27
Pure (unslotted) ALOHAunslotted Aloha simpler as there is no synchronizationwhen a frame first arrives transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
5 DataLink Layer 5-28
Pure Aloha efficiencyP(success by given node) = P(node transmits)
P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]
= p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
hellip finding optimum p as N infinity
max efficiency = 1(2e) = 18
Even worse than slotted ALOHA
5 DataLink Layer 5-29
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmittingif the channel is sensed idle transmit the entire frameif the channel is sensed busy defer transmission
human analogy donrsquot interrupt others
can this prevents collisions
5 DataLink Layer 5-30
CSMA collisionscollisions can still occurdue to the propagation delay between nodes one node may not hear the otherrsquos transmission early enough
collisionthe entire packet transmission time is wasted (the nodes keep transmitting regardless)
spatial layout of nodes
notethe important role of distance amp propagation delay in determining collision probability
5 DataLink Layer 5-31
CSMACD (Collision Detection)CSMACD carrier sensing amp deferral as in CSMA
collisions are detected within a short timecolliding transmissions are aborted reducing the channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted and received signalsdifficult in wireless LANs receiver shut off while transmitting (hence WLAN uses collision avoidance)
human analogy the polite conversationalist
5 DataLink Layer 5-32
CSMACD collision detection
5 DataLink Layer 5-33
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high loadinefficient at low load there is delay in channel access and only 1N of the bandwidth is allocated even if there is only 1 active node
Random access MAC protocolsefficient at low load a single node can fully utilize the channelDecreasing efficiency at high load collision overhead
ldquotaking turnsrdquo protocolslook for the best of both worlds
5 DataLink Layer 5-34
ldquoTaking Turnsrdquo MAC protocolsPolling
a master node ldquoinvitesrdquo slave nodes to transmit in turnconcerns
polling overhead latencysingle point of failure (the master)
Token passinga control token is passed from one node to the next sequentiallydecentralized and efficient concerns
token overhead latencysingle point of failure
bull token not passedbull failure of one node can break
the channel
5 DataLink Layer 5-35
Summary of MAC protocolsWhat do you do with a shared medium
Channel Partitioning by time frequency or codebull Time Division Frequency Division Code Division
Random Partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard
in others (wireless)bull CSMACD used in IEEE 8023 Ethernetbull CSMACA used in IEEE 80211 WLAN
Taking Turnsbull polling from a central nodebull token passingbull Token Ring used in IEEE 8025
5 DataLink Layer 5-36
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-37
MAC Addresses and ARPIP address
network-layer address32128-bit logical address assigned to an interfaceused to get the datagram to the destination IP subnethierarchical structure
MAC (or LAN or physical or Ethernet) addresslink-layer addressunique 48-bit physical address burned in the adapterrsquos ROMused to get the frame from one to another physically-connected interfaces (within the same network)flat structure
5 DataLink Layer 5-38
LAN Addresses and ARPEach adapter on the LAN has a unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
5 DataLink Layer 5-39
LAN Address (more)MAC address allocation is administered by IEEEmanufacturer buys portion of MAC address space (16 million block) in order to assure uniquenessAnalogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC is a flat address insures portability can move the same adapter from one LAN to another
IP hierarchical address is NOT portabledepends on the IP subnet to which node is attached to
5 DataLink Layer 5-40
ARP Address Resolution ProtocolARP protocol provides IP-to-MAC translation mechanism ARP is similar to DNS except that it is used within the same subnetEach IP node (Host Router) on the LAN has an ARP tableARP Table IPMAC address mappings for someLAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time after which address mapping will be removed (typically 20 min)
Question how to determine MAC address of B knowing Brsquos IP address
Possible ARP table in node 222222222220
5 DataLink Layer 5-41
ARP protocol Same LAN (network)A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP tableA broadcasts ARP query packet containing Bs IP address
Dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP query
B receives the ARP query replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address is a standard or unicast frame
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 ldquoplug-and-playrdquonodes create their ARP tables without intervention from net administrator
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-11
Parity CheckingSingle Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
detects odd number of errorsefficient only if the bit error probability is low andor bit errors are independentbut in fact errors are dependent and occur in burstswith burst errors amp single parity bit the probability of undetected errors is ~50FEC (Forward Error Correction) can reduce the number of retransmissions with ARQ protocols
5 DataLink Layer 5-12
Internet checksum
Sendertreat segment contents as sequence of 16-bit integerschecksum addition (1rsquos complement sum) of segment contentssender puts checksum value into checksum field
Receivercompute checksum of received segmentcheck if computed checksum equals checksum field value
NO - error detectedYES - no error detected But maybe errors nonethelessMore later hellip
Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted segment (note used at transport layer only)
Checksum methods have little packet overhead However they provide relatively weak protection against errors
5 DataLink Layer 5-13
Checksumming Cyclic Redundancy Checkview data bits D as a binary numberchoose r+1 bit pattern (generator) Ggoal choose r CRC bits R such that
ltDRgt exactly divisible by G (in modulo 2 arithmetic or XOR) receiver knows G divides ltDRgt by G If non-zero remainder error is detectedcan detect all burst errors less than r+1 bits amp all odd number of errorslarger burst errors of length r can be detected with prob of 1-05^r
widely used in practice (eg ATM)
5 DataLink Layer 5-14
CRC ExampleWant
D2r XOR R = Gequivalently
D2r = G XOR R equivalently
if we divide D2r by G want remainder R
R = remainder[ ]D2r
GTransmit D2r XOR R = 10111011
5 DataLink Layer 5-15
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-16
Multiple Access Links and ProtocolsTwo types of ldquolinksrdquo
point-to-pointPPP (Point-to-Point Protocol) for dial-up accesspoint-to-point link between Ethernet switch and host
broadcast (shared wire or medium)traditional Ethernet80211 wireless LAN
5 DataLink Layer 5-17
Multiple Access protocolsconsider a single shared broadcast channel two or more simultaneous transmissions by nodes cause an interference which causes a packet collision
collision if a node receives two or more signals at the same timethe collision happens at all the nodes sharing the channelcollisions waste some of the broadcast channel bandwidth
multiple access protocoldistributed algorithm that determines how nodes can share a channel ie determine when nodes can transmitcommunication about the channel sharing must use the channel itself
no out-of-band channel for coordination
5 DataLink Layer 5-18
Ideal Multiple Access ProtocolBroadcast channel of rate R bps1 When only one node wants to transmit it
can send at rate R2 When M nodes want to transmit each can
send on average at rate RM3 Fully decentralized
no special node to coordinate transmissionsno synchronization of clocks or time-slots
4 Simple and cost-effective to implement
5 DataLink Layer 5-19
MAC Protocols a taxonomy
Three broad classesChannel Partitioning
divide the channel into smaller ldquopiecesrdquo such as time slots (eg TDMA) frequency bands (eg FDMA) codes (eg CDMA)allocate each piece to a node for exclusive use
Random Accessthe channel is not divided but shared allowing collisionsthere is a mechanism to ldquorecoverrdquo from collisions
ldquoTaking turnsrdquonodes take turns but nodes with more to send can take longer turns
5 DataLink Layer 5-20
Channel Partitioning MAC protocols TDMATDMA Time Division Multiple Access
access to channel in rounds each station gets fixed length slot (length = packet transmission time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
Two major drawbacks1 a node is limited to average BW of RN even if it is the only one 2 a node must always wait for its turn even if it is the only one
5 DataLink Layer 5-21
Channel Partitioning MAC protocols FDMAFDMA Frequency Division Multiple Access
the channel spectrum is divided into frequency bandseach station is assigned a fixed frequency bandunused transmission time in frequency bands go idlethe same limited BW drawback as the TDMAexample 6-station LAN 134 have pkt frequency bands 256 idle
freq
uenc
y ba
nds
time
5 DataLink Layer 5-22
Channel Partitioning MAC protocols CDMACDMA Code Division Multiple Access
each node is assigned a unique codeeach node uses its code to encode the data bits it sendsthe codes are orthogonal (ie different codes cancel or flatten each other at the receiver)all other signals behave as background noise to one anotherthe receiver node knows the code of the sender nodethe receiver decodes the intended signal using its sender codeall nodes can use the channel simultaneouslymay need a separate code for control signaling
drawbacks1 requires strict synchronization for codingdecoding2 fairly complex implementation
5 DataLink Layer 5-23
Random Access Protocolswhen a node has a packet to send
transmit at full channel data rate Rno a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquorandom access MAC protocol specifies
how to detect (or avoid) collisionshow to recover from collisions (eg via delayed retransmissions)
examples of random access MAC protocolsslotted ALOHApure (unslotted) ALOHACSMA CSMACD CSMACA
5 DataLink Layer 5-24
Slotted ALOHAAssumptions
all frames have the same sizetime is divided into equal size slots each equals the time to transmit 1 framenodes start to transmit frames only at the beginning of the slotsnodes are synchronizedif 2 or more nodes transmit within the same slot all nodes detect the collision
Operationwhen a node obtains a fresh frame it transmits in next slotif no collision occurs the node can send a new frame in the next slotif a collision occurs the node retransmits the frame in each subsequent slot with a probability p until success
5 DataLink Layer 5-25
Slotted ALOHA
Pros (advantages)a single active node can continuously transmit at the full rate of channelhighly decentralized only the slots in the nodes need to be in syncsimple
Cons (disadvantages)collisions wasting slotsidle slots due to random back offclock synchronization among nodes for the start of the slot
5 DataLink Layer 5-26
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in the slot with probability p
The probability that one node has success in a slot = p(1-p)N-1
The probability that any node has a success in a slot = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1 as N goes to infinity
max efficiency = 1e = 37
Efficiency in the long-run when there are many nodes each with many frames to send only a fraction of successful slots
At best a channel is used for useful transmissions only 37 of time
5 DataLink Layer 5-27
Pure (unslotted) ALOHAunslotted Aloha simpler as there is no synchronizationwhen a frame first arrives transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
5 DataLink Layer 5-28
Pure Aloha efficiencyP(success by given node) = P(node transmits)
P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]
= p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
hellip finding optimum p as N infinity
max efficiency = 1(2e) = 18
Even worse than slotted ALOHA
5 DataLink Layer 5-29
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmittingif the channel is sensed idle transmit the entire frameif the channel is sensed busy defer transmission
human analogy donrsquot interrupt others
can this prevents collisions
5 DataLink Layer 5-30
CSMA collisionscollisions can still occurdue to the propagation delay between nodes one node may not hear the otherrsquos transmission early enough
collisionthe entire packet transmission time is wasted (the nodes keep transmitting regardless)
spatial layout of nodes
notethe important role of distance amp propagation delay in determining collision probability
5 DataLink Layer 5-31
CSMACD (Collision Detection)CSMACD carrier sensing amp deferral as in CSMA
collisions are detected within a short timecolliding transmissions are aborted reducing the channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted and received signalsdifficult in wireless LANs receiver shut off while transmitting (hence WLAN uses collision avoidance)
human analogy the polite conversationalist
5 DataLink Layer 5-32
CSMACD collision detection
5 DataLink Layer 5-33
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high loadinefficient at low load there is delay in channel access and only 1N of the bandwidth is allocated even if there is only 1 active node
Random access MAC protocolsefficient at low load a single node can fully utilize the channelDecreasing efficiency at high load collision overhead
ldquotaking turnsrdquo protocolslook for the best of both worlds
5 DataLink Layer 5-34
ldquoTaking Turnsrdquo MAC protocolsPolling
a master node ldquoinvitesrdquo slave nodes to transmit in turnconcerns
polling overhead latencysingle point of failure (the master)
Token passinga control token is passed from one node to the next sequentiallydecentralized and efficient concerns
token overhead latencysingle point of failure
bull token not passedbull failure of one node can break
the channel
5 DataLink Layer 5-35
Summary of MAC protocolsWhat do you do with a shared medium
Channel Partitioning by time frequency or codebull Time Division Frequency Division Code Division
Random Partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard
in others (wireless)bull CSMACD used in IEEE 8023 Ethernetbull CSMACA used in IEEE 80211 WLAN
Taking Turnsbull polling from a central nodebull token passingbull Token Ring used in IEEE 8025
5 DataLink Layer 5-36
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-37
MAC Addresses and ARPIP address
network-layer address32128-bit logical address assigned to an interfaceused to get the datagram to the destination IP subnethierarchical structure
MAC (or LAN or physical or Ethernet) addresslink-layer addressunique 48-bit physical address burned in the adapterrsquos ROMused to get the frame from one to another physically-connected interfaces (within the same network)flat structure
5 DataLink Layer 5-38
LAN Addresses and ARPEach adapter on the LAN has a unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
5 DataLink Layer 5-39
LAN Address (more)MAC address allocation is administered by IEEEmanufacturer buys portion of MAC address space (16 million block) in order to assure uniquenessAnalogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC is a flat address insures portability can move the same adapter from one LAN to another
IP hierarchical address is NOT portabledepends on the IP subnet to which node is attached to
5 DataLink Layer 5-40
ARP Address Resolution ProtocolARP protocol provides IP-to-MAC translation mechanism ARP is similar to DNS except that it is used within the same subnetEach IP node (Host Router) on the LAN has an ARP tableARP Table IPMAC address mappings for someLAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time after which address mapping will be removed (typically 20 min)
Question how to determine MAC address of B knowing Brsquos IP address
Possible ARP table in node 222222222220
5 DataLink Layer 5-41
ARP protocol Same LAN (network)A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP tableA broadcasts ARP query packet containing Bs IP address
Dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP query
B receives the ARP query replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address is a standard or unicast frame
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 ldquoplug-and-playrdquonodes create their ARP tables without intervention from net administrator
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-12
Internet checksum
Sendertreat segment contents as sequence of 16-bit integerschecksum addition (1rsquos complement sum) of segment contentssender puts checksum value into checksum field
Receivercompute checksum of received segmentcheck if computed checksum equals checksum field value
NO - error detectedYES - no error detected But maybe errors nonethelessMore later hellip
Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted segment (note used at transport layer only)
Checksum methods have little packet overhead However they provide relatively weak protection against errors
5 DataLink Layer 5-13
Checksumming Cyclic Redundancy Checkview data bits D as a binary numberchoose r+1 bit pattern (generator) Ggoal choose r CRC bits R such that
ltDRgt exactly divisible by G (in modulo 2 arithmetic or XOR) receiver knows G divides ltDRgt by G If non-zero remainder error is detectedcan detect all burst errors less than r+1 bits amp all odd number of errorslarger burst errors of length r can be detected with prob of 1-05^r
widely used in practice (eg ATM)
5 DataLink Layer 5-14
CRC ExampleWant
D2r XOR R = Gequivalently
D2r = G XOR R equivalently
if we divide D2r by G want remainder R
R = remainder[ ]D2r
GTransmit D2r XOR R = 10111011
5 DataLink Layer 5-15
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-16
Multiple Access Links and ProtocolsTwo types of ldquolinksrdquo
point-to-pointPPP (Point-to-Point Protocol) for dial-up accesspoint-to-point link between Ethernet switch and host
broadcast (shared wire or medium)traditional Ethernet80211 wireless LAN
5 DataLink Layer 5-17
Multiple Access protocolsconsider a single shared broadcast channel two or more simultaneous transmissions by nodes cause an interference which causes a packet collision
collision if a node receives two or more signals at the same timethe collision happens at all the nodes sharing the channelcollisions waste some of the broadcast channel bandwidth
multiple access protocoldistributed algorithm that determines how nodes can share a channel ie determine when nodes can transmitcommunication about the channel sharing must use the channel itself
no out-of-band channel for coordination
5 DataLink Layer 5-18
Ideal Multiple Access ProtocolBroadcast channel of rate R bps1 When only one node wants to transmit it
can send at rate R2 When M nodes want to transmit each can
send on average at rate RM3 Fully decentralized
no special node to coordinate transmissionsno synchronization of clocks or time-slots
4 Simple and cost-effective to implement
5 DataLink Layer 5-19
MAC Protocols a taxonomy
Three broad classesChannel Partitioning
divide the channel into smaller ldquopiecesrdquo such as time slots (eg TDMA) frequency bands (eg FDMA) codes (eg CDMA)allocate each piece to a node for exclusive use
Random Accessthe channel is not divided but shared allowing collisionsthere is a mechanism to ldquorecoverrdquo from collisions
ldquoTaking turnsrdquonodes take turns but nodes with more to send can take longer turns
5 DataLink Layer 5-20
Channel Partitioning MAC protocols TDMATDMA Time Division Multiple Access
access to channel in rounds each station gets fixed length slot (length = packet transmission time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
Two major drawbacks1 a node is limited to average BW of RN even if it is the only one 2 a node must always wait for its turn even if it is the only one
5 DataLink Layer 5-21
Channel Partitioning MAC protocols FDMAFDMA Frequency Division Multiple Access
the channel spectrum is divided into frequency bandseach station is assigned a fixed frequency bandunused transmission time in frequency bands go idlethe same limited BW drawback as the TDMAexample 6-station LAN 134 have pkt frequency bands 256 idle
freq
uenc
y ba
nds
time
5 DataLink Layer 5-22
Channel Partitioning MAC protocols CDMACDMA Code Division Multiple Access
each node is assigned a unique codeeach node uses its code to encode the data bits it sendsthe codes are orthogonal (ie different codes cancel or flatten each other at the receiver)all other signals behave as background noise to one anotherthe receiver node knows the code of the sender nodethe receiver decodes the intended signal using its sender codeall nodes can use the channel simultaneouslymay need a separate code for control signaling
drawbacks1 requires strict synchronization for codingdecoding2 fairly complex implementation
5 DataLink Layer 5-23
Random Access Protocolswhen a node has a packet to send
transmit at full channel data rate Rno a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquorandom access MAC protocol specifies
how to detect (or avoid) collisionshow to recover from collisions (eg via delayed retransmissions)
examples of random access MAC protocolsslotted ALOHApure (unslotted) ALOHACSMA CSMACD CSMACA
5 DataLink Layer 5-24
Slotted ALOHAAssumptions
all frames have the same sizetime is divided into equal size slots each equals the time to transmit 1 framenodes start to transmit frames only at the beginning of the slotsnodes are synchronizedif 2 or more nodes transmit within the same slot all nodes detect the collision
Operationwhen a node obtains a fresh frame it transmits in next slotif no collision occurs the node can send a new frame in the next slotif a collision occurs the node retransmits the frame in each subsequent slot with a probability p until success
5 DataLink Layer 5-25
Slotted ALOHA
Pros (advantages)a single active node can continuously transmit at the full rate of channelhighly decentralized only the slots in the nodes need to be in syncsimple
Cons (disadvantages)collisions wasting slotsidle slots due to random back offclock synchronization among nodes for the start of the slot
5 DataLink Layer 5-26
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in the slot with probability p
The probability that one node has success in a slot = p(1-p)N-1
The probability that any node has a success in a slot = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1 as N goes to infinity
max efficiency = 1e = 37
Efficiency in the long-run when there are many nodes each with many frames to send only a fraction of successful slots
At best a channel is used for useful transmissions only 37 of time
5 DataLink Layer 5-27
Pure (unslotted) ALOHAunslotted Aloha simpler as there is no synchronizationwhen a frame first arrives transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
5 DataLink Layer 5-28
Pure Aloha efficiencyP(success by given node) = P(node transmits)
P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]
= p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
hellip finding optimum p as N infinity
max efficiency = 1(2e) = 18
Even worse than slotted ALOHA
5 DataLink Layer 5-29
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmittingif the channel is sensed idle transmit the entire frameif the channel is sensed busy defer transmission
human analogy donrsquot interrupt others
can this prevents collisions
5 DataLink Layer 5-30
CSMA collisionscollisions can still occurdue to the propagation delay between nodes one node may not hear the otherrsquos transmission early enough
collisionthe entire packet transmission time is wasted (the nodes keep transmitting regardless)
spatial layout of nodes
notethe important role of distance amp propagation delay in determining collision probability
5 DataLink Layer 5-31
CSMACD (Collision Detection)CSMACD carrier sensing amp deferral as in CSMA
collisions are detected within a short timecolliding transmissions are aborted reducing the channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted and received signalsdifficult in wireless LANs receiver shut off while transmitting (hence WLAN uses collision avoidance)
human analogy the polite conversationalist
5 DataLink Layer 5-32
CSMACD collision detection
5 DataLink Layer 5-33
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high loadinefficient at low load there is delay in channel access and only 1N of the bandwidth is allocated even if there is only 1 active node
Random access MAC protocolsefficient at low load a single node can fully utilize the channelDecreasing efficiency at high load collision overhead
ldquotaking turnsrdquo protocolslook for the best of both worlds
5 DataLink Layer 5-34
ldquoTaking Turnsrdquo MAC protocolsPolling
a master node ldquoinvitesrdquo slave nodes to transmit in turnconcerns
polling overhead latencysingle point of failure (the master)
Token passinga control token is passed from one node to the next sequentiallydecentralized and efficient concerns
token overhead latencysingle point of failure
bull token not passedbull failure of one node can break
the channel
5 DataLink Layer 5-35
Summary of MAC protocolsWhat do you do with a shared medium
Channel Partitioning by time frequency or codebull Time Division Frequency Division Code Division
Random Partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard
in others (wireless)bull CSMACD used in IEEE 8023 Ethernetbull CSMACA used in IEEE 80211 WLAN
Taking Turnsbull polling from a central nodebull token passingbull Token Ring used in IEEE 8025
5 DataLink Layer 5-36
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-37
MAC Addresses and ARPIP address
network-layer address32128-bit logical address assigned to an interfaceused to get the datagram to the destination IP subnethierarchical structure
MAC (or LAN or physical or Ethernet) addresslink-layer addressunique 48-bit physical address burned in the adapterrsquos ROMused to get the frame from one to another physically-connected interfaces (within the same network)flat structure
5 DataLink Layer 5-38
LAN Addresses and ARPEach adapter on the LAN has a unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
5 DataLink Layer 5-39
LAN Address (more)MAC address allocation is administered by IEEEmanufacturer buys portion of MAC address space (16 million block) in order to assure uniquenessAnalogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC is a flat address insures portability can move the same adapter from one LAN to another
IP hierarchical address is NOT portabledepends on the IP subnet to which node is attached to
5 DataLink Layer 5-40
ARP Address Resolution ProtocolARP protocol provides IP-to-MAC translation mechanism ARP is similar to DNS except that it is used within the same subnetEach IP node (Host Router) on the LAN has an ARP tableARP Table IPMAC address mappings for someLAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time after which address mapping will be removed (typically 20 min)
Question how to determine MAC address of B knowing Brsquos IP address
Possible ARP table in node 222222222220
5 DataLink Layer 5-41
ARP protocol Same LAN (network)A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP tableA broadcasts ARP query packet containing Bs IP address
Dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP query
B receives the ARP query replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address is a standard or unicast frame
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 ldquoplug-and-playrdquonodes create their ARP tables without intervention from net administrator
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-13
Checksumming Cyclic Redundancy Checkview data bits D as a binary numberchoose r+1 bit pattern (generator) Ggoal choose r CRC bits R such that
ltDRgt exactly divisible by G (in modulo 2 arithmetic or XOR) receiver knows G divides ltDRgt by G If non-zero remainder error is detectedcan detect all burst errors less than r+1 bits amp all odd number of errorslarger burst errors of length r can be detected with prob of 1-05^r
widely used in practice (eg ATM)
5 DataLink Layer 5-14
CRC ExampleWant
D2r XOR R = Gequivalently
D2r = G XOR R equivalently
if we divide D2r by G want remainder R
R = remainder[ ]D2r
GTransmit D2r XOR R = 10111011
5 DataLink Layer 5-15
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-16
Multiple Access Links and ProtocolsTwo types of ldquolinksrdquo
point-to-pointPPP (Point-to-Point Protocol) for dial-up accesspoint-to-point link between Ethernet switch and host
broadcast (shared wire or medium)traditional Ethernet80211 wireless LAN
5 DataLink Layer 5-17
Multiple Access protocolsconsider a single shared broadcast channel two or more simultaneous transmissions by nodes cause an interference which causes a packet collision
collision if a node receives two or more signals at the same timethe collision happens at all the nodes sharing the channelcollisions waste some of the broadcast channel bandwidth
multiple access protocoldistributed algorithm that determines how nodes can share a channel ie determine when nodes can transmitcommunication about the channel sharing must use the channel itself
no out-of-band channel for coordination
5 DataLink Layer 5-18
Ideal Multiple Access ProtocolBroadcast channel of rate R bps1 When only one node wants to transmit it
can send at rate R2 When M nodes want to transmit each can
send on average at rate RM3 Fully decentralized
no special node to coordinate transmissionsno synchronization of clocks or time-slots
4 Simple and cost-effective to implement
5 DataLink Layer 5-19
MAC Protocols a taxonomy
Three broad classesChannel Partitioning
divide the channel into smaller ldquopiecesrdquo such as time slots (eg TDMA) frequency bands (eg FDMA) codes (eg CDMA)allocate each piece to a node for exclusive use
Random Accessthe channel is not divided but shared allowing collisionsthere is a mechanism to ldquorecoverrdquo from collisions
ldquoTaking turnsrdquonodes take turns but nodes with more to send can take longer turns
5 DataLink Layer 5-20
Channel Partitioning MAC protocols TDMATDMA Time Division Multiple Access
access to channel in rounds each station gets fixed length slot (length = packet transmission time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
Two major drawbacks1 a node is limited to average BW of RN even if it is the only one 2 a node must always wait for its turn even if it is the only one
5 DataLink Layer 5-21
Channel Partitioning MAC protocols FDMAFDMA Frequency Division Multiple Access
the channel spectrum is divided into frequency bandseach station is assigned a fixed frequency bandunused transmission time in frequency bands go idlethe same limited BW drawback as the TDMAexample 6-station LAN 134 have pkt frequency bands 256 idle
freq
uenc
y ba
nds
time
5 DataLink Layer 5-22
Channel Partitioning MAC protocols CDMACDMA Code Division Multiple Access
each node is assigned a unique codeeach node uses its code to encode the data bits it sendsthe codes are orthogonal (ie different codes cancel or flatten each other at the receiver)all other signals behave as background noise to one anotherthe receiver node knows the code of the sender nodethe receiver decodes the intended signal using its sender codeall nodes can use the channel simultaneouslymay need a separate code for control signaling
drawbacks1 requires strict synchronization for codingdecoding2 fairly complex implementation
5 DataLink Layer 5-23
Random Access Protocolswhen a node has a packet to send
transmit at full channel data rate Rno a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquorandom access MAC protocol specifies
how to detect (or avoid) collisionshow to recover from collisions (eg via delayed retransmissions)
examples of random access MAC protocolsslotted ALOHApure (unslotted) ALOHACSMA CSMACD CSMACA
5 DataLink Layer 5-24
Slotted ALOHAAssumptions
all frames have the same sizetime is divided into equal size slots each equals the time to transmit 1 framenodes start to transmit frames only at the beginning of the slotsnodes are synchronizedif 2 or more nodes transmit within the same slot all nodes detect the collision
Operationwhen a node obtains a fresh frame it transmits in next slotif no collision occurs the node can send a new frame in the next slotif a collision occurs the node retransmits the frame in each subsequent slot with a probability p until success
5 DataLink Layer 5-25
Slotted ALOHA
Pros (advantages)a single active node can continuously transmit at the full rate of channelhighly decentralized only the slots in the nodes need to be in syncsimple
Cons (disadvantages)collisions wasting slotsidle slots due to random back offclock synchronization among nodes for the start of the slot
5 DataLink Layer 5-26
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in the slot with probability p
The probability that one node has success in a slot = p(1-p)N-1
The probability that any node has a success in a slot = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1 as N goes to infinity
max efficiency = 1e = 37
Efficiency in the long-run when there are many nodes each with many frames to send only a fraction of successful slots
At best a channel is used for useful transmissions only 37 of time
5 DataLink Layer 5-27
Pure (unslotted) ALOHAunslotted Aloha simpler as there is no synchronizationwhen a frame first arrives transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
5 DataLink Layer 5-28
Pure Aloha efficiencyP(success by given node) = P(node transmits)
P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]
= p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
hellip finding optimum p as N infinity
max efficiency = 1(2e) = 18
Even worse than slotted ALOHA
5 DataLink Layer 5-29
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmittingif the channel is sensed idle transmit the entire frameif the channel is sensed busy defer transmission
human analogy donrsquot interrupt others
can this prevents collisions
5 DataLink Layer 5-30
CSMA collisionscollisions can still occurdue to the propagation delay between nodes one node may not hear the otherrsquos transmission early enough
collisionthe entire packet transmission time is wasted (the nodes keep transmitting regardless)
spatial layout of nodes
notethe important role of distance amp propagation delay in determining collision probability
5 DataLink Layer 5-31
CSMACD (Collision Detection)CSMACD carrier sensing amp deferral as in CSMA
collisions are detected within a short timecolliding transmissions are aborted reducing the channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted and received signalsdifficult in wireless LANs receiver shut off while transmitting (hence WLAN uses collision avoidance)
human analogy the polite conversationalist
5 DataLink Layer 5-32
CSMACD collision detection
5 DataLink Layer 5-33
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high loadinefficient at low load there is delay in channel access and only 1N of the bandwidth is allocated even if there is only 1 active node
Random access MAC protocolsefficient at low load a single node can fully utilize the channelDecreasing efficiency at high load collision overhead
ldquotaking turnsrdquo protocolslook for the best of both worlds
5 DataLink Layer 5-34
ldquoTaking Turnsrdquo MAC protocolsPolling
a master node ldquoinvitesrdquo slave nodes to transmit in turnconcerns
polling overhead latencysingle point of failure (the master)
Token passinga control token is passed from one node to the next sequentiallydecentralized and efficient concerns
token overhead latencysingle point of failure
bull token not passedbull failure of one node can break
the channel
5 DataLink Layer 5-35
Summary of MAC protocolsWhat do you do with a shared medium
Channel Partitioning by time frequency or codebull Time Division Frequency Division Code Division
Random Partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard
in others (wireless)bull CSMACD used in IEEE 8023 Ethernetbull CSMACA used in IEEE 80211 WLAN
Taking Turnsbull polling from a central nodebull token passingbull Token Ring used in IEEE 8025
5 DataLink Layer 5-36
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-37
MAC Addresses and ARPIP address
network-layer address32128-bit logical address assigned to an interfaceused to get the datagram to the destination IP subnethierarchical structure
MAC (or LAN or physical or Ethernet) addresslink-layer addressunique 48-bit physical address burned in the adapterrsquos ROMused to get the frame from one to another physically-connected interfaces (within the same network)flat structure
5 DataLink Layer 5-38
LAN Addresses and ARPEach adapter on the LAN has a unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
5 DataLink Layer 5-39
LAN Address (more)MAC address allocation is administered by IEEEmanufacturer buys portion of MAC address space (16 million block) in order to assure uniquenessAnalogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC is a flat address insures portability can move the same adapter from one LAN to another
IP hierarchical address is NOT portabledepends on the IP subnet to which node is attached to
5 DataLink Layer 5-40
ARP Address Resolution ProtocolARP protocol provides IP-to-MAC translation mechanism ARP is similar to DNS except that it is used within the same subnetEach IP node (Host Router) on the LAN has an ARP tableARP Table IPMAC address mappings for someLAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time after which address mapping will be removed (typically 20 min)
Question how to determine MAC address of B knowing Brsquos IP address
Possible ARP table in node 222222222220
5 DataLink Layer 5-41
ARP protocol Same LAN (network)A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP tableA broadcasts ARP query packet containing Bs IP address
Dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP query
B receives the ARP query replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address is a standard or unicast frame
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 ldquoplug-and-playrdquonodes create their ARP tables without intervention from net administrator
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-14
CRC ExampleWant
D2r XOR R = Gequivalently
D2r = G XOR R equivalently
if we divide D2r by G want remainder R
R = remainder[ ]D2r
GTransmit D2r XOR R = 10111011
5 DataLink Layer 5-15
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-16
Multiple Access Links and ProtocolsTwo types of ldquolinksrdquo
point-to-pointPPP (Point-to-Point Protocol) for dial-up accesspoint-to-point link between Ethernet switch and host
broadcast (shared wire or medium)traditional Ethernet80211 wireless LAN
5 DataLink Layer 5-17
Multiple Access protocolsconsider a single shared broadcast channel two or more simultaneous transmissions by nodes cause an interference which causes a packet collision
collision if a node receives two or more signals at the same timethe collision happens at all the nodes sharing the channelcollisions waste some of the broadcast channel bandwidth
multiple access protocoldistributed algorithm that determines how nodes can share a channel ie determine when nodes can transmitcommunication about the channel sharing must use the channel itself
no out-of-band channel for coordination
5 DataLink Layer 5-18
Ideal Multiple Access ProtocolBroadcast channel of rate R bps1 When only one node wants to transmit it
can send at rate R2 When M nodes want to transmit each can
send on average at rate RM3 Fully decentralized
no special node to coordinate transmissionsno synchronization of clocks or time-slots
4 Simple and cost-effective to implement
5 DataLink Layer 5-19
MAC Protocols a taxonomy
Three broad classesChannel Partitioning
divide the channel into smaller ldquopiecesrdquo such as time slots (eg TDMA) frequency bands (eg FDMA) codes (eg CDMA)allocate each piece to a node for exclusive use
Random Accessthe channel is not divided but shared allowing collisionsthere is a mechanism to ldquorecoverrdquo from collisions
ldquoTaking turnsrdquonodes take turns but nodes with more to send can take longer turns
5 DataLink Layer 5-20
Channel Partitioning MAC protocols TDMATDMA Time Division Multiple Access
access to channel in rounds each station gets fixed length slot (length = packet transmission time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
Two major drawbacks1 a node is limited to average BW of RN even if it is the only one 2 a node must always wait for its turn even if it is the only one
5 DataLink Layer 5-21
Channel Partitioning MAC protocols FDMAFDMA Frequency Division Multiple Access
the channel spectrum is divided into frequency bandseach station is assigned a fixed frequency bandunused transmission time in frequency bands go idlethe same limited BW drawback as the TDMAexample 6-station LAN 134 have pkt frequency bands 256 idle
freq
uenc
y ba
nds
time
5 DataLink Layer 5-22
Channel Partitioning MAC protocols CDMACDMA Code Division Multiple Access
each node is assigned a unique codeeach node uses its code to encode the data bits it sendsthe codes are orthogonal (ie different codes cancel or flatten each other at the receiver)all other signals behave as background noise to one anotherthe receiver node knows the code of the sender nodethe receiver decodes the intended signal using its sender codeall nodes can use the channel simultaneouslymay need a separate code for control signaling
drawbacks1 requires strict synchronization for codingdecoding2 fairly complex implementation
5 DataLink Layer 5-23
Random Access Protocolswhen a node has a packet to send
transmit at full channel data rate Rno a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquorandom access MAC protocol specifies
how to detect (or avoid) collisionshow to recover from collisions (eg via delayed retransmissions)
examples of random access MAC protocolsslotted ALOHApure (unslotted) ALOHACSMA CSMACD CSMACA
5 DataLink Layer 5-24
Slotted ALOHAAssumptions
all frames have the same sizetime is divided into equal size slots each equals the time to transmit 1 framenodes start to transmit frames only at the beginning of the slotsnodes are synchronizedif 2 or more nodes transmit within the same slot all nodes detect the collision
Operationwhen a node obtains a fresh frame it transmits in next slotif no collision occurs the node can send a new frame in the next slotif a collision occurs the node retransmits the frame in each subsequent slot with a probability p until success
5 DataLink Layer 5-25
Slotted ALOHA
Pros (advantages)a single active node can continuously transmit at the full rate of channelhighly decentralized only the slots in the nodes need to be in syncsimple
Cons (disadvantages)collisions wasting slotsidle slots due to random back offclock synchronization among nodes for the start of the slot
5 DataLink Layer 5-26
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in the slot with probability p
The probability that one node has success in a slot = p(1-p)N-1
The probability that any node has a success in a slot = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1 as N goes to infinity
max efficiency = 1e = 37
Efficiency in the long-run when there are many nodes each with many frames to send only a fraction of successful slots
At best a channel is used for useful transmissions only 37 of time
5 DataLink Layer 5-27
Pure (unslotted) ALOHAunslotted Aloha simpler as there is no synchronizationwhen a frame first arrives transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
5 DataLink Layer 5-28
Pure Aloha efficiencyP(success by given node) = P(node transmits)
P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]
= p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
hellip finding optimum p as N infinity
max efficiency = 1(2e) = 18
Even worse than slotted ALOHA
5 DataLink Layer 5-29
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmittingif the channel is sensed idle transmit the entire frameif the channel is sensed busy defer transmission
human analogy donrsquot interrupt others
can this prevents collisions
5 DataLink Layer 5-30
CSMA collisionscollisions can still occurdue to the propagation delay between nodes one node may not hear the otherrsquos transmission early enough
collisionthe entire packet transmission time is wasted (the nodes keep transmitting regardless)
spatial layout of nodes
notethe important role of distance amp propagation delay in determining collision probability
5 DataLink Layer 5-31
CSMACD (Collision Detection)CSMACD carrier sensing amp deferral as in CSMA
collisions are detected within a short timecolliding transmissions are aborted reducing the channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted and received signalsdifficult in wireless LANs receiver shut off while transmitting (hence WLAN uses collision avoidance)
human analogy the polite conversationalist
5 DataLink Layer 5-32
CSMACD collision detection
5 DataLink Layer 5-33
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high loadinefficient at low load there is delay in channel access and only 1N of the bandwidth is allocated even if there is only 1 active node
Random access MAC protocolsefficient at low load a single node can fully utilize the channelDecreasing efficiency at high load collision overhead
ldquotaking turnsrdquo protocolslook for the best of both worlds
5 DataLink Layer 5-34
ldquoTaking Turnsrdquo MAC protocolsPolling
a master node ldquoinvitesrdquo slave nodes to transmit in turnconcerns
polling overhead latencysingle point of failure (the master)
Token passinga control token is passed from one node to the next sequentiallydecentralized and efficient concerns
token overhead latencysingle point of failure
bull token not passedbull failure of one node can break
the channel
5 DataLink Layer 5-35
Summary of MAC protocolsWhat do you do with a shared medium
Channel Partitioning by time frequency or codebull Time Division Frequency Division Code Division
Random Partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard
in others (wireless)bull CSMACD used in IEEE 8023 Ethernetbull CSMACA used in IEEE 80211 WLAN
Taking Turnsbull polling from a central nodebull token passingbull Token Ring used in IEEE 8025
5 DataLink Layer 5-36
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-37
MAC Addresses and ARPIP address
network-layer address32128-bit logical address assigned to an interfaceused to get the datagram to the destination IP subnethierarchical structure
MAC (or LAN or physical or Ethernet) addresslink-layer addressunique 48-bit physical address burned in the adapterrsquos ROMused to get the frame from one to another physically-connected interfaces (within the same network)flat structure
5 DataLink Layer 5-38
LAN Addresses and ARPEach adapter on the LAN has a unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
5 DataLink Layer 5-39
LAN Address (more)MAC address allocation is administered by IEEEmanufacturer buys portion of MAC address space (16 million block) in order to assure uniquenessAnalogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC is a flat address insures portability can move the same adapter from one LAN to another
IP hierarchical address is NOT portabledepends on the IP subnet to which node is attached to
5 DataLink Layer 5-40
ARP Address Resolution ProtocolARP protocol provides IP-to-MAC translation mechanism ARP is similar to DNS except that it is used within the same subnetEach IP node (Host Router) on the LAN has an ARP tableARP Table IPMAC address mappings for someLAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time after which address mapping will be removed (typically 20 min)
Question how to determine MAC address of B knowing Brsquos IP address
Possible ARP table in node 222222222220
5 DataLink Layer 5-41
ARP protocol Same LAN (network)A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP tableA broadcasts ARP query packet containing Bs IP address
Dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP query
B receives the ARP query replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address is a standard or unicast frame
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 ldquoplug-and-playrdquonodes create their ARP tables without intervention from net administrator
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-15
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-16
Multiple Access Links and ProtocolsTwo types of ldquolinksrdquo
point-to-pointPPP (Point-to-Point Protocol) for dial-up accesspoint-to-point link between Ethernet switch and host
broadcast (shared wire or medium)traditional Ethernet80211 wireless LAN
5 DataLink Layer 5-17
Multiple Access protocolsconsider a single shared broadcast channel two or more simultaneous transmissions by nodes cause an interference which causes a packet collision
collision if a node receives two or more signals at the same timethe collision happens at all the nodes sharing the channelcollisions waste some of the broadcast channel bandwidth
multiple access protocoldistributed algorithm that determines how nodes can share a channel ie determine when nodes can transmitcommunication about the channel sharing must use the channel itself
no out-of-band channel for coordination
5 DataLink Layer 5-18
Ideal Multiple Access ProtocolBroadcast channel of rate R bps1 When only one node wants to transmit it
can send at rate R2 When M nodes want to transmit each can
send on average at rate RM3 Fully decentralized
no special node to coordinate transmissionsno synchronization of clocks or time-slots
4 Simple and cost-effective to implement
5 DataLink Layer 5-19
MAC Protocols a taxonomy
Three broad classesChannel Partitioning
divide the channel into smaller ldquopiecesrdquo such as time slots (eg TDMA) frequency bands (eg FDMA) codes (eg CDMA)allocate each piece to a node for exclusive use
Random Accessthe channel is not divided but shared allowing collisionsthere is a mechanism to ldquorecoverrdquo from collisions
ldquoTaking turnsrdquonodes take turns but nodes with more to send can take longer turns
5 DataLink Layer 5-20
Channel Partitioning MAC protocols TDMATDMA Time Division Multiple Access
access to channel in rounds each station gets fixed length slot (length = packet transmission time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
Two major drawbacks1 a node is limited to average BW of RN even if it is the only one 2 a node must always wait for its turn even if it is the only one
5 DataLink Layer 5-21
Channel Partitioning MAC protocols FDMAFDMA Frequency Division Multiple Access
the channel spectrum is divided into frequency bandseach station is assigned a fixed frequency bandunused transmission time in frequency bands go idlethe same limited BW drawback as the TDMAexample 6-station LAN 134 have pkt frequency bands 256 idle
freq
uenc
y ba
nds
time
5 DataLink Layer 5-22
Channel Partitioning MAC protocols CDMACDMA Code Division Multiple Access
each node is assigned a unique codeeach node uses its code to encode the data bits it sendsthe codes are orthogonal (ie different codes cancel or flatten each other at the receiver)all other signals behave as background noise to one anotherthe receiver node knows the code of the sender nodethe receiver decodes the intended signal using its sender codeall nodes can use the channel simultaneouslymay need a separate code for control signaling
drawbacks1 requires strict synchronization for codingdecoding2 fairly complex implementation
5 DataLink Layer 5-23
Random Access Protocolswhen a node has a packet to send
transmit at full channel data rate Rno a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquorandom access MAC protocol specifies
how to detect (or avoid) collisionshow to recover from collisions (eg via delayed retransmissions)
examples of random access MAC protocolsslotted ALOHApure (unslotted) ALOHACSMA CSMACD CSMACA
5 DataLink Layer 5-24
Slotted ALOHAAssumptions
all frames have the same sizetime is divided into equal size slots each equals the time to transmit 1 framenodes start to transmit frames only at the beginning of the slotsnodes are synchronizedif 2 or more nodes transmit within the same slot all nodes detect the collision
Operationwhen a node obtains a fresh frame it transmits in next slotif no collision occurs the node can send a new frame in the next slotif a collision occurs the node retransmits the frame in each subsequent slot with a probability p until success
5 DataLink Layer 5-25
Slotted ALOHA
Pros (advantages)a single active node can continuously transmit at the full rate of channelhighly decentralized only the slots in the nodes need to be in syncsimple
Cons (disadvantages)collisions wasting slotsidle slots due to random back offclock synchronization among nodes for the start of the slot
5 DataLink Layer 5-26
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in the slot with probability p
The probability that one node has success in a slot = p(1-p)N-1
The probability that any node has a success in a slot = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1 as N goes to infinity
max efficiency = 1e = 37
Efficiency in the long-run when there are many nodes each with many frames to send only a fraction of successful slots
At best a channel is used for useful transmissions only 37 of time
5 DataLink Layer 5-27
Pure (unslotted) ALOHAunslotted Aloha simpler as there is no synchronizationwhen a frame first arrives transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
5 DataLink Layer 5-28
Pure Aloha efficiencyP(success by given node) = P(node transmits)
P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]
= p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
hellip finding optimum p as N infinity
max efficiency = 1(2e) = 18
Even worse than slotted ALOHA
5 DataLink Layer 5-29
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmittingif the channel is sensed idle transmit the entire frameif the channel is sensed busy defer transmission
human analogy donrsquot interrupt others
can this prevents collisions
5 DataLink Layer 5-30
CSMA collisionscollisions can still occurdue to the propagation delay between nodes one node may not hear the otherrsquos transmission early enough
collisionthe entire packet transmission time is wasted (the nodes keep transmitting regardless)
spatial layout of nodes
notethe important role of distance amp propagation delay in determining collision probability
5 DataLink Layer 5-31
CSMACD (Collision Detection)CSMACD carrier sensing amp deferral as in CSMA
collisions are detected within a short timecolliding transmissions are aborted reducing the channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted and received signalsdifficult in wireless LANs receiver shut off while transmitting (hence WLAN uses collision avoidance)
human analogy the polite conversationalist
5 DataLink Layer 5-32
CSMACD collision detection
5 DataLink Layer 5-33
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high loadinefficient at low load there is delay in channel access and only 1N of the bandwidth is allocated even if there is only 1 active node
Random access MAC protocolsefficient at low load a single node can fully utilize the channelDecreasing efficiency at high load collision overhead
ldquotaking turnsrdquo protocolslook for the best of both worlds
5 DataLink Layer 5-34
ldquoTaking Turnsrdquo MAC protocolsPolling
a master node ldquoinvitesrdquo slave nodes to transmit in turnconcerns
polling overhead latencysingle point of failure (the master)
Token passinga control token is passed from one node to the next sequentiallydecentralized and efficient concerns
token overhead latencysingle point of failure
bull token not passedbull failure of one node can break
the channel
5 DataLink Layer 5-35
Summary of MAC protocolsWhat do you do with a shared medium
Channel Partitioning by time frequency or codebull Time Division Frequency Division Code Division
Random Partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard
in others (wireless)bull CSMACD used in IEEE 8023 Ethernetbull CSMACA used in IEEE 80211 WLAN
Taking Turnsbull polling from a central nodebull token passingbull Token Ring used in IEEE 8025
5 DataLink Layer 5-36
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-37
MAC Addresses and ARPIP address
network-layer address32128-bit logical address assigned to an interfaceused to get the datagram to the destination IP subnethierarchical structure
MAC (or LAN or physical or Ethernet) addresslink-layer addressunique 48-bit physical address burned in the adapterrsquos ROMused to get the frame from one to another physically-connected interfaces (within the same network)flat structure
5 DataLink Layer 5-38
LAN Addresses and ARPEach adapter on the LAN has a unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
5 DataLink Layer 5-39
LAN Address (more)MAC address allocation is administered by IEEEmanufacturer buys portion of MAC address space (16 million block) in order to assure uniquenessAnalogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC is a flat address insures portability can move the same adapter from one LAN to another
IP hierarchical address is NOT portabledepends on the IP subnet to which node is attached to
5 DataLink Layer 5-40
ARP Address Resolution ProtocolARP protocol provides IP-to-MAC translation mechanism ARP is similar to DNS except that it is used within the same subnetEach IP node (Host Router) on the LAN has an ARP tableARP Table IPMAC address mappings for someLAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time after which address mapping will be removed (typically 20 min)
Question how to determine MAC address of B knowing Brsquos IP address
Possible ARP table in node 222222222220
5 DataLink Layer 5-41
ARP protocol Same LAN (network)A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP tableA broadcasts ARP query packet containing Bs IP address
Dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP query
B receives the ARP query replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address is a standard or unicast frame
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 ldquoplug-and-playrdquonodes create their ARP tables without intervention from net administrator
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-16
Multiple Access Links and ProtocolsTwo types of ldquolinksrdquo
point-to-pointPPP (Point-to-Point Protocol) for dial-up accesspoint-to-point link between Ethernet switch and host
broadcast (shared wire or medium)traditional Ethernet80211 wireless LAN
5 DataLink Layer 5-17
Multiple Access protocolsconsider a single shared broadcast channel two or more simultaneous transmissions by nodes cause an interference which causes a packet collision
collision if a node receives two or more signals at the same timethe collision happens at all the nodes sharing the channelcollisions waste some of the broadcast channel bandwidth
multiple access protocoldistributed algorithm that determines how nodes can share a channel ie determine when nodes can transmitcommunication about the channel sharing must use the channel itself
no out-of-band channel for coordination
5 DataLink Layer 5-18
Ideal Multiple Access ProtocolBroadcast channel of rate R bps1 When only one node wants to transmit it
can send at rate R2 When M nodes want to transmit each can
send on average at rate RM3 Fully decentralized
no special node to coordinate transmissionsno synchronization of clocks or time-slots
4 Simple and cost-effective to implement
5 DataLink Layer 5-19
MAC Protocols a taxonomy
Three broad classesChannel Partitioning
divide the channel into smaller ldquopiecesrdquo such as time slots (eg TDMA) frequency bands (eg FDMA) codes (eg CDMA)allocate each piece to a node for exclusive use
Random Accessthe channel is not divided but shared allowing collisionsthere is a mechanism to ldquorecoverrdquo from collisions
ldquoTaking turnsrdquonodes take turns but nodes with more to send can take longer turns
5 DataLink Layer 5-20
Channel Partitioning MAC protocols TDMATDMA Time Division Multiple Access
access to channel in rounds each station gets fixed length slot (length = packet transmission time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
Two major drawbacks1 a node is limited to average BW of RN even if it is the only one 2 a node must always wait for its turn even if it is the only one
5 DataLink Layer 5-21
Channel Partitioning MAC protocols FDMAFDMA Frequency Division Multiple Access
the channel spectrum is divided into frequency bandseach station is assigned a fixed frequency bandunused transmission time in frequency bands go idlethe same limited BW drawback as the TDMAexample 6-station LAN 134 have pkt frequency bands 256 idle
freq
uenc
y ba
nds
time
5 DataLink Layer 5-22
Channel Partitioning MAC protocols CDMACDMA Code Division Multiple Access
each node is assigned a unique codeeach node uses its code to encode the data bits it sendsthe codes are orthogonal (ie different codes cancel or flatten each other at the receiver)all other signals behave as background noise to one anotherthe receiver node knows the code of the sender nodethe receiver decodes the intended signal using its sender codeall nodes can use the channel simultaneouslymay need a separate code for control signaling
drawbacks1 requires strict synchronization for codingdecoding2 fairly complex implementation
5 DataLink Layer 5-23
Random Access Protocolswhen a node has a packet to send
transmit at full channel data rate Rno a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquorandom access MAC protocol specifies
how to detect (or avoid) collisionshow to recover from collisions (eg via delayed retransmissions)
examples of random access MAC protocolsslotted ALOHApure (unslotted) ALOHACSMA CSMACD CSMACA
5 DataLink Layer 5-24
Slotted ALOHAAssumptions
all frames have the same sizetime is divided into equal size slots each equals the time to transmit 1 framenodes start to transmit frames only at the beginning of the slotsnodes are synchronizedif 2 or more nodes transmit within the same slot all nodes detect the collision
Operationwhen a node obtains a fresh frame it transmits in next slotif no collision occurs the node can send a new frame in the next slotif a collision occurs the node retransmits the frame in each subsequent slot with a probability p until success
5 DataLink Layer 5-25
Slotted ALOHA
Pros (advantages)a single active node can continuously transmit at the full rate of channelhighly decentralized only the slots in the nodes need to be in syncsimple
Cons (disadvantages)collisions wasting slotsidle slots due to random back offclock synchronization among nodes for the start of the slot
5 DataLink Layer 5-26
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in the slot with probability p
The probability that one node has success in a slot = p(1-p)N-1
The probability that any node has a success in a slot = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1 as N goes to infinity
max efficiency = 1e = 37
Efficiency in the long-run when there are many nodes each with many frames to send only a fraction of successful slots
At best a channel is used for useful transmissions only 37 of time
5 DataLink Layer 5-27
Pure (unslotted) ALOHAunslotted Aloha simpler as there is no synchronizationwhen a frame first arrives transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
5 DataLink Layer 5-28
Pure Aloha efficiencyP(success by given node) = P(node transmits)
P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]
= p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
hellip finding optimum p as N infinity
max efficiency = 1(2e) = 18
Even worse than slotted ALOHA
5 DataLink Layer 5-29
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmittingif the channel is sensed idle transmit the entire frameif the channel is sensed busy defer transmission
human analogy donrsquot interrupt others
can this prevents collisions
5 DataLink Layer 5-30
CSMA collisionscollisions can still occurdue to the propagation delay between nodes one node may not hear the otherrsquos transmission early enough
collisionthe entire packet transmission time is wasted (the nodes keep transmitting regardless)
spatial layout of nodes
notethe important role of distance amp propagation delay in determining collision probability
5 DataLink Layer 5-31
CSMACD (Collision Detection)CSMACD carrier sensing amp deferral as in CSMA
collisions are detected within a short timecolliding transmissions are aborted reducing the channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted and received signalsdifficult in wireless LANs receiver shut off while transmitting (hence WLAN uses collision avoidance)
human analogy the polite conversationalist
5 DataLink Layer 5-32
CSMACD collision detection
5 DataLink Layer 5-33
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high loadinefficient at low load there is delay in channel access and only 1N of the bandwidth is allocated even if there is only 1 active node
Random access MAC protocolsefficient at low load a single node can fully utilize the channelDecreasing efficiency at high load collision overhead
ldquotaking turnsrdquo protocolslook for the best of both worlds
5 DataLink Layer 5-34
ldquoTaking Turnsrdquo MAC protocolsPolling
a master node ldquoinvitesrdquo slave nodes to transmit in turnconcerns
polling overhead latencysingle point of failure (the master)
Token passinga control token is passed from one node to the next sequentiallydecentralized and efficient concerns
token overhead latencysingle point of failure
bull token not passedbull failure of one node can break
the channel
5 DataLink Layer 5-35
Summary of MAC protocolsWhat do you do with a shared medium
Channel Partitioning by time frequency or codebull Time Division Frequency Division Code Division
Random Partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard
in others (wireless)bull CSMACD used in IEEE 8023 Ethernetbull CSMACA used in IEEE 80211 WLAN
Taking Turnsbull polling from a central nodebull token passingbull Token Ring used in IEEE 8025
5 DataLink Layer 5-36
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-37
MAC Addresses and ARPIP address
network-layer address32128-bit logical address assigned to an interfaceused to get the datagram to the destination IP subnethierarchical structure
MAC (or LAN or physical or Ethernet) addresslink-layer addressunique 48-bit physical address burned in the adapterrsquos ROMused to get the frame from one to another physically-connected interfaces (within the same network)flat structure
5 DataLink Layer 5-38
LAN Addresses and ARPEach adapter on the LAN has a unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
5 DataLink Layer 5-39
LAN Address (more)MAC address allocation is administered by IEEEmanufacturer buys portion of MAC address space (16 million block) in order to assure uniquenessAnalogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC is a flat address insures portability can move the same adapter from one LAN to another
IP hierarchical address is NOT portabledepends on the IP subnet to which node is attached to
5 DataLink Layer 5-40
ARP Address Resolution ProtocolARP protocol provides IP-to-MAC translation mechanism ARP is similar to DNS except that it is used within the same subnetEach IP node (Host Router) on the LAN has an ARP tableARP Table IPMAC address mappings for someLAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time after which address mapping will be removed (typically 20 min)
Question how to determine MAC address of B knowing Brsquos IP address
Possible ARP table in node 222222222220
5 DataLink Layer 5-41
ARP protocol Same LAN (network)A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP tableA broadcasts ARP query packet containing Bs IP address
Dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP query
B receives the ARP query replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address is a standard or unicast frame
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 ldquoplug-and-playrdquonodes create their ARP tables without intervention from net administrator
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-17
Multiple Access protocolsconsider a single shared broadcast channel two or more simultaneous transmissions by nodes cause an interference which causes a packet collision
collision if a node receives two or more signals at the same timethe collision happens at all the nodes sharing the channelcollisions waste some of the broadcast channel bandwidth
multiple access protocoldistributed algorithm that determines how nodes can share a channel ie determine when nodes can transmitcommunication about the channel sharing must use the channel itself
no out-of-band channel for coordination
5 DataLink Layer 5-18
Ideal Multiple Access ProtocolBroadcast channel of rate R bps1 When only one node wants to transmit it
can send at rate R2 When M nodes want to transmit each can
send on average at rate RM3 Fully decentralized
no special node to coordinate transmissionsno synchronization of clocks or time-slots
4 Simple and cost-effective to implement
5 DataLink Layer 5-19
MAC Protocols a taxonomy
Three broad classesChannel Partitioning
divide the channel into smaller ldquopiecesrdquo such as time slots (eg TDMA) frequency bands (eg FDMA) codes (eg CDMA)allocate each piece to a node for exclusive use
Random Accessthe channel is not divided but shared allowing collisionsthere is a mechanism to ldquorecoverrdquo from collisions
ldquoTaking turnsrdquonodes take turns but nodes with more to send can take longer turns
5 DataLink Layer 5-20
Channel Partitioning MAC protocols TDMATDMA Time Division Multiple Access
access to channel in rounds each station gets fixed length slot (length = packet transmission time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
Two major drawbacks1 a node is limited to average BW of RN even if it is the only one 2 a node must always wait for its turn even if it is the only one
5 DataLink Layer 5-21
Channel Partitioning MAC protocols FDMAFDMA Frequency Division Multiple Access
the channel spectrum is divided into frequency bandseach station is assigned a fixed frequency bandunused transmission time in frequency bands go idlethe same limited BW drawback as the TDMAexample 6-station LAN 134 have pkt frequency bands 256 idle
freq
uenc
y ba
nds
time
5 DataLink Layer 5-22
Channel Partitioning MAC protocols CDMACDMA Code Division Multiple Access
each node is assigned a unique codeeach node uses its code to encode the data bits it sendsthe codes are orthogonal (ie different codes cancel or flatten each other at the receiver)all other signals behave as background noise to one anotherthe receiver node knows the code of the sender nodethe receiver decodes the intended signal using its sender codeall nodes can use the channel simultaneouslymay need a separate code for control signaling
drawbacks1 requires strict synchronization for codingdecoding2 fairly complex implementation
5 DataLink Layer 5-23
Random Access Protocolswhen a node has a packet to send
transmit at full channel data rate Rno a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquorandom access MAC protocol specifies
how to detect (or avoid) collisionshow to recover from collisions (eg via delayed retransmissions)
examples of random access MAC protocolsslotted ALOHApure (unslotted) ALOHACSMA CSMACD CSMACA
5 DataLink Layer 5-24
Slotted ALOHAAssumptions
all frames have the same sizetime is divided into equal size slots each equals the time to transmit 1 framenodes start to transmit frames only at the beginning of the slotsnodes are synchronizedif 2 or more nodes transmit within the same slot all nodes detect the collision
Operationwhen a node obtains a fresh frame it transmits in next slotif no collision occurs the node can send a new frame in the next slotif a collision occurs the node retransmits the frame in each subsequent slot with a probability p until success
5 DataLink Layer 5-25
Slotted ALOHA
Pros (advantages)a single active node can continuously transmit at the full rate of channelhighly decentralized only the slots in the nodes need to be in syncsimple
Cons (disadvantages)collisions wasting slotsidle slots due to random back offclock synchronization among nodes for the start of the slot
5 DataLink Layer 5-26
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in the slot with probability p
The probability that one node has success in a slot = p(1-p)N-1
The probability that any node has a success in a slot = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1 as N goes to infinity
max efficiency = 1e = 37
Efficiency in the long-run when there are many nodes each with many frames to send only a fraction of successful slots
At best a channel is used for useful transmissions only 37 of time
5 DataLink Layer 5-27
Pure (unslotted) ALOHAunslotted Aloha simpler as there is no synchronizationwhen a frame first arrives transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
5 DataLink Layer 5-28
Pure Aloha efficiencyP(success by given node) = P(node transmits)
P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]
= p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
hellip finding optimum p as N infinity
max efficiency = 1(2e) = 18
Even worse than slotted ALOHA
5 DataLink Layer 5-29
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmittingif the channel is sensed idle transmit the entire frameif the channel is sensed busy defer transmission
human analogy donrsquot interrupt others
can this prevents collisions
5 DataLink Layer 5-30
CSMA collisionscollisions can still occurdue to the propagation delay between nodes one node may not hear the otherrsquos transmission early enough
collisionthe entire packet transmission time is wasted (the nodes keep transmitting regardless)
spatial layout of nodes
notethe important role of distance amp propagation delay in determining collision probability
5 DataLink Layer 5-31
CSMACD (Collision Detection)CSMACD carrier sensing amp deferral as in CSMA
collisions are detected within a short timecolliding transmissions are aborted reducing the channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted and received signalsdifficult in wireless LANs receiver shut off while transmitting (hence WLAN uses collision avoidance)
human analogy the polite conversationalist
5 DataLink Layer 5-32
CSMACD collision detection
5 DataLink Layer 5-33
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high loadinefficient at low load there is delay in channel access and only 1N of the bandwidth is allocated even if there is only 1 active node
Random access MAC protocolsefficient at low load a single node can fully utilize the channelDecreasing efficiency at high load collision overhead
ldquotaking turnsrdquo protocolslook for the best of both worlds
5 DataLink Layer 5-34
ldquoTaking Turnsrdquo MAC protocolsPolling
a master node ldquoinvitesrdquo slave nodes to transmit in turnconcerns
polling overhead latencysingle point of failure (the master)
Token passinga control token is passed from one node to the next sequentiallydecentralized and efficient concerns
token overhead latencysingle point of failure
bull token not passedbull failure of one node can break
the channel
5 DataLink Layer 5-35
Summary of MAC protocolsWhat do you do with a shared medium
Channel Partitioning by time frequency or codebull Time Division Frequency Division Code Division
Random Partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard
in others (wireless)bull CSMACD used in IEEE 8023 Ethernetbull CSMACA used in IEEE 80211 WLAN
Taking Turnsbull polling from a central nodebull token passingbull Token Ring used in IEEE 8025
5 DataLink Layer 5-36
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-37
MAC Addresses and ARPIP address
network-layer address32128-bit logical address assigned to an interfaceused to get the datagram to the destination IP subnethierarchical structure
MAC (or LAN or physical or Ethernet) addresslink-layer addressunique 48-bit physical address burned in the adapterrsquos ROMused to get the frame from one to another physically-connected interfaces (within the same network)flat structure
5 DataLink Layer 5-38
LAN Addresses and ARPEach adapter on the LAN has a unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
5 DataLink Layer 5-39
LAN Address (more)MAC address allocation is administered by IEEEmanufacturer buys portion of MAC address space (16 million block) in order to assure uniquenessAnalogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC is a flat address insures portability can move the same adapter from one LAN to another
IP hierarchical address is NOT portabledepends on the IP subnet to which node is attached to
5 DataLink Layer 5-40
ARP Address Resolution ProtocolARP protocol provides IP-to-MAC translation mechanism ARP is similar to DNS except that it is used within the same subnetEach IP node (Host Router) on the LAN has an ARP tableARP Table IPMAC address mappings for someLAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time after which address mapping will be removed (typically 20 min)
Question how to determine MAC address of B knowing Brsquos IP address
Possible ARP table in node 222222222220
5 DataLink Layer 5-41
ARP protocol Same LAN (network)A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP tableA broadcasts ARP query packet containing Bs IP address
Dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP query
B receives the ARP query replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address is a standard or unicast frame
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 ldquoplug-and-playrdquonodes create their ARP tables without intervention from net administrator
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-18
Ideal Multiple Access ProtocolBroadcast channel of rate R bps1 When only one node wants to transmit it
can send at rate R2 When M nodes want to transmit each can
send on average at rate RM3 Fully decentralized
no special node to coordinate transmissionsno synchronization of clocks or time-slots
4 Simple and cost-effective to implement
5 DataLink Layer 5-19
MAC Protocols a taxonomy
Three broad classesChannel Partitioning
divide the channel into smaller ldquopiecesrdquo such as time slots (eg TDMA) frequency bands (eg FDMA) codes (eg CDMA)allocate each piece to a node for exclusive use
Random Accessthe channel is not divided but shared allowing collisionsthere is a mechanism to ldquorecoverrdquo from collisions
ldquoTaking turnsrdquonodes take turns but nodes with more to send can take longer turns
5 DataLink Layer 5-20
Channel Partitioning MAC protocols TDMATDMA Time Division Multiple Access
access to channel in rounds each station gets fixed length slot (length = packet transmission time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
Two major drawbacks1 a node is limited to average BW of RN even if it is the only one 2 a node must always wait for its turn even if it is the only one
5 DataLink Layer 5-21
Channel Partitioning MAC protocols FDMAFDMA Frequency Division Multiple Access
the channel spectrum is divided into frequency bandseach station is assigned a fixed frequency bandunused transmission time in frequency bands go idlethe same limited BW drawback as the TDMAexample 6-station LAN 134 have pkt frequency bands 256 idle
freq
uenc
y ba
nds
time
5 DataLink Layer 5-22
Channel Partitioning MAC protocols CDMACDMA Code Division Multiple Access
each node is assigned a unique codeeach node uses its code to encode the data bits it sendsthe codes are orthogonal (ie different codes cancel or flatten each other at the receiver)all other signals behave as background noise to one anotherthe receiver node knows the code of the sender nodethe receiver decodes the intended signal using its sender codeall nodes can use the channel simultaneouslymay need a separate code for control signaling
drawbacks1 requires strict synchronization for codingdecoding2 fairly complex implementation
5 DataLink Layer 5-23
Random Access Protocolswhen a node has a packet to send
transmit at full channel data rate Rno a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquorandom access MAC protocol specifies
how to detect (or avoid) collisionshow to recover from collisions (eg via delayed retransmissions)
examples of random access MAC protocolsslotted ALOHApure (unslotted) ALOHACSMA CSMACD CSMACA
5 DataLink Layer 5-24
Slotted ALOHAAssumptions
all frames have the same sizetime is divided into equal size slots each equals the time to transmit 1 framenodes start to transmit frames only at the beginning of the slotsnodes are synchronizedif 2 or more nodes transmit within the same slot all nodes detect the collision
Operationwhen a node obtains a fresh frame it transmits in next slotif no collision occurs the node can send a new frame in the next slotif a collision occurs the node retransmits the frame in each subsequent slot with a probability p until success
5 DataLink Layer 5-25
Slotted ALOHA
Pros (advantages)a single active node can continuously transmit at the full rate of channelhighly decentralized only the slots in the nodes need to be in syncsimple
Cons (disadvantages)collisions wasting slotsidle slots due to random back offclock synchronization among nodes for the start of the slot
5 DataLink Layer 5-26
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in the slot with probability p
The probability that one node has success in a slot = p(1-p)N-1
The probability that any node has a success in a slot = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1 as N goes to infinity
max efficiency = 1e = 37
Efficiency in the long-run when there are many nodes each with many frames to send only a fraction of successful slots
At best a channel is used for useful transmissions only 37 of time
5 DataLink Layer 5-27
Pure (unslotted) ALOHAunslotted Aloha simpler as there is no synchronizationwhen a frame first arrives transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
5 DataLink Layer 5-28
Pure Aloha efficiencyP(success by given node) = P(node transmits)
P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]
= p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
hellip finding optimum p as N infinity
max efficiency = 1(2e) = 18
Even worse than slotted ALOHA
5 DataLink Layer 5-29
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmittingif the channel is sensed idle transmit the entire frameif the channel is sensed busy defer transmission
human analogy donrsquot interrupt others
can this prevents collisions
5 DataLink Layer 5-30
CSMA collisionscollisions can still occurdue to the propagation delay between nodes one node may not hear the otherrsquos transmission early enough
collisionthe entire packet transmission time is wasted (the nodes keep transmitting regardless)
spatial layout of nodes
notethe important role of distance amp propagation delay in determining collision probability
5 DataLink Layer 5-31
CSMACD (Collision Detection)CSMACD carrier sensing amp deferral as in CSMA
collisions are detected within a short timecolliding transmissions are aborted reducing the channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted and received signalsdifficult in wireless LANs receiver shut off while transmitting (hence WLAN uses collision avoidance)
human analogy the polite conversationalist
5 DataLink Layer 5-32
CSMACD collision detection
5 DataLink Layer 5-33
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high loadinefficient at low load there is delay in channel access and only 1N of the bandwidth is allocated even if there is only 1 active node
Random access MAC protocolsefficient at low load a single node can fully utilize the channelDecreasing efficiency at high load collision overhead
ldquotaking turnsrdquo protocolslook for the best of both worlds
5 DataLink Layer 5-34
ldquoTaking Turnsrdquo MAC protocolsPolling
a master node ldquoinvitesrdquo slave nodes to transmit in turnconcerns
polling overhead latencysingle point of failure (the master)
Token passinga control token is passed from one node to the next sequentiallydecentralized and efficient concerns
token overhead latencysingle point of failure
bull token not passedbull failure of one node can break
the channel
5 DataLink Layer 5-35
Summary of MAC protocolsWhat do you do with a shared medium
Channel Partitioning by time frequency or codebull Time Division Frequency Division Code Division
Random Partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard
in others (wireless)bull CSMACD used in IEEE 8023 Ethernetbull CSMACA used in IEEE 80211 WLAN
Taking Turnsbull polling from a central nodebull token passingbull Token Ring used in IEEE 8025
5 DataLink Layer 5-36
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-37
MAC Addresses and ARPIP address
network-layer address32128-bit logical address assigned to an interfaceused to get the datagram to the destination IP subnethierarchical structure
MAC (or LAN or physical or Ethernet) addresslink-layer addressunique 48-bit physical address burned in the adapterrsquos ROMused to get the frame from one to another physically-connected interfaces (within the same network)flat structure
5 DataLink Layer 5-38
LAN Addresses and ARPEach adapter on the LAN has a unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
5 DataLink Layer 5-39
LAN Address (more)MAC address allocation is administered by IEEEmanufacturer buys portion of MAC address space (16 million block) in order to assure uniquenessAnalogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC is a flat address insures portability can move the same adapter from one LAN to another
IP hierarchical address is NOT portabledepends on the IP subnet to which node is attached to
5 DataLink Layer 5-40
ARP Address Resolution ProtocolARP protocol provides IP-to-MAC translation mechanism ARP is similar to DNS except that it is used within the same subnetEach IP node (Host Router) on the LAN has an ARP tableARP Table IPMAC address mappings for someLAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time after which address mapping will be removed (typically 20 min)
Question how to determine MAC address of B knowing Brsquos IP address
Possible ARP table in node 222222222220
5 DataLink Layer 5-41
ARP protocol Same LAN (network)A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP tableA broadcasts ARP query packet containing Bs IP address
Dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP query
B receives the ARP query replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address is a standard or unicast frame
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 ldquoplug-and-playrdquonodes create their ARP tables without intervention from net administrator
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-19
MAC Protocols a taxonomy
Three broad classesChannel Partitioning
divide the channel into smaller ldquopiecesrdquo such as time slots (eg TDMA) frequency bands (eg FDMA) codes (eg CDMA)allocate each piece to a node for exclusive use
Random Accessthe channel is not divided but shared allowing collisionsthere is a mechanism to ldquorecoverrdquo from collisions
ldquoTaking turnsrdquonodes take turns but nodes with more to send can take longer turns
5 DataLink Layer 5-20
Channel Partitioning MAC protocols TDMATDMA Time Division Multiple Access
access to channel in rounds each station gets fixed length slot (length = packet transmission time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
Two major drawbacks1 a node is limited to average BW of RN even if it is the only one 2 a node must always wait for its turn even if it is the only one
5 DataLink Layer 5-21
Channel Partitioning MAC protocols FDMAFDMA Frequency Division Multiple Access
the channel spectrum is divided into frequency bandseach station is assigned a fixed frequency bandunused transmission time in frequency bands go idlethe same limited BW drawback as the TDMAexample 6-station LAN 134 have pkt frequency bands 256 idle
freq
uenc
y ba
nds
time
5 DataLink Layer 5-22
Channel Partitioning MAC protocols CDMACDMA Code Division Multiple Access
each node is assigned a unique codeeach node uses its code to encode the data bits it sendsthe codes are orthogonal (ie different codes cancel or flatten each other at the receiver)all other signals behave as background noise to one anotherthe receiver node knows the code of the sender nodethe receiver decodes the intended signal using its sender codeall nodes can use the channel simultaneouslymay need a separate code for control signaling
drawbacks1 requires strict synchronization for codingdecoding2 fairly complex implementation
5 DataLink Layer 5-23
Random Access Protocolswhen a node has a packet to send
transmit at full channel data rate Rno a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquorandom access MAC protocol specifies
how to detect (or avoid) collisionshow to recover from collisions (eg via delayed retransmissions)
examples of random access MAC protocolsslotted ALOHApure (unslotted) ALOHACSMA CSMACD CSMACA
5 DataLink Layer 5-24
Slotted ALOHAAssumptions
all frames have the same sizetime is divided into equal size slots each equals the time to transmit 1 framenodes start to transmit frames only at the beginning of the slotsnodes are synchronizedif 2 or more nodes transmit within the same slot all nodes detect the collision
Operationwhen a node obtains a fresh frame it transmits in next slotif no collision occurs the node can send a new frame in the next slotif a collision occurs the node retransmits the frame in each subsequent slot with a probability p until success
5 DataLink Layer 5-25
Slotted ALOHA
Pros (advantages)a single active node can continuously transmit at the full rate of channelhighly decentralized only the slots in the nodes need to be in syncsimple
Cons (disadvantages)collisions wasting slotsidle slots due to random back offclock synchronization among nodes for the start of the slot
5 DataLink Layer 5-26
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in the slot with probability p
The probability that one node has success in a slot = p(1-p)N-1
The probability that any node has a success in a slot = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1 as N goes to infinity
max efficiency = 1e = 37
Efficiency in the long-run when there are many nodes each with many frames to send only a fraction of successful slots
At best a channel is used for useful transmissions only 37 of time
5 DataLink Layer 5-27
Pure (unslotted) ALOHAunslotted Aloha simpler as there is no synchronizationwhen a frame first arrives transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
5 DataLink Layer 5-28
Pure Aloha efficiencyP(success by given node) = P(node transmits)
P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]
= p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
hellip finding optimum p as N infinity
max efficiency = 1(2e) = 18
Even worse than slotted ALOHA
5 DataLink Layer 5-29
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmittingif the channel is sensed idle transmit the entire frameif the channel is sensed busy defer transmission
human analogy donrsquot interrupt others
can this prevents collisions
5 DataLink Layer 5-30
CSMA collisionscollisions can still occurdue to the propagation delay between nodes one node may not hear the otherrsquos transmission early enough
collisionthe entire packet transmission time is wasted (the nodes keep transmitting regardless)
spatial layout of nodes
notethe important role of distance amp propagation delay in determining collision probability
5 DataLink Layer 5-31
CSMACD (Collision Detection)CSMACD carrier sensing amp deferral as in CSMA
collisions are detected within a short timecolliding transmissions are aborted reducing the channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted and received signalsdifficult in wireless LANs receiver shut off while transmitting (hence WLAN uses collision avoidance)
human analogy the polite conversationalist
5 DataLink Layer 5-32
CSMACD collision detection
5 DataLink Layer 5-33
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high loadinefficient at low load there is delay in channel access and only 1N of the bandwidth is allocated even if there is only 1 active node
Random access MAC protocolsefficient at low load a single node can fully utilize the channelDecreasing efficiency at high load collision overhead
ldquotaking turnsrdquo protocolslook for the best of both worlds
5 DataLink Layer 5-34
ldquoTaking Turnsrdquo MAC protocolsPolling
a master node ldquoinvitesrdquo slave nodes to transmit in turnconcerns
polling overhead latencysingle point of failure (the master)
Token passinga control token is passed from one node to the next sequentiallydecentralized and efficient concerns
token overhead latencysingle point of failure
bull token not passedbull failure of one node can break
the channel
5 DataLink Layer 5-35
Summary of MAC protocolsWhat do you do with a shared medium
Channel Partitioning by time frequency or codebull Time Division Frequency Division Code Division
Random Partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard
in others (wireless)bull CSMACD used in IEEE 8023 Ethernetbull CSMACA used in IEEE 80211 WLAN
Taking Turnsbull polling from a central nodebull token passingbull Token Ring used in IEEE 8025
5 DataLink Layer 5-36
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-37
MAC Addresses and ARPIP address
network-layer address32128-bit logical address assigned to an interfaceused to get the datagram to the destination IP subnethierarchical structure
MAC (or LAN or physical or Ethernet) addresslink-layer addressunique 48-bit physical address burned in the adapterrsquos ROMused to get the frame from one to another physically-connected interfaces (within the same network)flat structure
5 DataLink Layer 5-38
LAN Addresses and ARPEach adapter on the LAN has a unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
5 DataLink Layer 5-39
LAN Address (more)MAC address allocation is administered by IEEEmanufacturer buys portion of MAC address space (16 million block) in order to assure uniquenessAnalogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC is a flat address insures portability can move the same adapter from one LAN to another
IP hierarchical address is NOT portabledepends on the IP subnet to which node is attached to
5 DataLink Layer 5-40
ARP Address Resolution ProtocolARP protocol provides IP-to-MAC translation mechanism ARP is similar to DNS except that it is used within the same subnetEach IP node (Host Router) on the LAN has an ARP tableARP Table IPMAC address mappings for someLAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time after which address mapping will be removed (typically 20 min)
Question how to determine MAC address of B knowing Brsquos IP address
Possible ARP table in node 222222222220
5 DataLink Layer 5-41
ARP protocol Same LAN (network)A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP tableA broadcasts ARP query packet containing Bs IP address
Dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP query
B receives the ARP query replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address is a standard or unicast frame
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 ldquoplug-and-playrdquonodes create their ARP tables without intervention from net administrator
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-20
Channel Partitioning MAC protocols TDMATDMA Time Division Multiple Access
access to channel in rounds each station gets fixed length slot (length = packet transmission time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
Two major drawbacks1 a node is limited to average BW of RN even if it is the only one 2 a node must always wait for its turn even if it is the only one
5 DataLink Layer 5-21
Channel Partitioning MAC protocols FDMAFDMA Frequency Division Multiple Access
the channel spectrum is divided into frequency bandseach station is assigned a fixed frequency bandunused transmission time in frequency bands go idlethe same limited BW drawback as the TDMAexample 6-station LAN 134 have pkt frequency bands 256 idle
freq
uenc
y ba
nds
time
5 DataLink Layer 5-22
Channel Partitioning MAC protocols CDMACDMA Code Division Multiple Access
each node is assigned a unique codeeach node uses its code to encode the data bits it sendsthe codes are orthogonal (ie different codes cancel or flatten each other at the receiver)all other signals behave as background noise to one anotherthe receiver node knows the code of the sender nodethe receiver decodes the intended signal using its sender codeall nodes can use the channel simultaneouslymay need a separate code for control signaling
drawbacks1 requires strict synchronization for codingdecoding2 fairly complex implementation
5 DataLink Layer 5-23
Random Access Protocolswhen a node has a packet to send
transmit at full channel data rate Rno a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquorandom access MAC protocol specifies
how to detect (or avoid) collisionshow to recover from collisions (eg via delayed retransmissions)
examples of random access MAC protocolsslotted ALOHApure (unslotted) ALOHACSMA CSMACD CSMACA
5 DataLink Layer 5-24
Slotted ALOHAAssumptions
all frames have the same sizetime is divided into equal size slots each equals the time to transmit 1 framenodes start to transmit frames only at the beginning of the slotsnodes are synchronizedif 2 or more nodes transmit within the same slot all nodes detect the collision
Operationwhen a node obtains a fresh frame it transmits in next slotif no collision occurs the node can send a new frame in the next slotif a collision occurs the node retransmits the frame in each subsequent slot with a probability p until success
5 DataLink Layer 5-25
Slotted ALOHA
Pros (advantages)a single active node can continuously transmit at the full rate of channelhighly decentralized only the slots in the nodes need to be in syncsimple
Cons (disadvantages)collisions wasting slotsidle slots due to random back offclock synchronization among nodes for the start of the slot
5 DataLink Layer 5-26
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in the slot with probability p
The probability that one node has success in a slot = p(1-p)N-1
The probability that any node has a success in a slot = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1 as N goes to infinity
max efficiency = 1e = 37
Efficiency in the long-run when there are many nodes each with many frames to send only a fraction of successful slots
At best a channel is used for useful transmissions only 37 of time
5 DataLink Layer 5-27
Pure (unslotted) ALOHAunslotted Aloha simpler as there is no synchronizationwhen a frame first arrives transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
5 DataLink Layer 5-28
Pure Aloha efficiencyP(success by given node) = P(node transmits)
P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]
= p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
hellip finding optimum p as N infinity
max efficiency = 1(2e) = 18
Even worse than slotted ALOHA
5 DataLink Layer 5-29
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmittingif the channel is sensed idle transmit the entire frameif the channel is sensed busy defer transmission
human analogy donrsquot interrupt others
can this prevents collisions
5 DataLink Layer 5-30
CSMA collisionscollisions can still occurdue to the propagation delay between nodes one node may not hear the otherrsquos transmission early enough
collisionthe entire packet transmission time is wasted (the nodes keep transmitting regardless)
spatial layout of nodes
notethe important role of distance amp propagation delay in determining collision probability
5 DataLink Layer 5-31
CSMACD (Collision Detection)CSMACD carrier sensing amp deferral as in CSMA
collisions are detected within a short timecolliding transmissions are aborted reducing the channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted and received signalsdifficult in wireless LANs receiver shut off while transmitting (hence WLAN uses collision avoidance)
human analogy the polite conversationalist
5 DataLink Layer 5-32
CSMACD collision detection
5 DataLink Layer 5-33
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high loadinefficient at low load there is delay in channel access and only 1N of the bandwidth is allocated even if there is only 1 active node
Random access MAC protocolsefficient at low load a single node can fully utilize the channelDecreasing efficiency at high load collision overhead
ldquotaking turnsrdquo protocolslook for the best of both worlds
5 DataLink Layer 5-34
ldquoTaking Turnsrdquo MAC protocolsPolling
a master node ldquoinvitesrdquo slave nodes to transmit in turnconcerns
polling overhead latencysingle point of failure (the master)
Token passinga control token is passed from one node to the next sequentiallydecentralized and efficient concerns
token overhead latencysingle point of failure
bull token not passedbull failure of one node can break
the channel
5 DataLink Layer 5-35
Summary of MAC protocolsWhat do you do with a shared medium
Channel Partitioning by time frequency or codebull Time Division Frequency Division Code Division
Random Partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard
in others (wireless)bull CSMACD used in IEEE 8023 Ethernetbull CSMACA used in IEEE 80211 WLAN
Taking Turnsbull polling from a central nodebull token passingbull Token Ring used in IEEE 8025
5 DataLink Layer 5-36
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-37
MAC Addresses and ARPIP address
network-layer address32128-bit logical address assigned to an interfaceused to get the datagram to the destination IP subnethierarchical structure
MAC (or LAN or physical or Ethernet) addresslink-layer addressunique 48-bit physical address burned in the adapterrsquos ROMused to get the frame from one to another physically-connected interfaces (within the same network)flat structure
5 DataLink Layer 5-38
LAN Addresses and ARPEach adapter on the LAN has a unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
5 DataLink Layer 5-39
LAN Address (more)MAC address allocation is administered by IEEEmanufacturer buys portion of MAC address space (16 million block) in order to assure uniquenessAnalogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC is a flat address insures portability can move the same adapter from one LAN to another
IP hierarchical address is NOT portabledepends on the IP subnet to which node is attached to
5 DataLink Layer 5-40
ARP Address Resolution ProtocolARP protocol provides IP-to-MAC translation mechanism ARP is similar to DNS except that it is used within the same subnetEach IP node (Host Router) on the LAN has an ARP tableARP Table IPMAC address mappings for someLAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time after which address mapping will be removed (typically 20 min)
Question how to determine MAC address of B knowing Brsquos IP address
Possible ARP table in node 222222222220
5 DataLink Layer 5-41
ARP protocol Same LAN (network)A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP tableA broadcasts ARP query packet containing Bs IP address
Dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP query
B receives the ARP query replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address is a standard or unicast frame
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 ldquoplug-and-playrdquonodes create their ARP tables without intervention from net administrator
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-21
Channel Partitioning MAC protocols FDMAFDMA Frequency Division Multiple Access
the channel spectrum is divided into frequency bandseach station is assigned a fixed frequency bandunused transmission time in frequency bands go idlethe same limited BW drawback as the TDMAexample 6-station LAN 134 have pkt frequency bands 256 idle
freq
uenc
y ba
nds
time
5 DataLink Layer 5-22
Channel Partitioning MAC protocols CDMACDMA Code Division Multiple Access
each node is assigned a unique codeeach node uses its code to encode the data bits it sendsthe codes are orthogonal (ie different codes cancel or flatten each other at the receiver)all other signals behave as background noise to one anotherthe receiver node knows the code of the sender nodethe receiver decodes the intended signal using its sender codeall nodes can use the channel simultaneouslymay need a separate code for control signaling
drawbacks1 requires strict synchronization for codingdecoding2 fairly complex implementation
5 DataLink Layer 5-23
Random Access Protocolswhen a node has a packet to send
transmit at full channel data rate Rno a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquorandom access MAC protocol specifies
how to detect (or avoid) collisionshow to recover from collisions (eg via delayed retransmissions)
examples of random access MAC protocolsslotted ALOHApure (unslotted) ALOHACSMA CSMACD CSMACA
5 DataLink Layer 5-24
Slotted ALOHAAssumptions
all frames have the same sizetime is divided into equal size slots each equals the time to transmit 1 framenodes start to transmit frames only at the beginning of the slotsnodes are synchronizedif 2 or more nodes transmit within the same slot all nodes detect the collision
Operationwhen a node obtains a fresh frame it transmits in next slotif no collision occurs the node can send a new frame in the next slotif a collision occurs the node retransmits the frame in each subsequent slot with a probability p until success
5 DataLink Layer 5-25
Slotted ALOHA
Pros (advantages)a single active node can continuously transmit at the full rate of channelhighly decentralized only the slots in the nodes need to be in syncsimple
Cons (disadvantages)collisions wasting slotsidle slots due to random back offclock synchronization among nodes for the start of the slot
5 DataLink Layer 5-26
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in the slot with probability p
The probability that one node has success in a slot = p(1-p)N-1
The probability that any node has a success in a slot = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1 as N goes to infinity
max efficiency = 1e = 37
Efficiency in the long-run when there are many nodes each with many frames to send only a fraction of successful slots
At best a channel is used for useful transmissions only 37 of time
5 DataLink Layer 5-27
Pure (unslotted) ALOHAunslotted Aloha simpler as there is no synchronizationwhen a frame first arrives transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
5 DataLink Layer 5-28
Pure Aloha efficiencyP(success by given node) = P(node transmits)
P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]
= p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
hellip finding optimum p as N infinity
max efficiency = 1(2e) = 18
Even worse than slotted ALOHA
5 DataLink Layer 5-29
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmittingif the channel is sensed idle transmit the entire frameif the channel is sensed busy defer transmission
human analogy donrsquot interrupt others
can this prevents collisions
5 DataLink Layer 5-30
CSMA collisionscollisions can still occurdue to the propagation delay between nodes one node may not hear the otherrsquos transmission early enough
collisionthe entire packet transmission time is wasted (the nodes keep transmitting regardless)
spatial layout of nodes
notethe important role of distance amp propagation delay in determining collision probability
5 DataLink Layer 5-31
CSMACD (Collision Detection)CSMACD carrier sensing amp deferral as in CSMA
collisions are detected within a short timecolliding transmissions are aborted reducing the channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted and received signalsdifficult in wireless LANs receiver shut off while transmitting (hence WLAN uses collision avoidance)
human analogy the polite conversationalist
5 DataLink Layer 5-32
CSMACD collision detection
5 DataLink Layer 5-33
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high loadinefficient at low load there is delay in channel access and only 1N of the bandwidth is allocated even if there is only 1 active node
Random access MAC protocolsefficient at low load a single node can fully utilize the channelDecreasing efficiency at high load collision overhead
ldquotaking turnsrdquo protocolslook for the best of both worlds
5 DataLink Layer 5-34
ldquoTaking Turnsrdquo MAC protocolsPolling
a master node ldquoinvitesrdquo slave nodes to transmit in turnconcerns
polling overhead latencysingle point of failure (the master)
Token passinga control token is passed from one node to the next sequentiallydecentralized and efficient concerns
token overhead latencysingle point of failure
bull token not passedbull failure of one node can break
the channel
5 DataLink Layer 5-35
Summary of MAC protocolsWhat do you do with a shared medium
Channel Partitioning by time frequency or codebull Time Division Frequency Division Code Division
Random Partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard
in others (wireless)bull CSMACD used in IEEE 8023 Ethernetbull CSMACA used in IEEE 80211 WLAN
Taking Turnsbull polling from a central nodebull token passingbull Token Ring used in IEEE 8025
5 DataLink Layer 5-36
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-37
MAC Addresses and ARPIP address
network-layer address32128-bit logical address assigned to an interfaceused to get the datagram to the destination IP subnethierarchical structure
MAC (or LAN or physical or Ethernet) addresslink-layer addressunique 48-bit physical address burned in the adapterrsquos ROMused to get the frame from one to another physically-connected interfaces (within the same network)flat structure
5 DataLink Layer 5-38
LAN Addresses and ARPEach adapter on the LAN has a unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
5 DataLink Layer 5-39
LAN Address (more)MAC address allocation is administered by IEEEmanufacturer buys portion of MAC address space (16 million block) in order to assure uniquenessAnalogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC is a flat address insures portability can move the same adapter from one LAN to another
IP hierarchical address is NOT portabledepends on the IP subnet to which node is attached to
5 DataLink Layer 5-40
ARP Address Resolution ProtocolARP protocol provides IP-to-MAC translation mechanism ARP is similar to DNS except that it is used within the same subnetEach IP node (Host Router) on the LAN has an ARP tableARP Table IPMAC address mappings for someLAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time after which address mapping will be removed (typically 20 min)
Question how to determine MAC address of B knowing Brsquos IP address
Possible ARP table in node 222222222220
5 DataLink Layer 5-41
ARP protocol Same LAN (network)A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP tableA broadcasts ARP query packet containing Bs IP address
Dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP query
B receives the ARP query replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address is a standard or unicast frame
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 ldquoplug-and-playrdquonodes create their ARP tables without intervention from net administrator
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-22
Channel Partitioning MAC protocols CDMACDMA Code Division Multiple Access
each node is assigned a unique codeeach node uses its code to encode the data bits it sendsthe codes are orthogonal (ie different codes cancel or flatten each other at the receiver)all other signals behave as background noise to one anotherthe receiver node knows the code of the sender nodethe receiver decodes the intended signal using its sender codeall nodes can use the channel simultaneouslymay need a separate code for control signaling
drawbacks1 requires strict synchronization for codingdecoding2 fairly complex implementation
5 DataLink Layer 5-23
Random Access Protocolswhen a node has a packet to send
transmit at full channel data rate Rno a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquorandom access MAC protocol specifies
how to detect (or avoid) collisionshow to recover from collisions (eg via delayed retransmissions)
examples of random access MAC protocolsslotted ALOHApure (unslotted) ALOHACSMA CSMACD CSMACA
5 DataLink Layer 5-24
Slotted ALOHAAssumptions
all frames have the same sizetime is divided into equal size slots each equals the time to transmit 1 framenodes start to transmit frames only at the beginning of the slotsnodes are synchronizedif 2 or more nodes transmit within the same slot all nodes detect the collision
Operationwhen a node obtains a fresh frame it transmits in next slotif no collision occurs the node can send a new frame in the next slotif a collision occurs the node retransmits the frame in each subsequent slot with a probability p until success
5 DataLink Layer 5-25
Slotted ALOHA
Pros (advantages)a single active node can continuously transmit at the full rate of channelhighly decentralized only the slots in the nodes need to be in syncsimple
Cons (disadvantages)collisions wasting slotsidle slots due to random back offclock synchronization among nodes for the start of the slot
5 DataLink Layer 5-26
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in the slot with probability p
The probability that one node has success in a slot = p(1-p)N-1
The probability that any node has a success in a slot = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1 as N goes to infinity
max efficiency = 1e = 37
Efficiency in the long-run when there are many nodes each with many frames to send only a fraction of successful slots
At best a channel is used for useful transmissions only 37 of time
5 DataLink Layer 5-27
Pure (unslotted) ALOHAunslotted Aloha simpler as there is no synchronizationwhen a frame first arrives transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
5 DataLink Layer 5-28
Pure Aloha efficiencyP(success by given node) = P(node transmits)
P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]
= p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
hellip finding optimum p as N infinity
max efficiency = 1(2e) = 18
Even worse than slotted ALOHA
5 DataLink Layer 5-29
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmittingif the channel is sensed idle transmit the entire frameif the channel is sensed busy defer transmission
human analogy donrsquot interrupt others
can this prevents collisions
5 DataLink Layer 5-30
CSMA collisionscollisions can still occurdue to the propagation delay between nodes one node may not hear the otherrsquos transmission early enough
collisionthe entire packet transmission time is wasted (the nodes keep transmitting regardless)
spatial layout of nodes
notethe important role of distance amp propagation delay in determining collision probability
5 DataLink Layer 5-31
CSMACD (Collision Detection)CSMACD carrier sensing amp deferral as in CSMA
collisions are detected within a short timecolliding transmissions are aborted reducing the channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted and received signalsdifficult in wireless LANs receiver shut off while transmitting (hence WLAN uses collision avoidance)
human analogy the polite conversationalist
5 DataLink Layer 5-32
CSMACD collision detection
5 DataLink Layer 5-33
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high loadinefficient at low load there is delay in channel access and only 1N of the bandwidth is allocated even if there is only 1 active node
Random access MAC protocolsefficient at low load a single node can fully utilize the channelDecreasing efficiency at high load collision overhead
ldquotaking turnsrdquo protocolslook for the best of both worlds
5 DataLink Layer 5-34
ldquoTaking Turnsrdquo MAC protocolsPolling
a master node ldquoinvitesrdquo slave nodes to transmit in turnconcerns
polling overhead latencysingle point of failure (the master)
Token passinga control token is passed from one node to the next sequentiallydecentralized and efficient concerns
token overhead latencysingle point of failure
bull token not passedbull failure of one node can break
the channel
5 DataLink Layer 5-35
Summary of MAC protocolsWhat do you do with a shared medium
Channel Partitioning by time frequency or codebull Time Division Frequency Division Code Division
Random Partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard
in others (wireless)bull CSMACD used in IEEE 8023 Ethernetbull CSMACA used in IEEE 80211 WLAN
Taking Turnsbull polling from a central nodebull token passingbull Token Ring used in IEEE 8025
5 DataLink Layer 5-36
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-37
MAC Addresses and ARPIP address
network-layer address32128-bit logical address assigned to an interfaceused to get the datagram to the destination IP subnethierarchical structure
MAC (or LAN or physical or Ethernet) addresslink-layer addressunique 48-bit physical address burned in the adapterrsquos ROMused to get the frame from one to another physically-connected interfaces (within the same network)flat structure
5 DataLink Layer 5-38
LAN Addresses and ARPEach adapter on the LAN has a unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
5 DataLink Layer 5-39
LAN Address (more)MAC address allocation is administered by IEEEmanufacturer buys portion of MAC address space (16 million block) in order to assure uniquenessAnalogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC is a flat address insures portability can move the same adapter from one LAN to another
IP hierarchical address is NOT portabledepends on the IP subnet to which node is attached to
5 DataLink Layer 5-40
ARP Address Resolution ProtocolARP protocol provides IP-to-MAC translation mechanism ARP is similar to DNS except that it is used within the same subnetEach IP node (Host Router) on the LAN has an ARP tableARP Table IPMAC address mappings for someLAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time after which address mapping will be removed (typically 20 min)
Question how to determine MAC address of B knowing Brsquos IP address
Possible ARP table in node 222222222220
5 DataLink Layer 5-41
ARP protocol Same LAN (network)A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP tableA broadcasts ARP query packet containing Bs IP address
Dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP query
B receives the ARP query replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address is a standard or unicast frame
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 ldquoplug-and-playrdquonodes create their ARP tables without intervention from net administrator
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-23
Random Access Protocolswhen a node has a packet to send
transmit at full channel data rate Rno a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquorandom access MAC protocol specifies
how to detect (or avoid) collisionshow to recover from collisions (eg via delayed retransmissions)
examples of random access MAC protocolsslotted ALOHApure (unslotted) ALOHACSMA CSMACD CSMACA
5 DataLink Layer 5-24
Slotted ALOHAAssumptions
all frames have the same sizetime is divided into equal size slots each equals the time to transmit 1 framenodes start to transmit frames only at the beginning of the slotsnodes are synchronizedif 2 or more nodes transmit within the same slot all nodes detect the collision
Operationwhen a node obtains a fresh frame it transmits in next slotif no collision occurs the node can send a new frame in the next slotif a collision occurs the node retransmits the frame in each subsequent slot with a probability p until success
5 DataLink Layer 5-25
Slotted ALOHA
Pros (advantages)a single active node can continuously transmit at the full rate of channelhighly decentralized only the slots in the nodes need to be in syncsimple
Cons (disadvantages)collisions wasting slotsidle slots due to random back offclock synchronization among nodes for the start of the slot
5 DataLink Layer 5-26
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in the slot with probability p
The probability that one node has success in a slot = p(1-p)N-1
The probability that any node has a success in a slot = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1 as N goes to infinity
max efficiency = 1e = 37
Efficiency in the long-run when there are many nodes each with many frames to send only a fraction of successful slots
At best a channel is used for useful transmissions only 37 of time
5 DataLink Layer 5-27
Pure (unslotted) ALOHAunslotted Aloha simpler as there is no synchronizationwhen a frame first arrives transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
5 DataLink Layer 5-28
Pure Aloha efficiencyP(success by given node) = P(node transmits)
P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]
= p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
hellip finding optimum p as N infinity
max efficiency = 1(2e) = 18
Even worse than slotted ALOHA
5 DataLink Layer 5-29
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmittingif the channel is sensed idle transmit the entire frameif the channel is sensed busy defer transmission
human analogy donrsquot interrupt others
can this prevents collisions
5 DataLink Layer 5-30
CSMA collisionscollisions can still occurdue to the propagation delay between nodes one node may not hear the otherrsquos transmission early enough
collisionthe entire packet transmission time is wasted (the nodes keep transmitting regardless)
spatial layout of nodes
notethe important role of distance amp propagation delay in determining collision probability
5 DataLink Layer 5-31
CSMACD (Collision Detection)CSMACD carrier sensing amp deferral as in CSMA
collisions are detected within a short timecolliding transmissions are aborted reducing the channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted and received signalsdifficult in wireless LANs receiver shut off while transmitting (hence WLAN uses collision avoidance)
human analogy the polite conversationalist
5 DataLink Layer 5-32
CSMACD collision detection
5 DataLink Layer 5-33
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high loadinefficient at low load there is delay in channel access and only 1N of the bandwidth is allocated even if there is only 1 active node
Random access MAC protocolsefficient at low load a single node can fully utilize the channelDecreasing efficiency at high load collision overhead
ldquotaking turnsrdquo protocolslook for the best of both worlds
5 DataLink Layer 5-34
ldquoTaking Turnsrdquo MAC protocolsPolling
a master node ldquoinvitesrdquo slave nodes to transmit in turnconcerns
polling overhead latencysingle point of failure (the master)
Token passinga control token is passed from one node to the next sequentiallydecentralized and efficient concerns
token overhead latencysingle point of failure
bull token not passedbull failure of one node can break
the channel
5 DataLink Layer 5-35
Summary of MAC protocolsWhat do you do with a shared medium
Channel Partitioning by time frequency or codebull Time Division Frequency Division Code Division
Random Partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard
in others (wireless)bull CSMACD used in IEEE 8023 Ethernetbull CSMACA used in IEEE 80211 WLAN
Taking Turnsbull polling from a central nodebull token passingbull Token Ring used in IEEE 8025
5 DataLink Layer 5-36
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-37
MAC Addresses and ARPIP address
network-layer address32128-bit logical address assigned to an interfaceused to get the datagram to the destination IP subnethierarchical structure
MAC (or LAN or physical or Ethernet) addresslink-layer addressunique 48-bit physical address burned in the adapterrsquos ROMused to get the frame from one to another physically-connected interfaces (within the same network)flat structure
5 DataLink Layer 5-38
LAN Addresses and ARPEach adapter on the LAN has a unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
5 DataLink Layer 5-39
LAN Address (more)MAC address allocation is administered by IEEEmanufacturer buys portion of MAC address space (16 million block) in order to assure uniquenessAnalogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC is a flat address insures portability can move the same adapter from one LAN to another
IP hierarchical address is NOT portabledepends on the IP subnet to which node is attached to
5 DataLink Layer 5-40
ARP Address Resolution ProtocolARP protocol provides IP-to-MAC translation mechanism ARP is similar to DNS except that it is used within the same subnetEach IP node (Host Router) on the LAN has an ARP tableARP Table IPMAC address mappings for someLAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time after which address mapping will be removed (typically 20 min)
Question how to determine MAC address of B knowing Brsquos IP address
Possible ARP table in node 222222222220
5 DataLink Layer 5-41
ARP protocol Same LAN (network)A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP tableA broadcasts ARP query packet containing Bs IP address
Dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP query
B receives the ARP query replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address is a standard or unicast frame
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 ldquoplug-and-playrdquonodes create their ARP tables without intervention from net administrator
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-24
Slotted ALOHAAssumptions
all frames have the same sizetime is divided into equal size slots each equals the time to transmit 1 framenodes start to transmit frames only at the beginning of the slotsnodes are synchronizedif 2 or more nodes transmit within the same slot all nodes detect the collision
Operationwhen a node obtains a fresh frame it transmits in next slotif no collision occurs the node can send a new frame in the next slotif a collision occurs the node retransmits the frame in each subsequent slot with a probability p until success
5 DataLink Layer 5-25
Slotted ALOHA
Pros (advantages)a single active node can continuously transmit at the full rate of channelhighly decentralized only the slots in the nodes need to be in syncsimple
Cons (disadvantages)collisions wasting slotsidle slots due to random back offclock synchronization among nodes for the start of the slot
5 DataLink Layer 5-26
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in the slot with probability p
The probability that one node has success in a slot = p(1-p)N-1
The probability that any node has a success in a slot = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1 as N goes to infinity
max efficiency = 1e = 37
Efficiency in the long-run when there are many nodes each with many frames to send only a fraction of successful slots
At best a channel is used for useful transmissions only 37 of time
5 DataLink Layer 5-27
Pure (unslotted) ALOHAunslotted Aloha simpler as there is no synchronizationwhen a frame first arrives transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
5 DataLink Layer 5-28
Pure Aloha efficiencyP(success by given node) = P(node transmits)
P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]
= p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
hellip finding optimum p as N infinity
max efficiency = 1(2e) = 18
Even worse than slotted ALOHA
5 DataLink Layer 5-29
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmittingif the channel is sensed idle transmit the entire frameif the channel is sensed busy defer transmission
human analogy donrsquot interrupt others
can this prevents collisions
5 DataLink Layer 5-30
CSMA collisionscollisions can still occurdue to the propagation delay between nodes one node may not hear the otherrsquos transmission early enough
collisionthe entire packet transmission time is wasted (the nodes keep transmitting regardless)
spatial layout of nodes
notethe important role of distance amp propagation delay in determining collision probability
5 DataLink Layer 5-31
CSMACD (Collision Detection)CSMACD carrier sensing amp deferral as in CSMA
collisions are detected within a short timecolliding transmissions are aborted reducing the channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted and received signalsdifficult in wireless LANs receiver shut off while transmitting (hence WLAN uses collision avoidance)
human analogy the polite conversationalist
5 DataLink Layer 5-32
CSMACD collision detection
5 DataLink Layer 5-33
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high loadinefficient at low load there is delay in channel access and only 1N of the bandwidth is allocated even if there is only 1 active node
Random access MAC protocolsefficient at low load a single node can fully utilize the channelDecreasing efficiency at high load collision overhead
ldquotaking turnsrdquo protocolslook for the best of both worlds
5 DataLink Layer 5-34
ldquoTaking Turnsrdquo MAC protocolsPolling
a master node ldquoinvitesrdquo slave nodes to transmit in turnconcerns
polling overhead latencysingle point of failure (the master)
Token passinga control token is passed from one node to the next sequentiallydecentralized and efficient concerns
token overhead latencysingle point of failure
bull token not passedbull failure of one node can break
the channel
5 DataLink Layer 5-35
Summary of MAC protocolsWhat do you do with a shared medium
Channel Partitioning by time frequency or codebull Time Division Frequency Division Code Division
Random Partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard
in others (wireless)bull CSMACD used in IEEE 8023 Ethernetbull CSMACA used in IEEE 80211 WLAN
Taking Turnsbull polling from a central nodebull token passingbull Token Ring used in IEEE 8025
5 DataLink Layer 5-36
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-37
MAC Addresses and ARPIP address
network-layer address32128-bit logical address assigned to an interfaceused to get the datagram to the destination IP subnethierarchical structure
MAC (or LAN or physical or Ethernet) addresslink-layer addressunique 48-bit physical address burned in the adapterrsquos ROMused to get the frame from one to another physically-connected interfaces (within the same network)flat structure
5 DataLink Layer 5-38
LAN Addresses and ARPEach adapter on the LAN has a unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
5 DataLink Layer 5-39
LAN Address (more)MAC address allocation is administered by IEEEmanufacturer buys portion of MAC address space (16 million block) in order to assure uniquenessAnalogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC is a flat address insures portability can move the same adapter from one LAN to another
IP hierarchical address is NOT portabledepends on the IP subnet to which node is attached to
5 DataLink Layer 5-40
ARP Address Resolution ProtocolARP protocol provides IP-to-MAC translation mechanism ARP is similar to DNS except that it is used within the same subnetEach IP node (Host Router) on the LAN has an ARP tableARP Table IPMAC address mappings for someLAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time after which address mapping will be removed (typically 20 min)
Question how to determine MAC address of B knowing Brsquos IP address
Possible ARP table in node 222222222220
5 DataLink Layer 5-41
ARP protocol Same LAN (network)A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP tableA broadcasts ARP query packet containing Bs IP address
Dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP query
B receives the ARP query replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address is a standard or unicast frame
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 ldquoplug-and-playrdquonodes create their ARP tables without intervention from net administrator
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-25
Slotted ALOHA
Pros (advantages)a single active node can continuously transmit at the full rate of channelhighly decentralized only the slots in the nodes need to be in syncsimple
Cons (disadvantages)collisions wasting slotsidle slots due to random back offclock synchronization among nodes for the start of the slot
5 DataLink Layer 5-26
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in the slot with probability p
The probability that one node has success in a slot = p(1-p)N-1
The probability that any node has a success in a slot = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1 as N goes to infinity
max efficiency = 1e = 37
Efficiency in the long-run when there are many nodes each with many frames to send only a fraction of successful slots
At best a channel is used for useful transmissions only 37 of time
5 DataLink Layer 5-27
Pure (unslotted) ALOHAunslotted Aloha simpler as there is no synchronizationwhen a frame first arrives transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
5 DataLink Layer 5-28
Pure Aloha efficiencyP(success by given node) = P(node transmits)
P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]
= p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
hellip finding optimum p as N infinity
max efficiency = 1(2e) = 18
Even worse than slotted ALOHA
5 DataLink Layer 5-29
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmittingif the channel is sensed idle transmit the entire frameif the channel is sensed busy defer transmission
human analogy donrsquot interrupt others
can this prevents collisions
5 DataLink Layer 5-30
CSMA collisionscollisions can still occurdue to the propagation delay between nodes one node may not hear the otherrsquos transmission early enough
collisionthe entire packet transmission time is wasted (the nodes keep transmitting regardless)
spatial layout of nodes
notethe important role of distance amp propagation delay in determining collision probability
5 DataLink Layer 5-31
CSMACD (Collision Detection)CSMACD carrier sensing amp deferral as in CSMA
collisions are detected within a short timecolliding transmissions are aborted reducing the channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted and received signalsdifficult in wireless LANs receiver shut off while transmitting (hence WLAN uses collision avoidance)
human analogy the polite conversationalist
5 DataLink Layer 5-32
CSMACD collision detection
5 DataLink Layer 5-33
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high loadinefficient at low load there is delay in channel access and only 1N of the bandwidth is allocated even if there is only 1 active node
Random access MAC protocolsefficient at low load a single node can fully utilize the channelDecreasing efficiency at high load collision overhead
ldquotaking turnsrdquo protocolslook for the best of both worlds
5 DataLink Layer 5-34
ldquoTaking Turnsrdquo MAC protocolsPolling
a master node ldquoinvitesrdquo slave nodes to transmit in turnconcerns
polling overhead latencysingle point of failure (the master)
Token passinga control token is passed from one node to the next sequentiallydecentralized and efficient concerns
token overhead latencysingle point of failure
bull token not passedbull failure of one node can break
the channel
5 DataLink Layer 5-35
Summary of MAC protocolsWhat do you do with a shared medium
Channel Partitioning by time frequency or codebull Time Division Frequency Division Code Division
Random Partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard
in others (wireless)bull CSMACD used in IEEE 8023 Ethernetbull CSMACA used in IEEE 80211 WLAN
Taking Turnsbull polling from a central nodebull token passingbull Token Ring used in IEEE 8025
5 DataLink Layer 5-36
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-37
MAC Addresses and ARPIP address
network-layer address32128-bit logical address assigned to an interfaceused to get the datagram to the destination IP subnethierarchical structure
MAC (or LAN or physical or Ethernet) addresslink-layer addressunique 48-bit physical address burned in the adapterrsquos ROMused to get the frame from one to another physically-connected interfaces (within the same network)flat structure
5 DataLink Layer 5-38
LAN Addresses and ARPEach adapter on the LAN has a unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
5 DataLink Layer 5-39
LAN Address (more)MAC address allocation is administered by IEEEmanufacturer buys portion of MAC address space (16 million block) in order to assure uniquenessAnalogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC is a flat address insures portability can move the same adapter from one LAN to another
IP hierarchical address is NOT portabledepends on the IP subnet to which node is attached to
5 DataLink Layer 5-40
ARP Address Resolution ProtocolARP protocol provides IP-to-MAC translation mechanism ARP is similar to DNS except that it is used within the same subnetEach IP node (Host Router) on the LAN has an ARP tableARP Table IPMAC address mappings for someLAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time after which address mapping will be removed (typically 20 min)
Question how to determine MAC address of B knowing Brsquos IP address
Possible ARP table in node 222222222220
5 DataLink Layer 5-41
ARP protocol Same LAN (network)A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP tableA broadcasts ARP query packet containing Bs IP address
Dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP query
B receives the ARP query replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address is a standard or unicast frame
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 ldquoplug-and-playrdquonodes create their ARP tables without intervention from net administrator
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-26
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in the slot with probability p
The probability that one node has success in a slot = p(1-p)N-1
The probability that any node has a success in a slot = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1 as N goes to infinity
max efficiency = 1e = 37
Efficiency in the long-run when there are many nodes each with many frames to send only a fraction of successful slots
At best a channel is used for useful transmissions only 37 of time
5 DataLink Layer 5-27
Pure (unslotted) ALOHAunslotted Aloha simpler as there is no synchronizationwhen a frame first arrives transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
5 DataLink Layer 5-28
Pure Aloha efficiencyP(success by given node) = P(node transmits)
P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]
= p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
hellip finding optimum p as N infinity
max efficiency = 1(2e) = 18
Even worse than slotted ALOHA
5 DataLink Layer 5-29
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmittingif the channel is sensed idle transmit the entire frameif the channel is sensed busy defer transmission
human analogy donrsquot interrupt others
can this prevents collisions
5 DataLink Layer 5-30
CSMA collisionscollisions can still occurdue to the propagation delay between nodes one node may not hear the otherrsquos transmission early enough
collisionthe entire packet transmission time is wasted (the nodes keep transmitting regardless)
spatial layout of nodes
notethe important role of distance amp propagation delay in determining collision probability
5 DataLink Layer 5-31
CSMACD (Collision Detection)CSMACD carrier sensing amp deferral as in CSMA
collisions are detected within a short timecolliding transmissions are aborted reducing the channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted and received signalsdifficult in wireless LANs receiver shut off while transmitting (hence WLAN uses collision avoidance)
human analogy the polite conversationalist
5 DataLink Layer 5-32
CSMACD collision detection
5 DataLink Layer 5-33
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high loadinefficient at low load there is delay in channel access and only 1N of the bandwidth is allocated even if there is only 1 active node
Random access MAC protocolsefficient at low load a single node can fully utilize the channelDecreasing efficiency at high load collision overhead
ldquotaking turnsrdquo protocolslook for the best of both worlds
5 DataLink Layer 5-34
ldquoTaking Turnsrdquo MAC protocolsPolling
a master node ldquoinvitesrdquo slave nodes to transmit in turnconcerns
polling overhead latencysingle point of failure (the master)
Token passinga control token is passed from one node to the next sequentiallydecentralized and efficient concerns
token overhead latencysingle point of failure
bull token not passedbull failure of one node can break
the channel
5 DataLink Layer 5-35
Summary of MAC protocolsWhat do you do with a shared medium
Channel Partitioning by time frequency or codebull Time Division Frequency Division Code Division
Random Partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard
in others (wireless)bull CSMACD used in IEEE 8023 Ethernetbull CSMACA used in IEEE 80211 WLAN
Taking Turnsbull polling from a central nodebull token passingbull Token Ring used in IEEE 8025
5 DataLink Layer 5-36
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-37
MAC Addresses and ARPIP address
network-layer address32128-bit logical address assigned to an interfaceused to get the datagram to the destination IP subnethierarchical structure
MAC (or LAN or physical or Ethernet) addresslink-layer addressunique 48-bit physical address burned in the adapterrsquos ROMused to get the frame from one to another physically-connected interfaces (within the same network)flat structure
5 DataLink Layer 5-38
LAN Addresses and ARPEach adapter on the LAN has a unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
5 DataLink Layer 5-39
LAN Address (more)MAC address allocation is administered by IEEEmanufacturer buys portion of MAC address space (16 million block) in order to assure uniquenessAnalogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC is a flat address insures portability can move the same adapter from one LAN to another
IP hierarchical address is NOT portabledepends on the IP subnet to which node is attached to
5 DataLink Layer 5-40
ARP Address Resolution ProtocolARP protocol provides IP-to-MAC translation mechanism ARP is similar to DNS except that it is used within the same subnetEach IP node (Host Router) on the LAN has an ARP tableARP Table IPMAC address mappings for someLAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time after which address mapping will be removed (typically 20 min)
Question how to determine MAC address of B knowing Brsquos IP address
Possible ARP table in node 222222222220
5 DataLink Layer 5-41
ARP protocol Same LAN (network)A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP tableA broadcasts ARP query packet containing Bs IP address
Dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP query
B receives the ARP query replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address is a standard or unicast frame
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 ldquoplug-and-playrdquonodes create their ARP tables without intervention from net administrator
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-27
Pure (unslotted) ALOHAunslotted Aloha simpler as there is no synchronizationwhen a frame first arrives transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
5 DataLink Layer 5-28
Pure Aloha efficiencyP(success by given node) = P(node transmits)
P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]
= p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
hellip finding optimum p as N infinity
max efficiency = 1(2e) = 18
Even worse than slotted ALOHA
5 DataLink Layer 5-29
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmittingif the channel is sensed idle transmit the entire frameif the channel is sensed busy defer transmission
human analogy donrsquot interrupt others
can this prevents collisions
5 DataLink Layer 5-30
CSMA collisionscollisions can still occurdue to the propagation delay between nodes one node may not hear the otherrsquos transmission early enough
collisionthe entire packet transmission time is wasted (the nodes keep transmitting regardless)
spatial layout of nodes
notethe important role of distance amp propagation delay in determining collision probability
5 DataLink Layer 5-31
CSMACD (Collision Detection)CSMACD carrier sensing amp deferral as in CSMA
collisions are detected within a short timecolliding transmissions are aborted reducing the channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted and received signalsdifficult in wireless LANs receiver shut off while transmitting (hence WLAN uses collision avoidance)
human analogy the polite conversationalist
5 DataLink Layer 5-32
CSMACD collision detection
5 DataLink Layer 5-33
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high loadinefficient at low load there is delay in channel access and only 1N of the bandwidth is allocated even if there is only 1 active node
Random access MAC protocolsefficient at low load a single node can fully utilize the channelDecreasing efficiency at high load collision overhead
ldquotaking turnsrdquo protocolslook for the best of both worlds
5 DataLink Layer 5-34
ldquoTaking Turnsrdquo MAC protocolsPolling
a master node ldquoinvitesrdquo slave nodes to transmit in turnconcerns
polling overhead latencysingle point of failure (the master)
Token passinga control token is passed from one node to the next sequentiallydecentralized and efficient concerns
token overhead latencysingle point of failure
bull token not passedbull failure of one node can break
the channel
5 DataLink Layer 5-35
Summary of MAC protocolsWhat do you do with a shared medium
Channel Partitioning by time frequency or codebull Time Division Frequency Division Code Division
Random Partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard
in others (wireless)bull CSMACD used in IEEE 8023 Ethernetbull CSMACA used in IEEE 80211 WLAN
Taking Turnsbull polling from a central nodebull token passingbull Token Ring used in IEEE 8025
5 DataLink Layer 5-36
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-37
MAC Addresses and ARPIP address
network-layer address32128-bit logical address assigned to an interfaceused to get the datagram to the destination IP subnethierarchical structure
MAC (or LAN or physical or Ethernet) addresslink-layer addressunique 48-bit physical address burned in the adapterrsquos ROMused to get the frame from one to another physically-connected interfaces (within the same network)flat structure
5 DataLink Layer 5-38
LAN Addresses and ARPEach adapter on the LAN has a unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
5 DataLink Layer 5-39
LAN Address (more)MAC address allocation is administered by IEEEmanufacturer buys portion of MAC address space (16 million block) in order to assure uniquenessAnalogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC is a flat address insures portability can move the same adapter from one LAN to another
IP hierarchical address is NOT portabledepends on the IP subnet to which node is attached to
5 DataLink Layer 5-40
ARP Address Resolution ProtocolARP protocol provides IP-to-MAC translation mechanism ARP is similar to DNS except that it is used within the same subnetEach IP node (Host Router) on the LAN has an ARP tableARP Table IPMAC address mappings for someLAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time after which address mapping will be removed (typically 20 min)
Question how to determine MAC address of B knowing Brsquos IP address
Possible ARP table in node 222222222220
5 DataLink Layer 5-41
ARP protocol Same LAN (network)A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP tableA broadcasts ARP query packet containing Bs IP address
Dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP query
B receives the ARP query replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address is a standard or unicast frame
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 ldquoplug-and-playrdquonodes create their ARP tables without intervention from net administrator
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-28
Pure Aloha efficiencyP(success by given node) = P(node transmits)
P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1]
= p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
hellip finding optimum p as N infinity
max efficiency = 1(2e) = 18
Even worse than slotted ALOHA
5 DataLink Layer 5-29
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmittingif the channel is sensed idle transmit the entire frameif the channel is sensed busy defer transmission
human analogy donrsquot interrupt others
can this prevents collisions
5 DataLink Layer 5-30
CSMA collisionscollisions can still occurdue to the propagation delay between nodes one node may not hear the otherrsquos transmission early enough
collisionthe entire packet transmission time is wasted (the nodes keep transmitting regardless)
spatial layout of nodes
notethe important role of distance amp propagation delay in determining collision probability
5 DataLink Layer 5-31
CSMACD (Collision Detection)CSMACD carrier sensing amp deferral as in CSMA
collisions are detected within a short timecolliding transmissions are aborted reducing the channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted and received signalsdifficult in wireless LANs receiver shut off while transmitting (hence WLAN uses collision avoidance)
human analogy the polite conversationalist
5 DataLink Layer 5-32
CSMACD collision detection
5 DataLink Layer 5-33
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high loadinefficient at low load there is delay in channel access and only 1N of the bandwidth is allocated even if there is only 1 active node
Random access MAC protocolsefficient at low load a single node can fully utilize the channelDecreasing efficiency at high load collision overhead
ldquotaking turnsrdquo protocolslook for the best of both worlds
5 DataLink Layer 5-34
ldquoTaking Turnsrdquo MAC protocolsPolling
a master node ldquoinvitesrdquo slave nodes to transmit in turnconcerns
polling overhead latencysingle point of failure (the master)
Token passinga control token is passed from one node to the next sequentiallydecentralized and efficient concerns
token overhead latencysingle point of failure
bull token not passedbull failure of one node can break
the channel
5 DataLink Layer 5-35
Summary of MAC protocolsWhat do you do with a shared medium
Channel Partitioning by time frequency or codebull Time Division Frequency Division Code Division
Random Partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard
in others (wireless)bull CSMACD used in IEEE 8023 Ethernetbull CSMACA used in IEEE 80211 WLAN
Taking Turnsbull polling from a central nodebull token passingbull Token Ring used in IEEE 8025
5 DataLink Layer 5-36
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-37
MAC Addresses and ARPIP address
network-layer address32128-bit logical address assigned to an interfaceused to get the datagram to the destination IP subnethierarchical structure
MAC (or LAN or physical or Ethernet) addresslink-layer addressunique 48-bit physical address burned in the adapterrsquos ROMused to get the frame from one to another physically-connected interfaces (within the same network)flat structure
5 DataLink Layer 5-38
LAN Addresses and ARPEach adapter on the LAN has a unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
5 DataLink Layer 5-39
LAN Address (more)MAC address allocation is administered by IEEEmanufacturer buys portion of MAC address space (16 million block) in order to assure uniquenessAnalogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC is a flat address insures portability can move the same adapter from one LAN to another
IP hierarchical address is NOT portabledepends on the IP subnet to which node is attached to
5 DataLink Layer 5-40
ARP Address Resolution ProtocolARP protocol provides IP-to-MAC translation mechanism ARP is similar to DNS except that it is used within the same subnetEach IP node (Host Router) on the LAN has an ARP tableARP Table IPMAC address mappings for someLAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time after which address mapping will be removed (typically 20 min)
Question how to determine MAC address of B knowing Brsquos IP address
Possible ARP table in node 222222222220
5 DataLink Layer 5-41
ARP protocol Same LAN (network)A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP tableA broadcasts ARP query packet containing Bs IP address
Dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP query
B receives the ARP query replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address is a standard or unicast frame
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 ldquoplug-and-playrdquonodes create their ARP tables without intervention from net administrator
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-29
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmittingif the channel is sensed idle transmit the entire frameif the channel is sensed busy defer transmission
human analogy donrsquot interrupt others
can this prevents collisions
5 DataLink Layer 5-30
CSMA collisionscollisions can still occurdue to the propagation delay between nodes one node may not hear the otherrsquos transmission early enough
collisionthe entire packet transmission time is wasted (the nodes keep transmitting regardless)
spatial layout of nodes
notethe important role of distance amp propagation delay in determining collision probability
5 DataLink Layer 5-31
CSMACD (Collision Detection)CSMACD carrier sensing amp deferral as in CSMA
collisions are detected within a short timecolliding transmissions are aborted reducing the channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted and received signalsdifficult in wireless LANs receiver shut off while transmitting (hence WLAN uses collision avoidance)
human analogy the polite conversationalist
5 DataLink Layer 5-32
CSMACD collision detection
5 DataLink Layer 5-33
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high loadinefficient at low load there is delay in channel access and only 1N of the bandwidth is allocated even if there is only 1 active node
Random access MAC protocolsefficient at low load a single node can fully utilize the channelDecreasing efficiency at high load collision overhead
ldquotaking turnsrdquo protocolslook for the best of both worlds
5 DataLink Layer 5-34
ldquoTaking Turnsrdquo MAC protocolsPolling
a master node ldquoinvitesrdquo slave nodes to transmit in turnconcerns
polling overhead latencysingle point of failure (the master)
Token passinga control token is passed from one node to the next sequentiallydecentralized and efficient concerns
token overhead latencysingle point of failure
bull token not passedbull failure of one node can break
the channel
5 DataLink Layer 5-35
Summary of MAC protocolsWhat do you do with a shared medium
Channel Partitioning by time frequency or codebull Time Division Frequency Division Code Division
Random Partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard
in others (wireless)bull CSMACD used in IEEE 8023 Ethernetbull CSMACA used in IEEE 80211 WLAN
Taking Turnsbull polling from a central nodebull token passingbull Token Ring used in IEEE 8025
5 DataLink Layer 5-36
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-37
MAC Addresses and ARPIP address
network-layer address32128-bit logical address assigned to an interfaceused to get the datagram to the destination IP subnethierarchical structure
MAC (or LAN or physical or Ethernet) addresslink-layer addressunique 48-bit physical address burned in the adapterrsquos ROMused to get the frame from one to another physically-connected interfaces (within the same network)flat structure
5 DataLink Layer 5-38
LAN Addresses and ARPEach adapter on the LAN has a unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
5 DataLink Layer 5-39
LAN Address (more)MAC address allocation is administered by IEEEmanufacturer buys portion of MAC address space (16 million block) in order to assure uniquenessAnalogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC is a flat address insures portability can move the same adapter from one LAN to another
IP hierarchical address is NOT portabledepends on the IP subnet to which node is attached to
5 DataLink Layer 5-40
ARP Address Resolution ProtocolARP protocol provides IP-to-MAC translation mechanism ARP is similar to DNS except that it is used within the same subnetEach IP node (Host Router) on the LAN has an ARP tableARP Table IPMAC address mappings for someLAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time after which address mapping will be removed (typically 20 min)
Question how to determine MAC address of B knowing Brsquos IP address
Possible ARP table in node 222222222220
5 DataLink Layer 5-41
ARP protocol Same LAN (network)A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP tableA broadcasts ARP query packet containing Bs IP address
Dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP query
B receives the ARP query replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address is a standard or unicast frame
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 ldquoplug-and-playrdquonodes create their ARP tables without intervention from net administrator
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-30
CSMA collisionscollisions can still occurdue to the propagation delay between nodes one node may not hear the otherrsquos transmission early enough
collisionthe entire packet transmission time is wasted (the nodes keep transmitting regardless)
spatial layout of nodes
notethe important role of distance amp propagation delay in determining collision probability
5 DataLink Layer 5-31
CSMACD (Collision Detection)CSMACD carrier sensing amp deferral as in CSMA
collisions are detected within a short timecolliding transmissions are aborted reducing the channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted and received signalsdifficult in wireless LANs receiver shut off while transmitting (hence WLAN uses collision avoidance)
human analogy the polite conversationalist
5 DataLink Layer 5-32
CSMACD collision detection
5 DataLink Layer 5-33
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high loadinefficient at low load there is delay in channel access and only 1N of the bandwidth is allocated even if there is only 1 active node
Random access MAC protocolsefficient at low load a single node can fully utilize the channelDecreasing efficiency at high load collision overhead
ldquotaking turnsrdquo protocolslook for the best of both worlds
5 DataLink Layer 5-34
ldquoTaking Turnsrdquo MAC protocolsPolling
a master node ldquoinvitesrdquo slave nodes to transmit in turnconcerns
polling overhead latencysingle point of failure (the master)
Token passinga control token is passed from one node to the next sequentiallydecentralized and efficient concerns
token overhead latencysingle point of failure
bull token not passedbull failure of one node can break
the channel
5 DataLink Layer 5-35
Summary of MAC protocolsWhat do you do with a shared medium
Channel Partitioning by time frequency or codebull Time Division Frequency Division Code Division
Random Partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard
in others (wireless)bull CSMACD used in IEEE 8023 Ethernetbull CSMACA used in IEEE 80211 WLAN
Taking Turnsbull polling from a central nodebull token passingbull Token Ring used in IEEE 8025
5 DataLink Layer 5-36
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-37
MAC Addresses and ARPIP address
network-layer address32128-bit logical address assigned to an interfaceused to get the datagram to the destination IP subnethierarchical structure
MAC (or LAN or physical or Ethernet) addresslink-layer addressunique 48-bit physical address burned in the adapterrsquos ROMused to get the frame from one to another physically-connected interfaces (within the same network)flat structure
5 DataLink Layer 5-38
LAN Addresses and ARPEach adapter on the LAN has a unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
5 DataLink Layer 5-39
LAN Address (more)MAC address allocation is administered by IEEEmanufacturer buys portion of MAC address space (16 million block) in order to assure uniquenessAnalogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC is a flat address insures portability can move the same adapter from one LAN to another
IP hierarchical address is NOT portabledepends on the IP subnet to which node is attached to
5 DataLink Layer 5-40
ARP Address Resolution ProtocolARP protocol provides IP-to-MAC translation mechanism ARP is similar to DNS except that it is used within the same subnetEach IP node (Host Router) on the LAN has an ARP tableARP Table IPMAC address mappings for someLAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time after which address mapping will be removed (typically 20 min)
Question how to determine MAC address of B knowing Brsquos IP address
Possible ARP table in node 222222222220
5 DataLink Layer 5-41
ARP protocol Same LAN (network)A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP tableA broadcasts ARP query packet containing Bs IP address
Dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP query
B receives the ARP query replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address is a standard or unicast frame
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 ldquoplug-and-playrdquonodes create their ARP tables without intervention from net administrator
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-31
CSMACD (Collision Detection)CSMACD carrier sensing amp deferral as in CSMA
collisions are detected within a short timecolliding transmissions are aborted reducing the channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted and received signalsdifficult in wireless LANs receiver shut off while transmitting (hence WLAN uses collision avoidance)
human analogy the polite conversationalist
5 DataLink Layer 5-32
CSMACD collision detection
5 DataLink Layer 5-33
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high loadinefficient at low load there is delay in channel access and only 1N of the bandwidth is allocated even if there is only 1 active node
Random access MAC protocolsefficient at low load a single node can fully utilize the channelDecreasing efficiency at high load collision overhead
ldquotaking turnsrdquo protocolslook for the best of both worlds
5 DataLink Layer 5-34
ldquoTaking Turnsrdquo MAC protocolsPolling
a master node ldquoinvitesrdquo slave nodes to transmit in turnconcerns
polling overhead latencysingle point of failure (the master)
Token passinga control token is passed from one node to the next sequentiallydecentralized and efficient concerns
token overhead latencysingle point of failure
bull token not passedbull failure of one node can break
the channel
5 DataLink Layer 5-35
Summary of MAC protocolsWhat do you do with a shared medium
Channel Partitioning by time frequency or codebull Time Division Frequency Division Code Division
Random Partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard
in others (wireless)bull CSMACD used in IEEE 8023 Ethernetbull CSMACA used in IEEE 80211 WLAN
Taking Turnsbull polling from a central nodebull token passingbull Token Ring used in IEEE 8025
5 DataLink Layer 5-36
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-37
MAC Addresses and ARPIP address
network-layer address32128-bit logical address assigned to an interfaceused to get the datagram to the destination IP subnethierarchical structure
MAC (or LAN or physical or Ethernet) addresslink-layer addressunique 48-bit physical address burned in the adapterrsquos ROMused to get the frame from one to another physically-connected interfaces (within the same network)flat structure
5 DataLink Layer 5-38
LAN Addresses and ARPEach adapter on the LAN has a unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
5 DataLink Layer 5-39
LAN Address (more)MAC address allocation is administered by IEEEmanufacturer buys portion of MAC address space (16 million block) in order to assure uniquenessAnalogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC is a flat address insures portability can move the same adapter from one LAN to another
IP hierarchical address is NOT portabledepends on the IP subnet to which node is attached to
5 DataLink Layer 5-40
ARP Address Resolution ProtocolARP protocol provides IP-to-MAC translation mechanism ARP is similar to DNS except that it is used within the same subnetEach IP node (Host Router) on the LAN has an ARP tableARP Table IPMAC address mappings for someLAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time after which address mapping will be removed (typically 20 min)
Question how to determine MAC address of B knowing Brsquos IP address
Possible ARP table in node 222222222220
5 DataLink Layer 5-41
ARP protocol Same LAN (network)A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP tableA broadcasts ARP query packet containing Bs IP address
Dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP query
B receives the ARP query replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address is a standard or unicast frame
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 ldquoplug-and-playrdquonodes create their ARP tables without intervention from net administrator
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-32
CSMACD collision detection
5 DataLink Layer 5-33
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high loadinefficient at low load there is delay in channel access and only 1N of the bandwidth is allocated even if there is only 1 active node
Random access MAC protocolsefficient at low load a single node can fully utilize the channelDecreasing efficiency at high load collision overhead
ldquotaking turnsrdquo protocolslook for the best of both worlds
5 DataLink Layer 5-34
ldquoTaking Turnsrdquo MAC protocolsPolling
a master node ldquoinvitesrdquo slave nodes to transmit in turnconcerns
polling overhead latencysingle point of failure (the master)
Token passinga control token is passed from one node to the next sequentiallydecentralized and efficient concerns
token overhead latencysingle point of failure
bull token not passedbull failure of one node can break
the channel
5 DataLink Layer 5-35
Summary of MAC protocolsWhat do you do with a shared medium
Channel Partitioning by time frequency or codebull Time Division Frequency Division Code Division
Random Partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard
in others (wireless)bull CSMACD used in IEEE 8023 Ethernetbull CSMACA used in IEEE 80211 WLAN
Taking Turnsbull polling from a central nodebull token passingbull Token Ring used in IEEE 8025
5 DataLink Layer 5-36
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-37
MAC Addresses and ARPIP address
network-layer address32128-bit logical address assigned to an interfaceused to get the datagram to the destination IP subnethierarchical structure
MAC (or LAN or physical or Ethernet) addresslink-layer addressunique 48-bit physical address burned in the adapterrsquos ROMused to get the frame from one to another physically-connected interfaces (within the same network)flat structure
5 DataLink Layer 5-38
LAN Addresses and ARPEach adapter on the LAN has a unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
5 DataLink Layer 5-39
LAN Address (more)MAC address allocation is administered by IEEEmanufacturer buys portion of MAC address space (16 million block) in order to assure uniquenessAnalogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC is a flat address insures portability can move the same adapter from one LAN to another
IP hierarchical address is NOT portabledepends on the IP subnet to which node is attached to
5 DataLink Layer 5-40
ARP Address Resolution ProtocolARP protocol provides IP-to-MAC translation mechanism ARP is similar to DNS except that it is used within the same subnetEach IP node (Host Router) on the LAN has an ARP tableARP Table IPMAC address mappings for someLAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time after which address mapping will be removed (typically 20 min)
Question how to determine MAC address of B knowing Brsquos IP address
Possible ARP table in node 222222222220
5 DataLink Layer 5-41
ARP protocol Same LAN (network)A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP tableA broadcasts ARP query packet containing Bs IP address
Dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP query
B receives the ARP query replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address is a standard or unicast frame
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 ldquoplug-and-playrdquonodes create their ARP tables without intervention from net administrator
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-33
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high loadinefficient at low load there is delay in channel access and only 1N of the bandwidth is allocated even if there is only 1 active node
Random access MAC protocolsefficient at low load a single node can fully utilize the channelDecreasing efficiency at high load collision overhead
ldquotaking turnsrdquo protocolslook for the best of both worlds
5 DataLink Layer 5-34
ldquoTaking Turnsrdquo MAC protocolsPolling
a master node ldquoinvitesrdquo slave nodes to transmit in turnconcerns
polling overhead latencysingle point of failure (the master)
Token passinga control token is passed from one node to the next sequentiallydecentralized and efficient concerns
token overhead latencysingle point of failure
bull token not passedbull failure of one node can break
the channel
5 DataLink Layer 5-35
Summary of MAC protocolsWhat do you do with a shared medium
Channel Partitioning by time frequency or codebull Time Division Frequency Division Code Division
Random Partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard
in others (wireless)bull CSMACD used in IEEE 8023 Ethernetbull CSMACA used in IEEE 80211 WLAN
Taking Turnsbull polling from a central nodebull token passingbull Token Ring used in IEEE 8025
5 DataLink Layer 5-36
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-37
MAC Addresses and ARPIP address
network-layer address32128-bit logical address assigned to an interfaceused to get the datagram to the destination IP subnethierarchical structure
MAC (or LAN or physical or Ethernet) addresslink-layer addressunique 48-bit physical address burned in the adapterrsquos ROMused to get the frame from one to another physically-connected interfaces (within the same network)flat structure
5 DataLink Layer 5-38
LAN Addresses and ARPEach adapter on the LAN has a unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
5 DataLink Layer 5-39
LAN Address (more)MAC address allocation is administered by IEEEmanufacturer buys portion of MAC address space (16 million block) in order to assure uniquenessAnalogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC is a flat address insures portability can move the same adapter from one LAN to another
IP hierarchical address is NOT portabledepends on the IP subnet to which node is attached to
5 DataLink Layer 5-40
ARP Address Resolution ProtocolARP protocol provides IP-to-MAC translation mechanism ARP is similar to DNS except that it is used within the same subnetEach IP node (Host Router) on the LAN has an ARP tableARP Table IPMAC address mappings for someLAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time after which address mapping will be removed (typically 20 min)
Question how to determine MAC address of B knowing Brsquos IP address
Possible ARP table in node 222222222220
5 DataLink Layer 5-41
ARP protocol Same LAN (network)A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP tableA broadcasts ARP query packet containing Bs IP address
Dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP query
B receives the ARP query replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address is a standard or unicast frame
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 ldquoplug-and-playrdquonodes create their ARP tables without intervention from net administrator
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-34
ldquoTaking Turnsrdquo MAC protocolsPolling
a master node ldquoinvitesrdquo slave nodes to transmit in turnconcerns
polling overhead latencysingle point of failure (the master)
Token passinga control token is passed from one node to the next sequentiallydecentralized and efficient concerns
token overhead latencysingle point of failure
bull token not passedbull failure of one node can break
the channel
5 DataLink Layer 5-35
Summary of MAC protocolsWhat do you do with a shared medium
Channel Partitioning by time frequency or codebull Time Division Frequency Division Code Division
Random Partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard
in others (wireless)bull CSMACD used in IEEE 8023 Ethernetbull CSMACA used in IEEE 80211 WLAN
Taking Turnsbull polling from a central nodebull token passingbull Token Ring used in IEEE 8025
5 DataLink Layer 5-36
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-37
MAC Addresses and ARPIP address
network-layer address32128-bit logical address assigned to an interfaceused to get the datagram to the destination IP subnethierarchical structure
MAC (or LAN or physical or Ethernet) addresslink-layer addressunique 48-bit physical address burned in the adapterrsquos ROMused to get the frame from one to another physically-connected interfaces (within the same network)flat structure
5 DataLink Layer 5-38
LAN Addresses and ARPEach adapter on the LAN has a unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
5 DataLink Layer 5-39
LAN Address (more)MAC address allocation is administered by IEEEmanufacturer buys portion of MAC address space (16 million block) in order to assure uniquenessAnalogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC is a flat address insures portability can move the same adapter from one LAN to another
IP hierarchical address is NOT portabledepends on the IP subnet to which node is attached to
5 DataLink Layer 5-40
ARP Address Resolution ProtocolARP protocol provides IP-to-MAC translation mechanism ARP is similar to DNS except that it is used within the same subnetEach IP node (Host Router) on the LAN has an ARP tableARP Table IPMAC address mappings for someLAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time after which address mapping will be removed (typically 20 min)
Question how to determine MAC address of B knowing Brsquos IP address
Possible ARP table in node 222222222220
5 DataLink Layer 5-41
ARP protocol Same LAN (network)A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP tableA broadcasts ARP query packet containing Bs IP address
Dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP query
B receives the ARP query replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address is a standard or unicast frame
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 ldquoplug-and-playrdquonodes create their ARP tables without intervention from net administrator
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-35
Summary of MAC protocolsWhat do you do with a shared medium
Channel Partitioning by time frequency or codebull Time Division Frequency Division Code Division
Random Partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire) hard
in others (wireless)bull CSMACD used in IEEE 8023 Ethernetbull CSMACA used in IEEE 80211 WLAN
Taking Turnsbull polling from a central nodebull token passingbull Token Ring used in IEEE 8025
5 DataLink Layer 5-36
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-37
MAC Addresses and ARPIP address
network-layer address32128-bit logical address assigned to an interfaceused to get the datagram to the destination IP subnethierarchical structure
MAC (or LAN or physical or Ethernet) addresslink-layer addressunique 48-bit physical address burned in the adapterrsquos ROMused to get the frame from one to another physically-connected interfaces (within the same network)flat structure
5 DataLink Layer 5-38
LAN Addresses and ARPEach adapter on the LAN has a unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
5 DataLink Layer 5-39
LAN Address (more)MAC address allocation is administered by IEEEmanufacturer buys portion of MAC address space (16 million block) in order to assure uniquenessAnalogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC is a flat address insures portability can move the same adapter from one LAN to another
IP hierarchical address is NOT portabledepends on the IP subnet to which node is attached to
5 DataLink Layer 5-40
ARP Address Resolution ProtocolARP protocol provides IP-to-MAC translation mechanism ARP is similar to DNS except that it is used within the same subnetEach IP node (Host Router) on the LAN has an ARP tableARP Table IPMAC address mappings for someLAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time after which address mapping will be removed (typically 20 min)
Question how to determine MAC address of B knowing Brsquos IP address
Possible ARP table in node 222222222220
5 DataLink Layer 5-41
ARP protocol Same LAN (network)A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP tableA broadcasts ARP query packet containing Bs IP address
Dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP query
B receives the ARP query replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address is a standard or unicast frame
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 ldquoplug-and-playrdquonodes create their ARP tables without intervention from net administrator
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-36
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-37
MAC Addresses and ARPIP address
network-layer address32128-bit logical address assigned to an interfaceused to get the datagram to the destination IP subnethierarchical structure
MAC (or LAN or physical or Ethernet) addresslink-layer addressunique 48-bit physical address burned in the adapterrsquos ROMused to get the frame from one to another physically-connected interfaces (within the same network)flat structure
5 DataLink Layer 5-38
LAN Addresses and ARPEach adapter on the LAN has a unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
5 DataLink Layer 5-39
LAN Address (more)MAC address allocation is administered by IEEEmanufacturer buys portion of MAC address space (16 million block) in order to assure uniquenessAnalogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC is a flat address insures portability can move the same adapter from one LAN to another
IP hierarchical address is NOT portabledepends on the IP subnet to which node is attached to
5 DataLink Layer 5-40
ARP Address Resolution ProtocolARP protocol provides IP-to-MAC translation mechanism ARP is similar to DNS except that it is used within the same subnetEach IP node (Host Router) on the LAN has an ARP tableARP Table IPMAC address mappings for someLAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time after which address mapping will be removed (typically 20 min)
Question how to determine MAC address of B knowing Brsquos IP address
Possible ARP table in node 222222222220
5 DataLink Layer 5-41
ARP protocol Same LAN (network)A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP tableA broadcasts ARP query packet containing Bs IP address
Dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP query
B receives the ARP query replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address is a standard or unicast frame
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 ldquoplug-and-playrdquonodes create their ARP tables without intervention from net administrator
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-37
MAC Addresses and ARPIP address
network-layer address32128-bit logical address assigned to an interfaceused to get the datagram to the destination IP subnethierarchical structure
MAC (or LAN or physical or Ethernet) addresslink-layer addressunique 48-bit physical address burned in the adapterrsquos ROMused to get the frame from one to another physically-connected interfaces (within the same network)flat structure
5 DataLink Layer 5-38
LAN Addresses and ARPEach adapter on the LAN has a unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
5 DataLink Layer 5-39
LAN Address (more)MAC address allocation is administered by IEEEmanufacturer buys portion of MAC address space (16 million block) in order to assure uniquenessAnalogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC is a flat address insures portability can move the same adapter from one LAN to another
IP hierarchical address is NOT portabledepends on the IP subnet to which node is attached to
5 DataLink Layer 5-40
ARP Address Resolution ProtocolARP protocol provides IP-to-MAC translation mechanism ARP is similar to DNS except that it is used within the same subnetEach IP node (Host Router) on the LAN has an ARP tableARP Table IPMAC address mappings for someLAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time after which address mapping will be removed (typically 20 min)
Question how to determine MAC address of B knowing Brsquos IP address
Possible ARP table in node 222222222220
5 DataLink Layer 5-41
ARP protocol Same LAN (network)A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP tableA broadcasts ARP query packet containing Bs IP address
Dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP query
B receives the ARP query replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address is a standard or unicast frame
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 ldquoplug-and-playrdquonodes create their ARP tables without intervention from net administrator
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-38
LAN Addresses and ARPEach adapter on the LAN has a unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
5 DataLink Layer 5-39
LAN Address (more)MAC address allocation is administered by IEEEmanufacturer buys portion of MAC address space (16 million block) in order to assure uniquenessAnalogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC is a flat address insures portability can move the same adapter from one LAN to another
IP hierarchical address is NOT portabledepends on the IP subnet to which node is attached to
5 DataLink Layer 5-40
ARP Address Resolution ProtocolARP protocol provides IP-to-MAC translation mechanism ARP is similar to DNS except that it is used within the same subnetEach IP node (Host Router) on the LAN has an ARP tableARP Table IPMAC address mappings for someLAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time after which address mapping will be removed (typically 20 min)
Question how to determine MAC address of B knowing Brsquos IP address
Possible ARP table in node 222222222220
5 DataLink Layer 5-41
ARP protocol Same LAN (network)A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP tableA broadcasts ARP query packet containing Bs IP address
Dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP query
B receives the ARP query replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address is a standard or unicast frame
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 ldquoplug-and-playrdquonodes create their ARP tables without intervention from net administrator
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-39
LAN Address (more)MAC address allocation is administered by IEEEmanufacturer buys portion of MAC address space (16 million block) in order to assure uniquenessAnalogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC is a flat address insures portability can move the same adapter from one LAN to another
IP hierarchical address is NOT portabledepends on the IP subnet to which node is attached to
5 DataLink Layer 5-40
ARP Address Resolution ProtocolARP protocol provides IP-to-MAC translation mechanism ARP is similar to DNS except that it is used within the same subnetEach IP node (Host Router) on the LAN has an ARP tableARP Table IPMAC address mappings for someLAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time after which address mapping will be removed (typically 20 min)
Question how to determine MAC address of B knowing Brsquos IP address
Possible ARP table in node 222222222220
5 DataLink Layer 5-41
ARP protocol Same LAN (network)A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP tableA broadcasts ARP query packet containing Bs IP address
Dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP query
B receives the ARP query replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address is a standard or unicast frame
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 ldquoplug-and-playrdquonodes create their ARP tables without intervention from net administrator
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-40
ARP Address Resolution ProtocolARP protocol provides IP-to-MAC translation mechanism ARP is similar to DNS except that it is used within the same subnetEach IP node (Host Router) on the LAN has an ARP tableARP Table IPMAC address mappings for someLAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time after which address mapping will be removed (typically 20 min)
Question how to determine MAC address of B knowing Brsquos IP address
Possible ARP table in node 222222222220
5 DataLink Layer 5-41
ARP protocol Same LAN (network)A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP tableA broadcasts ARP query packet containing Bs IP address
Dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP query
B receives the ARP query replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address is a standard or unicast frame
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 ldquoplug-and-playrdquonodes create their ARP tables without intervention from net administrator
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-41
ARP protocol Same LAN (network)A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP tableA broadcasts ARP query packet containing Bs IP address
Dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive the ARP query
B receives the ARP query replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address is a standard or unicast frame
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 ldquoplug-and-playrdquonodes create their ARP tables without intervention from net administrator
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-42
Routing off the subnet to another LANwalkthrough send datagram from A to B via R
assume A knowrsquos B IP address
the router has an IP address an ARP table and an adapter for each interface (ie for each IP network or LAN connected to it)
AR
B
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-43
A creates a datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates a link-layer frame with Rs MAC address as destination The frame contains A-to-B IP datagramArsquos adapter sends the frame and Rrsquos adapter receives it R removes the IP datagram from the Ethernet frame sees that it is destined to B and uses ARP to get Brsquos MAC address R creates a frame containing A-to-B IP datagram and sends it to B
A
R
B
SIP=A SMAC=74-29-9C-E8-FF-55 DIP=B DMAC=E6-E9-00-17-BB-4B
SIP=A SMAC=1A-23-F9-CD-06-9BDIP=B DMAC=49-BD-D2-C7-56-2A
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-44
DHCP (Dynamic Host Configuration Protocol)It is a client-server protocolUsed by arriving host to get network configuration information such as its own IP address and IP address of the gateway or routerEach subnet usually has a DHCP server or a relay agent (typically a router) that knows the address of the DHCP server
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-45
DHCP Client-Server Interaction ProcessDHCP server discovery a client must find a server to interact with
DHCP discover message sent (or broadcasted) by the clientbull within a UDP segment to port 67 bull within a datagram with broadcast IP address 255255255255 and ldquothis
hostrdquo source IP address of 0000bull within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agentthe message contains a transaction ID to match responses to requests
DHCP server offer(s) at least one server offers the informationDHCP offer message sent by one or more DHCP server to the client
bull each offer contains the transaction ID of the request a proposed IP address a subnet mask a lease-time (ie the amount of time the IP address will be valid for)
DHCP request the client chooses one of the offers and responds with a DHCP request message echoing back the configuration infoDHCP ACK the server confirms the requested parameters by sending a DHCP ACK message to the client
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-46
DHCP Client-Server Interaction Process
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-47
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-48
Ethernet (IEEE 8023)It is the ldquodominantrdquo wired LAN technology Why
cheap $20 for 100Mbsfirst widely used LAN technologysimpler amp cheaper than token ring LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos EthernetSketch 30 years ago
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-49
Star topologyThe original Ethernet used a bus topology (10Base2 with thin coaxial cable) and was popular through mid 90sNow star topology prevailsConnection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-50
Ethernet Frame StructureThe sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011used to wakeup and synchronize the receiver and sender clockthe last two bits in the 8th byte indicate the start of the frame contentsthe end of the frame is detected by the absence of the current on the cable
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-51
Ethernet Frame Structure (more)Addresses 6 bytes
if the adapter receives a frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to the intended network-layer protocolotherwise the adapter discards the frame
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
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-52
Unreliable connectionless service
Connectionless No handshaking between sending and receiving adapter Unreliable receiving adapter doesnrsquot send ACK or NAK to sending adapter
the stream of datagrams that is passed to network layer can have gapsgaps will be filled if the application is using TCPotherwise the application will see the gaps
This makes Ethernet very simple and inexpensive
All Ethernet technologies are connectionless and unreliable
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-53
Ethernet uses CSMACDNo time slotsadapter doesnrsquot transmit if it senses that some other adapter is transmitting that is carrier sensetransmitting adapter aborts when it senses that another adapter is transmitting that is it uses collision detectionBefore attempting a retransmission adapter waits a random time that is it uses random access
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-54
Ethernet CSMACD algorithm1 The adaptor receives the
datagram from the network layer amp creates the frame
2 If the adapter senses that the channel is idle for 96 bit times it starts to transmit the frame If it senses that the channel is busy it waits until the channel is idle (plus 96 bit times) then and then transmits
3 If the adapter transmits the entire frame without detecting another transmission the adapter is done with frame
4 If the adapter detects another transmission while transmitting it aborts and sends a 48-bit jam signal to let others know
5 After aborting the adapter enters an exponential backoff after the mth
collision adapter chooses a random number K from 012hellip2m-1 and waits K512 bit times and returns to Step 2
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-55
Ethernetrsquos CSMACD (more)Jam Signal make sure that all
other transmitters are aware of the collision
Bit time 01 microsec for 10 Mbps Ethernetfor K=1023 wait time is 1023x512x01 microsec= 50 msec
Exponential BackoffGoal adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes random wait will be longer
first collision choose K from 01 delay = K 512 bit transmission timesafter second collision choose K from 0123hellipafter ten or more collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-56
CSMACD efficiency
Tprop = max propagation time between 2 nodes in LANttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0Goes to 1 as ttrans goes to infinityMuch better than ALOHA and still decentralized simple and cheap
transprop tt 511efficiency
+=
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-57
10BaseT and 100BaseT10100 Mbps rate latter called ldquofast ethernetrdquoT stands for Twisted PairNodes connect to a hub ldquostar topologyrdquo with 100 m max distance between each node and the hub (ie the max distance between any pair of node is 200 m)
twisted pair
hub
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-58
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out on all other linksreceive and transmit at the same rateno frame bufferingno CSMACD at hub adapters detect collisionsprovide network management functionality
bull detect and isolate malfunctioning adaptersbull can collect traffic information and pass it to a connected host
twisted pair
hub
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-59
Manchester encoding
Used in 10BaseTEach bit has a transitionAllows clocks in sending and receiving nodes to synchronize to each other
no need for a centralized global clock among nodes100BaseT uses the more efficient 4B5B encodingHey this is physical-layer stuff
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-60
Gbit Ethernet (IEEE 8023z amp 3ae)uses standard Ethernet frame formatallows for point-to-point links (via switches) and shared broadcast channels (via hubs)in the shared mode CSMACD is used and short distances between nodes are required for efficiencyuses hubs called here ldquoBuffered DistributorsrdquoFull-Duplex at 1 Gbps for point-to-point linksused as backbone to connect multiple 10100MbpsUsed to run on fiber but now on cat-5 UTP cable10 Gbps is available now
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-61
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Interconnections Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-62
Interconnecting with hubsprovides inter-segment host-to-host communication extends the max distance between hosts provides a degree of graceful degradation
malfunctioning hubs are isolated
hub hub hub
Backbone hub
Computer EngineeringComputer Science Information Systems
Multi-tier Hub Design
individual segment collision domains become one large collision domain
aggregate throughput is reducedcanrsquot interconnect 10 amp 100BaseT some performance restrictions
max number of nodes and max distance in a collision domainmax number of tiers
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-63
SwitchLink-layer device
stores and forwards Ethernet framesexamines the frame header and selectively forwards the frame based on the MAC dest addresswhen a frame is to be forwarded on a segment the switch uses CSMACD to access the segment
transparenthosts are unaware of the presence of switches
plug-and-play self-learningswitches do not need to be configured
advantages of switched compared to hubsLAN segments are connected while each is an isolated collision domain
bull better aggregate throughputcan interconnect different LAN technologiesno limit on the LAN size when interconnected via a switch
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-64
Forwarding
How to determine onto which LAN segment to forward a frameLooks like a routing problem
hub hubhub
switch1
2 3
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-65
Self learning
a switch has a switch tableentry in the switch table
(MAC Address Interface Time Stamp of the entry)stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through which interfaces
when a frame is received the switch ldquolearnsrdquo the location of the sender the incoming LAN segmentrecords senderlocation pair in switch table
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-66
FilteringForwardingWhen switch receives a frame
index the switch table using the MAC dest addressif entry is found for the destination
thenif dest is on segment from which frame arrived
then drop the frameelse forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-67
Switch exampleSuppose C sends a frame to D
the switch receives the frame from Cnotes in the switch table that C is on interface 1because D is not in the table the switch forwards the frame into interfaces 2 and 3
frame is received by D
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEG
1123
12 3
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-68
Switch exampleSuppose D replies back with frame to C
the switch receives a frame from Dnotes in the switch table that D is on interface 2because C is in table the switch forwards the frame only to interface 1
frame is received by C
hub hub hub
switch
A
B CD
EF G H
I
address interfaceABEGCD
112312
12 3
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-69
Switch traffic isolationthe switch installation breaks the subnet into LAN segmentsThe switch filters the packets
same-LAN-segment frames not usually forwarded onto other LAN segmentssegments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-70
Switches dedicated accessswitch with many interfaceshosts have direct connection to switchno collisions full duplexaggregate throughput increases
Switching A-to-Arsquo and B-to-Brsquosimultaneously no collisions
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-71
More on Switches
cut-through switching the frame is forwarded from the input to the output port without first collecting the entire frame
slight reduction in latencycombinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-72
Institutional network
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-73
Switches vs Routersboth store-and-forward devices
routers are network layer devices (examine network layer headers)switches are link layer devices
routers maintain routing tables implement routing algorithmsswitches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-74
Summary comparison
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-75
Link Layer
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-Layer Addressing55 Ethernet
56 Hubs and switches57 PPP58 Link Virtualization ATM
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-76
Point to Point Data Link Controlone sender one receiver one link easier than broadcast link
no Media Access Controlno need for explicit MAC addressingeg dialup link ISDN line
popular point-to-point DLC protocolsPPP (point-to-point protocol)HDLC High level data link control (Data link used to be considered ldquohigh layerrdquo in protocol stack
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-77
PPP Design Requirements [RFC 1557]
packet framing encapsulation of network-layer datagram in data link frame
carry network layer data of any network layer protocol (not just IP) at same timeability to demultiplex upwards
bit transparency must carry any bit pattern in the data fielderror detection (no correction)connection liveness detect signal link failure to network layernetwork layer address negotiation endpoint can learnconfigure each otherrsquos network address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-78
PPP non-requirements
no error correctionrecoveryno flow controlout of order delivery OK no need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-79
PPP Data Frame
Flag delimiter (framing)Address does nothing (only one option)Control does nothing in the future possible multiple control fieldsProtocol upper layer protocol to which frame delivered (eg PPP-LCP IP IPCP etc)
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-80
PPP Data Frame
info upper layer data being carriedcheck cyclic redundancy check for error detection
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-81
Byte Stuffingldquodata transparencyrdquo requirement data field must
be allowed to include flag pattern lt01111110gtQ is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byteReceiver
two 01111110 bytes in a row discard first byte continue data receptionsingle 01111110 flag byte
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-82
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address
5 DataLink Layer 5-83
PPP Data Control ProtocolBefore exchanging network-
layer data data link peers mustconfigure PPP link (max frame length authentication)learnconfigure networklayer information
for IP carry IP Control Protocol (IPCP) msgs(protocol field 8021) to configurelearn IP address