View
213
Download
0
Category
Tags:
Preview:
Citation preview
1
Fall 2015
COMP 46055605Computer Networks
Donghyun (David) KimDepartment of Mathematics and PhysicsNorth Carolina Central University
Some slides are in courtesy of J Kurose and K Ross
Chapter 5
Link Layer and LANs
2
Chapter 5 The Data Link LayerChapter goals bull understand principles behind data link
layer servicesbull error detection correctionbull sharing a broadcast channel multiple ac-
cessbull link layer addressingbull reliable data transfer flow control done
bull instantiation and implementation of various link layer technologies
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
3
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
4
Link Layer IntroductionSome terminologybull hosts and routers are nodesbull communication channels that
connect adjacent nodes along communication path are links
bull wired linksbull wireless linksbull LANsbull layer-2 packet is a frame encapsu-
lates datagram
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
5
Link layer contextbull datagram transferred
by different link pro-tocols over different linksbull eg Ethernet on first
link frame relay on in-termediate links 80211 on last link
bull each link protocol provides different servicesbull eg may or may not
provide rdt over linkFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transportation analogybull trip from Princeton to
Lausannebull limo Princeton to JFKbull plane JFK to Genevabull train Geneva to Lausanne
bull tourist = datagrambull transport segment =
communication linkbull transportation mode =
link layer protocolbull travel agent =
routing algorithm
6
Link Layer Servicesbull framing link access
bull encapsulate datagram into frame adding header trailer
bull channel access if shared mediumbull ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
bull reliable delivery between adjacent nodesbull we learned how to do this already (chapter 3)bull seldom used on low bit-error link (fiber some
twisted pair)bull wireless links high error rates
bull Q why both link-level and end-end reliabilityFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
7
Link Layer Services (more)bull flow control
bull pacing between adjacent sending and receiving nodes
bull error detection bull errors caused by signal attenuation noise bull receiver detects presence of errors
bull signals sender for retransmission or drops frame
bull error correction bull receiver identifies and corrects bit error(s) without re-
sorting to retransmission
bull half-duplex and full-duplexbull with half duplex nodes at both ends of link can
transmit but not at same timeFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
8
Where is the link layer imple-mentedbull in each and every hostbull link layer implemented
in ldquoadaptorrdquo (aka net-work interface card NIC)bull Ethernet card PCMCI
card 80211 cardbull implements link physical
layer
bull attaches into hostrsquos sys-tem buses
bull combination of hard-ware software firmware
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
controller
physicaltransmission
cpu memory
host bus (eg PCI)
network adaptercard
host schematic
applicationtransportnetwork
link
linkphysical
9
Adaptors Communicating
bull sending sidebull encapsulates datagram
in framebull adds error checking bits
rdt flow control etc
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull receiving sidebull looks for errors rdt flow
control etcbull extracts datagram
passes to upper layer at receiving side
controller controller
sending host receiving host
datagram datagram
datagram
frame
10
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
11
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
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
otherwise
12
Parity Checking
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
13
Internet checksum (re-view)
Senderbull treat segment contents
as sequence of 16-bit integers
bull checksum addition (1rsquos complement sum) of segment contents
bull sender puts checksum value into UDP check-sum field
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Receiverbull compute checksum of
received segmentbull check if computed
checksum equals check-sum field valuebull NO - error detectedbull YES - no error detected
But maybe errors nonethe-less
Goal detect ldquoerrorsrdquo (eg flipped bits) in trans-mitted packet (note used at transport layer only
14
Checksumming Cyclic Redun-dancy Checkbull view data bits D as a binary numberbull choose r+1 bit pattern (generator) G bull goal choose r CRC bits R such that
bull ltDRgt exactly divisible by G (modulo 2) bull receiver knows G divides ltDRgt by G If non-zero remain-
der error detectedbull can detect all burst errors less than r+1 bits
bull widely used in practice (Ethernet 80211 WiFi ATM)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
15
Checksumming Cyclic Redun-dancy Checkbull 1011 XOR 0101 = 1110 bull 1001 XOR 1101 = 0100
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
16
CRC Example
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
WantD2r XOR R = nG
equivalentlyD2r = nG XOR R
equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
17
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
18
Multiple Access Links and Proto-colsTwo types of ldquolinksrdquobull point-to-point
bull PPP for dial-up accessbull point-to-point link between Ethernet switch and host
bull broadcast (shared wire or medium)bull old-fashioned Ethernetbull upstream HFC (Hybrid Fiber-Coaxial)bull 80211 wireless LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
19
Multiple Access protocolsbull single shared broadcast channel bull two or more simultaneous transmis-
sions by nodes interference bull collision if a node receives two or more
signals at the same time
multiple access protocolbull distributed algorithm that deter-
mines how nodes share channel ie determine when node can transmit
bull communication about channel shar-ing must use channel itself bull no out-of-band channel for coordination
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
20
Ideal Multiple Access ProtocolBroadcast channel of rate R bps1 when one node wants to transmit it
can send at rate R2 when M nodes want to transmit each
can send at average rate RM3 fully decentralized
bull no special node to coordinate transmissionsbull no synchronization of clocks slots
4 simple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
21
MAC Protocols a taxonomyThree broad classesbull Channel Partitioning
bull divide channel into smaller ldquopiecesrdquo (time slots frequency code)
bull allocate piece to node for exclusive use
bull Random Accessbull channel not divided allow collisionsbull ldquorecoverrdquo from collisions
bull ldquoTaking turnsrdquobull nodes take turns but nodes with more to send
can take longer turnsFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
22
Channel Partitioning MAC proto-cols TDMATDMA time division multiple access bull access to channel in rounds bull each station gets fixed length slot
(length = pkt trans time) in each round bull unused slots go idle bull example 6-station LAN 134 have pkt
slots 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
1 3 4 1 3 4
6-slotframe
23
Channel Partitioning MAC proto-cols FDMAFDMA frequency division multiple access bull channel spectrum divided into frequency bandsbull each station assigned fixed frequency bandbull unused transmission time in frequency bands go idle bull example 6-station LAN 134 have pkt frequency
bands 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
freq
uency
bands time
FDM cable
24
Random Access Protocolsbull When node has packet to send
bull transmit at full channel data rate Rbull no a priori coordination among nodes
bull two or more transmitting nodes ldquocollisionrdquobull random access MAC protocol specifies
bull how to detect collisionsbull how to recover from collisions (eg via delayed retrans-
missions)
bull Examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA
bull (CS Carrier Sensing MA Multiple AccessCD Collision Detection CA Collision Avoidance)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
25
Slotted ALOHAAssumptionsbull all frames same sizebull time divided into
equal size slots (time to transmit 1 frame)
bull nodes start to transmit only slot beginning
bull nodes are synchro-nized
bull if 2 or more nodes transmit in slot all nodes detect collision
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Operationbull when node obtains
fresh frame trans-mits in next slotbull if no collision node
can send new frame in next slot
bull if collision node re-transmits frame in each subsequent slot with prob p until success
26
Slotted ALOHA
Prosbull single active node can
continuously transmit at full rate of channel
bull highly decentralized only slots in nodes need to be in sync
bull simpleFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Consbull collisions wasting slotsbull idle slotsbull nodes may be able to
detect collision in less than time to transmit packet
bull clock synchronization
27
Slotted Aloha Efficiency
bull suppose N nodes with many frames to send each transmits in slot with probability p
bull prob that given node has success in a slot = p(1-p)N-1
bull prob that any node has a success = Np(1-p)N-1
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull max efficiency find p that max-imizes Np(1-p)N-1
bull for many nodes take limit of Np(1- p)N-1 as N goes to infinity gives
Max efficiency = 1e = 37
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
At best channelused for useful transmissions 37of time
28
Pure (unslotted) ALOHAbull unslotted Aloha simpler no synchro-
nizationbull when frame first arrives
bull transmit immediately
bull collision probability increasesbull frame sent at t0 collides with other frames sent in
[t0-1t0+1]
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
29
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 choosing optimum p and then letting
= 1(2e) = 18
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
N
even worse than slotted Aloha
30
CSMA (Carrier Sense Multiple Access)CSMA listen before transmitIf channel sensed idle transmit entire framebull If channel sensed busy defer transmis-
sion
bull human analogy donrsquot interrupt others
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
31
CSMA Collisionscollisions can still occurbull propagation delay means
two nodes may not hear each otherrsquos transmission
collisionbull entire packet transmis-
sion time wasted
notebull role of distance amp propa-
gation delay in determin-ing collision probability
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
spatial layout of nodes
32
CSMACD (Collision Detec-tion)CSMACD carrier sensing deferral as in CSMA
bull collisions detected within short timebull colliding transmissions aborted reducing channel
wastage
bull collision detection bull easy in wired LANs measure signal strengths
compare transmitted received signalsbull difficult in wireless LANs received signal strength
overwhelmed by local transmission strength
bull human analogy the polite conversationalist
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
33
CSMACD collision detection
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
34
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
bull share channel efficiently and fairly at high loadbull inefficient at low load delay in channel access
1N bandwidth allocated even if only 1 active node
Random access MAC protocolsbull efficient at low load single node can fully uti-
lize channelbull high load collision overhead
ldquotaking turnsrdquo protocolsbull look for best of both worlds
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
35
ldquoTaking Turnsrdquo MAC protocolsPolling bull master node ldquoinvitesrdquo
slave nodes to transmit in turn
bull typically used with ldquodumbrdquo slave devices
bull concernsbull polling overhead bull latencybull single point of failure
(master)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
T
data
(nothingto send)
T
36
ldquoTaking Turnsrdquo MAC protocolsToken passingbull control token
passed from one node to next se-quentially
bull token messagebull concerns
bull token overhead bull latencybull single point of failure
(token)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
master
slaves
poll
data
data
37
Summary of MAC protocolsbull channel partitioning by time frequency or
codebull Time Division Frequency Division
bull random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
bull taking turnsbull polling from central site token passing
bull Bluetooth FDDI IBM Token Ring Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
38
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
39
MAC Addresses and ARPbull 32-bit IP address
bull network-layer addressbull used to get datagram to destination IP subnet
bull MAC (or LAN or physical or Ethernet) ad-dress bull function get frame from one interface to an-
other physically-connected interface (same network)
bull 48 bit MAC address (for most LANs)bull burned in NIC ROM also sometimes software set-
table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
40
LAN Addresses and ARP
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Each adapter on LAN has 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)
41
LAN Address (more)bull MAC address allocation administered by IEEEbull manufacturer buys portion of MAC address
space (to assure uniqueness)bull analogy
(a) MAC address like Social Security Num-ber
(b) IP address like postal addressbull MAC flat address portability
bull can move LAN card from one LAN to another
bull IP hierarchical address NOT portablebull address depends on IP subnet to which node is at-
tachedFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
2
Chapter 5 The Data Link LayerChapter goals bull understand principles behind data link
layer servicesbull error detection correctionbull sharing a broadcast channel multiple ac-
cessbull link layer addressingbull reliable data transfer flow control done
bull instantiation and implementation of various link layer technologies
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
3
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
4
Link Layer IntroductionSome terminologybull hosts and routers are nodesbull communication channels that
connect adjacent nodes along communication path are links
bull wired linksbull wireless linksbull LANsbull layer-2 packet is a frame encapsu-
lates datagram
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
5
Link layer contextbull datagram transferred
by different link pro-tocols over different linksbull eg Ethernet on first
link frame relay on in-termediate links 80211 on last link
bull each link protocol provides different servicesbull eg may or may not
provide rdt over linkFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transportation analogybull trip from Princeton to
Lausannebull limo Princeton to JFKbull plane JFK to Genevabull train Geneva to Lausanne
bull tourist = datagrambull transport segment =
communication linkbull transportation mode =
link layer protocolbull travel agent =
routing algorithm
6
Link Layer Servicesbull framing link access
bull encapsulate datagram into frame adding header trailer
bull channel access if shared mediumbull ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
bull reliable delivery between adjacent nodesbull we learned how to do this already (chapter 3)bull seldom used on low bit-error link (fiber some
twisted pair)bull wireless links high error rates
bull Q why both link-level and end-end reliabilityFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
7
Link Layer Services (more)bull flow control
bull pacing between adjacent sending and receiving nodes
bull error detection bull errors caused by signal attenuation noise bull receiver detects presence of errors
bull signals sender for retransmission or drops frame
bull error correction bull receiver identifies and corrects bit error(s) without re-
sorting to retransmission
bull half-duplex and full-duplexbull with half duplex nodes at both ends of link can
transmit but not at same timeFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
8
Where is the link layer imple-mentedbull in each and every hostbull link layer implemented
in ldquoadaptorrdquo (aka net-work interface card NIC)bull Ethernet card PCMCI
card 80211 cardbull implements link physical
layer
bull attaches into hostrsquos sys-tem buses
bull combination of hard-ware software firmware
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
controller
physicaltransmission
cpu memory
host bus (eg PCI)
network adaptercard
host schematic
applicationtransportnetwork
link
linkphysical
9
Adaptors Communicating
bull sending sidebull encapsulates datagram
in framebull adds error checking bits
rdt flow control etc
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull receiving sidebull looks for errors rdt flow
control etcbull extracts datagram
passes to upper layer at receiving side
controller controller
sending host receiving host
datagram datagram
datagram
frame
10
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
11
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
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
otherwise
12
Parity Checking
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
13
Internet checksum (re-view)
Senderbull treat segment contents
as sequence of 16-bit integers
bull checksum addition (1rsquos complement sum) of segment contents
bull sender puts checksum value into UDP check-sum field
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Receiverbull compute checksum of
received segmentbull check if computed
checksum equals check-sum field valuebull NO - error detectedbull YES - no error detected
But maybe errors nonethe-less
Goal detect ldquoerrorsrdquo (eg flipped bits) in trans-mitted packet (note used at transport layer only
14
Checksumming Cyclic Redun-dancy Checkbull view data bits D as a binary numberbull choose r+1 bit pattern (generator) G bull goal choose r CRC bits R such that
bull ltDRgt exactly divisible by G (modulo 2) bull receiver knows G divides ltDRgt by G If non-zero remain-
der error detectedbull can detect all burst errors less than r+1 bits
bull widely used in practice (Ethernet 80211 WiFi ATM)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
15
Checksumming Cyclic Redun-dancy Checkbull 1011 XOR 0101 = 1110 bull 1001 XOR 1101 = 0100
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
16
CRC Example
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
WantD2r XOR R = nG
equivalentlyD2r = nG XOR R
equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
17
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
18
Multiple Access Links and Proto-colsTwo types of ldquolinksrdquobull point-to-point
bull PPP for dial-up accessbull point-to-point link between Ethernet switch and host
bull broadcast (shared wire or medium)bull old-fashioned Ethernetbull upstream HFC (Hybrid Fiber-Coaxial)bull 80211 wireless LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
19
Multiple Access protocolsbull single shared broadcast channel bull two or more simultaneous transmis-
sions by nodes interference bull collision if a node receives two or more
signals at the same time
multiple access protocolbull distributed algorithm that deter-
mines how nodes share channel ie determine when node can transmit
bull communication about channel shar-ing must use channel itself bull no out-of-band channel for coordination
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
20
Ideal Multiple Access ProtocolBroadcast channel of rate R bps1 when one node wants to transmit it
can send at rate R2 when M nodes want to transmit each
can send at average rate RM3 fully decentralized
bull no special node to coordinate transmissionsbull no synchronization of clocks slots
4 simple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
21
MAC Protocols a taxonomyThree broad classesbull Channel Partitioning
bull divide channel into smaller ldquopiecesrdquo (time slots frequency code)
bull allocate piece to node for exclusive use
bull Random Accessbull channel not divided allow collisionsbull ldquorecoverrdquo from collisions
bull ldquoTaking turnsrdquobull nodes take turns but nodes with more to send
can take longer turnsFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
22
Channel Partitioning MAC proto-cols TDMATDMA time division multiple access bull access to channel in rounds bull each station gets fixed length slot
(length = pkt trans time) in each round bull unused slots go idle bull example 6-station LAN 134 have pkt
slots 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
1 3 4 1 3 4
6-slotframe
23
Channel Partitioning MAC proto-cols FDMAFDMA frequency division multiple access bull channel spectrum divided into frequency bandsbull each station assigned fixed frequency bandbull unused transmission time in frequency bands go idle bull example 6-station LAN 134 have pkt frequency
bands 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
freq
uency
bands time
FDM cable
24
Random Access Protocolsbull When node has packet to send
bull transmit at full channel data rate Rbull no a priori coordination among nodes
bull two or more transmitting nodes ldquocollisionrdquobull random access MAC protocol specifies
bull how to detect collisionsbull how to recover from collisions (eg via delayed retrans-
missions)
bull Examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA
bull (CS Carrier Sensing MA Multiple AccessCD Collision Detection CA Collision Avoidance)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
25
Slotted ALOHAAssumptionsbull all frames same sizebull time divided into
equal size slots (time to transmit 1 frame)
bull nodes start to transmit only slot beginning
bull nodes are synchro-nized
bull if 2 or more nodes transmit in slot all nodes detect collision
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Operationbull when node obtains
fresh frame trans-mits in next slotbull if no collision node
can send new frame in next slot
bull if collision node re-transmits frame in each subsequent slot with prob p until success
26
Slotted ALOHA
Prosbull single active node can
continuously transmit at full rate of channel
bull highly decentralized only slots in nodes need to be in sync
bull simpleFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Consbull collisions wasting slotsbull idle slotsbull nodes may be able to
detect collision in less than time to transmit packet
bull clock synchronization
27
Slotted Aloha Efficiency
bull suppose N nodes with many frames to send each transmits in slot with probability p
bull prob that given node has success in a slot = p(1-p)N-1
bull prob that any node has a success = Np(1-p)N-1
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull max efficiency find p that max-imizes Np(1-p)N-1
bull for many nodes take limit of Np(1- p)N-1 as N goes to infinity gives
Max efficiency = 1e = 37
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
At best channelused for useful transmissions 37of time
28
Pure (unslotted) ALOHAbull unslotted Aloha simpler no synchro-
nizationbull when frame first arrives
bull transmit immediately
bull collision probability increasesbull frame sent at t0 collides with other frames sent in
[t0-1t0+1]
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
29
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 choosing optimum p and then letting
= 1(2e) = 18
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
N
even worse than slotted Aloha
30
CSMA (Carrier Sense Multiple Access)CSMA listen before transmitIf channel sensed idle transmit entire framebull If channel sensed busy defer transmis-
sion
bull human analogy donrsquot interrupt others
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
31
CSMA Collisionscollisions can still occurbull propagation delay means
two nodes may not hear each otherrsquos transmission
collisionbull entire packet transmis-
sion time wasted
notebull role of distance amp propa-
gation delay in determin-ing collision probability
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
spatial layout of nodes
32
CSMACD (Collision Detec-tion)CSMACD carrier sensing deferral as in CSMA
bull collisions detected within short timebull colliding transmissions aborted reducing channel
wastage
bull collision detection bull easy in wired LANs measure signal strengths
compare transmitted received signalsbull difficult in wireless LANs received signal strength
overwhelmed by local transmission strength
bull human analogy the polite conversationalist
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
33
CSMACD collision detection
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
34
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
bull share channel efficiently and fairly at high loadbull inefficient at low load delay in channel access
1N bandwidth allocated even if only 1 active node
Random access MAC protocolsbull efficient at low load single node can fully uti-
lize channelbull high load collision overhead
ldquotaking turnsrdquo protocolsbull look for best of both worlds
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
35
ldquoTaking Turnsrdquo MAC protocolsPolling bull master node ldquoinvitesrdquo
slave nodes to transmit in turn
bull typically used with ldquodumbrdquo slave devices
bull concernsbull polling overhead bull latencybull single point of failure
(master)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
T
data
(nothingto send)
T
36
ldquoTaking Turnsrdquo MAC protocolsToken passingbull control token
passed from one node to next se-quentially
bull token messagebull concerns
bull token overhead bull latencybull single point of failure
(token)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
master
slaves
poll
data
data
37
Summary of MAC protocolsbull channel partitioning by time frequency or
codebull Time Division Frequency Division
bull random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
bull taking turnsbull polling from central site token passing
bull Bluetooth FDDI IBM Token Ring Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
38
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
39
MAC Addresses and ARPbull 32-bit IP address
bull network-layer addressbull used to get datagram to destination IP subnet
bull MAC (or LAN or physical or Ethernet) ad-dress bull function get frame from one interface to an-
other physically-connected interface (same network)
bull 48 bit MAC address (for most LANs)bull burned in NIC ROM also sometimes software set-
table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
40
LAN Addresses and ARP
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Each adapter on LAN has 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)
41
LAN Address (more)bull MAC address allocation administered by IEEEbull manufacturer buys portion of MAC address
space (to assure uniqueness)bull analogy
(a) MAC address like Social Security Num-ber
(b) IP address like postal addressbull MAC flat address portability
bull can move LAN card from one LAN to another
bull IP hierarchical address NOT portablebull address depends on IP subnet to which node is at-
tachedFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
3
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
4
Link Layer IntroductionSome terminologybull hosts and routers are nodesbull communication channels that
connect adjacent nodes along communication path are links
bull wired linksbull wireless linksbull LANsbull layer-2 packet is a frame encapsu-
lates datagram
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
5
Link layer contextbull datagram transferred
by different link pro-tocols over different linksbull eg Ethernet on first
link frame relay on in-termediate links 80211 on last link
bull each link protocol provides different servicesbull eg may or may not
provide rdt over linkFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transportation analogybull trip from Princeton to
Lausannebull limo Princeton to JFKbull plane JFK to Genevabull train Geneva to Lausanne
bull tourist = datagrambull transport segment =
communication linkbull transportation mode =
link layer protocolbull travel agent =
routing algorithm
6
Link Layer Servicesbull framing link access
bull encapsulate datagram into frame adding header trailer
bull channel access if shared mediumbull ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
bull reliable delivery between adjacent nodesbull we learned how to do this already (chapter 3)bull seldom used on low bit-error link (fiber some
twisted pair)bull wireless links high error rates
bull Q why both link-level and end-end reliabilityFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
7
Link Layer Services (more)bull flow control
bull pacing between adjacent sending and receiving nodes
bull error detection bull errors caused by signal attenuation noise bull receiver detects presence of errors
bull signals sender for retransmission or drops frame
bull error correction bull receiver identifies and corrects bit error(s) without re-
sorting to retransmission
bull half-duplex and full-duplexbull with half duplex nodes at both ends of link can
transmit but not at same timeFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
8
Where is the link layer imple-mentedbull in each and every hostbull link layer implemented
in ldquoadaptorrdquo (aka net-work interface card NIC)bull Ethernet card PCMCI
card 80211 cardbull implements link physical
layer
bull attaches into hostrsquos sys-tem buses
bull combination of hard-ware software firmware
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
controller
physicaltransmission
cpu memory
host bus (eg PCI)
network adaptercard
host schematic
applicationtransportnetwork
link
linkphysical
9
Adaptors Communicating
bull sending sidebull encapsulates datagram
in framebull adds error checking bits
rdt flow control etc
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull receiving sidebull looks for errors rdt flow
control etcbull extracts datagram
passes to upper layer at receiving side
controller controller
sending host receiving host
datagram datagram
datagram
frame
10
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
11
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
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
otherwise
12
Parity Checking
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
13
Internet checksum (re-view)
Senderbull treat segment contents
as sequence of 16-bit integers
bull checksum addition (1rsquos complement sum) of segment contents
bull sender puts checksum value into UDP check-sum field
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Receiverbull compute checksum of
received segmentbull check if computed
checksum equals check-sum field valuebull NO - error detectedbull YES - no error detected
But maybe errors nonethe-less
Goal detect ldquoerrorsrdquo (eg flipped bits) in trans-mitted packet (note used at transport layer only
14
Checksumming Cyclic Redun-dancy Checkbull view data bits D as a binary numberbull choose r+1 bit pattern (generator) G bull goal choose r CRC bits R such that
bull ltDRgt exactly divisible by G (modulo 2) bull receiver knows G divides ltDRgt by G If non-zero remain-
der error detectedbull can detect all burst errors less than r+1 bits
bull widely used in practice (Ethernet 80211 WiFi ATM)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
15
Checksumming Cyclic Redun-dancy Checkbull 1011 XOR 0101 = 1110 bull 1001 XOR 1101 = 0100
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
16
CRC Example
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
WantD2r XOR R = nG
equivalentlyD2r = nG XOR R
equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
17
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
18
Multiple Access Links and Proto-colsTwo types of ldquolinksrdquobull point-to-point
bull PPP for dial-up accessbull point-to-point link between Ethernet switch and host
bull broadcast (shared wire or medium)bull old-fashioned Ethernetbull upstream HFC (Hybrid Fiber-Coaxial)bull 80211 wireless LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
19
Multiple Access protocolsbull single shared broadcast channel bull two or more simultaneous transmis-
sions by nodes interference bull collision if a node receives two or more
signals at the same time
multiple access protocolbull distributed algorithm that deter-
mines how nodes share channel ie determine when node can transmit
bull communication about channel shar-ing must use channel itself bull no out-of-band channel for coordination
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
20
Ideal Multiple Access ProtocolBroadcast channel of rate R bps1 when one node wants to transmit it
can send at rate R2 when M nodes want to transmit each
can send at average rate RM3 fully decentralized
bull no special node to coordinate transmissionsbull no synchronization of clocks slots
4 simple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
21
MAC Protocols a taxonomyThree broad classesbull Channel Partitioning
bull divide channel into smaller ldquopiecesrdquo (time slots frequency code)
bull allocate piece to node for exclusive use
bull Random Accessbull channel not divided allow collisionsbull ldquorecoverrdquo from collisions
bull ldquoTaking turnsrdquobull nodes take turns but nodes with more to send
can take longer turnsFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
22
Channel Partitioning MAC proto-cols TDMATDMA time division multiple access bull access to channel in rounds bull each station gets fixed length slot
(length = pkt trans time) in each round bull unused slots go idle bull example 6-station LAN 134 have pkt
slots 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
1 3 4 1 3 4
6-slotframe
23
Channel Partitioning MAC proto-cols FDMAFDMA frequency division multiple access bull channel spectrum divided into frequency bandsbull each station assigned fixed frequency bandbull unused transmission time in frequency bands go idle bull example 6-station LAN 134 have pkt frequency
bands 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
freq
uency
bands time
FDM cable
24
Random Access Protocolsbull When node has packet to send
bull transmit at full channel data rate Rbull no a priori coordination among nodes
bull two or more transmitting nodes ldquocollisionrdquobull random access MAC protocol specifies
bull how to detect collisionsbull how to recover from collisions (eg via delayed retrans-
missions)
bull Examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA
bull (CS Carrier Sensing MA Multiple AccessCD Collision Detection CA Collision Avoidance)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
25
Slotted ALOHAAssumptionsbull all frames same sizebull time divided into
equal size slots (time to transmit 1 frame)
bull nodes start to transmit only slot beginning
bull nodes are synchro-nized
bull if 2 or more nodes transmit in slot all nodes detect collision
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Operationbull when node obtains
fresh frame trans-mits in next slotbull if no collision node
can send new frame in next slot
bull if collision node re-transmits frame in each subsequent slot with prob p until success
26
Slotted ALOHA
Prosbull single active node can
continuously transmit at full rate of channel
bull highly decentralized only slots in nodes need to be in sync
bull simpleFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Consbull collisions wasting slotsbull idle slotsbull nodes may be able to
detect collision in less than time to transmit packet
bull clock synchronization
27
Slotted Aloha Efficiency
bull suppose N nodes with many frames to send each transmits in slot with probability p
bull prob that given node has success in a slot = p(1-p)N-1
bull prob that any node has a success = Np(1-p)N-1
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull max efficiency find p that max-imizes Np(1-p)N-1
bull for many nodes take limit of Np(1- p)N-1 as N goes to infinity gives
Max efficiency = 1e = 37
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
At best channelused for useful transmissions 37of time
28
Pure (unslotted) ALOHAbull unslotted Aloha simpler no synchro-
nizationbull when frame first arrives
bull transmit immediately
bull collision probability increasesbull frame sent at t0 collides with other frames sent in
[t0-1t0+1]
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
29
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 choosing optimum p and then letting
= 1(2e) = 18
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
N
even worse than slotted Aloha
30
CSMA (Carrier Sense Multiple Access)CSMA listen before transmitIf channel sensed idle transmit entire framebull If channel sensed busy defer transmis-
sion
bull human analogy donrsquot interrupt others
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
31
CSMA Collisionscollisions can still occurbull propagation delay means
two nodes may not hear each otherrsquos transmission
collisionbull entire packet transmis-
sion time wasted
notebull role of distance amp propa-
gation delay in determin-ing collision probability
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
spatial layout of nodes
32
CSMACD (Collision Detec-tion)CSMACD carrier sensing deferral as in CSMA
bull collisions detected within short timebull colliding transmissions aborted reducing channel
wastage
bull collision detection bull easy in wired LANs measure signal strengths
compare transmitted received signalsbull difficult in wireless LANs received signal strength
overwhelmed by local transmission strength
bull human analogy the polite conversationalist
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
33
CSMACD collision detection
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
34
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
bull share channel efficiently and fairly at high loadbull inefficient at low load delay in channel access
1N bandwidth allocated even if only 1 active node
Random access MAC protocolsbull efficient at low load single node can fully uti-
lize channelbull high load collision overhead
ldquotaking turnsrdquo protocolsbull look for best of both worlds
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
35
ldquoTaking Turnsrdquo MAC protocolsPolling bull master node ldquoinvitesrdquo
slave nodes to transmit in turn
bull typically used with ldquodumbrdquo slave devices
bull concernsbull polling overhead bull latencybull single point of failure
(master)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
T
data
(nothingto send)
T
36
ldquoTaking Turnsrdquo MAC protocolsToken passingbull control token
passed from one node to next se-quentially
bull token messagebull concerns
bull token overhead bull latencybull single point of failure
(token)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
master
slaves
poll
data
data
37
Summary of MAC protocolsbull channel partitioning by time frequency or
codebull Time Division Frequency Division
bull random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
bull taking turnsbull polling from central site token passing
bull Bluetooth FDDI IBM Token Ring Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
38
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
39
MAC Addresses and ARPbull 32-bit IP address
bull network-layer addressbull used to get datagram to destination IP subnet
bull MAC (or LAN or physical or Ethernet) ad-dress bull function get frame from one interface to an-
other physically-connected interface (same network)
bull 48 bit MAC address (for most LANs)bull burned in NIC ROM also sometimes software set-
table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
40
LAN Addresses and ARP
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Each adapter on LAN has 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)
41
LAN Address (more)bull MAC address allocation administered by IEEEbull manufacturer buys portion of MAC address
space (to assure uniqueness)bull analogy
(a) MAC address like Social Security Num-ber
(b) IP address like postal addressbull MAC flat address portability
bull can move LAN card from one LAN to another
bull IP hierarchical address NOT portablebull address depends on IP subnet to which node is at-
tachedFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
4
Link Layer IntroductionSome terminologybull hosts and routers are nodesbull communication channels that
connect adjacent nodes along communication path are links
bull wired linksbull wireless linksbull LANsbull layer-2 packet is a frame encapsu-
lates datagram
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
5
Link layer contextbull datagram transferred
by different link pro-tocols over different linksbull eg Ethernet on first
link frame relay on in-termediate links 80211 on last link
bull each link protocol provides different servicesbull eg may or may not
provide rdt over linkFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transportation analogybull trip from Princeton to
Lausannebull limo Princeton to JFKbull plane JFK to Genevabull train Geneva to Lausanne
bull tourist = datagrambull transport segment =
communication linkbull transportation mode =
link layer protocolbull travel agent =
routing algorithm
6
Link Layer Servicesbull framing link access
bull encapsulate datagram into frame adding header trailer
bull channel access if shared mediumbull ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
bull reliable delivery between adjacent nodesbull we learned how to do this already (chapter 3)bull seldom used on low bit-error link (fiber some
twisted pair)bull wireless links high error rates
bull Q why both link-level and end-end reliabilityFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
7
Link Layer Services (more)bull flow control
bull pacing between adjacent sending and receiving nodes
bull error detection bull errors caused by signal attenuation noise bull receiver detects presence of errors
bull signals sender for retransmission or drops frame
bull error correction bull receiver identifies and corrects bit error(s) without re-
sorting to retransmission
bull half-duplex and full-duplexbull with half duplex nodes at both ends of link can
transmit but not at same timeFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
8
Where is the link layer imple-mentedbull in each and every hostbull link layer implemented
in ldquoadaptorrdquo (aka net-work interface card NIC)bull Ethernet card PCMCI
card 80211 cardbull implements link physical
layer
bull attaches into hostrsquos sys-tem buses
bull combination of hard-ware software firmware
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
controller
physicaltransmission
cpu memory
host bus (eg PCI)
network adaptercard
host schematic
applicationtransportnetwork
link
linkphysical
9
Adaptors Communicating
bull sending sidebull encapsulates datagram
in framebull adds error checking bits
rdt flow control etc
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull receiving sidebull looks for errors rdt flow
control etcbull extracts datagram
passes to upper layer at receiving side
controller controller
sending host receiving host
datagram datagram
datagram
frame
10
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
11
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
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
otherwise
12
Parity Checking
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
13
Internet checksum (re-view)
Senderbull treat segment contents
as sequence of 16-bit integers
bull checksum addition (1rsquos complement sum) of segment contents
bull sender puts checksum value into UDP check-sum field
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Receiverbull compute checksum of
received segmentbull check if computed
checksum equals check-sum field valuebull NO - error detectedbull YES - no error detected
But maybe errors nonethe-less
Goal detect ldquoerrorsrdquo (eg flipped bits) in trans-mitted packet (note used at transport layer only
14
Checksumming Cyclic Redun-dancy Checkbull view data bits D as a binary numberbull choose r+1 bit pattern (generator) G bull goal choose r CRC bits R such that
bull ltDRgt exactly divisible by G (modulo 2) bull receiver knows G divides ltDRgt by G If non-zero remain-
der error detectedbull can detect all burst errors less than r+1 bits
bull widely used in practice (Ethernet 80211 WiFi ATM)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
15
Checksumming Cyclic Redun-dancy Checkbull 1011 XOR 0101 = 1110 bull 1001 XOR 1101 = 0100
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
16
CRC Example
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
WantD2r XOR R = nG
equivalentlyD2r = nG XOR R
equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
17
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
18
Multiple Access Links and Proto-colsTwo types of ldquolinksrdquobull point-to-point
bull PPP for dial-up accessbull point-to-point link between Ethernet switch and host
bull broadcast (shared wire or medium)bull old-fashioned Ethernetbull upstream HFC (Hybrid Fiber-Coaxial)bull 80211 wireless LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
19
Multiple Access protocolsbull single shared broadcast channel bull two or more simultaneous transmis-
sions by nodes interference bull collision if a node receives two or more
signals at the same time
multiple access protocolbull distributed algorithm that deter-
mines how nodes share channel ie determine when node can transmit
bull communication about channel shar-ing must use channel itself bull no out-of-band channel for coordination
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
20
Ideal Multiple Access ProtocolBroadcast channel of rate R bps1 when one node wants to transmit it
can send at rate R2 when M nodes want to transmit each
can send at average rate RM3 fully decentralized
bull no special node to coordinate transmissionsbull no synchronization of clocks slots
4 simple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
21
MAC Protocols a taxonomyThree broad classesbull Channel Partitioning
bull divide channel into smaller ldquopiecesrdquo (time slots frequency code)
bull allocate piece to node for exclusive use
bull Random Accessbull channel not divided allow collisionsbull ldquorecoverrdquo from collisions
bull ldquoTaking turnsrdquobull nodes take turns but nodes with more to send
can take longer turnsFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
22
Channel Partitioning MAC proto-cols TDMATDMA time division multiple access bull access to channel in rounds bull each station gets fixed length slot
(length = pkt trans time) in each round bull unused slots go idle bull example 6-station LAN 134 have pkt
slots 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
1 3 4 1 3 4
6-slotframe
23
Channel Partitioning MAC proto-cols FDMAFDMA frequency division multiple access bull channel spectrum divided into frequency bandsbull each station assigned fixed frequency bandbull unused transmission time in frequency bands go idle bull example 6-station LAN 134 have pkt frequency
bands 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
freq
uency
bands time
FDM cable
24
Random Access Protocolsbull When node has packet to send
bull transmit at full channel data rate Rbull no a priori coordination among nodes
bull two or more transmitting nodes ldquocollisionrdquobull random access MAC protocol specifies
bull how to detect collisionsbull how to recover from collisions (eg via delayed retrans-
missions)
bull Examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA
bull (CS Carrier Sensing MA Multiple AccessCD Collision Detection CA Collision Avoidance)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
25
Slotted ALOHAAssumptionsbull all frames same sizebull time divided into
equal size slots (time to transmit 1 frame)
bull nodes start to transmit only slot beginning
bull nodes are synchro-nized
bull if 2 or more nodes transmit in slot all nodes detect collision
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Operationbull when node obtains
fresh frame trans-mits in next slotbull if no collision node
can send new frame in next slot
bull if collision node re-transmits frame in each subsequent slot with prob p until success
26
Slotted ALOHA
Prosbull single active node can
continuously transmit at full rate of channel
bull highly decentralized only slots in nodes need to be in sync
bull simpleFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Consbull collisions wasting slotsbull idle slotsbull nodes may be able to
detect collision in less than time to transmit packet
bull clock synchronization
27
Slotted Aloha Efficiency
bull suppose N nodes with many frames to send each transmits in slot with probability p
bull prob that given node has success in a slot = p(1-p)N-1
bull prob that any node has a success = Np(1-p)N-1
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull max efficiency find p that max-imizes Np(1-p)N-1
bull for many nodes take limit of Np(1- p)N-1 as N goes to infinity gives
Max efficiency = 1e = 37
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
At best channelused for useful transmissions 37of time
28
Pure (unslotted) ALOHAbull unslotted Aloha simpler no synchro-
nizationbull when frame first arrives
bull transmit immediately
bull collision probability increasesbull frame sent at t0 collides with other frames sent in
[t0-1t0+1]
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
29
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 choosing optimum p and then letting
= 1(2e) = 18
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
N
even worse than slotted Aloha
30
CSMA (Carrier Sense Multiple Access)CSMA listen before transmitIf channel sensed idle transmit entire framebull If channel sensed busy defer transmis-
sion
bull human analogy donrsquot interrupt others
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
31
CSMA Collisionscollisions can still occurbull propagation delay means
two nodes may not hear each otherrsquos transmission
collisionbull entire packet transmis-
sion time wasted
notebull role of distance amp propa-
gation delay in determin-ing collision probability
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
spatial layout of nodes
32
CSMACD (Collision Detec-tion)CSMACD carrier sensing deferral as in CSMA
bull collisions detected within short timebull colliding transmissions aborted reducing channel
wastage
bull collision detection bull easy in wired LANs measure signal strengths
compare transmitted received signalsbull difficult in wireless LANs received signal strength
overwhelmed by local transmission strength
bull human analogy the polite conversationalist
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
33
CSMACD collision detection
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
34
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
bull share channel efficiently and fairly at high loadbull inefficient at low load delay in channel access
1N bandwidth allocated even if only 1 active node
Random access MAC protocolsbull efficient at low load single node can fully uti-
lize channelbull high load collision overhead
ldquotaking turnsrdquo protocolsbull look for best of both worlds
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
35
ldquoTaking Turnsrdquo MAC protocolsPolling bull master node ldquoinvitesrdquo
slave nodes to transmit in turn
bull typically used with ldquodumbrdquo slave devices
bull concernsbull polling overhead bull latencybull single point of failure
(master)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
T
data
(nothingto send)
T
36
ldquoTaking Turnsrdquo MAC protocolsToken passingbull control token
passed from one node to next se-quentially
bull token messagebull concerns
bull token overhead bull latencybull single point of failure
(token)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
master
slaves
poll
data
data
37
Summary of MAC protocolsbull channel partitioning by time frequency or
codebull Time Division Frequency Division
bull random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
bull taking turnsbull polling from central site token passing
bull Bluetooth FDDI IBM Token Ring Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
38
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
39
MAC Addresses and ARPbull 32-bit IP address
bull network-layer addressbull used to get datagram to destination IP subnet
bull MAC (or LAN or physical or Ethernet) ad-dress bull function get frame from one interface to an-
other physically-connected interface (same network)
bull 48 bit MAC address (for most LANs)bull burned in NIC ROM also sometimes software set-
table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
40
LAN Addresses and ARP
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Each adapter on LAN has 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)
41
LAN Address (more)bull MAC address allocation administered by IEEEbull manufacturer buys portion of MAC address
space (to assure uniqueness)bull analogy
(a) MAC address like Social Security Num-ber
(b) IP address like postal addressbull MAC flat address portability
bull can move LAN card from one LAN to another
bull IP hierarchical address NOT portablebull address depends on IP subnet to which node is at-
tachedFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
5
Link layer contextbull datagram transferred
by different link pro-tocols over different linksbull eg Ethernet on first
link frame relay on in-termediate links 80211 on last link
bull each link protocol provides different servicesbull eg may or may not
provide rdt over linkFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transportation analogybull trip from Princeton to
Lausannebull limo Princeton to JFKbull plane JFK to Genevabull train Geneva to Lausanne
bull tourist = datagrambull transport segment =
communication linkbull transportation mode =
link layer protocolbull travel agent =
routing algorithm
6
Link Layer Servicesbull framing link access
bull encapsulate datagram into frame adding header trailer
bull channel access if shared mediumbull ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
bull reliable delivery between adjacent nodesbull we learned how to do this already (chapter 3)bull seldom used on low bit-error link (fiber some
twisted pair)bull wireless links high error rates
bull Q why both link-level and end-end reliabilityFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
7
Link Layer Services (more)bull flow control
bull pacing between adjacent sending and receiving nodes
bull error detection bull errors caused by signal attenuation noise bull receiver detects presence of errors
bull signals sender for retransmission or drops frame
bull error correction bull receiver identifies and corrects bit error(s) without re-
sorting to retransmission
bull half-duplex and full-duplexbull with half duplex nodes at both ends of link can
transmit but not at same timeFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
8
Where is the link layer imple-mentedbull in each and every hostbull link layer implemented
in ldquoadaptorrdquo (aka net-work interface card NIC)bull Ethernet card PCMCI
card 80211 cardbull implements link physical
layer
bull attaches into hostrsquos sys-tem buses
bull combination of hard-ware software firmware
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
controller
physicaltransmission
cpu memory
host bus (eg PCI)
network adaptercard
host schematic
applicationtransportnetwork
link
linkphysical
9
Adaptors Communicating
bull sending sidebull encapsulates datagram
in framebull adds error checking bits
rdt flow control etc
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull receiving sidebull looks for errors rdt flow
control etcbull extracts datagram
passes to upper layer at receiving side
controller controller
sending host receiving host
datagram datagram
datagram
frame
10
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
11
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
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
otherwise
12
Parity Checking
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
13
Internet checksum (re-view)
Senderbull treat segment contents
as sequence of 16-bit integers
bull checksum addition (1rsquos complement sum) of segment contents
bull sender puts checksum value into UDP check-sum field
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Receiverbull compute checksum of
received segmentbull check if computed
checksum equals check-sum field valuebull NO - error detectedbull YES - no error detected
But maybe errors nonethe-less
Goal detect ldquoerrorsrdquo (eg flipped bits) in trans-mitted packet (note used at transport layer only
14
Checksumming Cyclic Redun-dancy Checkbull view data bits D as a binary numberbull choose r+1 bit pattern (generator) G bull goal choose r CRC bits R such that
bull ltDRgt exactly divisible by G (modulo 2) bull receiver knows G divides ltDRgt by G If non-zero remain-
der error detectedbull can detect all burst errors less than r+1 bits
bull widely used in practice (Ethernet 80211 WiFi ATM)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
15
Checksumming Cyclic Redun-dancy Checkbull 1011 XOR 0101 = 1110 bull 1001 XOR 1101 = 0100
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
16
CRC Example
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
WantD2r XOR R = nG
equivalentlyD2r = nG XOR R
equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
17
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
18
Multiple Access Links and Proto-colsTwo types of ldquolinksrdquobull point-to-point
bull PPP for dial-up accessbull point-to-point link between Ethernet switch and host
bull broadcast (shared wire or medium)bull old-fashioned Ethernetbull upstream HFC (Hybrid Fiber-Coaxial)bull 80211 wireless LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
19
Multiple Access protocolsbull single shared broadcast channel bull two or more simultaneous transmis-
sions by nodes interference bull collision if a node receives two or more
signals at the same time
multiple access protocolbull distributed algorithm that deter-
mines how nodes share channel ie determine when node can transmit
bull communication about channel shar-ing must use channel itself bull no out-of-band channel for coordination
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
20
Ideal Multiple Access ProtocolBroadcast channel of rate R bps1 when one node wants to transmit it
can send at rate R2 when M nodes want to transmit each
can send at average rate RM3 fully decentralized
bull no special node to coordinate transmissionsbull no synchronization of clocks slots
4 simple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
21
MAC Protocols a taxonomyThree broad classesbull Channel Partitioning
bull divide channel into smaller ldquopiecesrdquo (time slots frequency code)
bull allocate piece to node for exclusive use
bull Random Accessbull channel not divided allow collisionsbull ldquorecoverrdquo from collisions
bull ldquoTaking turnsrdquobull nodes take turns but nodes with more to send
can take longer turnsFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
22
Channel Partitioning MAC proto-cols TDMATDMA time division multiple access bull access to channel in rounds bull each station gets fixed length slot
(length = pkt trans time) in each round bull unused slots go idle bull example 6-station LAN 134 have pkt
slots 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
1 3 4 1 3 4
6-slotframe
23
Channel Partitioning MAC proto-cols FDMAFDMA frequency division multiple access bull channel spectrum divided into frequency bandsbull each station assigned fixed frequency bandbull unused transmission time in frequency bands go idle bull example 6-station LAN 134 have pkt frequency
bands 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
freq
uency
bands time
FDM cable
24
Random Access Protocolsbull When node has packet to send
bull transmit at full channel data rate Rbull no a priori coordination among nodes
bull two or more transmitting nodes ldquocollisionrdquobull random access MAC protocol specifies
bull how to detect collisionsbull how to recover from collisions (eg via delayed retrans-
missions)
bull Examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA
bull (CS Carrier Sensing MA Multiple AccessCD Collision Detection CA Collision Avoidance)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
25
Slotted ALOHAAssumptionsbull all frames same sizebull time divided into
equal size slots (time to transmit 1 frame)
bull nodes start to transmit only slot beginning
bull nodes are synchro-nized
bull if 2 or more nodes transmit in slot all nodes detect collision
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Operationbull when node obtains
fresh frame trans-mits in next slotbull if no collision node
can send new frame in next slot
bull if collision node re-transmits frame in each subsequent slot with prob p until success
26
Slotted ALOHA
Prosbull single active node can
continuously transmit at full rate of channel
bull highly decentralized only slots in nodes need to be in sync
bull simpleFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Consbull collisions wasting slotsbull idle slotsbull nodes may be able to
detect collision in less than time to transmit packet
bull clock synchronization
27
Slotted Aloha Efficiency
bull suppose N nodes with many frames to send each transmits in slot with probability p
bull prob that given node has success in a slot = p(1-p)N-1
bull prob that any node has a success = Np(1-p)N-1
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull max efficiency find p that max-imizes Np(1-p)N-1
bull for many nodes take limit of Np(1- p)N-1 as N goes to infinity gives
Max efficiency = 1e = 37
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
At best channelused for useful transmissions 37of time
28
Pure (unslotted) ALOHAbull unslotted Aloha simpler no synchro-
nizationbull when frame first arrives
bull transmit immediately
bull collision probability increasesbull frame sent at t0 collides with other frames sent in
[t0-1t0+1]
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
29
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 choosing optimum p and then letting
= 1(2e) = 18
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
N
even worse than slotted Aloha
30
CSMA (Carrier Sense Multiple Access)CSMA listen before transmitIf channel sensed idle transmit entire framebull If channel sensed busy defer transmis-
sion
bull human analogy donrsquot interrupt others
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
31
CSMA Collisionscollisions can still occurbull propagation delay means
two nodes may not hear each otherrsquos transmission
collisionbull entire packet transmis-
sion time wasted
notebull role of distance amp propa-
gation delay in determin-ing collision probability
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
spatial layout of nodes
32
CSMACD (Collision Detec-tion)CSMACD carrier sensing deferral as in CSMA
bull collisions detected within short timebull colliding transmissions aborted reducing channel
wastage
bull collision detection bull easy in wired LANs measure signal strengths
compare transmitted received signalsbull difficult in wireless LANs received signal strength
overwhelmed by local transmission strength
bull human analogy the polite conversationalist
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
33
CSMACD collision detection
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
34
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
bull share channel efficiently and fairly at high loadbull inefficient at low load delay in channel access
1N bandwidth allocated even if only 1 active node
Random access MAC protocolsbull efficient at low load single node can fully uti-
lize channelbull high load collision overhead
ldquotaking turnsrdquo protocolsbull look for best of both worlds
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
35
ldquoTaking Turnsrdquo MAC protocolsPolling bull master node ldquoinvitesrdquo
slave nodes to transmit in turn
bull typically used with ldquodumbrdquo slave devices
bull concernsbull polling overhead bull latencybull single point of failure
(master)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
T
data
(nothingto send)
T
36
ldquoTaking Turnsrdquo MAC protocolsToken passingbull control token
passed from one node to next se-quentially
bull token messagebull concerns
bull token overhead bull latencybull single point of failure
(token)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
master
slaves
poll
data
data
37
Summary of MAC protocolsbull channel partitioning by time frequency or
codebull Time Division Frequency Division
bull random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
bull taking turnsbull polling from central site token passing
bull Bluetooth FDDI IBM Token Ring Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
38
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
39
MAC Addresses and ARPbull 32-bit IP address
bull network-layer addressbull used to get datagram to destination IP subnet
bull MAC (or LAN or physical or Ethernet) ad-dress bull function get frame from one interface to an-
other physically-connected interface (same network)
bull 48 bit MAC address (for most LANs)bull burned in NIC ROM also sometimes software set-
table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
40
LAN Addresses and ARP
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Each adapter on LAN has 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)
41
LAN Address (more)bull MAC address allocation administered by IEEEbull manufacturer buys portion of MAC address
space (to assure uniqueness)bull analogy
(a) MAC address like Social Security Num-ber
(b) IP address like postal addressbull MAC flat address portability
bull can move LAN card from one LAN to another
bull IP hierarchical address NOT portablebull address depends on IP subnet to which node is at-
tachedFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
6
Link Layer Servicesbull framing link access
bull encapsulate datagram into frame adding header trailer
bull channel access if shared mediumbull ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
bull reliable delivery between adjacent nodesbull we learned how to do this already (chapter 3)bull seldom used on low bit-error link (fiber some
twisted pair)bull wireless links high error rates
bull Q why both link-level and end-end reliabilityFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
7
Link Layer Services (more)bull flow control
bull pacing between adjacent sending and receiving nodes
bull error detection bull errors caused by signal attenuation noise bull receiver detects presence of errors
bull signals sender for retransmission or drops frame
bull error correction bull receiver identifies and corrects bit error(s) without re-
sorting to retransmission
bull half-duplex and full-duplexbull with half duplex nodes at both ends of link can
transmit but not at same timeFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
8
Where is the link layer imple-mentedbull in each and every hostbull link layer implemented
in ldquoadaptorrdquo (aka net-work interface card NIC)bull Ethernet card PCMCI
card 80211 cardbull implements link physical
layer
bull attaches into hostrsquos sys-tem buses
bull combination of hard-ware software firmware
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
controller
physicaltransmission
cpu memory
host bus (eg PCI)
network adaptercard
host schematic
applicationtransportnetwork
link
linkphysical
9
Adaptors Communicating
bull sending sidebull encapsulates datagram
in framebull adds error checking bits
rdt flow control etc
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull receiving sidebull looks for errors rdt flow
control etcbull extracts datagram
passes to upper layer at receiving side
controller controller
sending host receiving host
datagram datagram
datagram
frame
10
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
11
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
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
otherwise
12
Parity Checking
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
13
Internet checksum (re-view)
Senderbull treat segment contents
as sequence of 16-bit integers
bull checksum addition (1rsquos complement sum) of segment contents
bull sender puts checksum value into UDP check-sum field
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Receiverbull compute checksum of
received segmentbull check if computed
checksum equals check-sum field valuebull NO - error detectedbull YES - no error detected
But maybe errors nonethe-less
Goal detect ldquoerrorsrdquo (eg flipped bits) in trans-mitted packet (note used at transport layer only
14
Checksumming Cyclic Redun-dancy Checkbull view data bits D as a binary numberbull choose r+1 bit pattern (generator) G bull goal choose r CRC bits R such that
bull ltDRgt exactly divisible by G (modulo 2) bull receiver knows G divides ltDRgt by G If non-zero remain-
der error detectedbull can detect all burst errors less than r+1 bits
bull widely used in practice (Ethernet 80211 WiFi ATM)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
15
Checksumming Cyclic Redun-dancy Checkbull 1011 XOR 0101 = 1110 bull 1001 XOR 1101 = 0100
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
16
CRC Example
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
WantD2r XOR R = nG
equivalentlyD2r = nG XOR R
equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
17
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
18
Multiple Access Links and Proto-colsTwo types of ldquolinksrdquobull point-to-point
bull PPP for dial-up accessbull point-to-point link between Ethernet switch and host
bull broadcast (shared wire or medium)bull old-fashioned Ethernetbull upstream HFC (Hybrid Fiber-Coaxial)bull 80211 wireless LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
19
Multiple Access protocolsbull single shared broadcast channel bull two or more simultaneous transmis-
sions by nodes interference bull collision if a node receives two or more
signals at the same time
multiple access protocolbull distributed algorithm that deter-
mines how nodes share channel ie determine when node can transmit
bull communication about channel shar-ing must use channel itself bull no out-of-band channel for coordination
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
20
Ideal Multiple Access ProtocolBroadcast channel of rate R bps1 when one node wants to transmit it
can send at rate R2 when M nodes want to transmit each
can send at average rate RM3 fully decentralized
bull no special node to coordinate transmissionsbull no synchronization of clocks slots
4 simple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
21
MAC Protocols a taxonomyThree broad classesbull Channel Partitioning
bull divide channel into smaller ldquopiecesrdquo (time slots frequency code)
bull allocate piece to node for exclusive use
bull Random Accessbull channel not divided allow collisionsbull ldquorecoverrdquo from collisions
bull ldquoTaking turnsrdquobull nodes take turns but nodes with more to send
can take longer turnsFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
22
Channel Partitioning MAC proto-cols TDMATDMA time division multiple access bull access to channel in rounds bull each station gets fixed length slot
(length = pkt trans time) in each round bull unused slots go idle bull example 6-station LAN 134 have pkt
slots 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
1 3 4 1 3 4
6-slotframe
23
Channel Partitioning MAC proto-cols FDMAFDMA frequency division multiple access bull channel spectrum divided into frequency bandsbull each station assigned fixed frequency bandbull unused transmission time in frequency bands go idle bull example 6-station LAN 134 have pkt frequency
bands 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
freq
uency
bands time
FDM cable
24
Random Access Protocolsbull When node has packet to send
bull transmit at full channel data rate Rbull no a priori coordination among nodes
bull two or more transmitting nodes ldquocollisionrdquobull random access MAC protocol specifies
bull how to detect collisionsbull how to recover from collisions (eg via delayed retrans-
missions)
bull Examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA
bull (CS Carrier Sensing MA Multiple AccessCD Collision Detection CA Collision Avoidance)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
25
Slotted ALOHAAssumptionsbull all frames same sizebull time divided into
equal size slots (time to transmit 1 frame)
bull nodes start to transmit only slot beginning
bull nodes are synchro-nized
bull if 2 or more nodes transmit in slot all nodes detect collision
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Operationbull when node obtains
fresh frame trans-mits in next slotbull if no collision node
can send new frame in next slot
bull if collision node re-transmits frame in each subsequent slot with prob p until success
26
Slotted ALOHA
Prosbull single active node can
continuously transmit at full rate of channel
bull highly decentralized only slots in nodes need to be in sync
bull simpleFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Consbull collisions wasting slotsbull idle slotsbull nodes may be able to
detect collision in less than time to transmit packet
bull clock synchronization
27
Slotted Aloha Efficiency
bull suppose N nodes with many frames to send each transmits in slot with probability p
bull prob that given node has success in a slot = p(1-p)N-1
bull prob that any node has a success = Np(1-p)N-1
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull max efficiency find p that max-imizes Np(1-p)N-1
bull for many nodes take limit of Np(1- p)N-1 as N goes to infinity gives
Max efficiency = 1e = 37
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
At best channelused for useful transmissions 37of time
28
Pure (unslotted) ALOHAbull unslotted Aloha simpler no synchro-
nizationbull when frame first arrives
bull transmit immediately
bull collision probability increasesbull frame sent at t0 collides with other frames sent in
[t0-1t0+1]
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
29
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 choosing optimum p and then letting
= 1(2e) = 18
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
N
even worse than slotted Aloha
30
CSMA (Carrier Sense Multiple Access)CSMA listen before transmitIf channel sensed idle transmit entire framebull If channel sensed busy defer transmis-
sion
bull human analogy donrsquot interrupt others
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
31
CSMA Collisionscollisions can still occurbull propagation delay means
two nodes may not hear each otherrsquos transmission
collisionbull entire packet transmis-
sion time wasted
notebull role of distance amp propa-
gation delay in determin-ing collision probability
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
spatial layout of nodes
32
CSMACD (Collision Detec-tion)CSMACD carrier sensing deferral as in CSMA
bull collisions detected within short timebull colliding transmissions aborted reducing channel
wastage
bull collision detection bull easy in wired LANs measure signal strengths
compare transmitted received signalsbull difficult in wireless LANs received signal strength
overwhelmed by local transmission strength
bull human analogy the polite conversationalist
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
33
CSMACD collision detection
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
34
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
bull share channel efficiently and fairly at high loadbull inefficient at low load delay in channel access
1N bandwidth allocated even if only 1 active node
Random access MAC protocolsbull efficient at low load single node can fully uti-
lize channelbull high load collision overhead
ldquotaking turnsrdquo protocolsbull look for best of both worlds
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
35
ldquoTaking Turnsrdquo MAC protocolsPolling bull master node ldquoinvitesrdquo
slave nodes to transmit in turn
bull typically used with ldquodumbrdquo slave devices
bull concernsbull polling overhead bull latencybull single point of failure
(master)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
T
data
(nothingto send)
T
36
ldquoTaking Turnsrdquo MAC protocolsToken passingbull control token
passed from one node to next se-quentially
bull token messagebull concerns
bull token overhead bull latencybull single point of failure
(token)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
master
slaves
poll
data
data
37
Summary of MAC protocolsbull channel partitioning by time frequency or
codebull Time Division Frequency Division
bull random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
bull taking turnsbull polling from central site token passing
bull Bluetooth FDDI IBM Token Ring Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
38
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
39
MAC Addresses and ARPbull 32-bit IP address
bull network-layer addressbull used to get datagram to destination IP subnet
bull MAC (or LAN or physical or Ethernet) ad-dress bull function get frame from one interface to an-
other physically-connected interface (same network)
bull 48 bit MAC address (for most LANs)bull burned in NIC ROM also sometimes software set-
table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
40
LAN Addresses and ARP
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Each adapter on LAN has 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)
41
LAN Address (more)bull MAC address allocation administered by IEEEbull manufacturer buys portion of MAC address
space (to assure uniqueness)bull analogy
(a) MAC address like Social Security Num-ber
(b) IP address like postal addressbull MAC flat address portability
bull can move LAN card from one LAN to another
bull IP hierarchical address NOT portablebull address depends on IP subnet to which node is at-
tachedFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
7
Link Layer Services (more)bull flow control
bull pacing between adjacent sending and receiving nodes
bull error detection bull errors caused by signal attenuation noise bull receiver detects presence of errors
bull signals sender for retransmission or drops frame
bull error correction bull receiver identifies and corrects bit error(s) without re-
sorting to retransmission
bull half-duplex and full-duplexbull with half duplex nodes at both ends of link can
transmit but not at same timeFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
8
Where is the link layer imple-mentedbull in each and every hostbull link layer implemented
in ldquoadaptorrdquo (aka net-work interface card NIC)bull Ethernet card PCMCI
card 80211 cardbull implements link physical
layer
bull attaches into hostrsquos sys-tem buses
bull combination of hard-ware software firmware
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
controller
physicaltransmission
cpu memory
host bus (eg PCI)
network adaptercard
host schematic
applicationtransportnetwork
link
linkphysical
9
Adaptors Communicating
bull sending sidebull encapsulates datagram
in framebull adds error checking bits
rdt flow control etc
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull receiving sidebull looks for errors rdt flow
control etcbull extracts datagram
passes to upper layer at receiving side
controller controller
sending host receiving host
datagram datagram
datagram
frame
10
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
11
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
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
otherwise
12
Parity Checking
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
13
Internet checksum (re-view)
Senderbull treat segment contents
as sequence of 16-bit integers
bull checksum addition (1rsquos complement sum) of segment contents
bull sender puts checksum value into UDP check-sum field
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Receiverbull compute checksum of
received segmentbull check if computed
checksum equals check-sum field valuebull NO - error detectedbull YES - no error detected
But maybe errors nonethe-less
Goal detect ldquoerrorsrdquo (eg flipped bits) in trans-mitted packet (note used at transport layer only
14
Checksumming Cyclic Redun-dancy Checkbull view data bits D as a binary numberbull choose r+1 bit pattern (generator) G bull goal choose r CRC bits R such that
bull ltDRgt exactly divisible by G (modulo 2) bull receiver knows G divides ltDRgt by G If non-zero remain-
der error detectedbull can detect all burst errors less than r+1 bits
bull widely used in practice (Ethernet 80211 WiFi ATM)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
15
Checksumming Cyclic Redun-dancy Checkbull 1011 XOR 0101 = 1110 bull 1001 XOR 1101 = 0100
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
16
CRC Example
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
WantD2r XOR R = nG
equivalentlyD2r = nG XOR R
equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
17
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
18
Multiple Access Links and Proto-colsTwo types of ldquolinksrdquobull point-to-point
bull PPP for dial-up accessbull point-to-point link between Ethernet switch and host
bull broadcast (shared wire or medium)bull old-fashioned Ethernetbull upstream HFC (Hybrid Fiber-Coaxial)bull 80211 wireless LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
19
Multiple Access protocolsbull single shared broadcast channel bull two or more simultaneous transmis-
sions by nodes interference bull collision if a node receives two or more
signals at the same time
multiple access protocolbull distributed algorithm that deter-
mines how nodes share channel ie determine when node can transmit
bull communication about channel shar-ing must use channel itself bull no out-of-band channel for coordination
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
20
Ideal Multiple Access ProtocolBroadcast channel of rate R bps1 when one node wants to transmit it
can send at rate R2 when M nodes want to transmit each
can send at average rate RM3 fully decentralized
bull no special node to coordinate transmissionsbull no synchronization of clocks slots
4 simple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
21
MAC Protocols a taxonomyThree broad classesbull Channel Partitioning
bull divide channel into smaller ldquopiecesrdquo (time slots frequency code)
bull allocate piece to node for exclusive use
bull Random Accessbull channel not divided allow collisionsbull ldquorecoverrdquo from collisions
bull ldquoTaking turnsrdquobull nodes take turns but nodes with more to send
can take longer turnsFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
22
Channel Partitioning MAC proto-cols TDMATDMA time division multiple access bull access to channel in rounds bull each station gets fixed length slot
(length = pkt trans time) in each round bull unused slots go idle bull example 6-station LAN 134 have pkt
slots 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
1 3 4 1 3 4
6-slotframe
23
Channel Partitioning MAC proto-cols FDMAFDMA frequency division multiple access bull channel spectrum divided into frequency bandsbull each station assigned fixed frequency bandbull unused transmission time in frequency bands go idle bull example 6-station LAN 134 have pkt frequency
bands 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
freq
uency
bands time
FDM cable
24
Random Access Protocolsbull When node has packet to send
bull transmit at full channel data rate Rbull no a priori coordination among nodes
bull two or more transmitting nodes ldquocollisionrdquobull random access MAC protocol specifies
bull how to detect collisionsbull how to recover from collisions (eg via delayed retrans-
missions)
bull Examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA
bull (CS Carrier Sensing MA Multiple AccessCD Collision Detection CA Collision Avoidance)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
25
Slotted ALOHAAssumptionsbull all frames same sizebull time divided into
equal size slots (time to transmit 1 frame)
bull nodes start to transmit only slot beginning
bull nodes are synchro-nized
bull if 2 or more nodes transmit in slot all nodes detect collision
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Operationbull when node obtains
fresh frame trans-mits in next slotbull if no collision node
can send new frame in next slot
bull if collision node re-transmits frame in each subsequent slot with prob p until success
26
Slotted ALOHA
Prosbull single active node can
continuously transmit at full rate of channel
bull highly decentralized only slots in nodes need to be in sync
bull simpleFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Consbull collisions wasting slotsbull idle slotsbull nodes may be able to
detect collision in less than time to transmit packet
bull clock synchronization
27
Slotted Aloha Efficiency
bull suppose N nodes with many frames to send each transmits in slot with probability p
bull prob that given node has success in a slot = p(1-p)N-1
bull prob that any node has a success = Np(1-p)N-1
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull max efficiency find p that max-imizes Np(1-p)N-1
bull for many nodes take limit of Np(1- p)N-1 as N goes to infinity gives
Max efficiency = 1e = 37
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
At best channelused for useful transmissions 37of time
28
Pure (unslotted) ALOHAbull unslotted Aloha simpler no synchro-
nizationbull when frame first arrives
bull transmit immediately
bull collision probability increasesbull frame sent at t0 collides with other frames sent in
[t0-1t0+1]
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
29
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 choosing optimum p and then letting
= 1(2e) = 18
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
N
even worse than slotted Aloha
30
CSMA (Carrier Sense Multiple Access)CSMA listen before transmitIf channel sensed idle transmit entire framebull If channel sensed busy defer transmis-
sion
bull human analogy donrsquot interrupt others
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
31
CSMA Collisionscollisions can still occurbull propagation delay means
two nodes may not hear each otherrsquos transmission
collisionbull entire packet transmis-
sion time wasted
notebull role of distance amp propa-
gation delay in determin-ing collision probability
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
spatial layout of nodes
32
CSMACD (Collision Detec-tion)CSMACD carrier sensing deferral as in CSMA
bull collisions detected within short timebull colliding transmissions aborted reducing channel
wastage
bull collision detection bull easy in wired LANs measure signal strengths
compare transmitted received signalsbull difficult in wireless LANs received signal strength
overwhelmed by local transmission strength
bull human analogy the polite conversationalist
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
33
CSMACD collision detection
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
34
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
bull share channel efficiently and fairly at high loadbull inefficient at low load delay in channel access
1N bandwidth allocated even if only 1 active node
Random access MAC protocolsbull efficient at low load single node can fully uti-
lize channelbull high load collision overhead
ldquotaking turnsrdquo protocolsbull look for best of both worlds
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
35
ldquoTaking Turnsrdquo MAC protocolsPolling bull master node ldquoinvitesrdquo
slave nodes to transmit in turn
bull typically used with ldquodumbrdquo slave devices
bull concernsbull polling overhead bull latencybull single point of failure
(master)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
T
data
(nothingto send)
T
36
ldquoTaking Turnsrdquo MAC protocolsToken passingbull control token
passed from one node to next se-quentially
bull token messagebull concerns
bull token overhead bull latencybull single point of failure
(token)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
master
slaves
poll
data
data
37
Summary of MAC protocolsbull channel partitioning by time frequency or
codebull Time Division Frequency Division
bull random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
bull taking turnsbull polling from central site token passing
bull Bluetooth FDDI IBM Token Ring Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
38
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
39
MAC Addresses and ARPbull 32-bit IP address
bull network-layer addressbull used to get datagram to destination IP subnet
bull MAC (or LAN or physical or Ethernet) ad-dress bull function get frame from one interface to an-
other physically-connected interface (same network)
bull 48 bit MAC address (for most LANs)bull burned in NIC ROM also sometimes software set-
table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
40
LAN Addresses and ARP
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Each adapter on LAN has 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)
41
LAN Address (more)bull MAC address allocation administered by IEEEbull manufacturer buys portion of MAC address
space (to assure uniqueness)bull analogy
(a) MAC address like Social Security Num-ber
(b) IP address like postal addressbull MAC flat address portability
bull can move LAN card from one LAN to another
bull IP hierarchical address NOT portablebull address depends on IP subnet to which node is at-
tachedFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
8
Where is the link layer imple-mentedbull in each and every hostbull link layer implemented
in ldquoadaptorrdquo (aka net-work interface card NIC)bull Ethernet card PCMCI
card 80211 cardbull implements link physical
layer
bull attaches into hostrsquos sys-tem buses
bull combination of hard-ware software firmware
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
controller
physicaltransmission
cpu memory
host bus (eg PCI)
network adaptercard
host schematic
applicationtransportnetwork
link
linkphysical
9
Adaptors Communicating
bull sending sidebull encapsulates datagram
in framebull adds error checking bits
rdt flow control etc
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull receiving sidebull looks for errors rdt flow
control etcbull extracts datagram
passes to upper layer at receiving side
controller controller
sending host receiving host
datagram datagram
datagram
frame
10
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
11
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
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
otherwise
12
Parity Checking
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
13
Internet checksum (re-view)
Senderbull treat segment contents
as sequence of 16-bit integers
bull checksum addition (1rsquos complement sum) of segment contents
bull sender puts checksum value into UDP check-sum field
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Receiverbull compute checksum of
received segmentbull check if computed
checksum equals check-sum field valuebull NO - error detectedbull YES - no error detected
But maybe errors nonethe-less
Goal detect ldquoerrorsrdquo (eg flipped bits) in trans-mitted packet (note used at transport layer only
14
Checksumming Cyclic Redun-dancy Checkbull view data bits D as a binary numberbull choose r+1 bit pattern (generator) G bull goal choose r CRC bits R such that
bull ltDRgt exactly divisible by G (modulo 2) bull receiver knows G divides ltDRgt by G If non-zero remain-
der error detectedbull can detect all burst errors less than r+1 bits
bull widely used in practice (Ethernet 80211 WiFi ATM)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
15
Checksumming Cyclic Redun-dancy Checkbull 1011 XOR 0101 = 1110 bull 1001 XOR 1101 = 0100
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
16
CRC Example
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
WantD2r XOR R = nG
equivalentlyD2r = nG XOR R
equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
17
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
18
Multiple Access Links and Proto-colsTwo types of ldquolinksrdquobull point-to-point
bull PPP for dial-up accessbull point-to-point link between Ethernet switch and host
bull broadcast (shared wire or medium)bull old-fashioned Ethernetbull upstream HFC (Hybrid Fiber-Coaxial)bull 80211 wireless LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
19
Multiple Access protocolsbull single shared broadcast channel bull two or more simultaneous transmis-
sions by nodes interference bull collision if a node receives two or more
signals at the same time
multiple access protocolbull distributed algorithm that deter-
mines how nodes share channel ie determine when node can transmit
bull communication about channel shar-ing must use channel itself bull no out-of-band channel for coordination
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
20
Ideal Multiple Access ProtocolBroadcast channel of rate R bps1 when one node wants to transmit it
can send at rate R2 when M nodes want to transmit each
can send at average rate RM3 fully decentralized
bull no special node to coordinate transmissionsbull no synchronization of clocks slots
4 simple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
21
MAC Protocols a taxonomyThree broad classesbull Channel Partitioning
bull divide channel into smaller ldquopiecesrdquo (time slots frequency code)
bull allocate piece to node for exclusive use
bull Random Accessbull channel not divided allow collisionsbull ldquorecoverrdquo from collisions
bull ldquoTaking turnsrdquobull nodes take turns but nodes with more to send
can take longer turnsFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
22
Channel Partitioning MAC proto-cols TDMATDMA time division multiple access bull access to channel in rounds bull each station gets fixed length slot
(length = pkt trans time) in each round bull unused slots go idle bull example 6-station LAN 134 have pkt
slots 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
1 3 4 1 3 4
6-slotframe
23
Channel Partitioning MAC proto-cols FDMAFDMA frequency division multiple access bull channel spectrum divided into frequency bandsbull each station assigned fixed frequency bandbull unused transmission time in frequency bands go idle bull example 6-station LAN 134 have pkt frequency
bands 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
freq
uency
bands time
FDM cable
24
Random Access Protocolsbull When node has packet to send
bull transmit at full channel data rate Rbull no a priori coordination among nodes
bull two or more transmitting nodes ldquocollisionrdquobull random access MAC protocol specifies
bull how to detect collisionsbull how to recover from collisions (eg via delayed retrans-
missions)
bull Examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA
bull (CS Carrier Sensing MA Multiple AccessCD Collision Detection CA Collision Avoidance)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
25
Slotted ALOHAAssumptionsbull all frames same sizebull time divided into
equal size slots (time to transmit 1 frame)
bull nodes start to transmit only slot beginning
bull nodes are synchro-nized
bull if 2 or more nodes transmit in slot all nodes detect collision
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Operationbull when node obtains
fresh frame trans-mits in next slotbull if no collision node
can send new frame in next slot
bull if collision node re-transmits frame in each subsequent slot with prob p until success
26
Slotted ALOHA
Prosbull single active node can
continuously transmit at full rate of channel
bull highly decentralized only slots in nodes need to be in sync
bull simpleFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Consbull collisions wasting slotsbull idle slotsbull nodes may be able to
detect collision in less than time to transmit packet
bull clock synchronization
27
Slotted Aloha Efficiency
bull suppose N nodes with many frames to send each transmits in slot with probability p
bull prob that given node has success in a slot = p(1-p)N-1
bull prob that any node has a success = Np(1-p)N-1
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull max efficiency find p that max-imizes Np(1-p)N-1
bull for many nodes take limit of Np(1- p)N-1 as N goes to infinity gives
Max efficiency = 1e = 37
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
At best channelused for useful transmissions 37of time
28
Pure (unslotted) ALOHAbull unslotted Aloha simpler no synchro-
nizationbull when frame first arrives
bull transmit immediately
bull collision probability increasesbull frame sent at t0 collides with other frames sent in
[t0-1t0+1]
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
29
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 choosing optimum p and then letting
= 1(2e) = 18
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
N
even worse than slotted Aloha
30
CSMA (Carrier Sense Multiple Access)CSMA listen before transmitIf channel sensed idle transmit entire framebull If channel sensed busy defer transmis-
sion
bull human analogy donrsquot interrupt others
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
31
CSMA Collisionscollisions can still occurbull propagation delay means
two nodes may not hear each otherrsquos transmission
collisionbull entire packet transmis-
sion time wasted
notebull role of distance amp propa-
gation delay in determin-ing collision probability
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
spatial layout of nodes
32
CSMACD (Collision Detec-tion)CSMACD carrier sensing deferral as in CSMA
bull collisions detected within short timebull colliding transmissions aborted reducing channel
wastage
bull collision detection bull easy in wired LANs measure signal strengths
compare transmitted received signalsbull difficult in wireless LANs received signal strength
overwhelmed by local transmission strength
bull human analogy the polite conversationalist
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
33
CSMACD collision detection
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
34
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
bull share channel efficiently and fairly at high loadbull inefficient at low load delay in channel access
1N bandwidth allocated even if only 1 active node
Random access MAC protocolsbull efficient at low load single node can fully uti-
lize channelbull high load collision overhead
ldquotaking turnsrdquo protocolsbull look for best of both worlds
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
35
ldquoTaking Turnsrdquo MAC protocolsPolling bull master node ldquoinvitesrdquo
slave nodes to transmit in turn
bull typically used with ldquodumbrdquo slave devices
bull concernsbull polling overhead bull latencybull single point of failure
(master)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
T
data
(nothingto send)
T
36
ldquoTaking Turnsrdquo MAC protocolsToken passingbull control token
passed from one node to next se-quentially
bull token messagebull concerns
bull token overhead bull latencybull single point of failure
(token)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
master
slaves
poll
data
data
37
Summary of MAC protocolsbull channel partitioning by time frequency or
codebull Time Division Frequency Division
bull random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
bull taking turnsbull polling from central site token passing
bull Bluetooth FDDI IBM Token Ring Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
38
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
39
MAC Addresses and ARPbull 32-bit IP address
bull network-layer addressbull used to get datagram to destination IP subnet
bull MAC (or LAN or physical or Ethernet) ad-dress bull function get frame from one interface to an-
other physically-connected interface (same network)
bull 48 bit MAC address (for most LANs)bull burned in NIC ROM also sometimes software set-
table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
40
LAN Addresses and ARP
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Each adapter on LAN has 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)
41
LAN Address (more)bull MAC address allocation administered by IEEEbull manufacturer buys portion of MAC address
space (to assure uniqueness)bull analogy
(a) MAC address like Social Security Num-ber
(b) IP address like postal addressbull MAC flat address portability
bull can move LAN card from one LAN to another
bull IP hierarchical address NOT portablebull address depends on IP subnet to which node is at-
tachedFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
9
Adaptors Communicating
bull sending sidebull encapsulates datagram
in framebull adds error checking bits
rdt flow control etc
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull receiving sidebull looks for errors rdt flow
control etcbull extracts datagram
passes to upper layer at receiving side
controller controller
sending host receiving host
datagram datagram
datagram
frame
10
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
11
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
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
otherwise
12
Parity Checking
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
13
Internet checksum (re-view)
Senderbull treat segment contents
as sequence of 16-bit integers
bull checksum addition (1rsquos complement sum) of segment contents
bull sender puts checksum value into UDP check-sum field
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Receiverbull compute checksum of
received segmentbull check if computed
checksum equals check-sum field valuebull NO - error detectedbull YES - no error detected
But maybe errors nonethe-less
Goal detect ldquoerrorsrdquo (eg flipped bits) in trans-mitted packet (note used at transport layer only
14
Checksumming Cyclic Redun-dancy Checkbull view data bits D as a binary numberbull choose r+1 bit pattern (generator) G bull goal choose r CRC bits R such that
bull ltDRgt exactly divisible by G (modulo 2) bull receiver knows G divides ltDRgt by G If non-zero remain-
der error detectedbull can detect all burst errors less than r+1 bits
bull widely used in practice (Ethernet 80211 WiFi ATM)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
15
Checksumming Cyclic Redun-dancy Checkbull 1011 XOR 0101 = 1110 bull 1001 XOR 1101 = 0100
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
16
CRC Example
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
WantD2r XOR R = nG
equivalentlyD2r = nG XOR R
equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
17
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
18
Multiple Access Links and Proto-colsTwo types of ldquolinksrdquobull point-to-point
bull PPP for dial-up accessbull point-to-point link between Ethernet switch and host
bull broadcast (shared wire or medium)bull old-fashioned Ethernetbull upstream HFC (Hybrid Fiber-Coaxial)bull 80211 wireless LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
19
Multiple Access protocolsbull single shared broadcast channel bull two or more simultaneous transmis-
sions by nodes interference bull collision if a node receives two or more
signals at the same time
multiple access protocolbull distributed algorithm that deter-
mines how nodes share channel ie determine when node can transmit
bull communication about channel shar-ing must use channel itself bull no out-of-band channel for coordination
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
20
Ideal Multiple Access ProtocolBroadcast channel of rate R bps1 when one node wants to transmit it
can send at rate R2 when M nodes want to transmit each
can send at average rate RM3 fully decentralized
bull no special node to coordinate transmissionsbull no synchronization of clocks slots
4 simple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
21
MAC Protocols a taxonomyThree broad classesbull Channel Partitioning
bull divide channel into smaller ldquopiecesrdquo (time slots frequency code)
bull allocate piece to node for exclusive use
bull Random Accessbull channel not divided allow collisionsbull ldquorecoverrdquo from collisions
bull ldquoTaking turnsrdquobull nodes take turns but nodes with more to send
can take longer turnsFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
22
Channel Partitioning MAC proto-cols TDMATDMA time division multiple access bull access to channel in rounds bull each station gets fixed length slot
(length = pkt trans time) in each round bull unused slots go idle bull example 6-station LAN 134 have pkt
slots 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
1 3 4 1 3 4
6-slotframe
23
Channel Partitioning MAC proto-cols FDMAFDMA frequency division multiple access bull channel spectrum divided into frequency bandsbull each station assigned fixed frequency bandbull unused transmission time in frequency bands go idle bull example 6-station LAN 134 have pkt frequency
bands 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
freq
uency
bands time
FDM cable
24
Random Access Protocolsbull When node has packet to send
bull transmit at full channel data rate Rbull no a priori coordination among nodes
bull two or more transmitting nodes ldquocollisionrdquobull random access MAC protocol specifies
bull how to detect collisionsbull how to recover from collisions (eg via delayed retrans-
missions)
bull Examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA
bull (CS Carrier Sensing MA Multiple AccessCD Collision Detection CA Collision Avoidance)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
25
Slotted ALOHAAssumptionsbull all frames same sizebull time divided into
equal size slots (time to transmit 1 frame)
bull nodes start to transmit only slot beginning
bull nodes are synchro-nized
bull if 2 or more nodes transmit in slot all nodes detect collision
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Operationbull when node obtains
fresh frame trans-mits in next slotbull if no collision node
can send new frame in next slot
bull if collision node re-transmits frame in each subsequent slot with prob p until success
26
Slotted ALOHA
Prosbull single active node can
continuously transmit at full rate of channel
bull highly decentralized only slots in nodes need to be in sync
bull simpleFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Consbull collisions wasting slotsbull idle slotsbull nodes may be able to
detect collision in less than time to transmit packet
bull clock synchronization
27
Slotted Aloha Efficiency
bull suppose N nodes with many frames to send each transmits in slot with probability p
bull prob that given node has success in a slot = p(1-p)N-1
bull prob that any node has a success = Np(1-p)N-1
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull max efficiency find p that max-imizes Np(1-p)N-1
bull for many nodes take limit of Np(1- p)N-1 as N goes to infinity gives
Max efficiency = 1e = 37
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
At best channelused for useful transmissions 37of time
28
Pure (unslotted) ALOHAbull unslotted Aloha simpler no synchro-
nizationbull when frame first arrives
bull transmit immediately
bull collision probability increasesbull frame sent at t0 collides with other frames sent in
[t0-1t0+1]
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
29
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 choosing optimum p and then letting
= 1(2e) = 18
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
N
even worse than slotted Aloha
30
CSMA (Carrier Sense Multiple Access)CSMA listen before transmitIf channel sensed idle transmit entire framebull If channel sensed busy defer transmis-
sion
bull human analogy donrsquot interrupt others
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
31
CSMA Collisionscollisions can still occurbull propagation delay means
two nodes may not hear each otherrsquos transmission
collisionbull entire packet transmis-
sion time wasted
notebull role of distance amp propa-
gation delay in determin-ing collision probability
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
spatial layout of nodes
32
CSMACD (Collision Detec-tion)CSMACD carrier sensing deferral as in CSMA
bull collisions detected within short timebull colliding transmissions aborted reducing channel
wastage
bull collision detection bull easy in wired LANs measure signal strengths
compare transmitted received signalsbull difficult in wireless LANs received signal strength
overwhelmed by local transmission strength
bull human analogy the polite conversationalist
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
33
CSMACD collision detection
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
34
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
bull share channel efficiently and fairly at high loadbull inefficient at low load delay in channel access
1N bandwidth allocated even if only 1 active node
Random access MAC protocolsbull efficient at low load single node can fully uti-
lize channelbull high load collision overhead
ldquotaking turnsrdquo protocolsbull look for best of both worlds
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
35
ldquoTaking Turnsrdquo MAC protocolsPolling bull master node ldquoinvitesrdquo
slave nodes to transmit in turn
bull typically used with ldquodumbrdquo slave devices
bull concernsbull polling overhead bull latencybull single point of failure
(master)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
T
data
(nothingto send)
T
36
ldquoTaking Turnsrdquo MAC protocolsToken passingbull control token
passed from one node to next se-quentially
bull token messagebull concerns
bull token overhead bull latencybull single point of failure
(token)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
master
slaves
poll
data
data
37
Summary of MAC protocolsbull channel partitioning by time frequency or
codebull Time Division Frequency Division
bull random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
bull taking turnsbull polling from central site token passing
bull Bluetooth FDDI IBM Token Ring Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
38
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
39
MAC Addresses and ARPbull 32-bit IP address
bull network-layer addressbull used to get datagram to destination IP subnet
bull MAC (or LAN or physical or Ethernet) ad-dress bull function get frame from one interface to an-
other physically-connected interface (same network)
bull 48 bit MAC address (for most LANs)bull burned in NIC ROM also sometimes software set-
table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
40
LAN Addresses and ARP
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Each adapter on LAN has 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)
41
LAN Address (more)bull MAC address allocation administered by IEEEbull manufacturer buys portion of MAC address
space (to assure uniqueness)bull analogy
(a) MAC address like Social Security Num-ber
(b) IP address like postal addressbull MAC flat address portability
bull can move LAN card from one LAN to another
bull IP hierarchical address NOT portablebull address depends on IP subnet to which node is at-
tachedFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
10
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
11
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
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
otherwise
12
Parity Checking
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
13
Internet checksum (re-view)
Senderbull treat segment contents
as sequence of 16-bit integers
bull checksum addition (1rsquos complement sum) of segment contents
bull sender puts checksum value into UDP check-sum field
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Receiverbull compute checksum of
received segmentbull check if computed
checksum equals check-sum field valuebull NO - error detectedbull YES - no error detected
But maybe errors nonethe-less
Goal detect ldquoerrorsrdquo (eg flipped bits) in trans-mitted packet (note used at transport layer only
14
Checksumming Cyclic Redun-dancy Checkbull view data bits D as a binary numberbull choose r+1 bit pattern (generator) G bull goal choose r CRC bits R such that
bull ltDRgt exactly divisible by G (modulo 2) bull receiver knows G divides ltDRgt by G If non-zero remain-
der error detectedbull can detect all burst errors less than r+1 bits
bull widely used in practice (Ethernet 80211 WiFi ATM)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
15
Checksumming Cyclic Redun-dancy Checkbull 1011 XOR 0101 = 1110 bull 1001 XOR 1101 = 0100
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
16
CRC Example
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
WantD2r XOR R = nG
equivalentlyD2r = nG XOR R
equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
17
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
18
Multiple Access Links and Proto-colsTwo types of ldquolinksrdquobull point-to-point
bull PPP for dial-up accessbull point-to-point link between Ethernet switch and host
bull broadcast (shared wire or medium)bull old-fashioned Ethernetbull upstream HFC (Hybrid Fiber-Coaxial)bull 80211 wireless LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
19
Multiple Access protocolsbull single shared broadcast channel bull two or more simultaneous transmis-
sions by nodes interference bull collision if a node receives two or more
signals at the same time
multiple access protocolbull distributed algorithm that deter-
mines how nodes share channel ie determine when node can transmit
bull communication about channel shar-ing must use channel itself bull no out-of-band channel for coordination
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
20
Ideal Multiple Access ProtocolBroadcast channel of rate R bps1 when one node wants to transmit it
can send at rate R2 when M nodes want to transmit each
can send at average rate RM3 fully decentralized
bull no special node to coordinate transmissionsbull no synchronization of clocks slots
4 simple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
21
MAC Protocols a taxonomyThree broad classesbull Channel Partitioning
bull divide channel into smaller ldquopiecesrdquo (time slots frequency code)
bull allocate piece to node for exclusive use
bull Random Accessbull channel not divided allow collisionsbull ldquorecoverrdquo from collisions
bull ldquoTaking turnsrdquobull nodes take turns but nodes with more to send
can take longer turnsFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
22
Channel Partitioning MAC proto-cols TDMATDMA time division multiple access bull access to channel in rounds bull each station gets fixed length slot
(length = pkt trans time) in each round bull unused slots go idle bull example 6-station LAN 134 have pkt
slots 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
1 3 4 1 3 4
6-slotframe
23
Channel Partitioning MAC proto-cols FDMAFDMA frequency division multiple access bull channel spectrum divided into frequency bandsbull each station assigned fixed frequency bandbull unused transmission time in frequency bands go idle bull example 6-station LAN 134 have pkt frequency
bands 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
freq
uency
bands time
FDM cable
24
Random Access Protocolsbull When node has packet to send
bull transmit at full channel data rate Rbull no a priori coordination among nodes
bull two or more transmitting nodes ldquocollisionrdquobull random access MAC protocol specifies
bull how to detect collisionsbull how to recover from collisions (eg via delayed retrans-
missions)
bull Examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA
bull (CS Carrier Sensing MA Multiple AccessCD Collision Detection CA Collision Avoidance)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
25
Slotted ALOHAAssumptionsbull all frames same sizebull time divided into
equal size slots (time to transmit 1 frame)
bull nodes start to transmit only slot beginning
bull nodes are synchro-nized
bull if 2 or more nodes transmit in slot all nodes detect collision
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Operationbull when node obtains
fresh frame trans-mits in next slotbull if no collision node
can send new frame in next slot
bull if collision node re-transmits frame in each subsequent slot with prob p until success
26
Slotted ALOHA
Prosbull single active node can
continuously transmit at full rate of channel
bull highly decentralized only slots in nodes need to be in sync
bull simpleFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Consbull collisions wasting slotsbull idle slotsbull nodes may be able to
detect collision in less than time to transmit packet
bull clock synchronization
27
Slotted Aloha Efficiency
bull suppose N nodes with many frames to send each transmits in slot with probability p
bull prob that given node has success in a slot = p(1-p)N-1
bull prob that any node has a success = Np(1-p)N-1
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull max efficiency find p that max-imizes Np(1-p)N-1
bull for many nodes take limit of Np(1- p)N-1 as N goes to infinity gives
Max efficiency = 1e = 37
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
At best channelused for useful transmissions 37of time
28
Pure (unslotted) ALOHAbull unslotted Aloha simpler no synchro-
nizationbull when frame first arrives
bull transmit immediately
bull collision probability increasesbull frame sent at t0 collides with other frames sent in
[t0-1t0+1]
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
29
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 choosing optimum p and then letting
= 1(2e) = 18
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
N
even worse than slotted Aloha
30
CSMA (Carrier Sense Multiple Access)CSMA listen before transmitIf channel sensed idle transmit entire framebull If channel sensed busy defer transmis-
sion
bull human analogy donrsquot interrupt others
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
31
CSMA Collisionscollisions can still occurbull propagation delay means
two nodes may not hear each otherrsquos transmission
collisionbull entire packet transmis-
sion time wasted
notebull role of distance amp propa-
gation delay in determin-ing collision probability
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
spatial layout of nodes
32
CSMACD (Collision Detec-tion)CSMACD carrier sensing deferral as in CSMA
bull collisions detected within short timebull colliding transmissions aborted reducing channel
wastage
bull collision detection bull easy in wired LANs measure signal strengths
compare transmitted received signalsbull difficult in wireless LANs received signal strength
overwhelmed by local transmission strength
bull human analogy the polite conversationalist
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
33
CSMACD collision detection
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
34
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
bull share channel efficiently and fairly at high loadbull inefficient at low load delay in channel access
1N bandwidth allocated even if only 1 active node
Random access MAC protocolsbull efficient at low load single node can fully uti-
lize channelbull high load collision overhead
ldquotaking turnsrdquo protocolsbull look for best of both worlds
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
35
ldquoTaking Turnsrdquo MAC protocolsPolling bull master node ldquoinvitesrdquo
slave nodes to transmit in turn
bull typically used with ldquodumbrdquo slave devices
bull concernsbull polling overhead bull latencybull single point of failure
(master)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
T
data
(nothingto send)
T
36
ldquoTaking Turnsrdquo MAC protocolsToken passingbull control token
passed from one node to next se-quentially
bull token messagebull concerns
bull token overhead bull latencybull single point of failure
(token)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
master
slaves
poll
data
data
37
Summary of MAC protocolsbull channel partitioning by time frequency or
codebull Time Division Frequency Division
bull random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
bull taking turnsbull polling from central site token passing
bull Bluetooth FDDI IBM Token Ring Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
38
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
39
MAC Addresses and ARPbull 32-bit IP address
bull network-layer addressbull used to get datagram to destination IP subnet
bull MAC (or LAN or physical or Ethernet) ad-dress bull function get frame from one interface to an-
other physically-connected interface (same network)
bull 48 bit MAC address (for most LANs)bull burned in NIC ROM also sometimes software set-
table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
40
LAN Addresses and ARP
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Each adapter on LAN has 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)
41
LAN Address (more)bull MAC address allocation administered by IEEEbull manufacturer buys portion of MAC address
space (to assure uniqueness)bull analogy
(a) MAC address like Social Security Num-ber
(b) IP address like postal addressbull MAC flat address portability
bull can move LAN card from one LAN to another
bull IP hierarchical address NOT portablebull address depends on IP subnet to which node is at-
tachedFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
11
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
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
otherwise
12
Parity Checking
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
13
Internet checksum (re-view)
Senderbull treat segment contents
as sequence of 16-bit integers
bull checksum addition (1rsquos complement sum) of segment contents
bull sender puts checksum value into UDP check-sum field
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Receiverbull compute checksum of
received segmentbull check if computed
checksum equals check-sum field valuebull NO - error detectedbull YES - no error detected
But maybe errors nonethe-less
Goal detect ldquoerrorsrdquo (eg flipped bits) in trans-mitted packet (note used at transport layer only
14
Checksumming Cyclic Redun-dancy Checkbull view data bits D as a binary numberbull choose r+1 bit pattern (generator) G bull goal choose r CRC bits R such that
bull ltDRgt exactly divisible by G (modulo 2) bull receiver knows G divides ltDRgt by G If non-zero remain-
der error detectedbull can detect all burst errors less than r+1 bits
bull widely used in practice (Ethernet 80211 WiFi ATM)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
15
Checksumming Cyclic Redun-dancy Checkbull 1011 XOR 0101 = 1110 bull 1001 XOR 1101 = 0100
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
16
CRC Example
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
WantD2r XOR R = nG
equivalentlyD2r = nG XOR R
equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
17
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
18
Multiple Access Links and Proto-colsTwo types of ldquolinksrdquobull point-to-point
bull PPP for dial-up accessbull point-to-point link between Ethernet switch and host
bull broadcast (shared wire or medium)bull old-fashioned Ethernetbull upstream HFC (Hybrid Fiber-Coaxial)bull 80211 wireless LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
19
Multiple Access protocolsbull single shared broadcast channel bull two or more simultaneous transmis-
sions by nodes interference bull collision if a node receives two or more
signals at the same time
multiple access protocolbull distributed algorithm that deter-
mines how nodes share channel ie determine when node can transmit
bull communication about channel shar-ing must use channel itself bull no out-of-band channel for coordination
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
20
Ideal Multiple Access ProtocolBroadcast channel of rate R bps1 when one node wants to transmit it
can send at rate R2 when M nodes want to transmit each
can send at average rate RM3 fully decentralized
bull no special node to coordinate transmissionsbull no synchronization of clocks slots
4 simple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
21
MAC Protocols a taxonomyThree broad classesbull Channel Partitioning
bull divide channel into smaller ldquopiecesrdquo (time slots frequency code)
bull allocate piece to node for exclusive use
bull Random Accessbull channel not divided allow collisionsbull ldquorecoverrdquo from collisions
bull ldquoTaking turnsrdquobull nodes take turns but nodes with more to send
can take longer turnsFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
22
Channel Partitioning MAC proto-cols TDMATDMA time division multiple access bull access to channel in rounds bull each station gets fixed length slot
(length = pkt trans time) in each round bull unused slots go idle bull example 6-station LAN 134 have pkt
slots 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
1 3 4 1 3 4
6-slotframe
23
Channel Partitioning MAC proto-cols FDMAFDMA frequency division multiple access bull channel spectrum divided into frequency bandsbull each station assigned fixed frequency bandbull unused transmission time in frequency bands go idle bull example 6-station LAN 134 have pkt frequency
bands 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
freq
uency
bands time
FDM cable
24
Random Access Protocolsbull When node has packet to send
bull transmit at full channel data rate Rbull no a priori coordination among nodes
bull two or more transmitting nodes ldquocollisionrdquobull random access MAC protocol specifies
bull how to detect collisionsbull how to recover from collisions (eg via delayed retrans-
missions)
bull Examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA
bull (CS Carrier Sensing MA Multiple AccessCD Collision Detection CA Collision Avoidance)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
25
Slotted ALOHAAssumptionsbull all frames same sizebull time divided into
equal size slots (time to transmit 1 frame)
bull nodes start to transmit only slot beginning
bull nodes are synchro-nized
bull if 2 or more nodes transmit in slot all nodes detect collision
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Operationbull when node obtains
fresh frame trans-mits in next slotbull if no collision node
can send new frame in next slot
bull if collision node re-transmits frame in each subsequent slot with prob p until success
26
Slotted ALOHA
Prosbull single active node can
continuously transmit at full rate of channel
bull highly decentralized only slots in nodes need to be in sync
bull simpleFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Consbull collisions wasting slotsbull idle slotsbull nodes may be able to
detect collision in less than time to transmit packet
bull clock synchronization
27
Slotted Aloha Efficiency
bull suppose N nodes with many frames to send each transmits in slot with probability p
bull prob that given node has success in a slot = p(1-p)N-1
bull prob that any node has a success = Np(1-p)N-1
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull max efficiency find p that max-imizes Np(1-p)N-1
bull for many nodes take limit of Np(1- p)N-1 as N goes to infinity gives
Max efficiency = 1e = 37
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
At best channelused for useful transmissions 37of time
28
Pure (unslotted) ALOHAbull unslotted Aloha simpler no synchro-
nizationbull when frame first arrives
bull transmit immediately
bull collision probability increasesbull frame sent at t0 collides with other frames sent in
[t0-1t0+1]
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
29
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 choosing optimum p and then letting
= 1(2e) = 18
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
N
even worse than slotted Aloha
30
CSMA (Carrier Sense Multiple Access)CSMA listen before transmitIf channel sensed idle transmit entire framebull If channel sensed busy defer transmis-
sion
bull human analogy donrsquot interrupt others
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
31
CSMA Collisionscollisions can still occurbull propagation delay means
two nodes may not hear each otherrsquos transmission
collisionbull entire packet transmis-
sion time wasted
notebull role of distance amp propa-
gation delay in determin-ing collision probability
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
spatial layout of nodes
32
CSMACD (Collision Detec-tion)CSMACD carrier sensing deferral as in CSMA
bull collisions detected within short timebull colliding transmissions aborted reducing channel
wastage
bull collision detection bull easy in wired LANs measure signal strengths
compare transmitted received signalsbull difficult in wireless LANs received signal strength
overwhelmed by local transmission strength
bull human analogy the polite conversationalist
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
33
CSMACD collision detection
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
34
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
bull share channel efficiently and fairly at high loadbull inefficient at low load delay in channel access
1N bandwidth allocated even if only 1 active node
Random access MAC protocolsbull efficient at low load single node can fully uti-
lize channelbull high load collision overhead
ldquotaking turnsrdquo protocolsbull look for best of both worlds
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
35
ldquoTaking Turnsrdquo MAC protocolsPolling bull master node ldquoinvitesrdquo
slave nodes to transmit in turn
bull typically used with ldquodumbrdquo slave devices
bull concernsbull polling overhead bull latencybull single point of failure
(master)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
T
data
(nothingto send)
T
36
ldquoTaking Turnsrdquo MAC protocolsToken passingbull control token
passed from one node to next se-quentially
bull token messagebull concerns
bull token overhead bull latencybull single point of failure
(token)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
master
slaves
poll
data
data
37
Summary of MAC protocolsbull channel partitioning by time frequency or
codebull Time Division Frequency Division
bull random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
bull taking turnsbull polling from central site token passing
bull Bluetooth FDDI IBM Token Ring Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
38
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
39
MAC Addresses and ARPbull 32-bit IP address
bull network-layer addressbull used to get datagram to destination IP subnet
bull MAC (or LAN or physical or Ethernet) ad-dress bull function get frame from one interface to an-
other physically-connected interface (same network)
bull 48 bit MAC address (for most LANs)bull burned in NIC ROM also sometimes software set-
table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
40
LAN Addresses and ARP
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Each adapter on LAN has 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)
41
LAN Address (more)bull MAC address allocation administered by IEEEbull manufacturer buys portion of MAC address
space (to assure uniqueness)bull analogy
(a) MAC address like Social Security Num-ber
(b) IP address like postal addressbull MAC flat address portability
bull can move LAN card from one LAN to another
bull IP hierarchical address NOT portablebull address depends on IP subnet to which node is at-
tachedFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
12
Parity Checking
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
13
Internet checksum (re-view)
Senderbull treat segment contents
as sequence of 16-bit integers
bull checksum addition (1rsquos complement sum) of segment contents
bull sender puts checksum value into UDP check-sum field
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Receiverbull compute checksum of
received segmentbull check if computed
checksum equals check-sum field valuebull NO - error detectedbull YES - no error detected
But maybe errors nonethe-less
Goal detect ldquoerrorsrdquo (eg flipped bits) in trans-mitted packet (note used at transport layer only
14
Checksumming Cyclic Redun-dancy Checkbull view data bits D as a binary numberbull choose r+1 bit pattern (generator) G bull goal choose r CRC bits R such that
bull ltDRgt exactly divisible by G (modulo 2) bull receiver knows G divides ltDRgt by G If non-zero remain-
der error detectedbull can detect all burst errors less than r+1 bits
bull widely used in practice (Ethernet 80211 WiFi ATM)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
15
Checksumming Cyclic Redun-dancy Checkbull 1011 XOR 0101 = 1110 bull 1001 XOR 1101 = 0100
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
16
CRC Example
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
WantD2r XOR R = nG
equivalentlyD2r = nG XOR R
equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
17
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
18
Multiple Access Links and Proto-colsTwo types of ldquolinksrdquobull point-to-point
bull PPP for dial-up accessbull point-to-point link between Ethernet switch and host
bull broadcast (shared wire or medium)bull old-fashioned Ethernetbull upstream HFC (Hybrid Fiber-Coaxial)bull 80211 wireless LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
19
Multiple Access protocolsbull single shared broadcast channel bull two or more simultaneous transmis-
sions by nodes interference bull collision if a node receives two or more
signals at the same time
multiple access protocolbull distributed algorithm that deter-
mines how nodes share channel ie determine when node can transmit
bull communication about channel shar-ing must use channel itself bull no out-of-band channel for coordination
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
20
Ideal Multiple Access ProtocolBroadcast channel of rate R bps1 when one node wants to transmit it
can send at rate R2 when M nodes want to transmit each
can send at average rate RM3 fully decentralized
bull no special node to coordinate transmissionsbull no synchronization of clocks slots
4 simple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
21
MAC Protocols a taxonomyThree broad classesbull Channel Partitioning
bull divide channel into smaller ldquopiecesrdquo (time slots frequency code)
bull allocate piece to node for exclusive use
bull Random Accessbull channel not divided allow collisionsbull ldquorecoverrdquo from collisions
bull ldquoTaking turnsrdquobull nodes take turns but nodes with more to send
can take longer turnsFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
22
Channel Partitioning MAC proto-cols TDMATDMA time division multiple access bull access to channel in rounds bull each station gets fixed length slot
(length = pkt trans time) in each round bull unused slots go idle bull example 6-station LAN 134 have pkt
slots 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
1 3 4 1 3 4
6-slotframe
23
Channel Partitioning MAC proto-cols FDMAFDMA frequency division multiple access bull channel spectrum divided into frequency bandsbull each station assigned fixed frequency bandbull unused transmission time in frequency bands go idle bull example 6-station LAN 134 have pkt frequency
bands 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
freq
uency
bands time
FDM cable
24
Random Access Protocolsbull When node has packet to send
bull transmit at full channel data rate Rbull no a priori coordination among nodes
bull two or more transmitting nodes ldquocollisionrdquobull random access MAC protocol specifies
bull how to detect collisionsbull how to recover from collisions (eg via delayed retrans-
missions)
bull Examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA
bull (CS Carrier Sensing MA Multiple AccessCD Collision Detection CA Collision Avoidance)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
25
Slotted ALOHAAssumptionsbull all frames same sizebull time divided into
equal size slots (time to transmit 1 frame)
bull nodes start to transmit only slot beginning
bull nodes are synchro-nized
bull if 2 or more nodes transmit in slot all nodes detect collision
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Operationbull when node obtains
fresh frame trans-mits in next slotbull if no collision node
can send new frame in next slot
bull if collision node re-transmits frame in each subsequent slot with prob p until success
26
Slotted ALOHA
Prosbull single active node can
continuously transmit at full rate of channel
bull highly decentralized only slots in nodes need to be in sync
bull simpleFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Consbull collisions wasting slotsbull idle slotsbull nodes may be able to
detect collision in less than time to transmit packet
bull clock synchronization
27
Slotted Aloha Efficiency
bull suppose N nodes with many frames to send each transmits in slot with probability p
bull prob that given node has success in a slot = p(1-p)N-1
bull prob that any node has a success = Np(1-p)N-1
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull max efficiency find p that max-imizes Np(1-p)N-1
bull for many nodes take limit of Np(1- p)N-1 as N goes to infinity gives
Max efficiency = 1e = 37
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
At best channelused for useful transmissions 37of time
28
Pure (unslotted) ALOHAbull unslotted Aloha simpler no synchro-
nizationbull when frame first arrives
bull transmit immediately
bull collision probability increasesbull frame sent at t0 collides with other frames sent in
[t0-1t0+1]
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
29
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 choosing optimum p and then letting
= 1(2e) = 18
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
N
even worse than slotted Aloha
30
CSMA (Carrier Sense Multiple Access)CSMA listen before transmitIf channel sensed idle transmit entire framebull If channel sensed busy defer transmis-
sion
bull human analogy donrsquot interrupt others
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
31
CSMA Collisionscollisions can still occurbull propagation delay means
two nodes may not hear each otherrsquos transmission
collisionbull entire packet transmis-
sion time wasted
notebull role of distance amp propa-
gation delay in determin-ing collision probability
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
spatial layout of nodes
32
CSMACD (Collision Detec-tion)CSMACD carrier sensing deferral as in CSMA
bull collisions detected within short timebull colliding transmissions aborted reducing channel
wastage
bull collision detection bull easy in wired LANs measure signal strengths
compare transmitted received signalsbull difficult in wireless LANs received signal strength
overwhelmed by local transmission strength
bull human analogy the polite conversationalist
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
33
CSMACD collision detection
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
34
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
bull share channel efficiently and fairly at high loadbull inefficient at low load delay in channel access
1N bandwidth allocated even if only 1 active node
Random access MAC protocolsbull efficient at low load single node can fully uti-
lize channelbull high load collision overhead
ldquotaking turnsrdquo protocolsbull look for best of both worlds
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
35
ldquoTaking Turnsrdquo MAC protocolsPolling bull master node ldquoinvitesrdquo
slave nodes to transmit in turn
bull typically used with ldquodumbrdquo slave devices
bull concernsbull polling overhead bull latencybull single point of failure
(master)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
T
data
(nothingto send)
T
36
ldquoTaking Turnsrdquo MAC protocolsToken passingbull control token
passed from one node to next se-quentially
bull token messagebull concerns
bull token overhead bull latencybull single point of failure
(token)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
master
slaves
poll
data
data
37
Summary of MAC protocolsbull channel partitioning by time frequency or
codebull Time Division Frequency Division
bull random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
bull taking turnsbull polling from central site token passing
bull Bluetooth FDDI IBM Token Ring Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
38
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
39
MAC Addresses and ARPbull 32-bit IP address
bull network-layer addressbull used to get datagram to destination IP subnet
bull MAC (or LAN or physical or Ethernet) ad-dress bull function get frame from one interface to an-
other physically-connected interface (same network)
bull 48 bit MAC address (for most LANs)bull burned in NIC ROM also sometimes software set-
table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
40
LAN Addresses and ARP
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Each adapter on LAN has 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)
41
LAN Address (more)bull MAC address allocation administered by IEEEbull manufacturer buys portion of MAC address
space (to assure uniqueness)bull analogy
(a) MAC address like Social Security Num-ber
(b) IP address like postal addressbull MAC flat address portability
bull can move LAN card from one LAN to another
bull IP hierarchical address NOT portablebull address depends on IP subnet to which node is at-
tachedFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
13
Internet checksum (re-view)
Senderbull treat segment contents
as sequence of 16-bit integers
bull checksum addition (1rsquos complement sum) of segment contents
bull sender puts checksum value into UDP check-sum field
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Receiverbull compute checksum of
received segmentbull check if computed
checksum equals check-sum field valuebull NO - error detectedbull YES - no error detected
But maybe errors nonethe-less
Goal detect ldquoerrorsrdquo (eg flipped bits) in trans-mitted packet (note used at transport layer only
14
Checksumming Cyclic Redun-dancy Checkbull view data bits D as a binary numberbull choose r+1 bit pattern (generator) G bull goal choose r CRC bits R such that
bull ltDRgt exactly divisible by G (modulo 2) bull receiver knows G divides ltDRgt by G If non-zero remain-
der error detectedbull can detect all burst errors less than r+1 bits
bull widely used in practice (Ethernet 80211 WiFi ATM)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
15
Checksumming Cyclic Redun-dancy Checkbull 1011 XOR 0101 = 1110 bull 1001 XOR 1101 = 0100
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
16
CRC Example
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
WantD2r XOR R = nG
equivalentlyD2r = nG XOR R
equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
17
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
18
Multiple Access Links and Proto-colsTwo types of ldquolinksrdquobull point-to-point
bull PPP for dial-up accessbull point-to-point link between Ethernet switch and host
bull broadcast (shared wire or medium)bull old-fashioned Ethernetbull upstream HFC (Hybrid Fiber-Coaxial)bull 80211 wireless LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
19
Multiple Access protocolsbull single shared broadcast channel bull two or more simultaneous transmis-
sions by nodes interference bull collision if a node receives two or more
signals at the same time
multiple access protocolbull distributed algorithm that deter-
mines how nodes share channel ie determine when node can transmit
bull communication about channel shar-ing must use channel itself bull no out-of-band channel for coordination
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
20
Ideal Multiple Access ProtocolBroadcast channel of rate R bps1 when one node wants to transmit it
can send at rate R2 when M nodes want to transmit each
can send at average rate RM3 fully decentralized
bull no special node to coordinate transmissionsbull no synchronization of clocks slots
4 simple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
21
MAC Protocols a taxonomyThree broad classesbull Channel Partitioning
bull divide channel into smaller ldquopiecesrdquo (time slots frequency code)
bull allocate piece to node for exclusive use
bull Random Accessbull channel not divided allow collisionsbull ldquorecoverrdquo from collisions
bull ldquoTaking turnsrdquobull nodes take turns but nodes with more to send
can take longer turnsFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
22
Channel Partitioning MAC proto-cols TDMATDMA time division multiple access bull access to channel in rounds bull each station gets fixed length slot
(length = pkt trans time) in each round bull unused slots go idle bull example 6-station LAN 134 have pkt
slots 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
1 3 4 1 3 4
6-slotframe
23
Channel Partitioning MAC proto-cols FDMAFDMA frequency division multiple access bull channel spectrum divided into frequency bandsbull each station assigned fixed frequency bandbull unused transmission time in frequency bands go idle bull example 6-station LAN 134 have pkt frequency
bands 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
freq
uency
bands time
FDM cable
24
Random Access Protocolsbull When node has packet to send
bull transmit at full channel data rate Rbull no a priori coordination among nodes
bull two or more transmitting nodes ldquocollisionrdquobull random access MAC protocol specifies
bull how to detect collisionsbull how to recover from collisions (eg via delayed retrans-
missions)
bull Examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA
bull (CS Carrier Sensing MA Multiple AccessCD Collision Detection CA Collision Avoidance)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
25
Slotted ALOHAAssumptionsbull all frames same sizebull time divided into
equal size slots (time to transmit 1 frame)
bull nodes start to transmit only slot beginning
bull nodes are synchro-nized
bull if 2 or more nodes transmit in slot all nodes detect collision
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Operationbull when node obtains
fresh frame trans-mits in next slotbull if no collision node
can send new frame in next slot
bull if collision node re-transmits frame in each subsequent slot with prob p until success
26
Slotted ALOHA
Prosbull single active node can
continuously transmit at full rate of channel
bull highly decentralized only slots in nodes need to be in sync
bull simpleFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Consbull collisions wasting slotsbull idle slotsbull nodes may be able to
detect collision in less than time to transmit packet
bull clock synchronization
27
Slotted Aloha Efficiency
bull suppose N nodes with many frames to send each transmits in slot with probability p
bull prob that given node has success in a slot = p(1-p)N-1
bull prob that any node has a success = Np(1-p)N-1
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull max efficiency find p that max-imizes Np(1-p)N-1
bull for many nodes take limit of Np(1- p)N-1 as N goes to infinity gives
Max efficiency = 1e = 37
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
At best channelused for useful transmissions 37of time
28
Pure (unslotted) ALOHAbull unslotted Aloha simpler no synchro-
nizationbull when frame first arrives
bull transmit immediately
bull collision probability increasesbull frame sent at t0 collides with other frames sent in
[t0-1t0+1]
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
29
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 choosing optimum p and then letting
= 1(2e) = 18
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
N
even worse than slotted Aloha
30
CSMA (Carrier Sense Multiple Access)CSMA listen before transmitIf channel sensed idle transmit entire framebull If channel sensed busy defer transmis-
sion
bull human analogy donrsquot interrupt others
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
31
CSMA Collisionscollisions can still occurbull propagation delay means
two nodes may not hear each otherrsquos transmission
collisionbull entire packet transmis-
sion time wasted
notebull role of distance amp propa-
gation delay in determin-ing collision probability
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
spatial layout of nodes
32
CSMACD (Collision Detec-tion)CSMACD carrier sensing deferral as in CSMA
bull collisions detected within short timebull colliding transmissions aborted reducing channel
wastage
bull collision detection bull easy in wired LANs measure signal strengths
compare transmitted received signalsbull difficult in wireless LANs received signal strength
overwhelmed by local transmission strength
bull human analogy the polite conversationalist
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
33
CSMACD collision detection
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
34
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
bull share channel efficiently and fairly at high loadbull inefficient at low load delay in channel access
1N bandwidth allocated even if only 1 active node
Random access MAC protocolsbull efficient at low load single node can fully uti-
lize channelbull high load collision overhead
ldquotaking turnsrdquo protocolsbull look for best of both worlds
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
35
ldquoTaking Turnsrdquo MAC protocolsPolling bull master node ldquoinvitesrdquo
slave nodes to transmit in turn
bull typically used with ldquodumbrdquo slave devices
bull concernsbull polling overhead bull latencybull single point of failure
(master)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
T
data
(nothingto send)
T
36
ldquoTaking Turnsrdquo MAC protocolsToken passingbull control token
passed from one node to next se-quentially
bull token messagebull concerns
bull token overhead bull latencybull single point of failure
(token)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
master
slaves
poll
data
data
37
Summary of MAC protocolsbull channel partitioning by time frequency or
codebull Time Division Frequency Division
bull random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
bull taking turnsbull polling from central site token passing
bull Bluetooth FDDI IBM Token Ring Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
38
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
39
MAC Addresses and ARPbull 32-bit IP address
bull network-layer addressbull used to get datagram to destination IP subnet
bull MAC (or LAN or physical or Ethernet) ad-dress bull function get frame from one interface to an-
other physically-connected interface (same network)
bull 48 bit MAC address (for most LANs)bull burned in NIC ROM also sometimes software set-
table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
40
LAN Addresses and ARP
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Each adapter on LAN has 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)
41
LAN Address (more)bull MAC address allocation administered by IEEEbull manufacturer buys portion of MAC address
space (to assure uniqueness)bull analogy
(a) MAC address like Social Security Num-ber
(b) IP address like postal addressbull MAC flat address portability
bull can move LAN card from one LAN to another
bull IP hierarchical address NOT portablebull address depends on IP subnet to which node is at-
tachedFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
14
Checksumming Cyclic Redun-dancy Checkbull view data bits D as a binary numberbull choose r+1 bit pattern (generator) G bull goal choose r CRC bits R such that
bull ltDRgt exactly divisible by G (modulo 2) bull receiver knows G divides ltDRgt by G If non-zero remain-
der error detectedbull can detect all burst errors less than r+1 bits
bull widely used in practice (Ethernet 80211 WiFi ATM)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
15
Checksumming Cyclic Redun-dancy Checkbull 1011 XOR 0101 = 1110 bull 1001 XOR 1101 = 0100
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
16
CRC Example
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
WantD2r XOR R = nG
equivalentlyD2r = nG XOR R
equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
17
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
18
Multiple Access Links and Proto-colsTwo types of ldquolinksrdquobull point-to-point
bull PPP for dial-up accessbull point-to-point link between Ethernet switch and host
bull broadcast (shared wire or medium)bull old-fashioned Ethernetbull upstream HFC (Hybrid Fiber-Coaxial)bull 80211 wireless LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
19
Multiple Access protocolsbull single shared broadcast channel bull two or more simultaneous transmis-
sions by nodes interference bull collision if a node receives two or more
signals at the same time
multiple access protocolbull distributed algorithm that deter-
mines how nodes share channel ie determine when node can transmit
bull communication about channel shar-ing must use channel itself bull no out-of-band channel for coordination
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
20
Ideal Multiple Access ProtocolBroadcast channel of rate R bps1 when one node wants to transmit it
can send at rate R2 when M nodes want to transmit each
can send at average rate RM3 fully decentralized
bull no special node to coordinate transmissionsbull no synchronization of clocks slots
4 simple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
21
MAC Protocols a taxonomyThree broad classesbull Channel Partitioning
bull divide channel into smaller ldquopiecesrdquo (time slots frequency code)
bull allocate piece to node for exclusive use
bull Random Accessbull channel not divided allow collisionsbull ldquorecoverrdquo from collisions
bull ldquoTaking turnsrdquobull nodes take turns but nodes with more to send
can take longer turnsFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
22
Channel Partitioning MAC proto-cols TDMATDMA time division multiple access bull access to channel in rounds bull each station gets fixed length slot
(length = pkt trans time) in each round bull unused slots go idle bull example 6-station LAN 134 have pkt
slots 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
1 3 4 1 3 4
6-slotframe
23
Channel Partitioning MAC proto-cols FDMAFDMA frequency division multiple access bull channel spectrum divided into frequency bandsbull each station assigned fixed frequency bandbull unused transmission time in frequency bands go idle bull example 6-station LAN 134 have pkt frequency
bands 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
freq
uency
bands time
FDM cable
24
Random Access Protocolsbull When node has packet to send
bull transmit at full channel data rate Rbull no a priori coordination among nodes
bull two or more transmitting nodes ldquocollisionrdquobull random access MAC protocol specifies
bull how to detect collisionsbull how to recover from collisions (eg via delayed retrans-
missions)
bull Examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA
bull (CS Carrier Sensing MA Multiple AccessCD Collision Detection CA Collision Avoidance)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
25
Slotted ALOHAAssumptionsbull all frames same sizebull time divided into
equal size slots (time to transmit 1 frame)
bull nodes start to transmit only slot beginning
bull nodes are synchro-nized
bull if 2 or more nodes transmit in slot all nodes detect collision
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Operationbull when node obtains
fresh frame trans-mits in next slotbull if no collision node
can send new frame in next slot
bull if collision node re-transmits frame in each subsequent slot with prob p until success
26
Slotted ALOHA
Prosbull single active node can
continuously transmit at full rate of channel
bull highly decentralized only slots in nodes need to be in sync
bull simpleFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Consbull collisions wasting slotsbull idle slotsbull nodes may be able to
detect collision in less than time to transmit packet
bull clock synchronization
27
Slotted Aloha Efficiency
bull suppose N nodes with many frames to send each transmits in slot with probability p
bull prob that given node has success in a slot = p(1-p)N-1
bull prob that any node has a success = Np(1-p)N-1
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull max efficiency find p that max-imizes Np(1-p)N-1
bull for many nodes take limit of Np(1- p)N-1 as N goes to infinity gives
Max efficiency = 1e = 37
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
At best channelused for useful transmissions 37of time
28
Pure (unslotted) ALOHAbull unslotted Aloha simpler no synchro-
nizationbull when frame first arrives
bull transmit immediately
bull collision probability increasesbull frame sent at t0 collides with other frames sent in
[t0-1t0+1]
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
29
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 choosing optimum p and then letting
= 1(2e) = 18
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
N
even worse than slotted Aloha
30
CSMA (Carrier Sense Multiple Access)CSMA listen before transmitIf channel sensed idle transmit entire framebull If channel sensed busy defer transmis-
sion
bull human analogy donrsquot interrupt others
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
31
CSMA Collisionscollisions can still occurbull propagation delay means
two nodes may not hear each otherrsquos transmission
collisionbull entire packet transmis-
sion time wasted
notebull role of distance amp propa-
gation delay in determin-ing collision probability
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
spatial layout of nodes
32
CSMACD (Collision Detec-tion)CSMACD carrier sensing deferral as in CSMA
bull collisions detected within short timebull colliding transmissions aborted reducing channel
wastage
bull collision detection bull easy in wired LANs measure signal strengths
compare transmitted received signalsbull difficult in wireless LANs received signal strength
overwhelmed by local transmission strength
bull human analogy the polite conversationalist
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
33
CSMACD collision detection
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
34
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
bull share channel efficiently and fairly at high loadbull inefficient at low load delay in channel access
1N bandwidth allocated even if only 1 active node
Random access MAC protocolsbull efficient at low load single node can fully uti-
lize channelbull high load collision overhead
ldquotaking turnsrdquo protocolsbull look for best of both worlds
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
35
ldquoTaking Turnsrdquo MAC protocolsPolling bull master node ldquoinvitesrdquo
slave nodes to transmit in turn
bull typically used with ldquodumbrdquo slave devices
bull concernsbull polling overhead bull latencybull single point of failure
(master)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
T
data
(nothingto send)
T
36
ldquoTaking Turnsrdquo MAC protocolsToken passingbull control token
passed from one node to next se-quentially
bull token messagebull concerns
bull token overhead bull latencybull single point of failure
(token)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
master
slaves
poll
data
data
37
Summary of MAC protocolsbull channel partitioning by time frequency or
codebull Time Division Frequency Division
bull random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
bull taking turnsbull polling from central site token passing
bull Bluetooth FDDI IBM Token Ring Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
38
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
39
MAC Addresses and ARPbull 32-bit IP address
bull network-layer addressbull used to get datagram to destination IP subnet
bull MAC (or LAN or physical or Ethernet) ad-dress bull function get frame from one interface to an-
other physically-connected interface (same network)
bull 48 bit MAC address (for most LANs)bull burned in NIC ROM also sometimes software set-
table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
40
LAN Addresses and ARP
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Each adapter on LAN has 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)
41
LAN Address (more)bull MAC address allocation administered by IEEEbull manufacturer buys portion of MAC address
space (to assure uniqueness)bull analogy
(a) MAC address like Social Security Num-ber
(b) IP address like postal addressbull MAC flat address portability
bull can move LAN card from one LAN to another
bull IP hierarchical address NOT portablebull address depends on IP subnet to which node is at-
tachedFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
15
Checksumming Cyclic Redun-dancy Checkbull 1011 XOR 0101 = 1110 bull 1001 XOR 1101 = 0100
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
16
CRC Example
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
WantD2r XOR R = nG
equivalentlyD2r = nG XOR R
equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
17
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
18
Multiple Access Links and Proto-colsTwo types of ldquolinksrdquobull point-to-point
bull PPP for dial-up accessbull point-to-point link between Ethernet switch and host
bull broadcast (shared wire or medium)bull old-fashioned Ethernetbull upstream HFC (Hybrid Fiber-Coaxial)bull 80211 wireless LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
19
Multiple Access protocolsbull single shared broadcast channel bull two or more simultaneous transmis-
sions by nodes interference bull collision if a node receives two or more
signals at the same time
multiple access protocolbull distributed algorithm that deter-
mines how nodes share channel ie determine when node can transmit
bull communication about channel shar-ing must use channel itself bull no out-of-band channel for coordination
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
20
Ideal Multiple Access ProtocolBroadcast channel of rate R bps1 when one node wants to transmit it
can send at rate R2 when M nodes want to transmit each
can send at average rate RM3 fully decentralized
bull no special node to coordinate transmissionsbull no synchronization of clocks slots
4 simple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
21
MAC Protocols a taxonomyThree broad classesbull Channel Partitioning
bull divide channel into smaller ldquopiecesrdquo (time slots frequency code)
bull allocate piece to node for exclusive use
bull Random Accessbull channel not divided allow collisionsbull ldquorecoverrdquo from collisions
bull ldquoTaking turnsrdquobull nodes take turns but nodes with more to send
can take longer turnsFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
22
Channel Partitioning MAC proto-cols TDMATDMA time division multiple access bull access to channel in rounds bull each station gets fixed length slot
(length = pkt trans time) in each round bull unused slots go idle bull example 6-station LAN 134 have pkt
slots 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
1 3 4 1 3 4
6-slotframe
23
Channel Partitioning MAC proto-cols FDMAFDMA frequency division multiple access bull channel spectrum divided into frequency bandsbull each station assigned fixed frequency bandbull unused transmission time in frequency bands go idle bull example 6-station LAN 134 have pkt frequency
bands 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
freq
uency
bands time
FDM cable
24
Random Access Protocolsbull When node has packet to send
bull transmit at full channel data rate Rbull no a priori coordination among nodes
bull two or more transmitting nodes ldquocollisionrdquobull random access MAC protocol specifies
bull how to detect collisionsbull how to recover from collisions (eg via delayed retrans-
missions)
bull Examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA
bull (CS Carrier Sensing MA Multiple AccessCD Collision Detection CA Collision Avoidance)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
25
Slotted ALOHAAssumptionsbull all frames same sizebull time divided into
equal size slots (time to transmit 1 frame)
bull nodes start to transmit only slot beginning
bull nodes are synchro-nized
bull if 2 or more nodes transmit in slot all nodes detect collision
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Operationbull when node obtains
fresh frame trans-mits in next slotbull if no collision node
can send new frame in next slot
bull if collision node re-transmits frame in each subsequent slot with prob p until success
26
Slotted ALOHA
Prosbull single active node can
continuously transmit at full rate of channel
bull highly decentralized only slots in nodes need to be in sync
bull simpleFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Consbull collisions wasting slotsbull idle slotsbull nodes may be able to
detect collision in less than time to transmit packet
bull clock synchronization
27
Slotted Aloha Efficiency
bull suppose N nodes with many frames to send each transmits in slot with probability p
bull prob that given node has success in a slot = p(1-p)N-1
bull prob that any node has a success = Np(1-p)N-1
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull max efficiency find p that max-imizes Np(1-p)N-1
bull for many nodes take limit of Np(1- p)N-1 as N goes to infinity gives
Max efficiency = 1e = 37
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
At best channelused for useful transmissions 37of time
28
Pure (unslotted) ALOHAbull unslotted Aloha simpler no synchro-
nizationbull when frame first arrives
bull transmit immediately
bull collision probability increasesbull frame sent at t0 collides with other frames sent in
[t0-1t0+1]
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
29
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 choosing optimum p and then letting
= 1(2e) = 18
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
N
even worse than slotted Aloha
30
CSMA (Carrier Sense Multiple Access)CSMA listen before transmitIf channel sensed idle transmit entire framebull If channel sensed busy defer transmis-
sion
bull human analogy donrsquot interrupt others
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
31
CSMA Collisionscollisions can still occurbull propagation delay means
two nodes may not hear each otherrsquos transmission
collisionbull entire packet transmis-
sion time wasted
notebull role of distance amp propa-
gation delay in determin-ing collision probability
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
spatial layout of nodes
32
CSMACD (Collision Detec-tion)CSMACD carrier sensing deferral as in CSMA
bull collisions detected within short timebull colliding transmissions aborted reducing channel
wastage
bull collision detection bull easy in wired LANs measure signal strengths
compare transmitted received signalsbull difficult in wireless LANs received signal strength
overwhelmed by local transmission strength
bull human analogy the polite conversationalist
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
33
CSMACD collision detection
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
34
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
bull share channel efficiently and fairly at high loadbull inefficient at low load delay in channel access
1N bandwidth allocated even if only 1 active node
Random access MAC protocolsbull efficient at low load single node can fully uti-
lize channelbull high load collision overhead
ldquotaking turnsrdquo protocolsbull look for best of both worlds
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
35
ldquoTaking Turnsrdquo MAC protocolsPolling bull master node ldquoinvitesrdquo
slave nodes to transmit in turn
bull typically used with ldquodumbrdquo slave devices
bull concernsbull polling overhead bull latencybull single point of failure
(master)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
T
data
(nothingto send)
T
36
ldquoTaking Turnsrdquo MAC protocolsToken passingbull control token
passed from one node to next se-quentially
bull token messagebull concerns
bull token overhead bull latencybull single point of failure
(token)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
master
slaves
poll
data
data
37
Summary of MAC protocolsbull channel partitioning by time frequency or
codebull Time Division Frequency Division
bull random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
bull taking turnsbull polling from central site token passing
bull Bluetooth FDDI IBM Token Ring Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
38
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
39
MAC Addresses and ARPbull 32-bit IP address
bull network-layer addressbull used to get datagram to destination IP subnet
bull MAC (or LAN or physical or Ethernet) ad-dress bull function get frame from one interface to an-
other physically-connected interface (same network)
bull 48 bit MAC address (for most LANs)bull burned in NIC ROM also sometimes software set-
table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
40
LAN Addresses and ARP
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Each adapter on LAN has 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)
41
LAN Address (more)bull MAC address allocation administered by IEEEbull manufacturer buys portion of MAC address
space (to assure uniqueness)bull analogy
(a) MAC address like Social Security Num-ber
(b) IP address like postal addressbull MAC flat address portability
bull can move LAN card from one LAN to another
bull IP hierarchical address NOT portablebull address depends on IP subnet to which node is at-
tachedFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
16
CRC Example
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
WantD2r XOR R = nG
equivalentlyD2r = nG XOR R
equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
17
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
18
Multiple Access Links and Proto-colsTwo types of ldquolinksrdquobull point-to-point
bull PPP for dial-up accessbull point-to-point link between Ethernet switch and host
bull broadcast (shared wire or medium)bull old-fashioned Ethernetbull upstream HFC (Hybrid Fiber-Coaxial)bull 80211 wireless LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
19
Multiple Access protocolsbull single shared broadcast channel bull two or more simultaneous transmis-
sions by nodes interference bull collision if a node receives two or more
signals at the same time
multiple access protocolbull distributed algorithm that deter-
mines how nodes share channel ie determine when node can transmit
bull communication about channel shar-ing must use channel itself bull no out-of-band channel for coordination
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
20
Ideal Multiple Access ProtocolBroadcast channel of rate R bps1 when one node wants to transmit it
can send at rate R2 when M nodes want to transmit each
can send at average rate RM3 fully decentralized
bull no special node to coordinate transmissionsbull no synchronization of clocks slots
4 simple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
21
MAC Protocols a taxonomyThree broad classesbull Channel Partitioning
bull divide channel into smaller ldquopiecesrdquo (time slots frequency code)
bull allocate piece to node for exclusive use
bull Random Accessbull channel not divided allow collisionsbull ldquorecoverrdquo from collisions
bull ldquoTaking turnsrdquobull nodes take turns but nodes with more to send
can take longer turnsFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
22
Channel Partitioning MAC proto-cols TDMATDMA time division multiple access bull access to channel in rounds bull each station gets fixed length slot
(length = pkt trans time) in each round bull unused slots go idle bull example 6-station LAN 134 have pkt
slots 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
1 3 4 1 3 4
6-slotframe
23
Channel Partitioning MAC proto-cols FDMAFDMA frequency division multiple access bull channel spectrum divided into frequency bandsbull each station assigned fixed frequency bandbull unused transmission time in frequency bands go idle bull example 6-station LAN 134 have pkt frequency
bands 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
freq
uency
bands time
FDM cable
24
Random Access Protocolsbull When node has packet to send
bull transmit at full channel data rate Rbull no a priori coordination among nodes
bull two or more transmitting nodes ldquocollisionrdquobull random access MAC protocol specifies
bull how to detect collisionsbull how to recover from collisions (eg via delayed retrans-
missions)
bull Examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA
bull (CS Carrier Sensing MA Multiple AccessCD Collision Detection CA Collision Avoidance)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
25
Slotted ALOHAAssumptionsbull all frames same sizebull time divided into
equal size slots (time to transmit 1 frame)
bull nodes start to transmit only slot beginning
bull nodes are synchro-nized
bull if 2 or more nodes transmit in slot all nodes detect collision
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Operationbull when node obtains
fresh frame trans-mits in next slotbull if no collision node
can send new frame in next slot
bull if collision node re-transmits frame in each subsequent slot with prob p until success
26
Slotted ALOHA
Prosbull single active node can
continuously transmit at full rate of channel
bull highly decentralized only slots in nodes need to be in sync
bull simpleFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Consbull collisions wasting slotsbull idle slotsbull nodes may be able to
detect collision in less than time to transmit packet
bull clock synchronization
27
Slotted Aloha Efficiency
bull suppose N nodes with many frames to send each transmits in slot with probability p
bull prob that given node has success in a slot = p(1-p)N-1
bull prob that any node has a success = Np(1-p)N-1
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull max efficiency find p that max-imizes Np(1-p)N-1
bull for many nodes take limit of Np(1- p)N-1 as N goes to infinity gives
Max efficiency = 1e = 37
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
At best channelused for useful transmissions 37of time
28
Pure (unslotted) ALOHAbull unslotted Aloha simpler no synchro-
nizationbull when frame first arrives
bull transmit immediately
bull collision probability increasesbull frame sent at t0 collides with other frames sent in
[t0-1t0+1]
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
29
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 choosing optimum p and then letting
= 1(2e) = 18
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
N
even worse than slotted Aloha
30
CSMA (Carrier Sense Multiple Access)CSMA listen before transmitIf channel sensed idle transmit entire framebull If channel sensed busy defer transmis-
sion
bull human analogy donrsquot interrupt others
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
31
CSMA Collisionscollisions can still occurbull propagation delay means
two nodes may not hear each otherrsquos transmission
collisionbull entire packet transmis-
sion time wasted
notebull role of distance amp propa-
gation delay in determin-ing collision probability
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
spatial layout of nodes
32
CSMACD (Collision Detec-tion)CSMACD carrier sensing deferral as in CSMA
bull collisions detected within short timebull colliding transmissions aborted reducing channel
wastage
bull collision detection bull easy in wired LANs measure signal strengths
compare transmitted received signalsbull difficult in wireless LANs received signal strength
overwhelmed by local transmission strength
bull human analogy the polite conversationalist
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
33
CSMACD collision detection
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
34
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
bull share channel efficiently and fairly at high loadbull inefficient at low load delay in channel access
1N bandwidth allocated even if only 1 active node
Random access MAC protocolsbull efficient at low load single node can fully uti-
lize channelbull high load collision overhead
ldquotaking turnsrdquo protocolsbull look for best of both worlds
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
35
ldquoTaking Turnsrdquo MAC protocolsPolling bull master node ldquoinvitesrdquo
slave nodes to transmit in turn
bull typically used with ldquodumbrdquo slave devices
bull concernsbull polling overhead bull latencybull single point of failure
(master)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
T
data
(nothingto send)
T
36
ldquoTaking Turnsrdquo MAC protocolsToken passingbull control token
passed from one node to next se-quentially
bull token messagebull concerns
bull token overhead bull latencybull single point of failure
(token)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
master
slaves
poll
data
data
37
Summary of MAC protocolsbull channel partitioning by time frequency or
codebull Time Division Frequency Division
bull random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
bull taking turnsbull polling from central site token passing
bull Bluetooth FDDI IBM Token Ring Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
38
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
39
MAC Addresses and ARPbull 32-bit IP address
bull network-layer addressbull used to get datagram to destination IP subnet
bull MAC (or LAN or physical or Ethernet) ad-dress bull function get frame from one interface to an-
other physically-connected interface (same network)
bull 48 bit MAC address (for most LANs)bull burned in NIC ROM also sometimes software set-
table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
40
LAN Addresses and ARP
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Each adapter on LAN has 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)
41
LAN Address (more)bull MAC address allocation administered by IEEEbull manufacturer buys portion of MAC address
space (to assure uniqueness)bull analogy
(a) MAC address like Social Security Num-ber
(b) IP address like postal addressbull MAC flat address portability
bull can move LAN card from one LAN to another
bull IP hierarchical address NOT portablebull address depends on IP subnet to which node is at-
tachedFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
17
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
18
Multiple Access Links and Proto-colsTwo types of ldquolinksrdquobull point-to-point
bull PPP for dial-up accessbull point-to-point link between Ethernet switch and host
bull broadcast (shared wire or medium)bull old-fashioned Ethernetbull upstream HFC (Hybrid Fiber-Coaxial)bull 80211 wireless LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
19
Multiple Access protocolsbull single shared broadcast channel bull two or more simultaneous transmis-
sions by nodes interference bull collision if a node receives two or more
signals at the same time
multiple access protocolbull distributed algorithm that deter-
mines how nodes share channel ie determine when node can transmit
bull communication about channel shar-ing must use channel itself bull no out-of-band channel for coordination
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
20
Ideal Multiple Access ProtocolBroadcast channel of rate R bps1 when one node wants to transmit it
can send at rate R2 when M nodes want to transmit each
can send at average rate RM3 fully decentralized
bull no special node to coordinate transmissionsbull no synchronization of clocks slots
4 simple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
21
MAC Protocols a taxonomyThree broad classesbull Channel Partitioning
bull divide channel into smaller ldquopiecesrdquo (time slots frequency code)
bull allocate piece to node for exclusive use
bull Random Accessbull channel not divided allow collisionsbull ldquorecoverrdquo from collisions
bull ldquoTaking turnsrdquobull nodes take turns but nodes with more to send
can take longer turnsFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
22
Channel Partitioning MAC proto-cols TDMATDMA time division multiple access bull access to channel in rounds bull each station gets fixed length slot
(length = pkt trans time) in each round bull unused slots go idle bull example 6-station LAN 134 have pkt
slots 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
1 3 4 1 3 4
6-slotframe
23
Channel Partitioning MAC proto-cols FDMAFDMA frequency division multiple access bull channel spectrum divided into frequency bandsbull each station assigned fixed frequency bandbull unused transmission time in frequency bands go idle bull example 6-station LAN 134 have pkt frequency
bands 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
freq
uency
bands time
FDM cable
24
Random Access Protocolsbull When node has packet to send
bull transmit at full channel data rate Rbull no a priori coordination among nodes
bull two or more transmitting nodes ldquocollisionrdquobull random access MAC protocol specifies
bull how to detect collisionsbull how to recover from collisions (eg via delayed retrans-
missions)
bull Examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA
bull (CS Carrier Sensing MA Multiple AccessCD Collision Detection CA Collision Avoidance)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
25
Slotted ALOHAAssumptionsbull all frames same sizebull time divided into
equal size slots (time to transmit 1 frame)
bull nodes start to transmit only slot beginning
bull nodes are synchro-nized
bull if 2 or more nodes transmit in slot all nodes detect collision
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Operationbull when node obtains
fresh frame trans-mits in next slotbull if no collision node
can send new frame in next slot
bull if collision node re-transmits frame in each subsequent slot with prob p until success
26
Slotted ALOHA
Prosbull single active node can
continuously transmit at full rate of channel
bull highly decentralized only slots in nodes need to be in sync
bull simpleFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Consbull collisions wasting slotsbull idle slotsbull nodes may be able to
detect collision in less than time to transmit packet
bull clock synchronization
27
Slotted Aloha Efficiency
bull suppose N nodes with many frames to send each transmits in slot with probability p
bull prob that given node has success in a slot = p(1-p)N-1
bull prob that any node has a success = Np(1-p)N-1
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull max efficiency find p that max-imizes Np(1-p)N-1
bull for many nodes take limit of Np(1- p)N-1 as N goes to infinity gives
Max efficiency = 1e = 37
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
At best channelused for useful transmissions 37of time
28
Pure (unslotted) ALOHAbull unslotted Aloha simpler no synchro-
nizationbull when frame first arrives
bull transmit immediately
bull collision probability increasesbull frame sent at t0 collides with other frames sent in
[t0-1t0+1]
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
29
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 choosing optimum p and then letting
= 1(2e) = 18
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
N
even worse than slotted Aloha
30
CSMA (Carrier Sense Multiple Access)CSMA listen before transmitIf channel sensed idle transmit entire framebull If channel sensed busy defer transmis-
sion
bull human analogy donrsquot interrupt others
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
31
CSMA Collisionscollisions can still occurbull propagation delay means
two nodes may not hear each otherrsquos transmission
collisionbull entire packet transmis-
sion time wasted
notebull role of distance amp propa-
gation delay in determin-ing collision probability
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
spatial layout of nodes
32
CSMACD (Collision Detec-tion)CSMACD carrier sensing deferral as in CSMA
bull collisions detected within short timebull colliding transmissions aborted reducing channel
wastage
bull collision detection bull easy in wired LANs measure signal strengths
compare transmitted received signalsbull difficult in wireless LANs received signal strength
overwhelmed by local transmission strength
bull human analogy the polite conversationalist
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
33
CSMACD collision detection
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
34
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
bull share channel efficiently and fairly at high loadbull inefficient at low load delay in channel access
1N bandwidth allocated even if only 1 active node
Random access MAC protocolsbull efficient at low load single node can fully uti-
lize channelbull high load collision overhead
ldquotaking turnsrdquo protocolsbull look for best of both worlds
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
35
ldquoTaking Turnsrdquo MAC protocolsPolling bull master node ldquoinvitesrdquo
slave nodes to transmit in turn
bull typically used with ldquodumbrdquo slave devices
bull concernsbull polling overhead bull latencybull single point of failure
(master)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
T
data
(nothingto send)
T
36
ldquoTaking Turnsrdquo MAC protocolsToken passingbull control token
passed from one node to next se-quentially
bull token messagebull concerns
bull token overhead bull latencybull single point of failure
(token)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
master
slaves
poll
data
data
37
Summary of MAC protocolsbull channel partitioning by time frequency or
codebull Time Division Frequency Division
bull random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
bull taking turnsbull polling from central site token passing
bull Bluetooth FDDI IBM Token Ring Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
38
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
39
MAC Addresses and ARPbull 32-bit IP address
bull network-layer addressbull used to get datagram to destination IP subnet
bull MAC (or LAN or physical or Ethernet) ad-dress bull function get frame from one interface to an-
other physically-connected interface (same network)
bull 48 bit MAC address (for most LANs)bull burned in NIC ROM also sometimes software set-
table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
40
LAN Addresses and ARP
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Each adapter on LAN has 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)
41
LAN Address (more)bull MAC address allocation administered by IEEEbull manufacturer buys portion of MAC address
space (to assure uniqueness)bull analogy
(a) MAC address like Social Security Num-ber
(b) IP address like postal addressbull MAC flat address portability
bull can move LAN card from one LAN to another
bull IP hierarchical address NOT portablebull address depends on IP subnet to which node is at-
tachedFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
18
Multiple Access Links and Proto-colsTwo types of ldquolinksrdquobull point-to-point
bull PPP for dial-up accessbull point-to-point link between Ethernet switch and host
bull broadcast (shared wire or medium)bull old-fashioned Ethernetbull upstream HFC (Hybrid Fiber-Coaxial)bull 80211 wireless LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
19
Multiple Access protocolsbull single shared broadcast channel bull two or more simultaneous transmis-
sions by nodes interference bull collision if a node receives two or more
signals at the same time
multiple access protocolbull distributed algorithm that deter-
mines how nodes share channel ie determine when node can transmit
bull communication about channel shar-ing must use channel itself bull no out-of-band channel for coordination
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
20
Ideal Multiple Access ProtocolBroadcast channel of rate R bps1 when one node wants to transmit it
can send at rate R2 when M nodes want to transmit each
can send at average rate RM3 fully decentralized
bull no special node to coordinate transmissionsbull no synchronization of clocks slots
4 simple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
21
MAC Protocols a taxonomyThree broad classesbull Channel Partitioning
bull divide channel into smaller ldquopiecesrdquo (time slots frequency code)
bull allocate piece to node for exclusive use
bull Random Accessbull channel not divided allow collisionsbull ldquorecoverrdquo from collisions
bull ldquoTaking turnsrdquobull nodes take turns but nodes with more to send
can take longer turnsFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
22
Channel Partitioning MAC proto-cols TDMATDMA time division multiple access bull access to channel in rounds bull each station gets fixed length slot
(length = pkt trans time) in each round bull unused slots go idle bull example 6-station LAN 134 have pkt
slots 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
1 3 4 1 3 4
6-slotframe
23
Channel Partitioning MAC proto-cols FDMAFDMA frequency division multiple access bull channel spectrum divided into frequency bandsbull each station assigned fixed frequency bandbull unused transmission time in frequency bands go idle bull example 6-station LAN 134 have pkt frequency
bands 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
freq
uency
bands time
FDM cable
24
Random Access Protocolsbull When node has packet to send
bull transmit at full channel data rate Rbull no a priori coordination among nodes
bull two or more transmitting nodes ldquocollisionrdquobull random access MAC protocol specifies
bull how to detect collisionsbull how to recover from collisions (eg via delayed retrans-
missions)
bull Examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA
bull (CS Carrier Sensing MA Multiple AccessCD Collision Detection CA Collision Avoidance)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
25
Slotted ALOHAAssumptionsbull all frames same sizebull time divided into
equal size slots (time to transmit 1 frame)
bull nodes start to transmit only slot beginning
bull nodes are synchro-nized
bull if 2 or more nodes transmit in slot all nodes detect collision
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Operationbull when node obtains
fresh frame trans-mits in next slotbull if no collision node
can send new frame in next slot
bull if collision node re-transmits frame in each subsequent slot with prob p until success
26
Slotted ALOHA
Prosbull single active node can
continuously transmit at full rate of channel
bull highly decentralized only slots in nodes need to be in sync
bull simpleFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Consbull collisions wasting slotsbull idle slotsbull nodes may be able to
detect collision in less than time to transmit packet
bull clock synchronization
27
Slotted Aloha Efficiency
bull suppose N nodes with many frames to send each transmits in slot with probability p
bull prob that given node has success in a slot = p(1-p)N-1
bull prob that any node has a success = Np(1-p)N-1
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull max efficiency find p that max-imizes Np(1-p)N-1
bull for many nodes take limit of Np(1- p)N-1 as N goes to infinity gives
Max efficiency = 1e = 37
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
At best channelused for useful transmissions 37of time
28
Pure (unslotted) ALOHAbull unslotted Aloha simpler no synchro-
nizationbull when frame first arrives
bull transmit immediately
bull collision probability increasesbull frame sent at t0 collides with other frames sent in
[t0-1t0+1]
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
29
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 choosing optimum p and then letting
= 1(2e) = 18
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
N
even worse than slotted Aloha
30
CSMA (Carrier Sense Multiple Access)CSMA listen before transmitIf channel sensed idle transmit entire framebull If channel sensed busy defer transmis-
sion
bull human analogy donrsquot interrupt others
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
31
CSMA Collisionscollisions can still occurbull propagation delay means
two nodes may not hear each otherrsquos transmission
collisionbull entire packet transmis-
sion time wasted
notebull role of distance amp propa-
gation delay in determin-ing collision probability
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
spatial layout of nodes
32
CSMACD (Collision Detec-tion)CSMACD carrier sensing deferral as in CSMA
bull collisions detected within short timebull colliding transmissions aborted reducing channel
wastage
bull collision detection bull easy in wired LANs measure signal strengths
compare transmitted received signalsbull difficult in wireless LANs received signal strength
overwhelmed by local transmission strength
bull human analogy the polite conversationalist
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
33
CSMACD collision detection
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
34
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
bull share channel efficiently and fairly at high loadbull inefficient at low load delay in channel access
1N bandwidth allocated even if only 1 active node
Random access MAC protocolsbull efficient at low load single node can fully uti-
lize channelbull high load collision overhead
ldquotaking turnsrdquo protocolsbull look for best of both worlds
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
35
ldquoTaking Turnsrdquo MAC protocolsPolling bull master node ldquoinvitesrdquo
slave nodes to transmit in turn
bull typically used with ldquodumbrdquo slave devices
bull concernsbull polling overhead bull latencybull single point of failure
(master)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
T
data
(nothingto send)
T
36
ldquoTaking Turnsrdquo MAC protocolsToken passingbull control token
passed from one node to next se-quentially
bull token messagebull concerns
bull token overhead bull latencybull single point of failure
(token)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
master
slaves
poll
data
data
37
Summary of MAC protocolsbull channel partitioning by time frequency or
codebull Time Division Frequency Division
bull random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
bull taking turnsbull polling from central site token passing
bull Bluetooth FDDI IBM Token Ring Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
38
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
39
MAC Addresses and ARPbull 32-bit IP address
bull network-layer addressbull used to get datagram to destination IP subnet
bull MAC (or LAN or physical or Ethernet) ad-dress bull function get frame from one interface to an-
other physically-connected interface (same network)
bull 48 bit MAC address (for most LANs)bull burned in NIC ROM also sometimes software set-
table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
40
LAN Addresses and ARP
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Each adapter on LAN has 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)
41
LAN Address (more)bull MAC address allocation administered by IEEEbull manufacturer buys portion of MAC address
space (to assure uniqueness)bull analogy
(a) MAC address like Social Security Num-ber
(b) IP address like postal addressbull MAC flat address portability
bull can move LAN card from one LAN to another
bull IP hierarchical address NOT portablebull address depends on IP subnet to which node is at-
tachedFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
19
Multiple Access protocolsbull single shared broadcast channel bull two or more simultaneous transmis-
sions by nodes interference bull collision if a node receives two or more
signals at the same time
multiple access protocolbull distributed algorithm that deter-
mines how nodes share channel ie determine when node can transmit
bull communication about channel shar-ing must use channel itself bull no out-of-band channel for coordination
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
20
Ideal Multiple Access ProtocolBroadcast channel of rate R bps1 when one node wants to transmit it
can send at rate R2 when M nodes want to transmit each
can send at average rate RM3 fully decentralized
bull no special node to coordinate transmissionsbull no synchronization of clocks slots
4 simple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
21
MAC Protocols a taxonomyThree broad classesbull Channel Partitioning
bull divide channel into smaller ldquopiecesrdquo (time slots frequency code)
bull allocate piece to node for exclusive use
bull Random Accessbull channel not divided allow collisionsbull ldquorecoverrdquo from collisions
bull ldquoTaking turnsrdquobull nodes take turns but nodes with more to send
can take longer turnsFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
22
Channel Partitioning MAC proto-cols TDMATDMA time division multiple access bull access to channel in rounds bull each station gets fixed length slot
(length = pkt trans time) in each round bull unused slots go idle bull example 6-station LAN 134 have pkt
slots 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
1 3 4 1 3 4
6-slotframe
23
Channel Partitioning MAC proto-cols FDMAFDMA frequency division multiple access bull channel spectrum divided into frequency bandsbull each station assigned fixed frequency bandbull unused transmission time in frequency bands go idle bull example 6-station LAN 134 have pkt frequency
bands 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
freq
uency
bands time
FDM cable
24
Random Access Protocolsbull When node has packet to send
bull transmit at full channel data rate Rbull no a priori coordination among nodes
bull two or more transmitting nodes ldquocollisionrdquobull random access MAC protocol specifies
bull how to detect collisionsbull how to recover from collisions (eg via delayed retrans-
missions)
bull Examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA
bull (CS Carrier Sensing MA Multiple AccessCD Collision Detection CA Collision Avoidance)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
25
Slotted ALOHAAssumptionsbull all frames same sizebull time divided into
equal size slots (time to transmit 1 frame)
bull nodes start to transmit only slot beginning
bull nodes are synchro-nized
bull if 2 or more nodes transmit in slot all nodes detect collision
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Operationbull when node obtains
fresh frame trans-mits in next slotbull if no collision node
can send new frame in next slot
bull if collision node re-transmits frame in each subsequent slot with prob p until success
26
Slotted ALOHA
Prosbull single active node can
continuously transmit at full rate of channel
bull highly decentralized only slots in nodes need to be in sync
bull simpleFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Consbull collisions wasting slotsbull idle slotsbull nodes may be able to
detect collision in less than time to transmit packet
bull clock synchronization
27
Slotted Aloha Efficiency
bull suppose N nodes with many frames to send each transmits in slot with probability p
bull prob that given node has success in a slot = p(1-p)N-1
bull prob that any node has a success = Np(1-p)N-1
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull max efficiency find p that max-imizes Np(1-p)N-1
bull for many nodes take limit of Np(1- p)N-1 as N goes to infinity gives
Max efficiency = 1e = 37
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
At best channelused for useful transmissions 37of time
28
Pure (unslotted) ALOHAbull unslotted Aloha simpler no synchro-
nizationbull when frame first arrives
bull transmit immediately
bull collision probability increasesbull frame sent at t0 collides with other frames sent in
[t0-1t0+1]
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
29
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 choosing optimum p and then letting
= 1(2e) = 18
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
N
even worse than slotted Aloha
30
CSMA (Carrier Sense Multiple Access)CSMA listen before transmitIf channel sensed idle transmit entire framebull If channel sensed busy defer transmis-
sion
bull human analogy donrsquot interrupt others
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
31
CSMA Collisionscollisions can still occurbull propagation delay means
two nodes may not hear each otherrsquos transmission
collisionbull entire packet transmis-
sion time wasted
notebull role of distance amp propa-
gation delay in determin-ing collision probability
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
spatial layout of nodes
32
CSMACD (Collision Detec-tion)CSMACD carrier sensing deferral as in CSMA
bull collisions detected within short timebull colliding transmissions aborted reducing channel
wastage
bull collision detection bull easy in wired LANs measure signal strengths
compare transmitted received signalsbull difficult in wireless LANs received signal strength
overwhelmed by local transmission strength
bull human analogy the polite conversationalist
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
33
CSMACD collision detection
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
34
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
bull share channel efficiently and fairly at high loadbull inefficient at low load delay in channel access
1N bandwidth allocated even if only 1 active node
Random access MAC protocolsbull efficient at low load single node can fully uti-
lize channelbull high load collision overhead
ldquotaking turnsrdquo protocolsbull look for best of both worlds
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
35
ldquoTaking Turnsrdquo MAC protocolsPolling bull master node ldquoinvitesrdquo
slave nodes to transmit in turn
bull typically used with ldquodumbrdquo slave devices
bull concernsbull polling overhead bull latencybull single point of failure
(master)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
T
data
(nothingto send)
T
36
ldquoTaking Turnsrdquo MAC protocolsToken passingbull control token
passed from one node to next se-quentially
bull token messagebull concerns
bull token overhead bull latencybull single point of failure
(token)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
master
slaves
poll
data
data
37
Summary of MAC protocolsbull channel partitioning by time frequency or
codebull Time Division Frequency Division
bull random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
bull taking turnsbull polling from central site token passing
bull Bluetooth FDDI IBM Token Ring Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
38
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
39
MAC Addresses and ARPbull 32-bit IP address
bull network-layer addressbull used to get datagram to destination IP subnet
bull MAC (or LAN or physical or Ethernet) ad-dress bull function get frame from one interface to an-
other physically-connected interface (same network)
bull 48 bit MAC address (for most LANs)bull burned in NIC ROM also sometimes software set-
table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
40
LAN Addresses and ARP
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Each adapter on LAN has 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)
41
LAN Address (more)bull MAC address allocation administered by IEEEbull manufacturer buys portion of MAC address
space (to assure uniqueness)bull analogy
(a) MAC address like Social Security Num-ber
(b) IP address like postal addressbull MAC flat address portability
bull can move LAN card from one LAN to another
bull IP hierarchical address NOT portablebull address depends on IP subnet to which node is at-
tachedFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
20
Ideal Multiple Access ProtocolBroadcast channel of rate R bps1 when one node wants to transmit it
can send at rate R2 when M nodes want to transmit each
can send at average rate RM3 fully decentralized
bull no special node to coordinate transmissionsbull no synchronization of clocks slots
4 simple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
21
MAC Protocols a taxonomyThree broad classesbull Channel Partitioning
bull divide channel into smaller ldquopiecesrdquo (time slots frequency code)
bull allocate piece to node for exclusive use
bull Random Accessbull channel not divided allow collisionsbull ldquorecoverrdquo from collisions
bull ldquoTaking turnsrdquobull nodes take turns but nodes with more to send
can take longer turnsFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
22
Channel Partitioning MAC proto-cols TDMATDMA time division multiple access bull access to channel in rounds bull each station gets fixed length slot
(length = pkt trans time) in each round bull unused slots go idle bull example 6-station LAN 134 have pkt
slots 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
1 3 4 1 3 4
6-slotframe
23
Channel Partitioning MAC proto-cols FDMAFDMA frequency division multiple access bull channel spectrum divided into frequency bandsbull each station assigned fixed frequency bandbull unused transmission time in frequency bands go idle bull example 6-station LAN 134 have pkt frequency
bands 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
freq
uency
bands time
FDM cable
24
Random Access Protocolsbull When node has packet to send
bull transmit at full channel data rate Rbull no a priori coordination among nodes
bull two or more transmitting nodes ldquocollisionrdquobull random access MAC protocol specifies
bull how to detect collisionsbull how to recover from collisions (eg via delayed retrans-
missions)
bull Examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA
bull (CS Carrier Sensing MA Multiple AccessCD Collision Detection CA Collision Avoidance)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
25
Slotted ALOHAAssumptionsbull all frames same sizebull time divided into
equal size slots (time to transmit 1 frame)
bull nodes start to transmit only slot beginning
bull nodes are synchro-nized
bull if 2 or more nodes transmit in slot all nodes detect collision
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Operationbull when node obtains
fresh frame trans-mits in next slotbull if no collision node
can send new frame in next slot
bull if collision node re-transmits frame in each subsequent slot with prob p until success
26
Slotted ALOHA
Prosbull single active node can
continuously transmit at full rate of channel
bull highly decentralized only slots in nodes need to be in sync
bull simpleFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Consbull collisions wasting slotsbull idle slotsbull nodes may be able to
detect collision in less than time to transmit packet
bull clock synchronization
27
Slotted Aloha Efficiency
bull suppose N nodes with many frames to send each transmits in slot with probability p
bull prob that given node has success in a slot = p(1-p)N-1
bull prob that any node has a success = Np(1-p)N-1
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull max efficiency find p that max-imizes Np(1-p)N-1
bull for many nodes take limit of Np(1- p)N-1 as N goes to infinity gives
Max efficiency = 1e = 37
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
At best channelused for useful transmissions 37of time
28
Pure (unslotted) ALOHAbull unslotted Aloha simpler no synchro-
nizationbull when frame first arrives
bull transmit immediately
bull collision probability increasesbull frame sent at t0 collides with other frames sent in
[t0-1t0+1]
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
29
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 choosing optimum p and then letting
= 1(2e) = 18
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
N
even worse than slotted Aloha
30
CSMA (Carrier Sense Multiple Access)CSMA listen before transmitIf channel sensed idle transmit entire framebull If channel sensed busy defer transmis-
sion
bull human analogy donrsquot interrupt others
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
31
CSMA Collisionscollisions can still occurbull propagation delay means
two nodes may not hear each otherrsquos transmission
collisionbull entire packet transmis-
sion time wasted
notebull role of distance amp propa-
gation delay in determin-ing collision probability
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
spatial layout of nodes
32
CSMACD (Collision Detec-tion)CSMACD carrier sensing deferral as in CSMA
bull collisions detected within short timebull colliding transmissions aborted reducing channel
wastage
bull collision detection bull easy in wired LANs measure signal strengths
compare transmitted received signalsbull difficult in wireless LANs received signal strength
overwhelmed by local transmission strength
bull human analogy the polite conversationalist
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
33
CSMACD collision detection
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
34
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
bull share channel efficiently and fairly at high loadbull inefficient at low load delay in channel access
1N bandwidth allocated even if only 1 active node
Random access MAC protocolsbull efficient at low load single node can fully uti-
lize channelbull high load collision overhead
ldquotaking turnsrdquo protocolsbull look for best of both worlds
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
35
ldquoTaking Turnsrdquo MAC protocolsPolling bull master node ldquoinvitesrdquo
slave nodes to transmit in turn
bull typically used with ldquodumbrdquo slave devices
bull concernsbull polling overhead bull latencybull single point of failure
(master)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
T
data
(nothingto send)
T
36
ldquoTaking Turnsrdquo MAC protocolsToken passingbull control token
passed from one node to next se-quentially
bull token messagebull concerns
bull token overhead bull latencybull single point of failure
(token)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
master
slaves
poll
data
data
37
Summary of MAC protocolsbull channel partitioning by time frequency or
codebull Time Division Frequency Division
bull random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
bull taking turnsbull polling from central site token passing
bull Bluetooth FDDI IBM Token Ring Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
38
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
39
MAC Addresses and ARPbull 32-bit IP address
bull network-layer addressbull used to get datagram to destination IP subnet
bull MAC (or LAN or physical or Ethernet) ad-dress bull function get frame from one interface to an-
other physically-connected interface (same network)
bull 48 bit MAC address (for most LANs)bull burned in NIC ROM also sometimes software set-
table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
40
LAN Addresses and ARP
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Each adapter on LAN has 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)
41
LAN Address (more)bull MAC address allocation administered by IEEEbull manufacturer buys portion of MAC address
space (to assure uniqueness)bull analogy
(a) MAC address like Social Security Num-ber
(b) IP address like postal addressbull MAC flat address portability
bull can move LAN card from one LAN to another
bull IP hierarchical address NOT portablebull address depends on IP subnet to which node is at-
tachedFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
21
MAC Protocols a taxonomyThree broad classesbull Channel Partitioning
bull divide channel into smaller ldquopiecesrdquo (time slots frequency code)
bull allocate piece to node for exclusive use
bull Random Accessbull channel not divided allow collisionsbull ldquorecoverrdquo from collisions
bull ldquoTaking turnsrdquobull nodes take turns but nodes with more to send
can take longer turnsFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
22
Channel Partitioning MAC proto-cols TDMATDMA time division multiple access bull access to channel in rounds bull each station gets fixed length slot
(length = pkt trans time) in each round bull unused slots go idle bull example 6-station LAN 134 have pkt
slots 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
1 3 4 1 3 4
6-slotframe
23
Channel Partitioning MAC proto-cols FDMAFDMA frequency division multiple access bull channel spectrum divided into frequency bandsbull each station assigned fixed frequency bandbull unused transmission time in frequency bands go idle bull example 6-station LAN 134 have pkt frequency
bands 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
freq
uency
bands time
FDM cable
24
Random Access Protocolsbull When node has packet to send
bull transmit at full channel data rate Rbull no a priori coordination among nodes
bull two or more transmitting nodes ldquocollisionrdquobull random access MAC protocol specifies
bull how to detect collisionsbull how to recover from collisions (eg via delayed retrans-
missions)
bull Examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA
bull (CS Carrier Sensing MA Multiple AccessCD Collision Detection CA Collision Avoidance)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
25
Slotted ALOHAAssumptionsbull all frames same sizebull time divided into
equal size slots (time to transmit 1 frame)
bull nodes start to transmit only slot beginning
bull nodes are synchro-nized
bull if 2 or more nodes transmit in slot all nodes detect collision
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Operationbull when node obtains
fresh frame trans-mits in next slotbull if no collision node
can send new frame in next slot
bull if collision node re-transmits frame in each subsequent slot with prob p until success
26
Slotted ALOHA
Prosbull single active node can
continuously transmit at full rate of channel
bull highly decentralized only slots in nodes need to be in sync
bull simpleFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Consbull collisions wasting slotsbull idle slotsbull nodes may be able to
detect collision in less than time to transmit packet
bull clock synchronization
27
Slotted Aloha Efficiency
bull suppose N nodes with many frames to send each transmits in slot with probability p
bull prob that given node has success in a slot = p(1-p)N-1
bull prob that any node has a success = Np(1-p)N-1
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull max efficiency find p that max-imizes Np(1-p)N-1
bull for many nodes take limit of Np(1- p)N-1 as N goes to infinity gives
Max efficiency = 1e = 37
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
At best channelused for useful transmissions 37of time
28
Pure (unslotted) ALOHAbull unslotted Aloha simpler no synchro-
nizationbull when frame first arrives
bull transmit immediately
bull collision probability increasesbull frame sent at t0 collides with other frames sent in
[t0-1t0+1]
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
29
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 choosing optimum p and then letting
= 1(2e) = 18
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
N
even worse than slotted Aloha
30
CSMA (Carrier Sense Multiple Access)CSMA listen before transmitIf channel sensed idle transmit entire framebull If channel sensed busy defer transmis-
sion
bull human analogy donrsquot interrupt others
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
31
CSMA Collisionscollisions can still occurbull propagation delay means
two nodes may not hear each otherrsquos transmission
collisionbull entire packet transmis-
sion time wasted
notebull role of distance amp propa-
gation delay in determin-ing collision probability
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
spatial layout of nodes
32
CSMACD (Collision Detec-tion)CSMACD carrier sensing deferral as in CSMA
bull collisions detected within short timebull colliding transmissions aborted reducing channel
wastage
bull collision detection bull easy in wired LANs measure signal strengths
compare transmitted received signalsbull difficult in wireless LANs received signal strength
overwhelmed by local transmission strength
bull human analogy the polite conversationalist
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
33
CSMACD collision detection
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
34
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
bull share channel efficiently and fairly at high loadbull inefficient at low load delay in channel access
1N bandwidth allocated even if only 1 active node
Random access MAC protocolsbull efficient at low load single node can fully uti-
lize channelbull high load collision overhead
ldquotaking turnsrdquo protocolsbull look for best of both worlds
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
35
ldquoTaking Turnsrdquo MAC protocolsPolling bull master node ldquoinvitesrdquo
slave nodes to transmit in turn
bull typically used with ldquodumbrdquo slave devices
bull concernsbull polling overhead bull latencybull single point of failure
(master)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
T
data
(nothingto send)
T
36
ldquoTaking Turnsrdquo MAC protocolsToken passingbull control token
passed from one node to next se-quentially
bull token messagebull concerns
bull token overhead bull latencybull single point of failure
(token)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
master
slaves
poll
data
data
37
Summary of MAC protocolsbull channel partitioning by time frequency or
codebull Time Division Frequency Division
bull random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
bull taking turnsbull polling from central site token passing
bull Bluetooth FDDI IBM Token Ring Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
38
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
39
MAC Addresses and ARPbull 32-bit IP address
bull network-layer addressbull used to get datagram to destination IP subnet
bull MAC (or LAN or physical or Ethernet) ad-dress bull function get frame from one interface to an-
other physically-connected interface (same network)
bull 48 bit MAC address (for most LANs)bull burned in NIC ROM also sometimes software set-
table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
40
LAN Addresses and ARP
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Each adapter on LAN has 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)
41
LAN Address (more)bull MAC address allocation administered by IEEEbull manufacturer buys portion of MAC address
space (to assure uniqueness)bull analogy
(a) MAC address like Social Security Num-ber
(b) IP address like postal addressbull MAC flat address portability
bull can move LAN card from one LAN to another
bull IP hierarchical address NOT portablebull address depends on IP subnet to which node is at-
tachedFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
22
Channel Partitioning MAC proto-cols TDMATDMA time division multiple access bull access to channel in rounds bull each station gets fixed length slot
(length = pkt trans time) in each round bull unused slots go idle bull example 6-station LAN 134 have pkt
slots 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
1 3 4 1 3 4
6-slotframe
23
Channel Partitioning MAC proto-cols FDMAFDMA frequency division multiple access bull channel spectrum divided into frequency bandsbull each station assigned fixed frequency bandbull unused transmission time in frequency bands go idle bull example 6-station LAN 134 have pkt frequency
bands 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
freq
uency
bands time
FDM cable
24
Random Access Protocolsbull When node has packet to send
bull transmit at full channel data rate Rbull no a priori coordination among nodes
bull two or more transmitting nodes ldquocollisionrdquobull random access MAC protocol specifies
bull how to detect collisionsbull how to recover from collisions (eg via delayed retrans-
missions)
bull Examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA
bull (CS Carrier Sensing MA Multiple AccessCD Collision Detection CA Collision Avoidance)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
25
Slotted ALOHAAssumptionsbull all frames same sizebull time divided into
equal size slots (time to transmit 1 frame)
bull nodes start to transmit only slot beginning
bull nodes are synchro-nized
bull if 2 or more nodes transmit in slot all nodes detect collision
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Operationbull when node obtains
fresh frame trans-mits in next slotbull if no collision node
can send new frame in next slot
bull if collision node re-transmits frame in each subsequent slot with prob p until success
26
Slotted ALOHA
Prosbull single active node can
continuously transmit at full rate of channel
bull highly decentralized only slots in nodes need to be in sync
bull simpleFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Consbull collisions wasting slotsbull idle slotsbull nodes may be able to
detect collision in less than time to transmit packet
bull clock synchronization
27
Slotted Aloha Efficiency
bull suppose N nodes with many frames to send each transmits in slot with probability p
bull prob that given node has success in a slot = p(1-p)N-1
bull prob that any node has a success = Np(1-p)N-1
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull max efficiency find p that max-imizes Np(1-p)N-1
bull for many nodes take limit of Np(1- p)N-1 as N goes to infinity gives
Max efficiency = 1e = 37
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
At best channelused for useful transmissions 37of time
28
Pure (unslotted) ALOHAbull unslotted Aloha simpler no synchro-
nizationbull when frame first arrives
bull transmit immediately
bull collision probability increasesbull frame sent at t0 collides with other frames sent in
[t0-1t0+1]
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
29
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 choosing optimum p and then letting
= 1(2e) = 18
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
N
even worse than slotted Aloha
30
CSMA (Carrier Sense Multiple Access)CSMA listen before transmitIf channel sensed idle transmit entire framebull If channel sensed busy defer transmis-
sion
bull human analogy donrsquot interrupt others
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
31
CSMA Collisionscollisions can still occurbull propagation delay means
two nodes may not hear each otherrsquos transmission
collisionbull entire packet transmis-
sion time wasted
notebull role of distance amp propa-
gation delay in determin-ing collision probability
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
spatial layout of nodes
32
CSMACD (Collision Detec-tion)CSMACD carrier sensing deferral as in CSMA
bull collisions detected within short timebull colliding transmissions aborted reducing channel
wastage
bull collision detection bull easy in wired LANs measure signal strengths
compare transmitted received signalsbull difficult in wireless LANs received signal strength
overwhelmed by local transmission strength
bull human analogy the polite conversationalist
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
33
CSMACD collision detection
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
34
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
bull share channel efficiently and fairly at high loadbull inefficient at low load delay in channel access
1N bandwidth allocated even if only 1 active node
Random access MAC protocolsbull efficient at low load single node can fully uti-
lize channelbull high load collision overhead
ldquotaking turnsrdquo protocolsbull look for best of both worlds
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
35
ldquoTaking Turnsrdquo MAC protocolsPolling bull master node ldquoinvitesrdquo
slave nodes to transmit in turn
bull typically used with ldquodumbrdquo slave devices
bull concernsbull polling overhead bull latencybull single point of failure
(master)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
T
data
(nothingto send)
T
36
ldquoTaking Turnsrdquo MAC protocolsToken passingbull control token
passed from one node to next se-quentially
bull token messagebull concerns
bull token overhead bull latencybull single point of failure
(token)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
master
slaves
poll
data
data
37
Summary of MAC protocolsbull channel partitioning by time frequency or
codebull Time Division Frequency Division
bull random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
bull taking turnsbull polling from central site token passing
bull Bluetooth FDDI IBM Token Ring Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
38
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
39
MAC Addresses and ARPbull 32-bit IP address
bull network-layer addressbull used to get datagram to destination IP subnet
bull MAC (or LAN or physical or Ethernet) ad-dress bull function get frame from one interface to an-
other physically-connected interface (same network)
bull 48 bit MAC address (for most LANs)bull burned in NIC ROM also sometimes software set-
table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
40
LAN Addresses and ARP
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Each adapter on LAN has 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)
41
LAN Address (more)bull MAC address allocation administered by IEEEbull manufacturer buys portion of MAC address
space (to assure uniqueness)bull analogy
(a) MAC address like Social Security Num-ber
(b) IP address like postal addressbull MAC flat address portability
bull can move LAN card from one LAN to another
bull IP hierarchical address NOT portablebull address depends on IP subnet to which node is at-
tachedFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
23
Channel Partitioning MAC proto-cols FDMAFDMA frequency division multiple access bull channel spectrum divided into frequency bandsbull each station assigned fixed frequency bandbull unused transmission time in frequency bands go idle bull example 6-station LAN 134 have pkt frequency
bands 256 idle
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
freq
uency
bands time
FDM cable
24
Random Access Protocolsbull When node has packet to send
bull transmit at full channel data rate Rbull no a priori coordination among nodes
bull two or more transmitting nodes ldquocollisionrdquobull random access MAC protocol specifies
bull how to detect collisionsbull how to recover from collisions (eg via delayed retrans-
missions)
bull Examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA
bull (CS Carrier Sensing MA Multiple AccessCD Collision Detection CA Collision Avoidance)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
25
Slotted ALOHAAssumptionsbull all frames same sizebull time divided into
equal size slots (time to transmit 1 frame)
bull nodes start to transmit only slot beginning
bull nodes are synchro-nized
bull if 2 or more nodes transmit in slot all nodes detect collision
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Operationbull when node obtains
fresh frame trans-mits in next slotbull if no collision node
can send new frame in next slot
bull if collision node re-transmits frame in each subsequent slot with prob p until success
26
Slotted ALOHA
Prosbull single active node can
continuously transmit at full rate of channel
bull highly decentralized only slots in nodes need to be in sync
bull simpleFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Consbull collisions wasting slotsbull idle slotsbull nodes may be able to
detect collision in less than time to transmit packet
bull clock synchronization
27
Slotted Aloha Efficiency
bull suppose N nodes with many frames to send each transmits in slot with probability p
bull prob that given node has success in a slot = p(1-p)N-1
bull prob that any node has a success = Np(1-p)N-1
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull max efficiency find p that max-imizes Np(1-p)N-1
bull for many nodes take limit of Np(1- p)N-1 as N goes to infinity gives
Max efficiency = 1e = 37
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
At best channelused for useful transmissions 37of time
28
Pure (unslotted) ALOHAbull unslotted Aloha simpler no synchro-
nizationbull when frame first arrives
bull transmit immediately
bull collision probability increasesbull frame sent at t0 collides with other frames sent in
[t0-1t0+1]
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
29
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 choosing optimum p and then letting
= 1(2e) = 18
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
N
even worse than slotted Aloha
30
CSMA (Carrier Sense Multiple Access)CSMA listen before transmitIf channel sensed idle transmit entire framebull If channel sensed busy defer transmis-
sion
bull human analogy donrsquot interrupt others
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
31
CSMA Collisionscollisions can still occurbull propagation delay means
two nodes may not hear each otherrsquos transmission
collisionbull entire packet transmis-
sion time wasted
notebull role of distance amp propa-
gation delay in determin-ing collision probability
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
spatial layout of nodes
32
CSMACD (Collision Detec-tion)CSMACD carrier sensing deferral as in CSMA
bull collisions detected within short timebull colliding transmissions aborted reducing channel
wastage
bull collision detection bull easy in wired LANs measure signal strengths
compare transmitted received signalsbull difficult in wireless LANs received signal strength
overwhelmed by local transmission strength
bull human analogy the polite conversationalist
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
33
CSMACD collision detection
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
34
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
bull share channel efficiently and fairly at high loadbull inefficient at low load delay in channel access
1N bandwidth allocated even if only 1 active node
Random access MAC protocolsbull efficient at low load single node can fully uti-
lize channelbull high load collision overhead
ldquotaking turnsrdquo protocolsbull look for best of both worlds
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
35
ldquoTaking Turnsrdquo MAC protocolsPolling bull master node ldquoinvitesrdquo
slave nodes to transmit in turn
bull typically used with ldquodumbrdquo slave devices
bull concernsbull polling overhead bull latencybull single point of failure
(master)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
T
data
(nothingto send)
T
36
ldquoTaking Turnsrdquo MAC protocolsToken passingbull control token
passed from one node to next se-quentially
bull token messagebull concerns
bull token overhead bull latencybull single point of failure
(token)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
master
slaves
poll
data
data
37
Summary of MAC protocolsbull channel partitioning by time frequency or
codebull Time Division Frequency Division
bull random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
bull taking turnsbull polling from central site token passing
bull Bluetooth FDDI IBM Token Ring Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
38
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
39
MAC Addresses and ARPbull 32-bit IP address
bull network-layer addressbull used to get datagram to destination IP subnet
bull MAC (or LAN or physical or Ethernet) ad-dress bull function get frame from one interface to an-
other physically-connected interface (same network)
bull 48 bit MAC address (for most LANs)bull burned in NIC ROM also sometimes software set-
table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
40
LAN Addresses and ARP
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Each adapter on LAN has 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)
41
LAN Address (more)bull MAC address allocation administered by IEEEbull manufacturer buys portion of MAC address
space (to assure uniqueness)bull analogy
(a) MAC address like Social Security Num-ber
(b) IP address like postal addressbull MAC flat address portability
bull can move LAN card from one LAN to another
bull IP hierarchical address NOT portablebull address depends on IP subnet to which node is at-
tachedFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
24
Random Access Protocolsbull When node has packet to send
bull transmit at full channel data rate Rbull no a priori coordination among nodes
bull two or more transmitting nodes ldquocollisionrdquobull random access MAC protocol specifies
bull how to detect collisionsbull how to recover from collisions (eg via delayed retrans-
missions)
bull Examples of random access MAC protocolsbull slotted ALOHAbull ALOHAbull CSMA CSMACD CSMACA
bull (CS Carrier Sensing MA Multiple AccessCD Collision Detection CA Collision Avoidance)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
25
Slotted ALOHAAssumptionsbull all frames same sizebull time divided into
equal size slots (time to transmit 1 frame)
bull nodes start to transmit only slot beginning
bull nodes are synchro-nized
bull if 2 or more nodes transmit in slot all nodes detect collision
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Operationbull when node obtains
fresh frame trans-mits in next slotbull if no collision node
can send new frame in next slot
bull if collision node re-transmits frame in each subsequent slot with prob p until success
26
Slotted ALOHA
Prosbull single active node can
continuously transmit at full rate of channel
bull highly decentralized only slots in nodes need to be in sync
bull simpleFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Consbull collisions wasting slotsbull idle slotsbull nodes may be able to
detect collision in less than time to transmit packet
bull clock synchronization
27
Slotted Aloha Efficiency
bull suppose N nodes with many frames to send each transmits in slot with probability p
bull prob that given node has success in a slot = p(1-p)N-1
bull prob that any node has a success = Np(1-p)N-1
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull max efficiency find p that max-imizes Np(1-p)N-1
bull for many nodes take limit of Np(1- p)N-1 as N goes to infinity gives
Max efficiency = 1e = 37
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
At best channelused for useful transmissions 37of time
28
Pure (unslotted) ALOHAbull unslotted Aloha simpler no synchro-
nizationbull when frame first arrives
bull transmit immediately
bull collision probability increasesbull frame sent at t0 collides with other frames sent in
[t0-1t0+1]
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
29
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 choosing optimum p and then letting
= 1(2e) = 18
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
N
even worse than slotted Aloha
30
CSMA (Carrier Sense Multiple Access)CSMA listen before transmitIf channel sensed idle transmit entire framebull If channel sensed busy defer transmis-
sion
bull human analogy donrsquot interrupt others
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
31
CSMA Collisionscollisions can still occurbull propagation delay means
two nodes may not hear each otherrsquos transmission
collisionbull entire packet transmis-
sion time wasted
notebull role of distance amp propa-
gation delay in determin-ing collision probability
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
spatial layout of nodes
32
CSMACD (Collision Detec-tion)CSMACD carrier sensing deferral as in CSMA
bull collisions detected within short timebull colliding transmissions aborted reducing channel
wastage
bull collision detection bull easy in wired LANs measure signal strengths
compare transmitted received signalsbull difficult in wireless LANs received signal strength
overwhelmed by local transmission strength
bull human analogy the polite conversationalist
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
33
CSMACD collision detection
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
34
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
bull share channel efficiently and fairly at high loadbull inefficient at low load delay in channel access
1N bandwidth allocated even if only 1 active node
Random access MAC protocolsbull efficient at low load single node can fully uti-
lize channelbull high load collision overhead
ldquotaking turnsrdquo protocolsbull look for best of both worlds
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
35
ldquoTaking Turnsrdquo MAC protocolsPolling bull master node ldquoinvitesrdquo
slave nodes to transmit in turn
bull typically used with ldquodumbrdquo slave devices
bull concernsbull polling overhead bull latencybull single point of failure
(master)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
T
data
(nothingto send)
T
36
ldquoTaking Turnsrdquo MAC protocolsToken passingbull control token
passed from one node to next se-quentially
bull token messagebull concerns
bull token overhead bull latencybull single point of failure
(token)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
master
slaves
poll
data
data
37
Summary of MAC protocolsbull channel partitioning by time frequency or
codebull Time Division Frequency Division
bull random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
bull taking turnsbull polling from central site token passing
bull Bluetooth FDDI IBM Token Ring Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
38
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
39
MAC Addresses and ARPbull 32-bit IP address
bull network-layer addressbull used to get datagram to destination IP subnet
bull MAC (or LAN or physical or Ethernet) ad-dress bull function get frame from one interface to an-
other physically-connected interface (same network)
bull 48 bit MAC address (for most LANs)bull burned in NIC ROM also sometimes software set-
table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
40
LAN Addresses and ARP
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Each adapter on LAN has 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)
41
LAN Address (more)bull MAC address allocation administered by IEEEbull manufacturer buys portion of MAC address
space (to assure uniqueness)bull analogy
(a) MAC address like Social Security Num-ber
(b) IP address like postal addressbull MAC flat address portability
bull can move LAN card from one LAN to another
bull IP hierarchical address NOT portablebull address depends on IP subnet to which node is at-
tachedFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
25
Slotted ALOHAAssumptionsbull all frames same sizebull time divided into
equal size slots (time to transmit 1 frame)
bull nodes start to transmit only slot beginning
bull nodes are synchro-nized
bull if 2 or more nodes transmit in slot all nodes detect collision
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Operationbull when node obtains
fresh frame trans-mits in next slotbull if no collision node
can send new frame in next slot
bull if collision node re-transmits frame in each subsequent slot with prob p until success
26
Slotted ALOHA
Prosbull single active node can
continuously transmit at full rate of channel
bull highly decentralized only slots in nodes need to be in sync
bull simpleFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Consbull collisions wasting slotsbull idle slotsbull nodes may be able to
detect collision in less than time to transmit packet
bull clock synchronization
27
Slotted Aloha Efficiency
bull suppose N nodes with many frames to send each transmits in slot with probability p
bull prob that given node has success in a slot = p(1-p)N-1
bull prob that any node has a success = Np(1-p)N-1
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull max efficiency find p that max-imizes Np(1-p)N-1
bull for many nodes take limit of Np(1- p)N-1 as N goes to infinity gives
Max efficiency = 1e = 37
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
At best channelused for useful transmissions 37of time
28
Pure (unslotted) ALOHAbull unslotted Aloha simpler no synchro-
nizationbull when frame first arrives
bull transmit immediately
bull collision probability increasesbull frame sent at t0 collides with other frames sent in
[t0-1t0+1]
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
29
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 choosing optimum p and then letting
= 1(2e) = 18
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
N
even worse than slotted Aloha
30
CSMA (Carrier Sense Multiple Access)CSMA listen before transmitIf channel sensed idle transmit entire framebull If channel sensed busy defer transmis-
sion
bull human analogy donrsquot interrupt others
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
31
CSMA Collisionscollisions can still occurbull propagation delay means
two nodes may not hear each otherrsquos transmission
collisionbull entire packet transmis-
sion time wasted
notebull role of distance amp propa-
gation delay in determin-ing collision probability
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
spatial layout of nodes
32
CSMACD (Collision Detec-tion)CSMACD carrier sensing deferral as in CSMA
bull collisions detected within short timebull colliding transmissions aborted reducing channel
wastage
bull collision detection bull easy in wired LANs measure signal strengths
compare transmitted received signalsbull difficult in wireless LANs received signal strength
overwhelmed by local transmission strength
bull human analogy the polite conversationalist
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
33
CSMACD collision detection
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
34
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
bull share channel efficiently and fairly at high loadbull inefficient at low load delay in channel access
1N bandwidth allocated even if only 1 active node
Random access MAC protocolsbull efficient at low load single node can fully uti-
lize channelbull high load collision overhead
ldquotaking turnsrdquo protocolsbull look for best of both worlds
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
35
ldquoTaking Turnsrdquo MAC protocolsPolling bull master node ldquoinvitesrdquo
slave nodes to transmit in turn
bull typically used with ldquodumbrdquo slave devices
bull concernsbull polling overhead bull latencybull single point of failure
(master)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
T
data
(nothingto send)
T
36
ldquoTaking Turnsrdquo MAC protocolsToken passingbull control token
passed from one node to next se-quentially
bull token messagebull concerns
bull token overhead bull latencybull single point of failure
(token)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
master
slaves
poll
data
data
37
Summary of MAC protocolsbull channel partitioning by time frequency or
codebull Time Division Frequency Division
bull random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
bull taking turnsbull polling from central site token passing
bull Bluetooth FDDI IBM Token Ring Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
38
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
39
MAC Addresses and ARPbull 32-bit IP address
bull network-layer addressbull used to get datagram to destination IP subnet
bull MAC (or LAN or physical or Ethernet) ad-dress bull function get frame from one interface to an-
other physically-connected interface (same network)
bull 48 bit MAC address (for most LANs)bull burned in NIC ROM also sometimes software set-
table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
40
LAN Addresses and ARP
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Each adapter on LAN has 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)
41
LAN Address (more)bull MAC address allocation administered by IEEEbull manufacturer buys portion of MAC address
space (to assure uniqueness)bull analogy
(a) MAC address like Social Security Num-ber
(b) IP address like postal addressbull MAC flat address portability
bull can move LAN card from one LAN to another
bull IP hierarchical address NOT portablebull address depends on IP subnet to which node is at-
tachedFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
26
Slotted ALOHA
Prosbull single active node can
continuously transmit at full rate of channel
bull highly decentralized only slots in nodes need to be in sync
bull simpleFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Consbull collisions wasting slotsbull idle slotsbull nodes may be able to
detect collision in less than time to transmit packet
bull clock synchronization
27
Slotted Aloha Efficiency
bull suppose N nodes with many frames to send each transmits in slot with probability p
bull prob that given node has success in a slot = p(1-p)N-1
bull prob that any node has a success = Np(1-p)N-1
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull max efficiency find p that max-imizes Np(1-p)N-1
bull for many nodes take limit of Np(1- p)N-1 as N goes to infinity gives
Max efficiency = 1e = 37
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
At best channelused for useful transmissions 37of time
28
Pure (unslotted) ALOHAbull unslotted Aloha simpler no synchro-
nizationbull when frame first arrives
bull transmit immediately
bull collision probability increasesbull frame sent at t0 collides with other frames sent in
[t0-1t0+1]
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
29
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 choosing optimum p and then letting
= 1(2e) = 18
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
N
even worse than slotted Aloha
30
CSMA (Carrier Sense Multiple Access)CSMA listen before transmitIf channel sensed idle transmit entire framebull If channel sensed busy defer transmis-
sion
bull human analogy donrsquot interrupt others
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
31
CSMA Collisionscollisions can still occurbull propagation delay means
two nodes may not hear each otherrsquos transmission
collisionbull entire packet transmis-
sion time wasted
notebull role of distance amp propa-
gation delay in determin-ing collision probability
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
spatial layout of nodes
32
CSMACD (Collision Detec-tion)CSMACD carrier sensing deferral as in CSMA
bull collisions detected within short timebull colliding transmissions aborted reducing channel
wastage
bull collision detection bull easy in wired LANs measure signal strengths
compare transmitted received signalsbull difficult in wireless LANs received signal strength
overwhelmed by local transmission strength
bull human analogy the polite conversationalist
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
33
CSMACD collision detection
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
34
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
bull share channel efficiently and fairly at high loadbull inefficient at low load delay in channel access
1N bandwidth allocated even if only 1 active node
Random access MAC protocolsbull efficient at low load single node can fully uti-
lize channelbull high load collision overhead
ldquotaking turnsrdquo protocolsbull look for best of both worlds
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
35
ldquoTaking Turnsrdquo MAC protocolsPolling bull master node ldquoinvitesrdquo
slave nodes to transmit in turn
bull typically used with ldquodumbrdquo slave devices
bull concernsbull polling overhead bull latencybull single point of failure
(master)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
T
data
(nothingto send)
T
36
ldquoTaking Turnsrdquo MAC protocolsToken passingbull control token
passed from one node to next se-quentially
bull token messagebull concerns
bull token overhead bull latencybull single point of failure
(token)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
master
slaves
poll
data
data
37
Summary of MAC protocolsbull channel partitioning by time frequency or
codebull Time Division Frequency Division
bull random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
bull taking turnsbull polling from central site token passing
bull Bluetooth FDDI IBM Token Ring Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
38
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
39
MAC Addresses and ARPbull 32-bit IP address
bull network-layer addressbull used to get datagram to destination IP subnet
bull MAC (or LAN or physical or Ethernet) ad-dress bull function get frame from one interface to an-
other physically-connected interface (same network)
bull 48 bit MAC address (for most LANs)bull burned in NIC ROM also sometimes software set-
table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
40
LAN Addresses and ARP
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Each adapter on LAN has 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)
41
LAN Address (more)bull MAC address allocation administered by IEEEbull manufacturer buys portion of MAC address
space (to assure uniqueness)bull analogy
(a) MAC address like Social Security Num-ber
(b) IP address like postal addressbull MAC flat address portability
bull can move LAN card from one LAN to another
bull IP hierarchical address NOT portablebull address depends on IP subnet to which node is at-
tachedFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
27
Slotted Aloha Efficiency
bull suppose N nodes with many frames to send each transmits in slot with probability p
bull prob that given node has success in a slot = p(1-p)N-1
bull prob that any node has a success = Np(1-p)N-1
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull max efficiency find p that max-imizes Np(1-p)N-1
bull for many nodes take limit of Np(1- p)N-1 as N goes to infinity gives
Max efficiency = 1e = 37
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
At best channelused for useful transmissions 37of time
28
Pure (unslotted) ALOHAbull unslotted Aloha simpler no synchro-
nizationbull when frame first arrives
bull transmit immediately
bull collision probability increasesbull frame sent at t0 collides with other frames sent in
[t0-1t0+1]
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
29
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 choosing optimum p and then letting
= 1(2e) = 18
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
N
even worse than slotted Aloha
30
CSMA (Carrier Sense Multiple Access)CSMA listen before transmitIf channel sensed idle transmit entire framebull If channel sensed busy defer transmis-
sion
bull human analogy donrsquot interrupt others
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
31
CSMA Collisionscollisions can still occurbull propagation delay means
two nodes may not hear each otherrsquos transmission
collisionbull entire packet transmis-
sion time wasted
notebull role of distance amp propa-
gation delay in determin-ing collision probability
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
spatial layout of nodes
32
CSMACD (Collision Detec-tion)CSMACD carrier sensing deferral as in CSMA
bull collisions detected within short timebull colliding transmissions aborted reducing channel
wastage
bull collision detection bull easy in wired LANs measure signal strengths
compare transmitted received signalsbull difficult in wireless LANs received signal strength
overwhelmed by local transmission strength
bull human analogy the polite conversationalist
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
33
CSMACD collision detection
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
34
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
bull share channel efficiently and fairly at high loadbull inefficient at low load delay in channel access
1N bandwidth allocated even if only 1 active node
Random access MAC protocolsbull efficient at low load single node can fully uti-
lize channelbull high load collision overhead
ldquotaking turnsrdquo protocolsbull look for best of both worlds
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
35
ldquoTaking Turnsrdquo MAC protocolsPolling bull master node ldquoinvitesrdquo
slave nodes to transmit in turn
bull typically used with ldquodumbrdquo slave devices
bull concernsbull polling overhead bull latencybull single point of failure
(master)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
T
data
(nothingto send)
T
36
ldquoTaking Turnsrdquo MAC protocolsToken passingbull control token
passed from one node to next se-quentially
bull token messagebull concerns
bull token overhead bull latencybull single point of failure
(token)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
master
slaves
poll
data
data
37
Summary of MAC protocolsbull channel partitioning by time frequency or
codebull Time Division Frequency Division
bull random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
bull taking turnsbull polling from central site token passing
bull Bluetooth FDDI IBM Token Ring Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
38
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
39
MAC Addresses and ARPbull 32-bit IP address
bull network-layer addressbull used to get datagram to destination IP subnet
bull MAC (or LAN or physical or Ethernet) ad-dress bull function get frame from one interface to an-
other physically-connected interface (same network)
bull 48 bit MAC address (for most LANs)bull burned in NIC ROM also sometimes software set-
table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
40
LAN Addresses and ARP
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Each adapter on LAN has 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)
41
LAN Address (more)bull MAC address allocation administered by IEEEbull manufacturer buys portion of MAC address
space (to assure uniqueness)bull analogy
(a) MAC address like Social Security Num-ber
(b) IP address like postal addressbull MAC flat address portability
bull can move LAN card from one LAN to another
bull IP hierarchical address NOT portablebull address depends on IP subnet to which node is at-
tachedFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
28
Pure (unslotted) ALOHAbull unslotted Aloha simpler no synchro-
nizationbull when frame first arrives
bull transmit immediately
bull collision probability increasesbull frame sent at t0 collides with other frames sent in
[t0-1t0+1]
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
29
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 choosing optimum p and then letting
= 1(2e) = 18
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
N
even worse than slotted Aloha
30
CSMA (Carrier Sense Multiple Access)CSMA listen before transmitIf channel sensed idle transmit entire framebull If channel sensed busy defer transmis-
sion
bull human analogy donrsquot interrupt others
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
31
CSMA Collisionscollisions can still occurbull propagation delay means
two nodes may not hear each otherrsquos transmission
collisionbull entire packet transmis-
sion time wasted
notebull role of distance amp propa-
gation delay in determin-ing collision probability
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
spatial layout of nodes
32
CSMACD (Collision Detec-tion)CSMACD carrier sensing deferral as in CSMA
bull collisions detected within short timebull colliding transmissions aborted reducing channel
wastage
bull collision detection bull easy in wired LANs measure signal strengths
compare transmitted received signalsbull difficult in wireless LANs received signal strength
overwhelmed by local transmission strength
bull human analogy the polite conversationalist
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
33
CSMACD collision detection
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
34
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
bull share channel efficiently and fairly at high loadbull inefficient at low load delay in channel access
1N bandwidth allocated even if only 1 active node
Random access MAC protocolsbull efficient at low load single node can fully uti-
lize channelbull high load collision overhead
ldquotaking turnsrdquo protocolsbull look for best of both worlds
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
35
ldquoTaking Turnsrdquo MAC protocolsPolling bull master node ldquoinvitesrdquo
slave nodes to transmit in turn
bull typically used with ldquodumbrdquo slave devices
bull concernsbull polling overhead bull latencybull single point of failure
(master)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
T
data
(nothingto send)
T
36
ldquoTaking Turnsrdquo MAC protocolsToken passingbull control token
passed from one node to next se-quentially
bull token messagebull concerns
bull token overhead bull latencybull single point of failure
(token)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
master
slaves
poll
data
data
37
Summary of MAC protocolsbull channel partitioning by time frequency or
codebull Time Division Frequency Division
bull random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
bull taking turnsbull polling from central site token passing
bull Bluetooth FDDI IBM Token Ring Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
38
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
39
MAC Addresses and ARPbull 32-bit IP address
bull network-layer addressbull used to get datagram to destination IP subnet
bull MAC (or LAN or physical or Ethernet) ad-dress bull function get frame from one interface to an-
other physically-connected interface (same network)
bull 48 bit MAC address (for most LANs)bull burned in NIC ROM also sometimes software set-
table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
40
LAN Addresses and ARP
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Each adapter on LAN has 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)
41
LAN Address (more)bull MAC address allocation administered by IEEEbull manufacturer buys portion of MAC address
space (to assure uniqueness)bull analogy
(a) MAC address like Social Security Num-ber
(b) IP address like postal addressbull MAC flat address portability
bull can move LAN card from one LAN to another
bull IP hierarchical address NOT portablebull address depends on IP subnet to which node is at-
tachedFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
29
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 choosing optimum p and then letting
= 1(2e) = 18
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
N
even worse than slotted Aloha
30
CSMA (Carrier Sense Multiple Access)CSMA listen before transmitIf channel sensed idle transmit entire framebull If channel sensed busy defer transmis-
sion
bull human analogy donrsquot interrupt others
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
31
CSMA Collisionscollisions can still occurbull propagation delay means
two nodes may not hear each otherrsquos transmission
collisionbull entire packet transmis-
sion time wasted
notebull role of distance amp propa-
gation delay in determin-ing collision probability
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
spatial layout of nodes
32
CSMACD (Collision Detec-tion)CSMACD carrier sensing deferral as in CSMA
bull collisions detected within short timebull colliding transmissions aborted reducing channel
wastage
bull collision detection bull easy in wired LANs measure signal strengths
compare transmitted received signalsbull difficult in wireless LANs received signal strength
overwhelmed by local transmission strength
bull human analogy the polite conversationalist
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
33
CSMACD collision detection
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
34
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
bull share channel efficiently and fairly at high loadbull inefficient at low load delay in channel access
1N bandwidth allocated even if only 1 active node
Random access MAC protocolsbull efficient at low load single node can fully uti-
lize channelbull high load collision overhead
ldquotaking turnsrdquo protocolsbull look for best of both worlds
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
35
ldquoTaking Turnsrdquo MAC protocolsPolling bull master node ldquoinvitesrdquo
slave nodes to transmit in turn
bull typically used with ldquodumbrdquo slave devices
bull concernsbull polling overhead bull latencybull single point of failure
(master)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
T
data
(nothingto send)
T
36
ldquoTaking Turnsrdquo MAC protocolsToken passingbull control token
passed from one node to next se-quentially
bull token messagebull concerns
bull token overhead bull latencybull single point of failure
(token)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
master
slaves
poll
data
data
37
Summary of MAC protocolsbull channel partitioning by time frequency or
codebull Time Division Frequency Division
bull random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
bull taking turnsbull polling from central site token passing
bull Bluetooth FDDI IBM Token Ring Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
38
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
39
MAC Addresses and ARPbull 32-bit IP address
bull network-layer addressbull used to get datagram to destination IP subnet
bull MAC (or LAN or physical or Ethernet) ad-dress bull function get frame from one interface to an-
other physically-connected interface (same network)
bull 48 bit MAC address (for most LANs)bull burned in NIC ROM also sometimes software set-
table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
40
LAN Addresses and ARP
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Each adapter on LAN has 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)
41
LAN Address (more)bull MAC address allocation administered by IEEEbull manufacturer buys portion of MAC address
space (to assure uniqueness)bull analogy
(a) MAC address like Social Security Num-ber
(b) IP address like postal addressbull MAC flat address portability
bull can move LAN card from one LAN to another
bull IP hierarchical address NOT portablebull address depends on IP subnet to which node is at-
tachedFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
30
CSMA (Carrier Sense Multiple Access)CSMA listen before transmitIf channel sensed idle transmit entire framebull If channel sensed busy defer transmis-
sion
bull human analogy donrsquot interrupt others
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
31
CSMA Collisionscollisions can still occurbull propagation delay means
two nodes may not hear each otherrsquos transmission
collisionbull entire packet transmis-
sion time wasted
notebull role of distance amp propa-
gation delay in determin-ing collision probability
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
spatial layout of nodes
32
CSMACD (Collision Detec-tion)CSMACD carrier sensing deferral as in CSMA
bull collisions detected within short timebull colliding transmissions aborted reducing channel
wastage
bull collision detection bull easy in wired LANs measure signal strengths
compare transmitted received signalsbull difficult in wireless LANs received signal strength
overwhelmed by local transmission strength
bull human analogy the polite conversationalist
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
33
CSMACD collision detection
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
34
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
bull share channel efficiently and fairly at high loadbull inefficient at low load delay in channel access
1N bandwidth allocated even if only 1 active node
Random access MAC protocolsbull efficient at low load single node can fully uti-
lize channelbull high load collision overhead
ldquotaking turnsrdquo protocolsbull look for best of both worlds
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
35
ldquoTaking Turnsrdquo MAC protocolsPolling bull master node ldquoinvitesrdquo
slave nodes to transmit in turn
bull typically used with ldquodumbrdquo slave devices
bull concernsbull polling overhead bull latencybull single point of failure
(master)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
T
data
(nothingto send)
T
36
ldquoTaking Turnsrdquo MAC protocolsToken passingbull control token
passed from one node to next se-quentially
bull token messagebull concerns
bull token overhead bull latencybull single point of failure
(token)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
master
slaves
poll
data
data
37
Summary of MAC protocolsbull channel partitioning by time frequency or
codebull Time Division Frequency Division
bull random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
bull taking turnsbull polling from central site token passing
bull Bluetooth FDDI IBM Token Ring Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
38
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
39
MAC Addresses and ARPbull 32-bit IP address
bull network-layer addressbull used to get datagram to destination IP subnet
bull MAC (or LAN or physical or Ethernet) ad-dress bull function get frame from one interface to an-
other physically-connected interface (same network)
bull 48 bit MAC address (for most LANs)bull burned in NIC ROM also sometimes software set-
table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
40
LAN Addresses and ARP
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Each adapter on LAN has 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)
41
LAN Address (more)bull MAC address allocation administered by IEEEbull manufacturer buys portion of MAC address
space (to assure uniqueness)bull analogy
(a) MAC address like Social Security Num-ber
(b) IP address like postal addressbull MAC flat address portability
bull can move LAN card from one LAN to another
bull IP hierarchical address NOT portablebull address depends on IP subnet to which node is at-
tachedFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
31
CSMA Collisionscollisions can still occurbull propagation delay means
two nodes may not hear each otherrsquos transmission
collisionbull entire packet transmis-
sion time wasted
notebull role of distance amp propa-
gation delay in determin-ing collision probability
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
spatial layout of nodes
32
CSMACD (Collision Detec-tion)CSMACD carrier sensing deferral as in CSMA
bull collisions detected within short timebull colliding transmissions aborted reducing channel
wastage
bull collision detection bull easy in wired LANs measure signal strengths
compare transmitted received signalsbull difficult in wireless LANs received signal strength
overwhelmed by local transmission strength
bull human analogy the polite conversationalist
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
33
CSMACD collision detection
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
34
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
bull share channel efficiently and fairly at high loadbull inefficient at low load delay in channel access
1N bandwidth allocated even if only 1 active node
Random access MAC protocolsbull efficient at low load single node can fully uti-
lize channelbull high load collision overhead
ldquotaking turnsrdquo protocolsbull look for best of both worlds
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
35
ldquoTaking Turnsrdquo MAC protocolsPolling bull master node ldquoinvitesrdquo
slave nodes to transmit in turn
bull typically used with ldquodumbrdquo slave devices
bull concernsbull polling overhead bull latencybull single point of failure
(master)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
T
data
(nothingto send)
T
36
ldquoTaking Turnsrdquo MAC protocolsToken passingbull control token
passed from one node to next se-quentially
bull token messagebull concerns
bull token overhead bull latencybull single point of failure
(token)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
master
slaves
poll
data
data
37
Summary of MAC protocolsbull channel partitioning by time frequency or
codebull Time Division Frequency Division
bull random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
bull taking turnsbull polling from central site token passing
bull Bluetooth FDDI IBM Token Ring Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
38
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
39
MAC Addresses and ARPbull 32-bit IP address
bull network-layer addressbull used to get datagram to destination IP subnet
bull MAC (or LAN or physical or Ethernet) ad-dress bull function get frame from one interface to an-
other physically-connected interface (same network)
bull 48 bit MAC address (for most LANs)bull burned in NIC ROM also sometimes software set-
table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
40
LAN Addresses and ARP
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Each adapter on LAN has 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)
41
LAN Address (more)bull MAC address allocation administered by IEEEbull manufacturer buys portion of MAC address
space (to assure uniqueness)bull analogy
(a) MAC address like Social Security Num-ber
(b) IP address like postal addressbull MAC flat address portability
bull can move LAN card from one LAN to another
bull IP hierarchical address NOT portablebull address depends on IP subnet to which node is at-
tachedFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
32
CSMACD (Collision Detec-tion)CSMACD carrier sensing deferral as in CSMA
bull collisions detected within short timebull colliding transmissions aborted reducing channel
wastage
bull collision detection bull easy in wired LANs measure signal strengths
compare transmitted received signalsbull difficult in wireless LANs received signal strength
overwhelmed by local transmission strength
bull human analogy the polite conversationalist
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
33
CSMACD collision detection
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
34
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
bull share channel efficiently and fairly at high loadbull inefficient at low load delay in channel access
1N bandwidth allocated even if only 1 active node
Random access MAC protocolsbull efficient at low load single node can fully uti-
lize channelbull high load collision overhead
ldquotaking turnsrdquo protocolsbull look for best of both worlds
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
35
ldquoTaking Turnsrdquo MAC protocolsPolling bull master node ldquoinvitesrdquo
slave nodes to transmit in turn
bull typically used with ldquodumbrdquo slave devices
bull concernsbull polling overhead bull latencybull single point of failure
(master)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
T
data
(nothingto send)
T
36
ldquoTaking Turnsrdquo MAC protocolsToken passingbull control token
passed from one node to next se-quentially
bull token messagebull concerns
bull token overhead bull latencybull single point of failure
(token)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
master
slaves
poll
data
data
37
Summary of MAC protocolsbull channel partitioning by time frequency or
codebull Time Division Frequency Division
bull random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
bull taking turnsbull polling from central site token passing
bull Bluetooth FDDI IBM Token Ring Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
38
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
39
MAC Addresses and ARPbull 32-bit IP address
bull network-layer addressbull used to get datagram to destination IP subnet
bull MAC (or LAN or physical or Ethernet) ad-dress bull function get frame from one interface to an-
other physically-connected interface (same network)
bull 48 bit MAC address (for most LANs)bull burned in NIC ROM also sometimes software set-
table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
40
LAN Addresses and ARP
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Each adapter on LAN has 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)
41
LAN Address (more)bull MAC address allocation administered by IEEEbull manufacturer buys portion of MAC address
space (to assure uniqueness)bull analogy
(a) MAC address like Social Security Num-ber
(b) IP address like postal addressbull MAC flat address portability
bull can move LAN card from one LAN to another
bull IP hierarchical address NOT portablebull address depends on IP subnet to which node is at-
tachedFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
33
CSMACD collision detection
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
34
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
bull share channel efficiently and fairly at high loadbull inefficient at low load delay in channel access
1N bandwidth allocated even if only 1 active node
Random access MAC protocolsbull efficient at low load single node can fully uti-
lize channelbull high load collision overhead
ldquotaking turnsrdquo protocolsbull look for best of both worlds
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
35
ldquoTaking Turnsrdquo MAC protocolsPolling bull master node ldquoinvitesrdquo
slave nodes to transmit in turn
bull typically used with ldquodumbrdquo slave devices
bull concernsbull polling overhead bull latencybull single point of failure
(master)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
T
data
(nothingto send)
T
36
ldquoTaking Turnsrdquo MAC protocolsToken passingbull control token
passed from one node to next se-quentially
bull token messagebull concerns
bull token overhead bull latencybull single point of failure
(token)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
master
slaves
poll
data
data
37
Summary of MAC protocolsbull channel partitioning by time frequency or
codebull Time Division Frequency Division
bull random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
bull taking turnsbull polling from central site token passing
bull Bluetooth FDDI IBM Token Ring Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
38
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
39
MAC Addresses and ARPbull 32-bit IP address
bull network-layer addressbull used to get datagram to destination IP subnet
bull MAC (or LAN or physical or Ethernet) ad-dress bull function get frame from one interface to an-
other physically-connected interface (same network)
bull 48 bit MAC address (for most LANs)bull burned in NIC ROM also sometimes software set-
table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
40
LAN Addresses and ARP
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Each adapter on LAN has 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)
41
LAN Address (more)bull MAC address allocation administered by IEEEbull manufacturer buys portion of MAC address
space (to assure uniqueness)bull analogy
(a) MAC address like Social Security Num-ber
(b) IP address like postal addressbull MAC flat address portability
bull can move LAN card from one LAN to another
bull IP hierarchical address NOT portablebull address depends on IP subnet to which node is at-
tachedFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
34
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
bull share channel efficiently and fairly at high loadbull inefficient at low load delay in channel access
1N bandwidth allocated even if only 1 active node
Random access MAC protocolsbull efficient at low load single node can fully uti-
lize channelbull high load collision overhead
ldquotaking turnsrdquo protocolsbull look for best of both worlds
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
35
ldquoTaking Turnsrdquo MAC protocolsPolling bull master node ldquoinvitesrdquo
slave nodes to transmit in turn
bull typically used with ldquodumbrdquo slave devices
bull concernsbull polling overhead bull latencybull single point of failure
(master)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
T
data
(nothingto send)
T
36
ldquoTaking Turnsrdquo MAC protocolsToken passingbull control token
passed from one node to next se-quentially
bull token messagebull concerns
bull token overhead bull latencybull single point of failure
(token)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
master
slaves
poll
data
data
37
Summary of MAC protocolsbull channel partitioning by time frequency or
codebull Time Division Frequency Division
bull random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
bull taking turnsbull polling from central site token passing
bull Bluetooth FDDI IBM Token Ring Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
38
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
39
MAC Addresses and ARPbull 32-bit IP address
bull network-layer addressbull used to get datagram to destination IP subnet
bull MAC (or LAN or physical or Ethernet) ad-dress bull function get frame from one interface to an-
other physically-connected interface (same network)
bull 48 bit MAC address (for most LANs)bull burned in NIC ROM also sometimes software set-
table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
40
LAN Addresses and ARP
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Each adapter on LAN has 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)
41
LAN Address (more)bull MAC address allocation administered by IEEEbull manufacturer buys portion of MAC address
space (to assure uniqueness)bull analogy
(a) MAC address like Social Security Num-ber
(b) IP address like postal addressbull MAC flat address portability
bull can move LAN card from one LAN to another
bull IP hierarchical address NOT portablebull address depends on IP subnet to which node is at-
tachedFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
35
ldquoTaking Turnsrdquo MAC protocolsPolling bull master node ldquoinvitesrdquo
slave nodes to transmit in turn
bull typically used with ldquodumbrdquo slave devices
bull concernsbull polling overhead bull latencybull single point of failure
(master)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
T
data
(nothingto send)
T
36
ldquoTaking Turnsrdquo MAC protocolsToken passingbull control token
passed from one node to next se-quentially
bull token messagebull concerns
bull token overhead bull latencybull single point of failure
(token)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
master
slaves
poll
data
data
37
Summary of MAC protocolsbull channel partitioning by time frequency or
codebull Time Division Frequency Division
bull random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
bull taking turnsbull polling from central site token passing
bull Bluetooth FDDI IBM Token Ring Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
38
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
39
MAC Addresses and ARPbull 32-bit IP address
bull network-layer addressbull used to get datagram to destination IP subnet
bull MAC (or LAN or physical or Ethernet) ad-dress bull function get frame from one interface to an-
other physically-connected interface (same network)
bull 48 bit MAC address (for most LANs)bull burned in NIC ROM also sometimes software set-
table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
40
LAN Addresses and ARP
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Each adapter on LAN has 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)
41
LAN Address (more)bull MAC address allocation administered by IEEEbull manufacturer buys portion of MAC address
space (to assure uniqueness)bull analogy
(a) MAC address like Social Security Num-ber
(b) IP address like postal addressbull MAC flat address portability
bull can move LAN card from one LAN to another
bull IP hierarchical address NOT portablebull address depends on IP subnet to which node is at-
tachedFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
36
ldquoTaking Turnsrdquo MAC protocolsToken passingbull control token
passed from one node to next se-quentially
bull token messagebull concerns
bull token overhead bull latencybull single point of failure
(token)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
master
slaves
poll
data
data
37
Summary of MAC protocolsbull channel partitioning by time frequency or
codebull Time Division Frequency Division
bull random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
bull taking turnsbull polling from central site token passing
bull Bluetooth FDDI IBM Token Ring Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
38
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
39
MAC Addresses and ARPbull 32-bit IP address
bull network-layer addressbull used to get datagram to destination IP subnet
bull MAC (or LAN or physical or Ethernet) ad-dress bull function get frame from one interface to an-
other physically-connected interface (same network)
bull 48 bit MAC address (for most LANs)bull burned in NIC ROM also sometimes software set-
table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
40
LAN Addresses and ARP
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Each adapter on LAN has 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)
41
LAN Address (more)bull MAC address allocation administered by IEEEbull manufacturer buys portion of MAC address
space (to assure uniqueness)bull analogy
(a) MAC address like Social Security Num-ber
(b) IP address like postal addressbull MAC flat address portability
bull can move LAN card from one LAN to another
bull IP hierarchical address NOT portablebull address depends on IP subnet to which node is at-
tachedFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
37
Summary of MAC protocolsbull channel partitioning by time frequency or
codebull Time Division Frequency Division
bull random access (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
bull taking turnsbull polling from central site token passing
bull Bluetooth FDDI IBM Token Ring Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
38
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
39
MAC Addresses and ARPbull 32-bit IP address
bull network-layer addressbull used to get datagram to destination IP subnet
bull MAC (or LAN or physical or Ethernet) ad-dress bull function get frame from one interface to an-
other physically-connected interface (same network)
bull 48 bit MAC address (for most LANs)bull burned in NIC ROM also sometimes software set-
table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
40
LAN Addresses and ARP
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Each adapter on LAN has 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)
41
LAN Address (more)bull MAC address allocation administered by IEEEbull manufacturer buys portion of MAC address
space (to assure uniqueness)bull analogy
(a) MAC address like Social Security Num-ber
(b) IP address like postal addressbull MAC flat address portability
bull can move LAN card from one LAN to another
bull IP hierarchical address NOT portablebull address depends on IP subnet to which node is at-
tachedFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
38
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
39
MAC Addresses and ARPbull 32-bit IP address
bull network-layer addressbull used to get datagram to destination IP subnet
bull MAC (or LAN or physical or Ethernet) ad-dress bull function get frame from one interface to an-
other physically-connected interface (same network)
bull 48 bit MAC address (for most LANs)bull burned in NIC ROM also sometimes software set-
table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
40
LAN Addresses and ARP
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Each adapter on LAN has 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)
41
LAN Address (more)bull MAC address allocation administered by IEEEbull manufacturer buys portion of MAC address
space (to assure uniqueness)bull analogy
(a) MAC address like Social Security Num-ber
(b) IP address like postal addressbull MAC flat address portability
bull can move LAN card from one LAN to another
bull IP hierarchical address NOT portablebull address depends on IP subnet to which node is at-
tachedFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
39
MAC Addresses and ARPbull 32-bit IP address
bull network-layer addressbull used to get datagram to destination IP subnet
bull MAC (or LAN or physical or Ethernet) ad-dress bull function get frame from one interface to an-
other physically-connected interface (same network)
bull 48 bit MAC address (for most LANs)bull burned in NIC ROM also sometimes software set-
table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
40
LAN Addresses and ARP
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Each adapter on LAN has 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)
41
LAN Address (more)bull MAC address allocation administered by IEEEbull manufacturer buys portion of MAC address
space (to assure uniqueness)bull analogy
(a) MAC address like Social Security Num-ber
(b) IP address like postal addressbull MAC flat address portability
bull can move LAN card from one LAN to another
bull IP hierarchical address NOT portablebull address depends on IP subnet to which node is at-
tachedFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
40
LAN Addresses and ARP
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Each adapter on LAN has 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)
41
LAN Address (more)bull MAC address allocation administered by IEEEbull manufacturer buys portion of MAC address
space (to assure uniqueness)bull analogy
(a) MAC address like Social Security Num-ber
(b) IP address like postal addressbull MAC flat address portability
bull can move LAN card from one LAN to another
bull IP hierarchical address NOT portablebull address depends on IP subnet to which node is at-
tachedFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
41
LAN Address (more)bull MAC address allocation administered by IEEEbull manufacturer buys portion of MAC address
space (to assure uniqueness)bull analogy
(a) MAC address like Social Security Num-ber
(b) IP address like postal addressbull MAC flat address portability
bull can move LAN card from one LAN to another
bull IP hierarchical address NOT portablebull address depends on IP subnet to which node is at-
tachedFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
42
ARP Address Resolution Proto-colbull Each IP node (host
router) on LAN has ARP table
bull ARP table IPMAC address mappings for some LAN nodeslt IP address MAC address
TTLgt
bull TTL (Time To Live) time after which ad-dress mapping will be forgotten (typically 20 min)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Question how to determineMAC address of Bknowing Brsquos IP address
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
137196723
137196778
137196714
137196788
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
43
ARP protocol Same LAN (net-work)bull A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
bull A broadcasts ARP query packet containing Bs IP address bull dest MAC address = FF-FF-FF-
FF-FF-FFbull all machines on LAN receive
ARP query
bull B receives ARP packet replies to A with its (Bs) MAC addressbull frame sent to Arsquos MAC ad-
dress (unicast)Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull A caches (saves) IP-to-MAC address pair in its ARP table until infor-mation becomes old (times out) bull soft state information
that times out (goes away) unless refreshed
bull ARP is ldquoplug-and-playrdquobull nodes create their ARP
tables without interven-tion from net administra-tor
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
44
Addressing routing to another LAN
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
walkthrough send datagram from A to B via R assume A knows Brsquos IP address
bull two ARP tables in router R one for each IP network (LAN)
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
45
bull A creates IP datagram with source A destination B bull A uses ARP to get Rrsquos MAC address for 111111111110bull A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagrambull Arsquos NIC sends frame bull Rrsquos NIC receives frame bull R removes IP datagram from Ethernet frame sees its des-
tined to Bbull R uses ARP to get Brsquos MAC address bull R creates frame containing A-to-B IP datagram sends to B
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
This is a really importantexample ndash make sure youunderstand
R
1A-23-F9-CD-06-9B
222222222220
111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
A74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
B222222222222
49-BD-D2-C7-56-2A
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
46
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
47
Ethernetldquodominantrdquo wired LAN technology bull cheap $20 for NICbull first widely used LAN technologybull simpler cheaper than token LANs and ATMbull kept up with speed race 10 Mbps ndash 10 Gbps
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Metcalfersquos Ethernetsketch
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
48
Star Topologybull bus topology popular through mid 90s
bull all nodes in same collision domain (can collide with each other)
bull today star topology prevailsbull active switch in centerbull each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch
bus coaxial cable star
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
49
Ethernet Frame Structurebull Sending adapter encapsulates IP datagram
(or other network layer protocol packet) in Ethernet frame
Preamble bull 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011bull used to synchronize receiver sender clock
ratesFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
50
Ethernet Frame Structure (more)bull Addresses 6 bytes
bull if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
bull otherwise adapter discards frame
bull Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)
bull CRC checked at receiver if error is detected frame is dropped
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
51
Ethernet Unreliable connection-lessbull connectionless No handshaking be-
tween sending and receiving NICs bull unreliable receiving NIC doesnrsquot send
acks or nacks to sending NICbull stream of datagrams passed to network
layer can have gaps (missing datagrams)bull gaps will be filled if app is using TCPbull otherwise app will see gaps
bull Ethernetrsquos MAC protocol unslotted CSMACD
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
52
Ethernet CSMACD algorithmbull 1 NIC receives data-
gram from network layer creates frame
bull 2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits
bull 3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
bull 4 If NIC detects an-other transmission while transmitting aborts and sends jam signal
bull 5 After aborting NIC enters exponential backoff after mth colli-sion NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
53
Ethernetrsquos CSMACD (more)bull Jam Signal make
sure all other transmitters are aware of collision 48 bits
bull Bit time 1 micro sec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
Exponential Backoff bull Goal adapt retransmission
attempts to estimated cur-rent load
bull heavy load random wait will be longer
bull first collision choose K from 01 delay is K 512 bit transmission times
bull after second collision choose K from 0123hellip
bull after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
54
CSMACD efficiencybull Tprop = max prop delay between 2 nodes in
LANbull ttrans = time to transmit max-size frame
bull efficiency goes to 1 bull as tprop goes to 0
bull as ttrans goes to infinity
bull better performance than ALOHA and simple cheap decentralized
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
transprop ttefficiency
51
1
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
55
8023 Ethernet Standards Link amp Physical Layersbull many different Ethernet standards
bull common MAC protocol and frame formatbull different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bpsbull different physical layer media fiber cable
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
56
Manchester encodingbull used in 10BaseTbull each bit has a transitionbull allows clocks in sending and receiving nodes to syn-
chronize to each otherbull no need for a centralized global clock among nodes
bull Hey this is physical-layer stuff
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
57
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53 Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
58
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bull bits coming in one link go out all other links at same rate
bull all nodes connected to hub can collide with one another
bull no frame bufferingbull no CSMACD at hub host NICs detect colli-
sions
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
twisted pair
hub
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
59
Switchbull link-layer device smarter than hubs take
active rolebull store forward Ethernet framesbull examine incoming framersquos MAC address se-
lectively forward frame to one-or-more out-going links when frame is to be forwarded on segment uses CSMACD to access segment
bull transparentbull hosts are unaware of presence of switches
bull plug-and-play self-learning (HOW)bull switches do not need to be configured
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
60
Switch allows multiple simulta-neous transmissionsbull hosts have dedicated direct
connection to switchbull switches buffer packetsbull Ethernet protocol used on
each incoming link but no collisions full duplexbull each link is its own collision
domain
bull switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions bull not possible with dumb hub
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
61
Switch Tablebull Q how does switch know
that Arsquo reachable via inter-face 4 Brsquo reachable via inter-face 5
bull A each switch has a switch table each entrybull (MAC address of host interface
to reach host time stamp)
bull looks like a routing tablebull Q how are entries created
maintained in switch table bull something like a routing proto-
colFall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
switch with six interfaces(123456)
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
62
Switch self-learningbull switch learns which
hosts can be reached through which inter-facesbull when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
bull records senderlocation pair in switch table
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
63
Switch frame filteringforward-ingWhen frame received
1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination then if dest on segment from which frame arrived then drop the frame else
forward the frame on interface indicated else flood
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
forward on all but the interface on which the frame arrived
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
64
Self-learning forwarding exam-ple
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
65
Interconnecting switchesbull switches can be connected together
bull Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
bull A self learning (works exactly the same as in single-switch case)
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
C D
E
FS2
S4
S3
H
I
G
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
66
Self-learning multi-switch exam-plebull Suppose C sends frame to I I responds to
C
bull Q show switch tables and packet forward-ing in S1 S2 S3 S4
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
A
B
S1
CD
E F
S2
S4
S3
H
I
G
12
1
2 3
3
1 2 3 12 3
444
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
67
Institutional network
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
to externalnetwork
router
IP subnet
mail server
web server
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
68
Switches vs Routersbull both store-and-forward devices
bull routers network layer devices (examine network layer head-ers)
bull switches are link layer devices
bull routers maintain routing tables implement routing al-gorithms
bull switches maintain switch tables implement filtering learning algorithms
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
69
Link Layer
Fall 2015 COMP 46055605 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University
51 Introduction and services52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing55 Ethernet56 Link-layer switches57 PPP58 Link virtualization MPLS59 A day in the life of a web request
Recommended