View
233
Download
0
Tags:
Embed Size (px)
Citation preview
5 DataLink Layer 8-1
Chapter 5 Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM and MPLS
5 DataLink Layer 8-2
Link Layer IntroductionSome terminology hosts and routers are nodes communication channels
that connect adjacent nodes along communication path are links wired links wireless links LANs
layer-2 packet is a frame encapsulates datagram
ldquo linkrdquo
data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
5 DataLink Layer 8-3
Link layer context
Datagram transferred by different link protocols over different links eg Ethernet on first
link frame relay on intermediate links 80211 on last link
Each link protocol provides different services eg may or may not
provide rdt over link
transportation analogy trip from Buf to NYU
Taxi Home to BUF plane BUF to JFK BUS JFK to NYU
visitor = datagram transport segment =
communication link transportation mode =
link layer protocol travel agent = routing
algorithm
5 DataLink Layer 8-4
Link Layer Services Framing link access
encapsulate datagram into frame adding header trailer
channel access if shared medium Link-level ldquoMACrdquo addresses used in frame headers to
identify source dest bull different from IP address
Reliable delivery between adjacent nodes we learned how to do this already (chapter 3) seldomly used on low bit error link (fiber some
twisted pair) wireless links high error rates
bull Q why both link-level and end-end reliability
5 DataLink Layer 8-5
Link Layer Services (more)
Flow Control (also discussed earlier) pacing between adjacent sending and receiving nodes
Error Detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender retransmits or drops (gives up) frame
Error Correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Half-duplex and full-duplex with half duplex nodes at both ends of link can
transmit but not at same time (eg cellphone radios)
5 DataLink Layer 8-6
Adaptors Network Interface Card (NIC)
link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card
80211 card
sending side encapsulates datagram in
a frame adds error checking bits
rdt flow control etc
receiving side looks for errors rdt flow
control etc extracts datagram
passes to rcving node
adapter is semi-autonomous
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
5 DataLink Layer 8-7
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-8
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields D rsquo amp EDArsquo = received versions EDCrsquos is used to checkdetect errors in Drsquobull Error detection not 100 reliable
bull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
5 DataLink Layer 8-9
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Odd parity or
Even parity
5 DataLink Layer 8-10
Error DetectingCorrecting Codes Given m data bits add r check bits
(redundant) to form a frame A codeword (ie a frame) thus has n=m+r bits
Error-correcting code enough redundant info to deduce the correct codeword (and thus the correct data bits) even from an garbled one (ie a damaged frame)
Error-detecting code only enough to deduce that an error occurred but not which error
Definition Hamming distance between two codewords the number of bits that differ that is need to be flippedinverted to change from one codeword to the other
5 DataLink Layer 8-11
Hamming Distance (Example 1) If the minimum Hamming distance
between any two valid codewords is d then can detect any error up to d-1 bits and can correct any error up to (d-1)2 (if d is
odd) or d2-1 (if d is even) bits Example Data 011010 Even-parity code
is 0110101 Hamming distance = 2 Can detect but not correct a single-bit error Extra can detect odd but not even number of
single-bit errors
5 DataLink Layer 8-12
Hamming Distance (Example 2) Four valid codewords
000000 000111 111000 and 111111 Hamming distance is 3 Can correct all single (bit) errors
001111 =gt 000111 (the closest wins) Can correct some but not all double
errors 010011 =gt 000111 But 011111 will become 111111 not
000111
5 DataLink Layer 8-13
Dealing with Burst Errors
Errors tend to come in bursts rather than singly A burst error of K bits the first and the last bits
are gabled so are most (probably not all) bits in between pros affect one entire frame rather than many frames cons hard to detectcorrect
Hamming codes (d=3) only correct single errors Solution interleaving K codewords (bit-by-bit)
rather than sending one codeword at a time Similar to the 2D parity matrix check
5 DataLink Layer 8-14
Correcting or Detecting
Hamming codes can detect double errors (use interleaving to detect burst errors of 2K bits)
Many more check bits needed to correct k single-bit errors than simply to detect them
Trade-off between wasting bandwidth in redundant check bits vs in retransmission of damaged frames
Eg BER (bit error rate)= 10-6 Block (frame) size =1000 data bits 1 Mb data = 1000 frames
Error-correcting code 10 check bits per block Overhead = 1000 x 10 = 10000 check bits
Error-detecting code 1 parity-bit per block Approx one bit error or one retransmission every 1000
frames (1 Mb data) Overhead = 1000 (parity bits) + 1001 (one block) = 2001
bits
5 DataLink Layer 8-15
Internet checksum
Sender treat segment contents
as sequence of 16-bit integers
checksum addition (1rsquos complement sum) of segment contents
sender puts checksum value into TCPUDP checksum field
Receiver compute checksum of
received segment check if computed checksum
equals checksum field value NO - error detected YES - no error detected
But maybe errors nonetheless More later hellip
Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted segment (note used at transport layer although IP has its own header checksum)
5 DataLink Layer 8-16
Checksumming Cyclic Redundancy Check view data bits D as a binary number Sender chooses r+1 bit pattern (generator) G Sender chooses r (lower-order bits) R such that
ltDRgt exactly divisible by G (modulo 2)
Receiver knows G divides the received ltDrsquoRrsquogt by G If non-zero remainder error detected can detect all burst errors less than r+1 bits
widely used in practice
5 DataLink Layer 8-17
CRC Example D=5 and R=3 (G=4 bits)Want R such that
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
1 0 1 1 1 00 1 1
5 DataLink Layer 8-18
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-19
Multiple Access Links and Protocols
Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) traditional Ethernet upstream HFC 80211 wireless LAN
5 DataLink Layer 8-20
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
interference collision if node receives two or more signals at the same
time
multiple access protocol distributed algorithm that determines how nodes
share channel ie determine when node can transmit
communication about channel sharing must use channel itself no out-of-band channel for coordination
5 DataLink Layer 8-21
Ideal Mulitple Access Protocol
Broadcast 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
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
5 DataLink Layer 8-22
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
5 DataLink Layer 8-23
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =
pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots
256 idle
5 DataLink Layer 8-24
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle example 6-station LAN 134 have pkt
frequency bands 256 idle
frequ
ency
bands time
5 DataLink Layer 8-25
Random Access Protocols
When node has packet to send transmit at full channel data rate R no a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies
how to detect collisions how to recover from collisions (eg via delayed
retransmissions)
Examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA
5 DataLink Layer 8-26
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
5 DataLink Layer 8-27
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
5 DataLink Layer 8-28
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
5 DataLink Layer 8-29
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately
collision probability increases frame sent at t0 collides with other frames sent in [t0-
1t0+1]
5 DataLink Layer 8-30
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 n -gt infty
= 1(2e) = 18 Even worse
5 DataLink Layer 8-31
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
5 DataLink Layer 8-32
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
5 DataLink Layer 8-33
CSMA
1-persistent continuously senses the channel until itrsquos idle transmits whenever idle may still have collisions
nonpersistent if the channel is busy waits a random period time before
sensing it again transmits if idle
p-persistent for slotted channels if busy initially senses the channel again for the next slot
(like 1-persistent) if idle transmits with probability p (lt 1) (at the beginning
of the next slot) or defers with probability q = 1-p if it didnrsquot transmit senses the channel in the next slot if
idle again repeat the process (either transmits or defers) if busy waits a random period time before sensing it again (like non-persistent)
5 DataLink Layer 8-34
CSMA Performance
5 DataLink Layer 8-35
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short time colliding transmissions aborted reducing channel
wastage collision detection
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs receiver shut off while transmitting
human analogy the polite conversationalist
5 DataLink Layer 8-36
CSMACD collision detection
5 DataLink Layer 8-37
CSMACD Collision Detection Delay
One way propagation delay
5 DataLink Layer 8-38
ldquo Taking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocols efficient at low load single node can fully
utilize channel high load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
5 DataLink Layer 8-39
ldquo Taking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
5 DataLink Layer 8-40
Limited Contention ndash Adaptive Tree Walking
Slot 0 for all stations under node 1 Repeat if no collisionsbull Otherwise Slot 1 for those under node 2 (left subtree)bull If successful Slot 2 for those under node 3 (right subtree)bull Else Slot 2 for those under node 4 (the left sub-subtree)
5 DataLink Layer 8-41
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-2
Link Layer IntroductionSome terminology hosts and routers are nodes communication channels
that connect adjacent nodes along communication path are links wired links wireless links LANs
layer-2 packet is a frame encapsulates datagram
ldquo linkrdquo
data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
5 DataLink Layer 8-3
Link layer context
Datagram transferred by different link protocols over different links eg Ethernet on first
link frame relay on intermediate links 80211 on last link
Each link protocol provides different services eg may or may not
provide rdt over link
transportation analogy trip from Buf to NYU
Taxi Home to BUF plane BUF to JFK BUS JFK to NYU
visitor = datagram transport segment =
communication link transportation mode =
link layer protocol travel agent = routing
algorithm
5 DataLink Layer 8-4
Link Layer Services Framing link access
encapsulate datagram into frame adding header trailer
channel access if shared medium Link-level ldquoMACrdquo addresses used in frame headers to
identify source dest bull different from IP address
Reliable delivery between adjacent nodes we learned how to do this already (chapter 3) seldomly used on low bit error link (fiber some
twisted pair) wireless links high error rates
bull Q why both link-level and end-end reliability
5 DataLink Layer 8-5
Link Layer Services (more)
Flow Control (also discussed earlier) pacing between adjacent sending and receiving nodes
Error Detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender retransmits or drops (gives up) frame
Error Correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Half-duplex and full-duplex with half duplex nodes at both ends of link can
transmit but not at same time (eg cellphone radios)
5 DataLink Layer 8-6
Adaptors Network Interface Card (NIC)
link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card
80211 card
sending side encapsulates datagram in
a frame adds error checking bits
rdt flow control etc
receiving side looks for errors rdt flow
control etc extracts datagram
passes to rcving node
adapter is semi-autonomous
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
5 DataLink Layer 8-7
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-8
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields D rsquo amp EDArsquo = received versions EDCrsquos is used to checkdetect errors in Drsquobull Error detection not 100 reliable
bull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
5 DataLink Layer 8-9
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Odd parity or
Even parity
5 DataLink Layer 8-10
Error DetectingCorrecting Codes Given m data bits add r check bits
(redundant) to form a frame A codeword (ie a frame) thus has n=m+r bits
Error-correcting code enough redundant info to deduce the correct codeword (and thus the correct data bits) even from an garbled one (ie a damaged frame)
Error-detecting code only enough to deduce that an error occurred but not which error
Definition Hamming distance between two codewords the number of bits that differ that is need to be flippedinverted to change from one codeword to the other
5 DataLink Layer 8-11
Hamming Distance (Example 1) If the minimum Hamming distance
between any two valid codewords is d then can detect any error up to d-1 bits and can correct any error up to (d-1)2 (if d is
odd) or d2-1 (if d is even) bits Example Data 011010 Even-parity code
is 0110101 Hamming distance = 2 Can detect but not correct a single-bit error Extra can detect odd but not even number of
single-bit errors
5 DataLink Layer 8-12
Hamming Distance (Example 2) Four valid codewords
000000 000111 111000 and 111111 Hamming distance is 3 Can correct all single (bit) errors
001111 =gt 000111 (the closest wins) Can correct some but not all double
errors 010011 =gt 000111 But 011111 will become 111111 not
000111
5 DataLink Layer 8-13
Dealing with Burst Errors
Errors tend to come in bursts rather than singly A burst error of K bits the first and the last bits
are gabled so are most (probably not all) bits in between pros affect one entire frame rather than many frames cons hard to detectcorrect
Hamming codes (d=3) only correct single errors Solution interleaving K codewords (bit-by-bit)
rather than sending one codeword at a time Similar to the 2D parity matrix check
5 DataLink Layer 8-14
Correcting or Detecting
Hamming codes can detect double errors (use interleaving to detect burst errors of 2K bits)
Many more check bits needed to correct k single-bit errors than simply to detect them
Trade-off between wasting bandwidth in redundant check bits vs in retransmission of damaged frames
Eg BER (bit error rate)= 10-6 Block (frame) size =1000 data bits 1 Mb data = 1000 frames
Error-correcting code 10 check bits per block Overhead = 1000 x 10 = 10000 check bits
Error-detecting code 1 parity-bit per block Approx one bit error or one retransmission every 1000
frames (1 Mb data) Overhead = 1000 (parity bits) + 1001 (one block) = 2001
bits
5 DataLink Layer 8-15
Internet checksum
Sender treat segment contents
as sequence of 16-bit integers
checksum addition (1rsquos complement sum) of segment contents
sender puts checksum value into TCPUDP checksum field
Receiver compute checksum of
received segment check if computed checksum
equals checksum field value NO - error detected YES - no error detected
But maybe errors nonetheless More later hellip
Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted segment (note used at transport layer although IP has its own header checksum)
5 DataLink Layer 8-16
Checksumming Cyclic Redundancy Check view data bits D as a binary number Sender chooses r+1 bit pattern (generator) G Sender chooses r (lower-order bits) R such that
ltDRgt exactly divisible by G (modulo 2)
Receiver knows G divides the received ltDrsquoRrsquogt by G If non-zero remainder error detected can detect all burst errors less than r+1 bits
widely used in practice
5 DataLink Layer 8-17
CRC Example D=5 and R=3 (G=4 bits)Want R such that
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
1 0 1 1 1 00 1 1
5 DataLink Layer 8-18
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-19
Multiple Access Links and Protocols
Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) traditional Ethernet upstream HFC 80211 wireless LAN
5 DataLink Layer 8-20
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
interference collision if node receives two or more signals at the same
time
multiple access protocol distributed algorithm that determines how nodes
share channel ie determine when node can transmit
communication about channel sharing must use channel itself no out-of-band channel for coordination
5 DataLink Layer 8-21
Ideal Mulitple Access Protocol
Broadcast 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
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
5 DataLink Layer 8-22
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
5 DataLink Layer 8-23
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =
pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots
256 idle
5 DataLink Layer 8-24
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle example 6-station LAN 134 have pkt
frequency bands 256 idle
frequ
ency
bands time
5 DataLink Layer 8-25
Random Access Protocols
When node has packet to send transmit at full channel data rate R no a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies
how to detect collisions how to recover from collisions (eg via delayed
retransmissions)
Examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA
5 DataLink Layer 8-26
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
5 DataLink Layer 8-27
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
5 DataLink Layer 8-28
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
5 DataLink Layer 8-29
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately
collision probability increases frame sent at t0 collides with other frames sent in [t0-
1t0+1]
5 DataLink Layer 8-30
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 n -gt infty
= 1(2e) = 18 Even worse
5 DataLink Layer 8-31
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
5 DataLink Layer 8-32
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
5 DataLink Layer 8-33
CSMA
1-persistent continuously senses the channel until itrsquos idle transmits whenever idle may still have collisions
nonpersistent if the channel is busy waits a random period time before
sensing it again transmits if idle
p-persistent for slotted channels if busy initially senses the channel again for the next slot
(like 1-persistent) if idle transmits with probability p (lt 1) (at the beginning
of the next slot) or defers with probability q = 1-p if it didnrsquot transmit senses the channel in the next slot if
idle again repeat the process (either transmits or defers) if busy waits a random period time before sensing it again (like non-persistent)
5 DataLink Layer 8-34
CSMA Performance
5 DataLink Layer 8-35
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short time colliding transmissions aborted reducing channel
wastage collision detection
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs receiver shut off while transmitting
human analogy the polite conversationalist
5 DataLink Layer 8-36
CSMACD collision detection
5 DataLink Layer 8-37
CSMACD Collision Detection Delay
One way propagation delay
5 DataLink Layer 8-38
ldquo Taking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocols efficient at low load single node can fully
utilize channel high load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
5 DataLink Layer 8-39
ldquo Taking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
5 DataLink Layer 8-40
Limited Contention ndash Adaptive Tree Walking
Slot 0 for all stations under node 1 Repeat if no collisionsbull Otherwise Slot 1 for those under node 2 (left subtree)bull If successful Slot 2 for those under node 3 (right subtree)bull Else Slot 2 for those under node 4 (the left sub-subtree)
5 DataLink Layer 8-41
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-3
Link layer context
Datagram transferred by different link protocols over different links eg Ethernet on first
link frame relay on intermediate links 80211 on last link
Each link protocol provides different services eg may or may not
provide rdt over link
transportation analogy trip from Buf to NYU
Taxi Home to BUF plane BUF to JFK BUS JFK to NYU
visitor = datagram transport segment =
communication link transportation mode =
link layer protocol travel agent = routing
algorithm
5 DataLink Layer 8-4
Link Layer Services Framing link access
encapsulate datagram into frame adding header trailer
channel access if shared medium Link-level ldquoMACrdquo addresses used in frame headers to
identify source dest bull different from IP address
Reliable delivery between adjacent nodes we learned how to do this already (chapter 3) seldomly used on low bit error link (fiber some
twisted pair) wireless links high error rates
bull Q why both link-level and end-end reliability
5 DataLink Layer 8-5
Link Layer Services (more)
Flow Control (also discussed earlier) pacing between adjacent sending and receiving nodes
Error Detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender retransmits or drops (gives up) frame
Error Correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Half-duplex and full-duplex with half duplex nodes at both ends of link can
transmit but not at same time (eg cellphone radios)
5 DataLink Layer 8-6
Adaptors Network Interface Card (NIC)
link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card
80211 card
sending side encapsulates datagram in
a frame adds error checking bits
rdt flow control etc
receiving side looks for errors rdt flow
control etc extracts datagram
passes to rcving node
adapter is semi-autonomous
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
5 DataLink Layer 8-7
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-8
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields D rsquo amp EDArsquo = received versions EDCrsquos is used to checkdetect errors in Drsquobull Error detection not 100 reliable
bull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
5 DataLink Layer 8-9
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Odd parity or
Even parity
5 DataLink Layer 8-10
Error DetectingCorrecting Codes Given m data bits add r check bits
(redundant) to form a frame A codeword (ie a frame) thus has n=m+r bits
Error-correcting code enough redundant info to deduce the correct codeword (and thus the correct data bits) even from an garbled one (ie a damaged frame)
Error-detecting code only enough to deduce that an error occurred but not which error
Definition Hamming distance between two codewords the number of bits that differ that is need to be flippedinverted to change from one codeword to the other
5 DataLink Layer 8-11
Hamming Distance (Example 1) If the minimum Hamming distance
between any two valid codewords is d then can detect any error up to d-1 bits and can correct any error up to (d-1)2 (if d is
odd) or d2-1 (if d is even) bits Example Data 011010 Even-parity code
is 0110101 Hamming distance = 2 Can detect but not correct a single-bit error Extra can detect odd but not even number of
single-bit errors
5 DataLink Layer 8-12
Hamming Distance (Example 2) Four valid codewords
000000 000111 111000 and 111111 Hamming distance is 3 Can correct all single (bit) errors
001111 =gt 000111 (the closest wins) Can correct some but not all double
errors 010011 =gt 000111 But 011111 will become 111111 not
000111
5 DataLink Layer 8-13
Dealing with Burst Errors
Errors tend to come in bursts rather than singly A burst error of K bits the first and the last bits
are gabled so are most (probably not all) bits in between pros affect one entire frame rather than many frames cons hard to detectcorrect
Hamming codes (d=3) only correct single errors Solution interleaving K codewords (bit-by-bit)
rather than sending one codeword at a time Similar to the 2D parity matrix check
5 DataLink Layer 8-14
Correcting or Detecting
Hamming codes can detect double errors (use interleaving to detect burst errors of 2K bits)
Many more check bits needed to correct k single-bit errors than simply to detect them
Trade-off between wasting bandwidth in redundant check bits vs in retransmission of damaged frames
Eg BER (bit error rate)= 10-6 Block (frame) size =1000 data bits 1 Mb data = 1000 frames
Error-correcting code 10 check bits per block Overhead = 1000 x 10 = 10000 check bits
Error-detecting code 1 parity-bit per block Approx one bit error or one retransmission every 1000
frames (1 Mb data) Overhead = 1000 (parity bits) + 1001 (one block) = 2001
bits
5 DataLink Layer 8-15
Internet checksum
Sender treat segment contents
as sequence of 16-bit integers
checksum addition (1rsquos complement sum) of segment contents
sender puts checksum value into TCPUDP checksum field
Receiver compute checksum of
received segment check if computed checksum
equals checksum field value NO - error detected YES - no error detected
But maybe errors nonetheless More later hellip
Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted segment (note used at transport layer although IP has its own header checksum)
5 DataLink Layer 8-16
Checksumming Cyclic Redundancy Check view data bits D as a binary number Sender chooses r+1 bit pattern (generator) G Sender chooses r (lower-order bits) R such that
ltDRgt exactly divisible by G (modulo 2)
Receiver knows G divides the received ltDrsquoRrsquogt by G If non-zero remainder error detected can detect all burst errors less than r+1 bits
widely used in practice
5 DataLink Layer 8-17
CRC Example D=5 and R=3 (G=4 bits)Want R such that
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
1 0 1 1 1 00 1 1
5 DataLink Layer 8-18
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-19
Multiple Access Links and Protocols
Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) traditional Ethernet upstream HFC 80211 wireless LAN
5 DataLink Layer 8-20
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
interference collision if node receives two or more signals at the same
time
multiple access protocol distributed algorithm that determines how nodes
share channel ie determine when node can transmit
communication about channel sharing must use channel itself no out-of-band channel for coordination
5 DataLink Layer 8-21
Ideal Mulitple Access Protocol
Broadcast 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
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
5 DataLink Layer 8-22
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
5 DataLink Layer 8-23
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =
pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots
256 idle
5 DataLink Layer 8-24
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle example 6-station LAN 134 have pkt
frequency bands 256 idle
frequ
ency
bands time
5 DataLink Layer 8-25
Random Access Protocols
When node has packet to send transmit at full channel data rate R no a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies
how to detect collisions how to recover from collisions (eg via delayed
retransmissions)
Examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA
5 DataLink Layer 8-26
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
5 DataLink Layer 8-27
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
5 DataLink Layer 8-28
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
5 DataLink Layer 8-29
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately
collision probability increases frame sent at t0 collides with other frames sent in [t0-
1t0+1]
5 DataLink Layer 8-30
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 n -gt infty
= 1(2e) = 18 Even worse
5 DataLink Layer 8-31
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
5 DataLink Layer 8-32
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
5 DataLink Layer 8-33
CSMA
1-persistent continuously senses the channel until itrsquos idle transmits whenever idle may still have collisions
nonpersistent if the channel is busy waits a random period time before
sensing it again transmits if idle
p-persistent for slotted channels if busy initially senses the channel again for the next slot
(like 1-persistent) if idle transmits with probability p (lt 1) (at the beginning
of the next slot) or defers with probability q = 1-p if it didnrsquot transmit senses the channel in the next slot if
idle again repeat the process (either transmits or defers) if busy waits a random period time before sensing it again (like non-persistent)
5 DataLink Layer 8-34
CSMA Performance
5 DataLink Layer 8-35
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short time colliding transmissions aborted reducing channel
wastage collision detection
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs receiver shut off while transmitting
human analogy the polite conversationalist
5 DataLink Layer 8-36
CSMACD collision detection
5 DataLink Layer 8-37
CSMACD Collision Detection Delay
One way propagation delay
5 DataLink Layer 8-38
ldquo Taking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocols efficient at low load single node can fully
utilize channel high load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
5 DataLink Layer 8-39
ldquo Taking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
5 DataLink Layer 8-40
Limited Contention ndash Adaptive Tree Walking
Slot 0 for all stations under node 1 Repeat if no collisionsbull Otherwise Slot 1 for those under node 2 (left subtree)bull If successful Slot 2 for those under node 3 (right subtree)bull Else Slot 2 for those under node 4 (the left sub-subtree)
5 DataLink Layer 8-41
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-4
Link Layer Services Framing link access
encapsulate datagram into frame adding header trailer
channel access if shared medium Link-level ldquoMACrdquo addresses used in frame headers to
identify source dest bull different from IP address
Reliable delivery between adjacent nodes we learned how to do this already (chapter 3) seldomly used on low bit error link (fiber some
twisted pair) wireless links high error rates
bull Q why both link-level and end-end reliability
5 DataLink Layer 8-5
Link Layer Services (more)
Flow Control (also discussed earlier) pacing between adjacent sending and receiving nodes
Error Detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender retransmits or drops (gives up) frame
Error Correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Half-duplex and full-duplex with half duplex nodes at both ends of link can
transmit but not at same time (eg cellphone radios)
5 DataLink Layer 8-6
Adaptors Network Interface Card (NIC)
link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card
80211 card
sending side encapsulates datagram in
a frame adds error checking bits
rdt flow control etc
receiving side looks for errors rdt flow
control etc extracts datagram
passes to rcving node
adapter is semi-autonomous
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
5 DataLink Layer 8-7
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-8
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields D rsquo amp EDArsquo = received versions EDCrsquos is used to checkdetect errors in Drsquobull Error detection not 100 reliable
bull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
5 DataLink Layer 8-9
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Odd parity or
Even parity
5 DataLink Layer 8-10
Error DetectingCorrecting Codes Given m data bits add r check bits
(redundant) to form a frame A codeword (ie a frame) thus has n=m+r bits
Error-correcting code enough redundant info to deduce the correct codeword (and thus the correct data bits) even from an garbled one (ie a damaged frame)
Error-detecting code only enough to deduce that an error occurred but not which error
Definition Hamming distance between two codewords the number of bits that differ that is need to be flippedinverted to change from one codeword to the other
5 DataLink Layer 8-11
Hamming Distance (Example 1) If the minimum Hamming distance
between any two valid codewords is d then can detect any error up to d-1 bits and can correct any error up to (d-1)2 (if d is
odd) or d2-1 (if d is even) bits Example Data 011010 Even-parity code
is 0110101 Hamming distance = 2 Can detect but not correct a single-bit error Extra can detect odd but not even number of
single-bit errors
5 DataLink Layer 8-12
Hamming Distance (Example 2) Four valid codewords
000000 000111 111000 and 111111 Hamming distance is 3 Can correct all single (bit) errors
001111 =gt 000111 (the closest wins) Can correct some but not all double
errors 010011 =gt 000111 But 011111 will become 111111 not
000111
5 DataLink Layer 8-13
Dealing with Burst Errors
Errors tend to come in bursts rather than singly A burst error of K bits the first and the last bits
are gabled so are most (probably not all) bits in between pros affect one entire frame rather than many frames cons hard to detectcorrect
Hamming codes (d=3) only correct single errors Solution interleaving K codewords (bit-by-bit)
rather than sending one codeword at a time Similar to the 2D parity matrix check
5 DataLink Layer 8-14
Correcting or Detecting
Hamming codes can detect double errors (use interleaving to detect burst errors of 2K bits)
Many more check bits needed to correct k single-bit errors than simply to detect them
Trade-off between wasting bandwidth in redundant check bits vs in retransmission of damaged frames
Eg BER (bit error rate)= 10-6 Block (frame) size =1000 data bits 1 Mb data = 1000 frames
Error-correcting code 10 check bits per block Overhead = 1000 x 10 = 10000 check bits
Error-detecting code 1 parity-bit per block Approx one bit error or one retransmission every 1000
frames (1 Mb data) Overhead = 1000 (parity bits) + 1001 (one block) = 2001
bits
5 DataLink Layer 8-15
Internet checksum
Sender treat segment contents
as sequence of 16-bit integers
checksum addition (1rsquos complement sum) of segment contents
sender puts checksum value into TCPUDP checksum field
Receiver compute checksum of
received segment check if computed checksum
equals checksum field value NO - error detected YES - no error detected
But maybe errors nonetheless More later hellip
Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted segment (note used at transport layer although IP has its own header checksum)
5 DataLink Layer 8-16
Checksumming Cyclic Redundancy Check view data bits D as a binary number Sender chooses r+1 bit pattern (generator) G Sender chooses r (lower-order bits) R such that
ltDRgt exactly divisible by G (modulo 2)
Receiver knows G divides the received ltDrsquoRrsquogt by G If non-zero remainder error detected can detect all burst errors less than r+1 bits
widely used in practice
5 DataLink Layer 8-17
CRC Example D=5 and R=3 (G=4 bits)Want R such that
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
1 0 1 1 1 00 1 1
5 DataLink Layer 8-18
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-19
Multiple Access Links and Protocols
Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) traditional Ethernet upstream HFC 80211 wireless LAN
5 DataLink Layer 8-20
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
interference collision if node receives two or more signals at the same
time
multiple access protocol distributed algorithm that determines how nodes
share channel ie determine when node can transmit
communication about channel sharing must use channel itself no out-of-band channel for coordination
5 DataLink Layer 8-21
Ideal Mulitple Access Protocol
Broadcast 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
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
5 DataLink Layer 8-22
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
5 DataLink Layer 8-23
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =
pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots
256 idle
5 DataLink Layer 8-24
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle example 6-station LAN 134 have pkt
frequency bands 256 idle
frequ
ency
bands time
5 DataLink Layer 8-25
Random Access Protocols
When node has packet to send transmit at full channel data rate R no a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies
how to detect collisions how to recover from collisions (eg via delayed
retransmissions)
Examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA
5 DataLink Layer 8-26
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
5 DataLink Layer 8-27
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
5 DataLink Layer 8-28
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
5 DataLink Layer 8-29
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately
collision probability increases frame sent at t0 collides with other frames sent in [t0-
1t0+1]
5 DataLink Layer 8-30
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 n -gt infty
= 1(2e) = 18 Even worse
5 DataLink Layer 8-31
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
5 DataLink Layer 8-32
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
5 DataLink Layer 8-33
CSMA
1-persistent continuously senses the channel until itrsquos idle transmits whenever idle may still have collisions
nonpersistent if the channel is busy waits a random period time before
sensing it again transmits if idle
p-persistent for slotted channels if busy initially senses the channel again for the next slot
(like 1-persistent) if idle transmits with probability p (lt 1) (at the beginning
of the next slot) or defers with probability q = 1-p if it didnrsquot transmit senses the channel in the next slot if
idle again repeat the process (either transmits or defers) if busy waits a random period time before sensing it again (like non-persistent)
5 DataLink Layer 8-34
CSMA Performance
5 DataLink Layer 8-35
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short time colliding transmissions aborted reducing channel
wastage collision detection
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs receiver shut off while transmitting
human analogy the polite conversationalist
5 DataLink Layer 8-36
CSMACD collision detection
5 DataLink Layer 8-37
CSMACD Collision Detection Delay
One way propagation delay
5 DataLink Layer 8-38
ldquo Taking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocols efficient at low load single node can fully
utilize channel high load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
5 DataLink Layer 8-39
ldquo Taking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
5 DataLink Layer 8-40
Limited Contention ndash Adaptive Tree Walking
Slot 0 for all stations under node 1 Repeat if no collisionsbull Otherwise Slot 1 for those under node 2 (left subtree)bull If successful Slot 2 for those under node 3 (right subtree)bull Else Slot 2 for those under node 4 (the left sub-subtree)
5 DataLink Layer 8-41
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-5
Link Layer Services (more)
Flow Control (also discussed earlier) pacing between adjacent sending and receiving nodes
Error Detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender retransmits or drops (gives up) frame
Error Correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Half-duplex and full-duplex with half duplex nodes at both ends of link can
transmit but not at same time (eg cellphone radios)
5 DataLink Layer 8-6
Adaptors Network Interface Card (NIC)
link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card
80211 card
sending side encapsulates datagram in
a frame adds error checking bits
rdt flow control etc
receiving side looks for errors rdt flow
control etc extracts datagram
passes to rcving node
adapter is semi-autonomous
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
5 DataLink Layer 8-7
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-8
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields D rsquo amp EDArsquo = received versions EDCrsquos is used to checkdetect errors in Drsquobull Error detection not 100 reliable
bull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
5 DataLink Layer 8-9
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Odd parity or
Even parity
5 DataLink Layer 8-10
Error DetectingCorrecting Codes Given m data bits add r check bits
(redundant) to form a frame A codeword (ie a frame) thus has n=m+r bits
Error-correcting code enough redundant info to deduce the correct codeword (and thus the correct data bits) even from an garbled one (ie a damaged frame)
Error-detecting code only enough to deduce that an error occurred but not which error
Definition Hamming distance between two codewords the number of bits that differ that is need to be flippedinverted to change from one codeword to the other
5 DataLink Layer 8-11
Hamming Distance (Example 1) If the minimum Hamming distance
between any two valid codewords is d then can detect any error up to d-1 bits and can correct any error up to (d-1)2 (if d is
odd) or d2-1 (if d is even) bits Example Data 011010 Even-parity code
is 0110101 Hamming distance = 2 Can detect but not correct a single-bit error Extra can detect odd but not even number of
single-bit errors
5 DataLink Layer 8-12
Hamming Distance (Example 2) Four valid codewords
000000 000111 111000 and 111111 Hamming distance is 3 Can correct all single (bit) errors
001111 =gt 000111 (the closest wins) Can correct some but not all double
errors 010011 =gt 000111 But 011111 will become 111111 not
000111
5 DataLink Layer 8-13
Dealing with Burst Errors
Errors tend to come in bursts rather than singly A burst error of K bits the first and the last bits
are gabled so are most (probably not all) bits in between pros affect one entire frame rather than many frames cons hard to detectcorrect
Hamming codes (d=3) only correct single errors Solution interleaving K codewords (bit-by-bit)
rather than sending one codeword at a time Similar to the 2D parity matrix check
5 DataLink Layer 8-14
Correcting or Detecting
Hamming codes can detect double errors (use interleaving to detect burst errors of 2K bits)
Many more check bits needed to correct k single-bit errors than simply to detect them
Trade-off between wasting bandwidth in redundant check bits vs in retransmission of damaged frames
Eg BER (bit error rate)= 10-6 Block (frame) size =1000 data bits 1 Mb data = 1000 frames
Error-correcting code 10 check bits per block Overhead = 1000 x 10 = 10000 check bits
Error-detecting code 1 parity-bit per block Approx one bit error or one retransmission every 1000
frames (1 Mb data) Overhead = 1000 (parity bits) + 1001 (one block) = 2001
bits
5 DataLink Layer 8-15
Internet checksum
Sender treat segment contents
as sequence of 16-bit integers
checksum addition (1rsquos complement sum) of segment contents
sender puts checksum value into TCPUDP checksum field
Receiver compute checksum of
received segment check if computed checksum
equals checksum field value NO - error detected YES - no error detected
But maybe errors nonetheless More later hellip
Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted segment (note used at transport layer although IP has its own header checksum)
5 DataLink Layer 8-16
Checksumming Cyclic Redundancy Check view data bits D as a binary number Sender chooses r+1 bit pattern (generator) G Sender chooses r (lower-order bits) R such that
ltDRgt exactly divisible by G (modulo 2)
Receiver knows G divides the received ltDrsquoRrsquogt by G If non-zero remainder error detected can detect all burst errors less than r+1 bits
widely used in practice
5 DataLink Layer 8-17
CRC Example D=5 and R=3 (G=4 bits)Want R such that
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
1 0 1 1 1 00 1 1
5 DataLink Layer 8-18
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-19
Multiple Access Links and Protocols
Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) traditional Ethernet upstream HFC 80211 wireless LAN
5 DataLink Layer 8-20
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
interference collision if node receives two or more signals at the same
time
multiple access protocol distributed algorithm that determines how nodes
share channel ie determine when node can transmit
communication about channel sharing must use channel itself no out-of-band channel for coordination
5 DataLink Layer 8-21
Ideal Mulitple Access Protocol
Broadcast 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
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
5 DataLink Layer 8-22
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
5 DataLink Layer 8-23
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =
pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots
256 idle
5 DataLink Layer 8-24
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle example 6-station LAN 134 have pkt
frequency bands 256 idle
frequ
ency
bands time
5 DataLink Layer 8-25
Random Access Protocols
When node has packet to send transmit at full channel data rate R no a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies
how to detect collisions how to recover from collisions (eg via delayed
retransmissions)
Examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA
5 DataLink Layer 8-26
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
5 DataLink Layer 8-27
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
5 DataLink Layer 8-28
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
5 DataLink Layer 8-29
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately
collision probability increases frame sent at t0 collides with other frames sent in [t0-
1t0+1]
5 DataLink Layer 8-30
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 n -gt infty
= 1(2e) = 18 Even worse
5 DataLink Layer 8-31
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
5 DataLink Layer 8-32
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
5 DataLink Layer 8-33
CSMA
1-persistent continuously senses the channel until itrsquos idle transmits whenever idle may still have collisions
nonpersistent if the channel is busy waits a random period time before
sensing it again transmits if idle
p-persistent for slotted channels if busy initially senses the channel again for the next slot
(like 1-persistent) if idle transmits with probability p (lt 1) (at the beginning
of the next slot) or defers with probability q = 1-p if it didnrsquot transmit senses the channel in the next slot if
idle again repeat the process (either transmits or defers) if busy waits a random period time before sensing it again (like non-persistent)
5 DataLink Layer 8-34
CSMA Performance
5 DataLink Layer 8-35
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short time colliding transmissions aborted reducing channel
wastage collision detection
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs receiver shut off while transmitting
human analogy the polite conversationalist
5 DataLink Layer 8-36
CSMACD collision detection
5 DataLink Layer 8-37
CSMACD Collision Detection Delay
One way propagation delay
5 DataLink Layer 8-38
ldquo Taking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocols efficient at low load single node can fully
utilize channel high load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
5 DataLink Layer 8-39
ldquo Taking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
5 DataLink Layer 8-40
Limited Contention ndash Adaptive Tree Walking
Slot 0 for all stations under node 1 Repeat if no collisionsbull Otherwise Slot 1 for those under node 2 (left subtree)bull If successful Slot 2 for those under node 3 (right subtree)bull Else Slot 2 for those under node 4 (the left sub-subtree)
5 DataLink Layer 8-41
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-6
Adaptors Network Interface Card (NIC)
link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card
80211 card
sending side encapsulates datagram in
a frame adds error checking bits
rdt flow control etc
receiving side looks for errors rdt flow
control etc extracts datagram
passes to rcving node
adapter is semi-autonomous
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
5 DataLink Layer 8-7
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-8
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields D rsquo amp EDArsquo = received versions EDCrsquos is used to checkdetect errors in Drsquobull Error detection not 100 reliable
bull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
5 DataLink Layer 8-9
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Odd parity or
Even parity
5 DataLink Layer 8-10
Error DetectingCorrecting Codes Given m data bits add r check bits
(redundant) to form a frame A codeword (ie a frame) thus has n=m+r bits
Error-correcting code enough redundant info to deduce the correct codeword (and thus the correct data bits) even from an garbled one (ie a damaged frame)
Error-detecting code only enough to deduce that an error occurred but not which error
Definition Hamming distance between two codewords the number of bits that differ that is need to be flippedinverted to change from one codeword to the other
5 DataLink Layer 8-11
Hamming Distance (Example 1) If the minimum Hamming distance
between any two valid codewords is d then can detect any error up to d-1 bits and can correct any error up to (d-1)2 (if d is
odd) or d2-1 (if d is even) bits Example Data 011010 Even-parity code
is 0110101 Hamming distance = 2 Can detect but not correct a single-bit error Extra can detect odd but not even number of
single-bit errors
5 DataLink Layer 8-12
Hamming Distance (Example 2) Four valid codewords
000000 000111 111000 and 111111 Hamming distance is 3 Can correct all single (bit) errors
001111 =gt 000111 (the closest wins) Can correct some but not all double
errors 010011 =gt 000111 But 011111 will become 111111 not
000111
5 DataLink Layer 8-13
Dealing with Burst Errors
Errors tend to come in bursts rather than singly A burst error of K bits the first and the last bits
are gabled so are most (probably not all) bits in between pros affect one entire frame rather than many frames cons hard to detectcorrect
Hamming codes (d=3) only correct single errors Solution interleaving K codewords (bit-by-bit)
rather than sending one codeword at a time Similar to the 2D parity matrix check
5 DataLink Layer 8-14
Correcting or Detecting
Hamming codes can detect double errors (use interleaving to detect burst errors of 2K bits)
Many more check bits needed to correct k single-bit errors than simply to detect them
Trade-off between wasting bandwidth in redundant check bits vs in retransmission of damaged frames
Eg BER (bit error rate)= 10-6 Block (frame) size =1000 data bits 1 Mb data = 1000 frames
Error-correcting code 10 check bits per block Overhead = 1000 x 10 = 10000 check bits
Error-detecting code 1 parity-bit per block Approx one bit error or one retransmission every 1000
frames (1 Mb data) Overhead = 1000 (parity bits) + 1001 (one block) = 2001
bits
5 DataLink Layer 8-15
Internet checksum
Sender treat segment contents
as sequence of 16-bit integers
checksum addition (1rsquos complement sum) of segment contents
sender puts checksum value into TCPUDP checksum field
Receiver compute checksum of
received segment check if computed checksum
equals checksum field value NO - error detected YES - no error detected
But maybe errors nonetheless More later hellip
Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted segment (note used at transport layer although IP has its own header checksum)
5 DataLink Layer 8-16
Checksumming Cyclic Redundancy Check view data bits D as a binary number Sender chooses r+1 bit pattern (generator) G Sender chooses r (lower-order bits) R such that
ltDRgt exactly divisible by G (modulo 2)
Receiver knows G divides the received ltDrsquoRrsquogt by G If non-zero remainder error detected can detect all burst errors less than r+1 bits
widely used in practice
5 DataLink Layer 8-17
CRC Example D=5 and R=3 (G=4 bits)Want R such that
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
1 0 1 1 1 00 1 1
5 DataLink Layer 8-18
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-19
Multiple Access Links and Protocols
Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) traditional Ethernet upstream HFC 80211 wireless LAN
5 DataLink Layer 8-20
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
interference collision if node receives two or more signals at the same
time
multiple access protocol distributed algorithm that determines how nodes
share channel ie determine when node can transmit
communication about channel sharing must use channel itself no out-of-band channel for coordination
5 DataLink Layer 8-21
Ideal Mulitple Access Protocol
Broadcast 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
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
5 DataLink Layer 8-22
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
5 DataLink Layer 8-23
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =
pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots
256 idle
5 DataLink Layer 8-24
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle example 6-station LAN 134 have pkt
frequency bands 256 idle
frequ
ency
bands time
5 DataLink Layer 8-25
Random Access Protocols
When node has packet to send transmit at full channel data rate R no a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies
how to detect collisions how to recover from collisions (eg via delayed
retransmissions)
Examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA
5 DataLink Layer 8-26
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
5 DataLink Layer 8-27
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
5 DataLink Layer 8-28
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
5 DataLink Layer 8-29
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately
collision probability increases frame sent at t0 collides with other frames sent in [t0-
1t0+1]
5 DataLink Layer 8-30
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 n -gt infty
= 1(2e) = 18 Even worse
5 DataLink Layer 8-31
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
5 DataLink Layer 8-32
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
5 DataLink Layer 8-33
CSMA
1-persistent continuously senses the channel until itrsquos idle transmits whenever idle may still have collisions
nonpersistent if the channel is busy waits a random period time before
sensing it again transmits if idle
p-persistent for slotted channels if busy initially senses the channel again for the next slot
(like 1-persistent) if idle transmits with probability p (lt 1) (at the beginning
of the next slot) or defers with probability q = 1-p if it didnrsquot transmit senses the channel in the next slot if
idle again repeat the process (either transmits or defers) if busy waits a random period time before sensing it again (like non-persistent)
5 DataLink Layer 8-34
CSMA Performance
5 DataLink Layer 8-35
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short time colliding transmissions aborted reducing channel
wastage collision detection
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs receiver shut off while transmitting
human analogy the polite conversationalist
5 DataLink Layer 8-36
CSMACD collision detection
5 DataLink Layer 8-37
CSMACD Collision Detection Delay
One way propagation delay
5 DataLink Layer 8-38
ldquo Taking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocols efficient at low load single node can fully
utilize channel high load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
5 DataLink Layer 8-39
ldquo Taking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
5 DataLink Layer 8-40
Limited Contention ndash Adaptive Tree Walking
Slot 0 for all stations under node 1 Repeat if no collisionsbull Otherwise Slot 1 for those under node 2 (left subtree)bull If successful Slot 2 for those under node 3 (right subtree)bull Else Slot 2 for those under node 4 (the left sub-subtree)
5 DataLink Layer 8-41
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-7
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-8
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields D rsquo amp EDArsquo = received versions EDCrsquos is used to checkdetect errors in Drsquobull Error detection not 100 reliable
bull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
5 DataLink Layer 8-9
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Odd parity or
Even parity
5 DataLink Layer 8-10
Error DetectingCorrecting Codes Given m data bits add r check bits
(redundant) to form a frame A codeword (ie a frame) thus has n=m+r bits
Error-correcting code enough redundant info to deduce the correct codeword (and thus the correct data bits) even from an garbled one (ie a damaged frame)
Error-detecting code only enough to deduce that an error occurred but not which error
Definition Hamming distance between two codewords the number of bits that differ that is need to be flippedinverted to change from one codeword to the other
5 DataLink Layer 8-11
Hamming Distance (Example 1) If the minimum Hamming distance
between any two valid codewords is d then can detect any error up to d-1 bits and can correct any error up to (d-1)2 (if d is
odd) or d2-1 (if d is even) bits Example Data 011010 Even-parity code
is 0110101 Hamming distance = 2 Can detect but not correct a single-bit error Extra can detect odd but not even number of
single-bit errors
5 DataLink Layer 8-12
Hamming Distance (Example 2) Four valid codewords
000000 000111 111000 and 111111 Hamming distance is 3 Can correct all single (bit) errors
001111 =gt 000111 (the closest wins) Can correct some but not all double
errors 010011 =gt 000111 But 011111 will become 111111 not
000111
5 DataLink Layer 8-13
Dealing with Burst Errors
Errors tend to come in bursts rather than singly A burst error of K bits the first and the last bits
are gabled so are most (probably not all) bits in between pros affect one entire frame rather than many frames cons hard to detectcorrect
Hamming codes (d=3) only correct single errors Solution interleaving K codewords (bit-by-bit)
rather than sending one codeword at a time Similar to the 2D parity matrix check
5 DataLink Layer 8-14
Correcting or Detecting
Hamming codes can detect double errors (use interleaving to detect burst errors of 2K bits)
Many more check bits needed to correct k single-bit errors than simply to detect them
Trade-off between wasting bandwidth in redundant check bits vs in retransmission of damaged frames
Eg BER (bit error rate)= 10-6 Block (frame) size =1000 data bits 1 Mb data = 1000 frames
Error-correcting code 10 check bits per block Overhead = 1000 x 10 = 10000 check bits
Error-detecting code 1 parity-bit per block Approx one bit error or one retransmission every 1000
frames (1 Mb data) Overhead = 1000 (parity bits) + 1001 (one block) = 2001
bits
5 DataLink Layer 8-15
Internet checksum
Sender treat segment contents
as sequence of 16-bit integers
checksum addition (1rsquos complement sum) of segment contents
sender puts checksum value into TCPUDP checksum field
Receiver compute checksum of
received segment check if computed checksum
equals checksum field value NO - error detected YES - no error detected
But maybe errors nonetheless More later hellip
Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted segment (note used at transport layer although IP has its own header checksum)
5 DataLink Layer 8-16
Checksumming Cyclic Redundancy Check view data bits D as a binary number Sender chooses r+1 bit pattern (generator) G Sender chooses r (lower-order bits) R such that
ltDRgt exactly divisible by G (modulo 2)
Receiver knows G divides the received ltDrsquoRrsquogt by G If non-zero remainder error detected can detect all burst errors less than r+1 bits
widely used in practice
5 DataLink Layer 8-17
CRC Example D=5 and R=3 (G=4 bits)Want R such that
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
1 0 1 1 1 00 1 1
5 DataLink Layer 8-18
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-19
Multiple Access Links and Protocols
Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) traditional Ethernet upstream HFC 80211 wireless LAN
5 DataLink Layer 8-20
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
interference collision if node receives two or more signals at the same
time
multiple access protocol distributed algorithm that determines how nodes
share channel ie determine when node can transmit
communication about channel sharing must use channel itself no out-of-band channel for coordination
5 DataLink Layer 8-21
Ideal Mulitple Access Protocol
Broadcast 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
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
5 DataLink Layer 8-22
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
5 DataLink Layer 8-23
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =
pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots
256 idle
5 DataLink Layer 8-24
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle example 6-station LAN 134 have pkt
frequency bands 256 idle
frequ
ency
bands time
5 DataLink Layer 8-25
Random Access Protocols
When node has packet to send transmit at full channel data rate R no a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies
how to detect collisions how to recover from collisions (eg via delayed
retransmissions)
Examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA
5 DataLink Layer 8-26
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
5 DataLink Layer 8-27
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
5 DataLink Layer 8-28
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
5 DataLink Layer 8-29
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately
collision probability increases frame sent at t0 collides with other frames sent in [t0-
1t0+1]
5 DataLink Layer 8-30
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 n -gt infty
= 1(2e) = 18 Even worse
5 DataLink Layer 8-31
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
5 DataLink Layer 8-32
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
5 DataLink Layer 8-33
CSMA
1-persistent continuously senses the channel until itrsquos idle transmits whenever idle may still have collisions
nonpersistent if the channel is busy waits a random period time before
sensing it again transmits if idle
p-persistent for slotted channels if busy initially senses the channel again for the next slot
(like 1-persistent) if idle transmits with probability p (lt 1) (at the beginning
of the next slot) or defers with probability q = 1-p if it didnrsquot transmit senses the channel in the next slot if
idle again repeat the process (either transmits or defers) if busy waits a random period time before sensing it again (like non-persistent)
5 DataLink Layer 8-34
CSMA Performance
5 DataLink Layer 8-35
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short time colliding transmissions aborted reducing channel
wastage collision detection
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs receiver shut off while transmitting
human analogy the polite conversationalist
5 DataLink Layer 8-36
CSMACD collision detection
5 DataLink Layer 8-37
CSMACD Collision Detection Delay
One way propagation delay
5 DataLink Layer 8-38
ldquo Taking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocols efficient at low load single node can fully
utilize channel high load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
5 DataLink Layer 8-39
ldquo Taking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
5 DataLink Layer 8-40
Limited Contention ndash Adaptive Tree Walking
Slot 0 for all stations under node 1 Repeat if no collisionsbull Otherwise Slot 1 for those under node 2 (left subtree)bull If successful Slot 2 for those under node 3 (right subtree)bull Else Slot 2 for those under node 4 (the left sub-subtree)
5 DataLink Layer 8-41
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-8
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields D rsquo amp EDArsquo = received versions EDCrsquos is used to checkdetect errors in Drsquobull Error detection not 100 reliable
bull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
5 DataLink Layer 8-9
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Odd parity or
Even parity
5 DataLink Layer 8-10
Error DetectingCorrecting Codes Given m data bits add r check bits
(redundant) to form a frame A codeword (ie a frame) thus has n=m+r bits
Error-correcting code enough redundant info to deduce the correct codeword (and thus the correct data bits) even from an garbled one (ie a damaged frame)
Error-detecting code only enough to deduce that an error occurred but not which error
Definition Hamming distance between two codewords the number of bits that differ that is need to be flippedinverted to change from one codeword to the other
5 DataLink Layer 8-11
Hamming Distance (Example 1) If the minimum Hamming distance
between any two valid codewords is d then can detect any error up to d-1 bits and can correct any error up to (d-1)2 (if d is
odd) or d2-1 (if d is even) bits Example Data 011010 Even-parity code
is 0110101 Hamming distance = 2 Can detect but not correct a single-bit error Extra can detect odd but not even number of
single-bit errors
5 DataLink Layer 8-12
Hamming Distance (Example 2) Four valid codewords
000000 000111 111000 and 111111 Hamming distance is 3 Can correct all single (bit) errors
001111 =gt 000111 (the closest wins) Can correct some but not all double
errors 010011 =gt 000111 But 011111 will become 111111 not
000111
5 DataLink Layer 8-13
Dealing with Burst Errors
Errors tend to come in bursts rather than singly A burst error of K bits the first and the last bits
are gabled so are most (probably not all) bits in between pros affect one entire frame rather than many frames cons hard to detectcorrect
Hamming codes (d=3) only correct single errors Solution interleaving K codewords (bit-by-bit)
rather than sending one codeword at a time Similar to the 2D parity matrix check
5 DataLink Layer 8-14
Correcting or Detecting
Hamming codes can detect double errors (use interleaving to detect burst errors of 2K bits)
Many more check bits needed to correct k single-bit errors than simply to detect them
Trade-off between wasting bandwidth in redundant check bits vs in retransmission of damaged frames
Eg BER (bit error rate)= 10-6 Block (frame) size =1000 data bits 1 Mb data = 1000 frames
Error-correcting code 10 check bits per block Overhead = 1000 x 10 = 10000 check bits
Error-detecting code 1 parity-bit per block Approx one bit error or one retransmission every 1000
frames (1 Mb data) Overhead = 1000 (parity bits) + 1001 (one block) = 2001
bits
5 DataLink Layer 8-15
Internet checksum
Sender treat segment contents
as sequence of 16-bit integers
checksum addition (1rsquos complement sum) of segment contents
sender puts checksum value into TCPUDP checksum field
Receiver compute checksum of
received segment check if computed checksum
equals checksum field value NO - error detected YES - no error detected
But maybe errors nonetheless More later hellip
Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted segment (note used at transport layer although IP has its own header checksum)
5 DataLink Layer 8-16
Checksumming Cyclic Redundancy Check view data bits D as a binary number Sender chooses r+1 bit pattern (generator) G Sender chooses r (lower-order bits) R such that
ltDRgt exactly divisible by G (modulo 2)
Receiver knows G divides the received ltDrsquoRrsquogt by G If non-zero remainder error detected can detect all burst errors less than r+1 bits
widely used in practice
5 DataLink Layer 8-17
CRC Example D=5 and R=3 (G=4 bits)Want R such that
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
1 0 1 1 1 00 1 1
5 DataLink Layer 8-18
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-19
Multiple Access Links and Protocols
Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) traditional Ethernet upstream HFC 80211 wireless LAN
5 DataLink Layer 8-20
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
interference collision if node receives two or more signals at the same
time
multiple access protocol distributed algorithm that determines how nodes
share channel ie determine when node can transmit
communication about channel sharing must use channel itself no out-of-band channel for coordination
5 DataLink Layer 8-21
Ideal Mulitple Access Protocol
Broadcast 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
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
5 DataLink Layer 8-22
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
5 DataLink Layer 8-23
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =
pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots
256 idle
5 DataLink Layer 8-24
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle example 6-station LAN 134 have pkt
frequency bands 256 idle
frequ
ency
bands time
5 DataLink Layer 8-25
Random Access Protocols
When node has packet to send transmit at full channel data rate R no a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies
how to detect collisions how to recover from collisions (eg via delayed
retransmissions)
Examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA
5 DataLink Layer 8-26
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
5 DataLink Layer 8-27
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
5 DataLink Layer 8-28
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
5 DataLink Layer 8-29
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately
collision probability increases frame sent at t0 collides with other frames sent in [t0-
1t0+1]
5 DataLink Layer 8-30
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 n -gt infty
= 1(2e) = 18 Even worse
5 DataLink Layer 8-31
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
5 DataLink Layer 8-32
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
5 DataLink Layer 8-33
CSMA
1-persistent continuously senses the channel until itrsquos idle transmits whenever idle may still have collisions
nonpersistent if the channel is busy waits a random period time before
sensing it again transmits if idle
p-persistent for slotted channels if busy initially senses the channel again for the next slot
(like 1-persistent) if idle transmits with probability p (lt 1) (at the beginning
of the next slot) or defers with probability q = 1-p if it didnrsquot transmit senses the channel in the next slot if
idle again repeat the process (either transmits or defers) if busy waits a random period time before sensing it again (like non-persistent)
5 DataLink Layer 8-34
CSMA Performance
5 DataLink Layer 8-35
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short time colliding transmissions aborted reducing channel
wastage collision detection
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs receiver shut off while transmitting
human analogy the polite conversationalist
5 DataLink Layer 8-36
CSMACD collision detection
5 DataLink Layer 8-37
CSMACD Collision Detection Delay
One way propagation delay
5 DataLink Layer 8-38
ldquo Taking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocols efficient at low load single node can fully
utilize channel high load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
5 DataLink Layer 8-39
ldquo Taking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
5 DataLink Layer 8-40
Limited Contention ndash Adaptive Tree Walking
Slot 0 for all stations under node 1 Repeat if no collisionsbull Otherwise Slot 1 for those under node 2 (left subtree)bull If successful Slot 2 for those under node 3 (right subtree)bull Else Slot 2 for those under node 4 (the left sub-subtree)
5 DataLink Layer 8-41
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-9
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Odd parity or
Even parity
5 DataLink Layer 8-10
Error DetectingCorrecting Codes Given m data bits add r check bits
(redundant) to form a frame A codeword (ie a frame) thus has n=m+r bits
Error-correcting code enough redundant info to deduce the correct codeword (and thus the correct data bits) even from an garbled one (ie a damaged frame)
Error-detecting code only enough to deduce that an error occurred but not which error
Definition Hamming distance between two codewords the number of bits that differ that is need to be flippedinverted to change from one codeword to the other
5 DataLink Layer 8-11
Hamming Distance (Example 1) If the minimum Hamming distance
between any two valid codewords is d then can detect any error up to d-1 bits and can correct any error up to (d-1)2 (if d is
odd) or d2-1 (if d is even) bits Example Data 011010 Even-parity code
is 0110101 Hamming distance = 2 Can detect but not correct a single-bit error Extra can detect odd but not even number of
single-bit errors
5 DataLink Layer 8-12
Hamming Distance (Example 2) Four valid codewords
000000 000111 111000 and 111111 Hamming distance is 3 Can correct all single (bit) errors
001111 =gt 000111 (the closest wins) Can correct some but not all double
errors 010011 =gt 000111 But 011111 will become 111111 not
000111
5 DataLink Layer 8-13
Dealing with Burst Errors
Errors tend to come in bursts rather than singly A burst error of K bits the first and the last bits
are gabled so are most (probably not all) bits in between pros affect one entire frame rather than many frames cons hard to detectcorrect
Hamming codes (d=3) only correct single errors Solution interleaving K codewords (bit-by-bit)
rather than sending one codeword at a time Similar to the 2D parity matrix check
5 DataLink Layer 8-14
Correcting or Detecting
Hamming codes can detect double errors (use interleaving to detect burst errors of 2K bits)
Many more check bits needed to correct k single-bit errors than simply to detect them
Trade-off between wasting bandwidth in redundant check bits vs in retransmission of damaged frames
Eg BER (bit error rate)= 10-6 Block (frame) size =1000 data bits 1 Mb data = 1000 frames
Error-correcting code 10 check bits per block Overhead = 1000 x 10 = 10000 check bits
Error-detecting code 1 parity-bit per block Approx one bit error or one retransmission every 1000
frames (1 Mb data) Overhead = 1000 (parity bits) + 1001 (one block) = 2001
bits
5 DataLink Layer 8-15
Internet checksum
Sender treat segment contents
as sequence of 16-bit integers
checksum addition (1rsquos complement sum) of segment contents
sender puts checksum value into TCPUDP checksum field
Receiver compute checksum of
received segment check if computed checksum
equals checksum field value NO - error detected YES - no error detected
But maybe errors nonetheless More later hellip
Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted segment (note used at transport layer although IP has its own header checksum)
5 DataLink Layer 8-16
Checksumming Cyclic Redundancy Check view data bits D as a binary number Sender chooses r+1 bit pattern (generator) G Sender chooses r (lower-order bits) R such that
ltDRgt exactly divisible by G (modulo 2)
Receiver knows G divides the received ltDrsquoRrsquogt by G If non-zero remainder error detected can detect all burst errors less than r+1 bits
widely used in practice
5 DataLink Layer 8-17
CRC Example D=5 and R=3 (G=4 bits)Want R such that
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
1 0 1 1 1 00 1 1
5 DataLink Layer 8-18
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-19
Multiple Access Links and Protocols
Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) traditional Ethernet upstream HFC 80211 wireless LAN
5 DataLink Layer 8-20
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
interference collision if node receives two or more signals at the same
time
multiple access protocol distributed algorithm that determines how nodes
share channel ie determine when node can transmit
communication about channel sharing must use channel itself no out-of-band channel for coordination
5 DataLink Layer 8-21
Ideal Mulitple Access Protocol
Broadcast 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
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
5 DataLink Layer 8-22
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
5 DataLink Layer 8-23
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =
pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots
256 idle
5 DataLink Layer 8-24
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle example 6-station LAN 134 have pkt
frequency bands 256 idle
frequ
ency
bands time
5 DataLink Layer 8-25
Random Access Protocols
When node has packet to send transmit at full channel data rate R no a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies
how to detect collisions how to recover from collisions (eg via delayed
retransmissions)
Examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA
5 DataLink Layer 8-26
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
5 DataLink Layer 8-27
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
5 DataLink Layer 8-28
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
5 DataLink Layer 8-29
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately
collision probability increases frame sent at t0 collides with other frames sent in [t0-
1t0+1]
5 DataLink Layer 8-30
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 n -gt infty
= 1(2e) = 18 Even worse
5 DataLink Layer 8-31
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
5 DataLink Layer 8-32
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
5 DataLink Layer 8-33
CSMA
1-persistent continuously senses the channel until itrsquos idle transmits whenever idle may still have collisions
nonpersistent if the channel is busy waits a random period time before
sensing it again transmits if idle
p-persistent for slotted channels if busy initially senses the channel again for the next slot
(like 1-persistent) if idle transmits with probability p (lt 1) (at the beginning
of the next slot) or defers with probability q = 1-p if it didnrsquot transmit senses the channel in the next slot if
idle again repeat the process (either transmits or defers) if busy waits a random period time before sensing it again (like non-persistent)
5 DataLink Layer 8-34
CSMA Performance
5 DataLink Layer 8-35
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short time colliding transmissions aborted reducing channel
wastage collision detection
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs receiver shut off while transmitting
human analogy the polite conversationalist
5 DataLink Layer 8-36
CSMACD collision detection
5 DataLink Layer 8-37
CSMACD Collision Detection Delay
One way propagation delay
5 DataLink Layer 8-38
ldquo Taking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocols efficient at low load single node can fully
utilize channel high load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
5 DataLink Layer 8-39
ldquo Taking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
5 DataLink Layer 8-40
Limited Contention ndash Adaptive Tree Walking
Slot 0 for all stations under node 1 Repeat if no collisionsbull Otherwise Slot 1 for those under node 2 (left subtree)bull If successful Slot 2 for those under node 3 (right subtree)bull Else Slot 2 for those under node 4 (the left sub-subtree)
5 DataLink Layer 8-41
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-10
Error DetectingCorrecting Codes Given m data bits add r check bits
(redundant) to form a frame A codeword (ie a frame) thus has n=m+r bits
Error-correcting code enough redundant info to deduce the correct codeword (and thus the correct data bits) even from an garbled one (ie a damaged frame)
Error-detecting code only enough to deduce that an error occurred but not which error
Definition Hamming distance between two codewords the number of bits that differ that is need to be flippedinverted to change from one codeword to the other
5 DataLink Layer 8-11
Hamming Distance (Example 1) If the minimum Hamming distance
between any two valid codewords is d then can detect any error up to d-1 bits and can correct any error up to (d-1)2 (if d is
odd) or d2-1 (if d is even) bits Example Data 011010 Even-parity code
is 0110101 Hamming distance = 2 Can detect but not correct a single-bit error Extra can detect odd but not even number of
single-bit errors
5 DataLink Layer 8-12
Hamming Distance (Example 2) Four valid codewords
000000 000111 111000 and 111111 Hamming distance is 3 Can correct all single (bit) errors
001111 =gt 000111 (the closest wins) Can correct some but not all double
errors 010011 =gt 000111 But 011111 will become 111111 not
000111
5 DataLink Layer 8-13
Dealing with Burst Errors
Errors tend to come in bursts rather than singly A burst error of K bits the first and the last bits
are gabled so are most (probably not all) bits in between pros affect one entire frame rather than many frames cons hard to detectcorrect
Hamming codes (d=3) only correct single errors Solution interleaving K codewords (bit-by-bit)
rather than sending one codeword at a time Similar to the 2D parity matrix check
5 DataLink Layer 8-14
Correcting or Detecting
Hamming codes can detect double errors (use interleaving to detect burst errors of 2K bits)
Many more check bits needed to correct k single-bit errors than simply to detect them
Trade-off between wasting bandwidth in redundant check bits vs in retransmission of damaged frames
Eg BER (bit error rate)= 10-6 Block (frame) size =1000 data bits 1 Mb data = 1000 frames
Error-correcting code 10 check bits per block Overhead = 1000 x 10 = 10000 check bits
Error-detecting code 1 parity-bit per block Approx one bit error or one retransmission every 1000
frames (1 Mb data) Overhead = 1000 (parity bits) + 1001 (one block) = 2001
bits
5 DataLink Layer 8-15
Internet checksum
Sender treat segment contents
as sequence of 16-bit integers
checksum addition (1rsquos complement sum) of segment contents
sender puts checksum value into TCPUDP checksum field
Receiver compute checksum of
received segment check if computed checksum
equals checksum field value NO - error detected YES - no error detected
But maybe errors nonetheless More later hellip
Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted segment (note used at transport layer although IP has its own header checksum)
5 DataLink Layer 8-16
Checksumming Cyclic Redundancy Check view data bits D as a binary number Sender chooses r+1 bit pattern (generator) G Sender chooses r (lower-order bits) R such that
ltDRgt exactly divisible by G (modulo 2)
Receiver knows G divides the received ltDrsquoRrsquogt by G If non-zero remainder error detected can detect all burst errors less than r+1 bits
widely used in practice
5 DataLink Layer 8-17
CRC Example D=5 and R=3 (G=4 bits)Want R such that
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
1 0 1 1 1 00 1 1
5 DataLink Layer 8-18
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-19
Multiple Access Links and Protocols
Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) traditional Ethernet upstream HFC 80211 wireless LAN
5 DataLink Layer 8-20
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
interference collision if node receives two or more signals at the same
time
multiple access protocol distributed algorithm that determines how nodes
share channel ie determine when node can transmit
communication about channel sharing must use channel itself no out-of-band channel for coordination
5 DataLink Layer 8-21
Ideal Mulitple Access Protocol
Broadcast 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
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
5 DataLink Layer 8-22
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
5 DataLink Layer 8-23
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =
pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots
256 idle
5 DataLink Layer 8-24
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle example 6-station LAN 134 have pkt
frequency bands 256 idle
frequ
ency
bands time
5 DataLink Layer 8-25
Random Access Protocols
When node has packet to send transmit at full channel data rate R no a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies
how to detect collisions how to recover from collisions (eg via delayed
retransmissions)
Examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA
5 DataLink Layer 8-26
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
5 DataLink Layer 8-27
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
5 DataLink Layer 8-28
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
5 DataLink Layer 8-29
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately
collision probability increases frame sent at t0 collides with other frames sent in [t0-
1t0+1]
5 DataLink Layer 8-30
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 n -gt infty
= 1(2e) = 18 Even worse
5 DataLink Layer 8-31
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
5 DataLink Layer 8-32
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
5 DataLink Layer 8-33
CSMA
1-persistent continuously senses the channel until itrsquos idle transmits whenever idle may still have collisions
nonpersistent if the channel is busy waits a random period time before
sensing it again transmits if idle
p-persistent for slotted channels if busy initially senses the channel again for the next slot
(like 1-persistent) if idle transmits with probability p (lt 1) (at the beginning
of the next slot) or defers with probability q = 1-p if it didnrsquot transmit senses the channel in the next slot if
idle again repeat the process (either transmits or defers) if busy waits a random period time before sensing it again (like non-persistent)
5 DataLink Layer 8-34
CSMA Performance
5 DataLink Layer 8-35
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short time colliding transmissions aborted reducing channel
wastage collision detection
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs receiver shut off while transmitting
human analogy the polite conversationalist
5 DataLink Layer 8-36
CSMACD collision detection
5 DataLink Layer 8-37
CSMACD Collision Detection Delay
One way propagation delay
5 DataLink Layer 8-38
ldquo Taking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocols efficient at low load single node can fully
utilize channel high load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
5 DataLink Layer 8-39
ldquo Taking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
5 DataLink Layer 8-40
Limited Contention ndash Adaptive Tree Walking
Slot 0 for all stations under node 1 Repeat if no collisionsbull Otherwise Slot 1 for those under node 2 (left subtree)bull If successful Slot 2 for those under node 3 (right subtree)bull Else Slot 2 for those under node 4 (the left sub-subtree)
5 DataLink Layer 8-41
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-11
Hamming Distance (Example 1) If the minimum Hamming distance
between any two valid codewords is d then can detect any error up to d-1 bits and can correct any error up to (d-1)2 (if d is
odd) or d2-1 (if d is even) bits Example Data 011010 Even-parity code
is 0110101 Hamming distance = 2 Can detect but not correct a single-bit error Extra can detect odd but not even number of
single-bit errors
5 DataLink Layer 8-12
Hamming Distance (Example 2) Four valid codewords
000000 000111 111000 and 111111 Hamming distance is 3 Can correct all single (bit) errors
001111 =gt 000111 (the closest wins) Can correct some but not all double
errors 010011 =gt 000111 But 011111 will become 111111 not
000111
5 DataLink Layer 8-13
Dealing with Burst Errors
Errors tend to come in bursts rather than singly A burst error of K bits the first and the last bits
are gabled so are most (probably not all) bits in between pros affect one entire frame rather than many frames cons hard to detectcorrect
Hamming codes (d=3) only correct single errors Solution interleaving K codewords (bit-by-bit)
rather than sending one codeword at a time Similar to the 2D parity matrix check
5 DataLink Layer 8-14
Correcting or Detecting
Hamming codes can detect double errors (use interleaving to detect burst errors of 2K bits)
Many more check bits needed to correct k single-bit errors than simply to detect them
Trade-off between wasting bandwidth in redundant check bits vs in retransmission of damaged frames
Eg BER (bit error rate)= 10-6 Block (frame) size =1000 data bits 1 Mb data = 1000 frames
Error-correcting code 10 check bits per block Overhead = 1000 x 10 = 10000 check bits
Error-detecting code 1 parity-bit per block Approx one bit error or one retransmission every 1000
frames (1 Mb data) Overhead = 1000 (parity bits) + 1001 (one block) = 2001
bits
5 DataLink Layer 8-15
Internet checksum
Sender treat segment contents
as sequence of 16-bit integers
checksum addition (1rsquos complement sum) of segment contents
sender puts checksum value into TCPUDP checksum field
Receiver compute checksum of
received segment check if computed checksum
equals checksum field value NO - error detected YES - no error detected
But maybe errors nonetheless More later hellip
Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted segment (note used at transport layer although IP has its own header checksum)
5 DataLink Layer 8-16
Checksumming Cyclic Redundancy Check view data bits D as a binary number Sender chooses r+1 bit pattern (generator) G Sender chooses r (lower-order bits) R such that
ltDRgt exactly divisible by G (modulo 2)
Receiver knows G divides the received ltDrsquoRrsquogt by G If non-zero remainder error detected can detect all burst errors less than r+1 bits
widely used in practice
5 DataLink Layer 8-17
CRC Example D=5 and R=3 (G=4 bits)Want R such that
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
1 0 1 1 1 00 1 1
5 DataLink Layer 8-18
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-19
Multiple Access Links and Protocols
Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) traditional Ethernet upstream HFC 80211 wireless LAN
5 DataLink Layer 8-20
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
interference collision if node receives two or more signals at the same
time
multiple access protocol distributed algorithm that determines how nodes
share channel ie determine when node can transmit
communication about channel sharing must use channel itself no out-of-band channel for coordination
5 DataLink Layer 8-21
Ideal Mulitple Access Protocol
Broadcast 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
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
5 DataLink Layer 8-22
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
5 DataLink Layer 8-23
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =
pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots
256 idle
5 DataLink Layer 8-24
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle example 6-station LAN 134 have pkt
frequency bands 256 idle
frequ
ency
bands time
5 DataLink Layer 8-25
Random Access Protocols
When node has packet to send transmit at full channel data rate R no a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies
how to detect collisions how to recover from collisions (eg via delayed
retransmissions)
Examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA
5 DataLink Layer 8-26
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
5 DataLink Layer 8-27
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
5 DataLink Layer 8-28
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
5 DataLink Layer 8-29
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately
collision probability increases frame sent at t0 collides with other frames sent in [t0-
1t0+1]
5 DataLink Layer 8-30
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 n -gt infty
= 1(2e) = 18 Even worse
5 DataLink Layer 8-31
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
5 DataLink Layer 8-32
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
5 DataLink Layer 8-33
CSMA
1-persistent continuously senses the channel until itrsquos idle transmits whenever idle may still have collisions
nonpersistent if the channel is busy waits a random period time before
sensing it again transmits if idle
p-persistent for slotted channels if busy initially senses the channel again for the next slot
(like 1-persistent) if idle transmits with probability p (lt 1) (at the beginning
of the next slot) or defers with probability q = 1-p if it didnrsquot transmit senses the channel in the next slot if
idle again repeat the process (either transmits or defers) if busy waits a random period time before sensing it again (like non-persistent)
5 DataLink Layer 8-34
CSMA Performance
5 DataLink Layer 8-35
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short time colliding transmissions aborted reducing channel
wastage collision detection
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs receiver shut off while transmitting
human analogy the polite conversationalist
5 DataLink Layer 8-36
CSMACD collision detection
5 DataLink Layer 8-37
CSMACD Collision Detection Delay
One way propagation delay
5 DataLink Layer 8-38
ldquo Taking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocols efficient at low load single node can fully
utilize channel high load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
5 DataLink Layer 8-39
ldquo Taking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
5 DataLink Layer 8-40
Limited Contention ndash Adaptive Tree Walking
Slot 0 for all stations under node 1 Repeat if no collisionsbull Otherwise Slot 1 for those under node 2 (left subtree)bull If successful Slot 2 for those under node 3 (right subtree)bull Else Slot 2 for those under node 4 (the left sub-subtree)
5 DataLink Layer 8-41
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-12
Hamming Distance (Example 2) Four valid codewords
000000 000111 111000 and 111111 Hamming distance is 3 Can correct all single (bit) errors
001111 =gt 000111 (the closest wins) Can correct some but not all double
errors 010011 =gt 000111 But 011111 will become 111111 not
000111
5 DataLink Layer 8-13
Dealing with Burst Errors
Errors tend to come in bursts rather than singly A burst error of K bits the first and the last bits
are gabled so are most (probably not all) bits in between pros affect one entire frame rather than many frames cons hard to detectcorrect
Hamming codes (d=3) only correct single errors Solution interleaving K codewords (bit-by-bit)
rather than sending one codeword at a time Similar to the 2D parity matrix check
5 DataLink Layer 8-14
Correcting or Detecting
Hamming codes can detect double errors (use interleaving to detect burst errors of 2K bits)
Many more check bits needed to correct k single-bit errors than simply to detect them
Trade-off between wasting bandwidth in redundant check bits vs in retransmission of damaged frames
Eg BER (bit error rate)= 10-6 Block (frame) size =1000 data bits 1 Mb data = 1000 frames
Error-correcting code 10 check bits per block Overhead = 1000 x 10 = 10000 check bits
Error-detecting code 1 parity-bit per block Approx one bit error or one retransmission every 1000
frames (1 Mb data) Overhead = 1000 (parity bits) + 1001 (one block) = 2001
bits
5 DataLink Layer 8-15
Internet checksum
Sender treat segment contents
as sequence of 16-bit integers
checksum addition (1rsquos complement sum) of segment contents
sender puts checksum value into TCPUDP checksum field
Receiver compute checksum of
received segment check if computed checksum
equals checksum field value NO - error detected YES - no error detected
But maybe errors nonetheless More later hellip
Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted segment (note used at transport layer although IP has its own header checksum)
5 DataLink Layer 8-16
Checksumming Cyclic Redundancy Check view data bits D as a binary number Sender chooses r+1 bit pattern (generator) G Sender chooses r (lower-order bits) R such that
ltDRgt exactly divisible by G (modulo 2)
Receiver knows G divides the received ltDrsquoRrsquogt by G If non-zero remainder error detected can detect all burst errors less than r+1 bits
widely used in practice
5 DataLink Layer 8-17
CRC Example D=5 and R=3 (G=4 bits)Want R such that
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
1 0 1 1 1 00 1 1
5 DataLink Layer 8-18
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-19
Multiple Access Links and Protocols
Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) traditional Ethernet upstream HFC 80211 wireless LAN
5 DataLink Layer 8-20
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
interference collision if node receives two or more signals at the same
time
multiple access protocol distributed algorithm that determines how nodes
share channel ie determine when node can transmit
communication about channel sharing must use channel itself no out-of-band channel for coordination
5 DataLink Layer 8-21
Ideal Mulitple Access Protocol
Broadcast 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
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
5 DataLink Layer 8-22
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
5 DataLink Layer 8-23
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =
pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots
256 idle
5 DataLink Layer 8-24
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle example 6-station LAN 134 have pkt
frequency bands 256 idle
frequ
ency
bands time
5 DataLink Layer 8-25
Random Access Protocols
When node has packet to send transmit at full channel data rate R no a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies
how to detect collisions how to recover from collisions (eg via delayed
retransmissions)
Examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA
5 DataLink Layer 8-26
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
5 DataLink Layer 8-27
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
5 DataLink Layer 8-28
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
5 DataLink Layer 8-29
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately
collision probability increases frame sent at t0 collides with other frames sent in [t0-
1t0+1]
5 DataLink Layer 8-30
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 n -gt infty
= 1(2e) = 18 Even worse
5 DataLink Layer 8-31
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
5 DataLink Layer 8-32
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
5 DataLink Layer 8-33
CSMA
1-persistent continuously senses the channel until itrsquos idle transmits whenever idle may still have collisions
nonpersistent if the channel is busy waits a random period time before
sensing it again transmits if idle
p-persistent for slotted channels if busy initially senses the channel again for the next slot
(like 1-persistent) if idle transmits with probability p (lt 1) (at the beginning
of the next slot) or defers with probability q = 1-p if it didnrsquot transmit senses the channel in the next slot if
idle again repeat the process (either transmits or defers) if busy waits a random period time before sensing it again (like non-persistent)
5 DataLink Layer 8-34
CSMA Performance
5 DataLink Layer 8-35
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short time colliding transmissions aborted reducing channel
wastage collision detection
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs receiver shut off while transmitting
human analogy the polite conversationalist
5 DataLink Layer 8-36
CSMACD collision detection
5 DataLink Layer 8-37
CSMACD Collision Detection Delay
One way propagation delay
5 DataLink Layer 8-38
ldquo Taking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocols efficient at low load single node can fully
utilize channel high load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
5 DataLink Layer 8-39
ldquo Taking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
5 DataLink Layer 8-40
Limited Contention ndash Adaptive Tree Walking
Slot 0 for all stations under node 1 Repeat if no collisionsbull Otherwise Slot 1 for those under node 2 (left subtree)bull If successful Slot 2 for those under node 3 (right subtree)bull Else Slot 2 for those under node 4 (the left sub-subtree)
5 DataLink Layer 8-41
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-13
Dealing with Burst Errors
Errors tend to come in bursts rather than singly A burst error of K bits the first and the last bits
are gabled so are most (probably not all) bits in between pros affect one entire frame rather than many frames cons hard to detectcorrect
Hamming codes (d=3) only correct single errors Solution interleaving K codewords (bit-by-bit)
rather than sending one codeword at a time Similar to the 2D parity matrix check
5 DataLink Layer 8-14
Correcting or Detecting
Hamming codes can detect double errors (use interleaving to detect burst errors of 2K bits)
Many more check bits needed to correct k single-bit errors than simply to detect them
Trade-off between wasting bandwidth in redundant check bits vs in retransmission of damaged frames
Eg BER (bit error rate)= 10-6 Block (frame) size =1000 data bits 1 Mb data = 1000 frames
Error-correcting code 10 check bits per block Overhead = 1000 x 10 = 10000 check bits
Error-detecting code 1 parity-bit per block Approx one bit error or one retransmission every 1000
frames (1 Mb data) Overhead = 1000 (parity bits) + 1001 (one block) = 2001
bits
5 DataLink Layer 8-15
Internet checksum
Sender treat segment contents
as sequence of 16-bit integers
checksum addition (1rsquos complement sum) of segment contents
sender puts checksum value into TCPUDP checksum field
Receiver compute checksum of
received segment check if computed checksum
equals checksum field value NO - error detected YES - no error detected
But maybe errors nonetheless More later hellip
Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted segment (note used at transport layer although IP has its own header checksum)
5 DataLink Layer 8-16
Checksumming Cyclic Redundancy Check view data bits D as a binary number Sender chooses r+1 bit pattern (generator) G Sender chooses r (lower-order bits) R such that
ltDRgt exactly divisible by G (modulo 2)
Receiver knows G divides the received ltDrsquoRrsquogt by G If non-zero remainder error detected can detect all burst errors less than r+1 bits
widely used in practice
5 DataLink Layer 8-17
CRC Example D=5 and R=3 (G=4 bits)Want R such that
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
1 0 1 1 1 00 1 1
5 DataLink Layer 8-18
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-19
Multiple Access Links and Protocols
Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) traditional Ethernet upstream HFC 80211 wireless LAN
5 DataLink Layer 8-20
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
interference collision if node receives two or more signals at the same
time
multiple access protocol distributed algorithm that determines how nodes
share channel ie determine when node can transmit
communication about channel sharing must use channel itself no out-of-band channel for coordination
5 DataLink Layer 8-21
Ideal Mulitple Access Protocol
Broadcast 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
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
5 DataLink Layer 8-22
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
5 DataLink Layer 8-23
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =
pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots
256 idle
5 DataLink Layer 8-24
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle example 6-station LAN 134 have pkt
frequency bands 256 idle
frequ
ency
bands time
5 DataLink Layer 8-25
Random Access Protocols
When node has packet to send transmit at full channel data rate R no a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies
how to detect collisions how to recover from collisions (eg via delayed
retransmissions)
Examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA
5 DataLink Layer 8-26
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
5 DataLink Layer 8-27
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
5 DataLink Layer 8-28
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
5 DataLink Layer 8-29
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately
collision probability increases frame sent at t0 collides with other frames sent in [t0-
1t0+1]
5 DataLink Layer 8-30
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 n -gt infty
= 1(2e) = 18 Even worse
5 DataLink Layer 8-31
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
5 DataLink Layer 8-32
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
5 DataLink Layer 8-33
CSMA
1-persistent continuously senses the channel until itrsquos idle transmits whenever idle may still have collisions
nonpersistent if the channel is busy waits a random period time before
sensing it again transmits if idle
p-persistent for slotted channels if busy initially senses the channel again for the next slot
(like 1-persistent) if idle transmits with probability p (lt 1) (at the beginning
of the next slot) or defers with probability q = 1-p if it didnrsquot transmit senses the channel in the next slot if
idle again repeat the process (either transmits or defers) if busy waits a random period time before sensing it again (like non-persistent)
5 DataLink Layer 8-34
CSMA Performance
5 DataLink Layer 8-35
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short time colliding transmissions aborted reducing channel
wastage collision detection
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs receiver shut off while transmitting
human analogy the polite conversationalist
5 DataLink Layer 8-36
CSMACD collision detection
5 DataLink Layer 8-37
CSMACD Collision Detection Delay
One way propagation delay
5 DataLink Layer 8-38
ldquo Taking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocols efficient at low load single node can fully
utilize channel high load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
5 DataLink Layer 8-39
ldquo Taking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
5 DataLink Layer 8-40
Limited Contention ndash Adaptive Tree Walking
Slot 0 for all stations under node 1 Repeat if no collisionsbull Otherwise Slot 1 for those under node 2 (left subtree)bull If successful Slot 2 for those under node 3 (right subtree)bull Else Slot 2 for those under node 4 (the left sub-subtree)
5 DataLink Layer 8-41
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-14
Correcting or Detecting
Hamming codes can detect double errors (use interleaving to detect burst errors of 2K bits)
Many more check bits needed to correct k single-bit errors than simply to detect them
Trade-off between wasting bandwidth in redundant check bits vs in retransmission of damaged frames
Eg BER (bit error rate)= 10-6 Block (frame) size =1000 data bits 1 Mb data = 1000 frames
Error-correcting code 10 check bits per block Overhead = 1000 x 10 = 10000 check bits
Error-detecting code 1 parity-bit per block Approx one bit error or one retransmission every 1000
frames (1 Mb data) Overhead = 1000 (parity bits) + 1001 (one block) = 2001
bits
5 DataLink Layer 8-15
Internet checksum
Sender treat segment contents
as sequence of 16-bit integers
checksum addition (1rsquos complement sum) of segment contents
sender puts checksum value into TCPUDP checksum field
Receiver compute checksum of
received segment check if computed checksum
equals checksum field value NO - error detected YES - no error detected
But maybe errors nonetheless More later hellip
Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted segment (note used at transport layer although IP has its own header checksum)
5 DataLink Layer 8-16
Checksumming Cyclic Redundancy Check view data bits D as a binary number Sender chooses r+1 bit pattern (generator) G Sender chooses r (lower-order bits) R such that
ltDRgt exactly divisible by G (modulo 2)
Receiver knows G divides the received ltDrsquoRrsquogt by G If non-zero remainder error detected can detect all burst errors less than r+1 bits
widely used in practice
5 DataLink Layer 8-17
CRC Example D=5 and R=3 (G=4 bits)Want R such that
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
1 0 1 1 1 00 1 1
5 DataLink Layer 8-18
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-19
Multiple Access Links and Protocols
Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) traditional Ethernet upstream HFC 80211 wireless LAN
5 DataLink Layer 8-20
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
interference collision if node receives two or more signals at the same
time
multiple access protocol distributed algorithm that determines how nodes
share channel ie determine when node can transmit
communication about channel sharing must use channel itself no out-of-band channel for coordination
5 DataLink Layer 8-21
Ideal Mulitple Access Protocol
Broadcast 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
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
5 DataLink Layer 8-22
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
5 DataLink Layer 8-23
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =
pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots
256 idle
5 DataLink Layer 8-24
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle example 6-station LAN 134 have pkt
frequency bands 256 idle
frequ
ency
bands time
5 DataLink Layer 8-25
Random Access Protocols
When node has packet to send transmit at full channel data rate R no a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies
how to detect collisions how to recover from collisions (eg via delayed
retransmissions)
Examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA
5 DataLink Layer 8-26
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
5 DataLink Layer 8-27
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
5 DataLink Layer 8-28
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
5 DataLink Layer 8-29
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately
collision probability increases frame sent at t0 collides with other frames sent in [t0-
1t0+1]
5 DataLink Layer 8-30
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 n -gt infty
= 1(2e) = 18 Even worse
5 DataLink Layer 8-31
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
5 DataLink Layer 8-32
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
5 DataLink Layer 8-33
CSMA
1-persistent continuously senses the channel until itrsquos idle transmits whenever idle may still have collisions
nonpersistent if the channel is busy waits a random period time before
sensing it again transmits if idle
p-persistent for slotted channels if busy initially senses the channel again for the next slot
(like 1-persistent) if idle transmits with probability p (lt 1) (at the beginning
of the next slot) or defers with probability q = 1-p if it didnrsquot transmit senses the channel in the next slot if
idle again repeat the process (either transmits or defers) if busy waits a random period time before sensing it again (like non-persistent)
5 DataLink Layer 8-34
CSMA Performance
5 DataLink Layer 8-35
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short time colliding transmissions aborted reducing channel
wastage collision detection
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs receiver shut off while transmitting
human analogy the polite conversationalist
5 DataLink Layer 8-36
CSMACD collision detection
5 DataLink Layer 8-37
CSMACD Collision Detection Delay
One way propagation delay
5 DataLink Layer 8-38
ldquo Taking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocols efficient at low load single node can fully
utilize channel high load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
5 DataLink Layer 8-39
ldquo Taking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
5 DataLink Layer 8-40
Limited Contention ndash Adaptive Tree Walking
Slot 0 for all stations under node 1 Repeat if no collisionsbull Otherwise Slot 1 for those under node 2 (left subtree)bull If successful Slot 2 for those under node 3 (right subtree)bull Else Slot 2 for those under node 4 (the left sub-subtree)
5 DataLink Layer 8-41
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-15
Internet checksum
Sender treat segment contents
as sequence of 16-bit integers
checksum addition (1rsquos complement sum) of segment contents
sender puts checksum value into TCPUDP checksum field
Receiver compute checksum of
received segment check if computed checksum
equals checksum field value NO - error detected YES - no error detected
But maybe errors nonetheless More later hellip
Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted segment (note used at transport layer although IP has its own header checksum)
5 DataLink Layer 8-16
Checksumming Cyclic Redundancy Check view data bits D as a binary number Sender chooses r+1 bit pattern (generator) G Sender chooses r (lower-order bits) R such that
ltDRgt exactly divisible by G (modulo 2)
Receiver knows G divides the received ltDrsquoRrsquogt by G If non-zero remainder error detected can detect all burst errors less than r+1 bits
widely used in practice
5 DataLink Layer 8-17
CRC Example D=5 and R=3 (G=4 bits)Want R such that
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
1 0 1 1 1 00 1 1
5 DataLink Layer 8-18
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-19
Multiple Access Links and Protocols
Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) traditional Ethernet upstream HFC 80211 wireless LAN
5 DataLink Layer 8-20
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
interference collision if node receives two or more signals at the same
time
multiple access protocol distributed algorithm that determines how nodes
share channel ie determine when node can transmit
communication about channel sharing must use channel itself no out-of-band channel for coordination
5 DataLink Layer 8-21
Ideal Mulitple Access Protocol
Broadcast 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
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
5 DataLink Layer 8-22
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
5 DataLink Layer 8-23
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =
pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots
256 idle
5 DataLink Layer 8-24
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle example 6-station LAN 134 have pkt
frequency bands 256 idle
frequ
ency
bands time
5 DataLink Layer 8-25
Random Access Protocols
When node has packet to send transmit at full channel data rate R no a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies
how to detect collisions how to recover from collisions (eg via delayed
retransmissions)
Examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA
5 DataLink Layer 8-26
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
5 DataLink Layer 8-27
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
5 DataLink Layer 8-28
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
5 DataLink Layer 8-29
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately
collision probability increases frame sent at t0 collides with other frames sent in [t0-
1t0+1]
5 DataLink Layer 8-30
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 n -gt infty
= 1(2e) = 18 Even worse
5 DataLink Layer 8-31
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
5 DataLink Layer 8-32
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
5 DataLink Layer 8-33
CSMA
1-persistent continuously senses the channel until itrsquos idle transmits whenever idle may still have collisions
nonpersistent if the channel is busy waits a random period time before
sensing it again transmits if idle
p-persistent for slotted channels if busy initially senses the channel again for the next slot
(like 1-persistent) if idle transmits with probability p (lt 1) (at the beginning
of the next slot) or defers with probability q = 1-p if it didnrsquot transmit senses the channel in the next slot if
idle again repeat the process (either transmits or defers) if busy waits a random period time before sensing it again (like non-persistent)
5 DataLink Layer 8-34
CSMA Performance
5 DataLink Layer 8-35
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short time colliding transmissions aborted reducing channel
wastage collision detection
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs receiver shut off while transmitting
human analogy the polite conversationalist
5 DataLink Layer 8-36
CSMACD collision detection
5 DataLink Layer 8-37
CSMACD Collision Detection Delay
One way propagation delay
5 DataLink Layer 8-38
ldquo Taking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocols efficient at low load single node can fully
utilize channel high load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
5 DataLink Layer 8-39
ldquo Taking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
5 DataLink Layer 8-40
Limited Contention ndash Adaptive Tree Walking
Slot 0 for all stations under node 1 Repeat if no collisionsbull Otherwise Slot 1 for those under node 2 (left subtree)bull If successful Slot 2 for those under node 3 (right subtree)bull Else Slot 2 for those under node 4 (the left sub-subtree)
5 DataLink Layer 8-41
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-16
Checksumming Cyclic Redundancy Check view data bits D as a binary number Sender chooses r+1 bit pattern (generator) G Sender chooses r (lower-order bits) R such that
ltDRgt exactly divisible by G (modulo 2)
Receiver knows G divides the received ltDrsquoRrsquogt by G If non-zero remainder error detected can detect all burst errors less than r+1 bits
widely used in practice
5 DataLink Layer 8-17
CRC Example D=5 and R=3 (G=4 bits)Want R such that
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
1 0 1 1 1 00 1 1
5 DataLink Layer 8-18
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-19
Multiple Access Links and Protocols
Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) traditional Ethernet upstream HFC 80211 wireless LAN
5 DataLink Layer 8-20
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
interference collision if node receives two or more signals at the same
time
multiple access protocol distributed algorithm that determines how nodes
share channel ie determine when node can transmit
communication about channel sharing must use channel itself no out-of-band channel for coordination
5 DataLink Layer 8-21
Ideal Mulitple Access Protocol
Broadcast 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
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
5 DataLink Layer 8-22
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
5 DataLink Layer 8-23
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =
pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots
256 idle
5 DataLink Layer 8-24
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle example 6-station LAN 134 have pkt
frequency bands 256 idle
frequ
ency
bands time
5 DataLink Layer 8-25
Random Access Protocols
When node has packet to send transmit at full channel data rate R no a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies
how to detect collisions how to recover from collisions (eg via delayed
retransmissions)
Examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA
5 DataLink Layer 8-26
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
5 DataLink Layer 8-27
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
5 DataLink Layer 8-28
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
5 DataLink Layer 8-29
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately
collision probability increases frame sent at t0 collides with other frames sent in [t0-
1t0+1]
5 DataLink Layer 8-30
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 n -gt infty
= 1(2e) = 18 Even worse
5 DataLink Layer 8-31
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
5 DataLink Layer 8-32
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
5 DataLink Layer 8-33
CSMA
1-persistent continuously senses the channel until itrsquos idle transmits whenever idle may still have collisions
nonpersistent if the channel is busy waits a random period time before
sensing it again transmits if idle
p-persistent for slotted channels if busy initially senses the channel again for the next slot
(like 1-persistent) if idle transmits with probability p (lt 1) (at the beginning
of the next slot) or defers with probability q = 1-p if it didnrsquot transmit senses the channel in the next slot if
idle again repeat the process (either transmits or defers) if busy waits a random period time before sensing it again (like non-persistent)
5 DataLink Layer 8-34
CSMA Performance
5 DataLink Layer 8-35
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short time colliding transmissions aborted reducing channel
wastage collision detection
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs receiver shut off while transmitting
human analogy the polite conversationalist
5 DataLink Layer 8-36
CSMACD collision detection
5 DataLink Layer 8-37
CSMACD Collision Detection Delay
One way propagation delay
5 DataLink Layer 8-38
ldquo Taking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocols efficient at low load single node can fully
utilize channel high load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
5 DataLink Layer 8-39
ldquo Taking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
5 DataLink Layer 8-40
Limited Contention ndash Adaptive Tree Walking
Slot 0 for all stations under node 1 Repeat if no collisionsbull Otherwise Slot 1 for those under node 2 (left subtree)bull If successful Slot 2 for those under node 3 (right subtree)bull Else Slot 2 for those under node 4 (the left sub-subtree)
5 DataLink Layer 8-41
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-17
CRC Example D=5 and R=3 (G=4 bits)Want R such that
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
1 0 1 1 1 00 1 1
5 DataLink Layer 8-18
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-19
Multiple Access Links and Protocols
Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) traditional Ethernet upstream HFC 80211 wireless LAN
5 DataLink Layer 8-20
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
interference collision if node receives two or more signals at the same
time
multiple access protocol distributed algorithm that determines how nodes
share channel ie determine when node can transmit
communication about channel sharing must use channel itself no out-of-band channel for coordination
5 DataLink Layer 8-21
Ideal Mulitple Access Protocol
Broadcast 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
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
5 DataLink Layer 8-22
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
5 DataLink Layer 8-23
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =
pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots
256 idle
5 DataLink Layer 8-24
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle example 6-station LAN 134 have pkt
frequency bands 256 idle
frequ
ency
bands time
5 DataLink Layer 8-25
Random Access Protocols
When node has packet to send transmit at full channel data rate R no a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies
how to detect collisions how to recover from collisions (eg via delayed
retransmissions)
Examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA
5 DataLink Layer 8-26
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
5 DataLink Layer 8-27
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
5 DataLink Layer 8-28
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
5 DataLink Layer 8-29
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately
collision probability increases frame sent at t0 collides with other frames sent in [t0-
1t0+1]
5 DataLink Layer 8-30
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 n -gt infty
= 1(2e) = 18 Even worse
5 DataLink Layer 8-31
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
5 DataLink Layer 8-32
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
5 DataLink Layer 8-33
CSMA
1-persistent continuously senses the channel until itrsquos idle transmits whenever idle may still have collisions
nonpersistent if the channel is busy waits a random period time before
sensing it again transmits if idle
p-persistent for slotted channels if busy initially senses the channel again for the next slot
(like 1-persistent) if idle transmits with probability p (lt 1) (at the beginning
of the next slot) or defers with probability q = 1-p if it didnrsquot transmit senses the channel in the next slot if
idle again repeat the process (either transmits or defers) if busy waits a random period time before sensing it again (like non-persistent)
5 DataLink Layer 8-34
CSMA Performance
5 DataLink Layer 8-35
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short time colliding transmissions aborted reducing channel
wastage collision detection
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs receiver shut off while transmitting
human analogy the polite conversationalist
5 DataLink Layer 8-36
CSMACD collision detection
5 DataLink Layer 8-37
CSMACD Collision Detection Delay
One way propagation delay
5 DataLink Layer 8-38
ldquo Taking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocols efficient at low load single node can fully
utilize channel high load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
5 DataLink Layer 8-39
ldquo Taking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
5 DataLink Layer 8-40
Limited Contention ndash Adaptive Tree Walking
Slot 0 for all stations under node 1 Repeat if no collisionsbull Otherwise Slot 1 for those under node 2 (left subtree)bull If successful Slot 2 for those under node 3 (right subtree)bull Else Slot 2 for those under node 4 (the left sub-subtree)
5 DataLink Layer 8-41
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-18
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-19
Multiple Access Links and Protocols
Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) traditional Ethernet upstream HFC 80211 wireless LAN
5 DataLink Layer 8-20
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
interference collision if node receives two or more signals at the same
time
multiple access protocol distributed algorithm that determines how nodes
share channel ie determine when node can transmit
communication about channel sharing must use channel itself no out-of-band channel for coordination
5 DataLink Layer 8-21
Ideal Mulitple Access Protocol
Broadcast 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
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
5 DataLink Layer 8-22
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
5 DataLink Layer 8-23
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =
pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots
256 idle
5 DataLink Layer 8-24
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle example 6-station LAN 134 have pkt
frequency bands 256 idle
frequ
ency
bands time
5 DataLink Layer 8-25
Random Access Protocols
When node has packet to send transmit at full channel data rate R no a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies
how to detect collisions how to recover from collisions (eg via delayed
retransmissions)
Examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA
5 DataLink Layer 8-26
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
5 DataLink Layer 8-27
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
5 DataLink Layer 8-28
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
5 DataLink Layer 8-29
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately
collision probability increases frame sent at t0 collides with other frames sent in [t0-
1t0+1]
5 DataLink Layer 8-30
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 n -gt infty
= 1(2e) = 18 Even worse
5 DataLink Layer 8-31
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
5 DataLink Layer 8-32
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
5 DataLink Layer 8-33
CSMA
1-persistent continuously senses the channel until itrsquos idle transmits whenever idle may still have collisions
nonpersistent if the channel is busy waits a random period time before
sensing it again transmits if idle
p-persistent for slotted channels if busy initially senses the channel again for the next slot
(like 1-persistent) if idle transmits with probability p (lt 1) (at the beginning
of the next slot) or defers with probability q = 1-p if it didnrsquot transmit senses the channel in the next slot if
idle again repeat the process (either transmits or defers) if busy waits a random period time before sensing it again (like non-persistent)
5 DataLink Layer 8-34
CSMA Performance
5 DataLink Layer 8-35
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short time colliding transmissions aborted reducing channel
wastage collision detection
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs receiver shut off while transmitting
human analogy the polite conversationalist
5 DataLink Layer 8-36
CSMACD collision detection
5 DataLink Layer 8-37
CSMACD Collision Detection Delay
One way propagation delay
5 DataLink Layer 8-38
ldquo Taking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocols efficient at low load single node can fully
utilize channel high load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
5 DataLink Layer 8-39
ldquo Taking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
5 DataLink Layer 8-40
Limited Contention ndash Adaptive Tree Walking
Slot 0 for all stations under node 1 Repeat if no collisionsbull Otherwise Slot 1 for those under node 2 (left subtree)bull If successful Slot 2 for those under node 3 (right subtree)bull Else Slot 2 for those under node 4 (the left sub-subtree)
5 DataLink Layer 8-41
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-19
Multiple Access Links and Protocols
Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) traditional Ethernet upstream HFC 80211 wireless LAN
5 DataLink Layer 8-20
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
interference collision if node receives two or more signals at the same
time
multiple access protocol distributed algorithm that determines how nodes
share channel ie determine when node can transmit
communication about channel sharing must use channel itself no out-of-band channel for coordination
5 DataLink Layer 8-21
Ideal Mulitple Access Protocol
Broadcast 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
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
5 DataLink Layer 8-22
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
5 DataLink Layer 8-23
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =
pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots
256 idle
5 DataLink Layer 8-24
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle example 6-station LAN 134 have pkt
frequency bands 256 idle
frequ
ency
bands time
5 DataLink Layer 8-25
Random Access Protocols
When node has packet to send transmit at full channel data rate R no a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies
how to detect collisions how to recover from collisions (eg via delayed
retransmissions)
Examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA
5 DataLink Layer 8-26
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
5 DataLink Layer 8-27
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
5 DataLink Layer 8-28
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
5 DataLink Layer 8-29
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately
collision probability increases frame sent at t0 collides with other frames sent in [t0-
1t0+1]
5 DataLink Layer 8-30
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 n -gt infty
= 1(2e) = 18 Even worse
5 DataLink Layer 8-31
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
5 DataLink Layer 8-32
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
5 DataLink Layer 8-33
CSMA
1-persistent continuously senses the channel until itrsquos idle transmits whenever idle may still have collisions
nonpersistent if the channel is busy waits a random period time before
sensing it again transmits if idle
p-persistent for slotted channels if busy initially senses the channel again for the next slot
(like 1-persistent) if idle transmits with probability p (lt 1) (at the beginning
of the next slot) or defers with probability q = 1-p if it didnrsquot transmit senses the channel in the next slot if
idle again repeat the process (either transmits or defers) if busy waits a random period time before sensing it again (like non-persistent)
5 DataLink Layer 8-34
CSMA Performance
5 DataLink Layer 8-35
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short time colliding transmissions aborted reducing channel
wastage collision detection
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs receiver shut off while transmitting
human analogy the polite conversationalist
5 DataLink Layer 8-36
CSMACD collision detection
5 DataLink Layer 8-37
CSMACD Collision Detection Delay
One way propagation delay
5 DataLink Layer 8-38
ldquo Taking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocols efficient at low load single node can fully
utilize channel high load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
5 DataLink Layer 8-39
ldquo Taking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
5 DataLink Layer 8-40
Limited Contention ndash Adaptive Tree Walking
Slot 0 for all stations under node 1 Repeat if no collisionsbull Otherwise Slot 1 for those under node 2 (left subtree)bull If successful Slot 2 for those under node 3 (right subtree)bull Else Slot 2 for those under node 4 (the left sub-subtree)
5 DataLink Layer 8-41
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-20
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
interference collision if node receives two or more signals at the same
time
multiple access protocol distributed algorithm that determines how nodes
share channel ie determine when node can transmit
communication about channel sharing must use channel itself no out-of-band channel for coordination
5 DataLink Layer 8-21
Ideal Mulitple Access Protocol
Broadcast 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
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
5 DataLink Layer 8-22
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
5 DataLink Layer 8-23
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =
pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots
256 idle
5 DataLink Layer 8-24
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle example 6-station LAN 134 have pkt
frequency bands 256 idle
frequ
ency
bands time
5 DataLink Layer 8-25
Random Access Protocols
When node has packet to send transmit at full channel data rate R no a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies
how to detect collisions how to recover from collisions (eg via delayed
retransmissions)
Examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA
5 DataLink Layer 8-26
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
5 DataLink Layer 8-27
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
5 DataLink Layer 8-28
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
5 DataLink Layer 8-29
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately
collision probability increases frame sent at t0 collides with other frames sent in [t0-
1t0+1]
5 DataLink Layer 8-30
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 n -gt infty
= 1(2e) = 18 Even worse
5 DataLink Layer 8-31
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
5 DataLink Layer 8-32
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
5 DataLink Layer 8-33
CSMA
1-persistent continuously senses the channel until itrsquos idle transmits whenever idle may still have collisions
nonpersistent if the channel is busy waits a random period time before
sensing it again transmits if idle
p-persistent for slotted channels if busy initially senses the channel again for the next slot
(like 1-persistent) if idle transmits with probability p (lt 1) (at the beginning
of the next slot) or defers with probability q = 1-p if it didnrsquot transmit senses the channel in the next slot if
idle again repeat the process (either transmits or defers) if busy waits a random period time before sensing it again (like non-persistent)
5 DataLink Layer 8-34
CSMA Performance
5 DataLink Layer 8-35
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short time colliding transmissions aborted reducing channel
wastage collision detection
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs receiver shut off while transmitting
human analogy the polite conversationalist
5 DataLink Layer 8-36
CSMACD collision detection
5 DataLink Layer 8-37
CSMACD Collision Detection Delay
One way propagation delay
5 DataLink Layer 8-38
ldquo Taking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocols efficient at low load single node can fully
utilize channel high load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
5 DataLink Layer 8-39
ldquo Taking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
5 DataLink Layer 8-40
Limited Contention ndash Adaptive Tree Walking
Slot 0 for all stations under node 1 Repeat if no collisionsbull Otherwise Slot 1 for those under node 2 (left subtree)bull If successful Slot 2 for those under node 3 (right subtree)bull Else Slot 2 for those under node 4 (the left sub-subtree)
5 DataLink Layer 8-41
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-21
Ideal Mulitple Access Protocol
Broadcast 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
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
5 DataLink Layer 8-22
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
5 DataLink Layer 8-23
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =
pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots
256 idle
5 DataLink Layer 8-24
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle example 6-station LAN 134 have pkt
frequency bands 256 idle
frequ
ency
bands time
5 DataLink Layer 8-25
Random Access Protocols
When node has packet to send transmit at full channel data rate R no a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies
how to detect collisions how to recover from collisions (eg via delayed
retransmissions)
Examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA
5 DataLink Layer 8-26
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
5 DataLink Layer 8-27
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
5 DataLink Layer 8-28
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
5 DataLink Layer 8-29
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately
collision probability increases frame sent at t0 collides with other frames sent in [t0-
1t0+1]
5 DataLink Layer 8-30
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 n -gt infty
= 1(2e) = 18 Even worse
5 DataLink Layer 8-31
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
5 DataLink Layer 8-32
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
5 DataLink Layer 8-33
CSMA
1-persistent continuously senses the channel until itrsquos idle transmits whenever idle may still have collisions
nonpersistent if the channel is busy waits a random period time before
sensing it again transmits if idle
p-persistent for slotted channels if busy initially senses the channel again for the next slot
(like 1-persistent) if idle transmits with probability p (lt 1) (at the beginning
of the next slot) or defers with probability q = 1-p if it didnrsquot transmit senses the channel in the next slot if
idle again repeat the process (either transmits or defers) if busy waits a random period time before sensing it again (like non-persistent)
5 DataLink Layer 8-34
CSMA Performance
5 DataLink Layer 8-35
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short time colliding transmissions aborted reducing channel
wastage collision detection
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs receiver shut off while transmitting
human analogy the polite conversationalist
5 DataLink Layer 8-36
CSMACD collision detection
5 DataLink Layer 8-37
CSMACD Collision Detection Delay
One way propagation delay
5 DataLink Layer 8-38
ldquo Taking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocols efficient at low load single node can fully
utilize channel high load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
5 DataLink Layer 8-39
ldquo Taking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
5 DataLink Layer 8-40
Limited Contention ndash Adaptive Tree Walking
Slot 0 for all stations under node 1 Repeat if no collisionsbull Otherwise Slot 1 for those under node 2 (left subtree)bull If successful Slot 2 for those under node 3 (right subtree)bull Else Slot 2 for those under node 4 (the left sub-subtree)
5 DataLink Layer 8-41
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-22
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
5 DataLink Layer 8-23
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =
pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots
256 idle
5 DataLink Layer 8-24
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle example 6-station LAN 134 have pkt
frequency bands 256 idle
frequ
ency
bands time
5 DataLink Layer 8-25
Random Access Protocols
When node has packet to send transmit at full channel data rate R no a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies
how to detect collisions how to recover from collisions (eg via delayed
retransmissions)
Examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA
5 DataLink Layer 8-26
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
5 DataLink Layer 8-27
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
5 DataLink Layer 8-28
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
5 DataLink Layer 8-29
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately
collision probability increases frame sent at t0 collides with other frames sent in [t0-
1t0+1]
5 DataLink Layer 8-30
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 n -gt infty
= 1(2e) = 18 Even worse
5 DataLink Layer 8-31
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
5 DataLink Layer 8-32
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
5 DataLink Layer 8-33
CSMA
1-persistent continuously senses the channel until itrsquos idle transmits whenever idle may still have collisions
nonpersistent if the channel is busy waits a random period time before
sensing it again transmits if idle
p-persistent for slotted channels if busy initially senses the channel again for the next slot
(like 1-persistent) if idle transmits with probability p (lt 1) (at the beginning
of the next slot) or defers with probability q = 1-p if it didnrsquot transmit senses the channel in the next slot if
idle again repeat the process (either transmits or defers) if busy waits a random period time before sensing it again (like non-persistent)
5 DataLink Layer 8-34
CSMA Performance
5 DataLink Layer 8-35
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short time colliding transmissions aborted reducing channel
wastage collision detection
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs receiver shut off while transmitting
human analogy the polite conversationalist
5 DataLink Layer 8-36
CSMACD collision detection
5 DataLink Layer 8-37
CSMACD Collision Detection Delay
One way propagation delay
5 DataLink Layer 8-38
ldquo Taking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocols efficient at low load single node can fully
utilize channel high load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
5 DataLink Layer 8-39
ldquo Taking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
5 DataLink Layer 8-40
Limited Contention ndash Adaptive Tree Walking
Slot 0 for all stations under node 1 Repeat if no collisionsbull Otherwise Slot 1 for those under node 2 (left subtree)bull If successful Slot 2 for those under node 3 (right subtree)bull Else Slot 2 for those under node 4 (the left sub-subtree)
5 DataLink Layer 8-41
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-23
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =
pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots
256 idle
5 DataLink Layer 8-24
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle example 6-station LAN 134 have pkt
frequency bands 256 idle
frequ
ency
bands time
5 DataLink Layer 8-25
Random Access Protocols
When node has packet to send transmit at full channel data rate R no a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies
how to detect collisions how to recover from collisions (eg via delayed
retransmissions)
Examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA
5 DataLink Layer 8-26
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
5 DataLink Layer 8-27
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
5 DataLink Layer 8-28
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
5 DataLink Layer 8-29
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately
collision probability increases frame sent at t0 collides with other frames sent in [t0-
1t0+1]
5 DataLink Layer 8-30
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 n -gt infty
= 1(2e) = 18 Even worse
5 DataLink Layer 8-31
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
5 DataLink Layer 8-32
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
5 DataLink Layer 8-33
CSMA
1-persistent continuously senses the channel until itrsquos idle transmits whenever idle may still have collisions
nonpersistent if the channel is busy waits a random period time before
sensing it again transmits if idle
p-persistent for slotted channels if busy initially senses the channel again for the next slot
(like 1-persistent) if idle transmits with probability p (lt 1) (at the beginning
of the next slot) or defers with probability q = 1-p if it didnrsquot transmit senses the channel in the next slot if
idle again repeat the process (either transmits or defers) if busy waits a random period time before sensing it again (like non-persistent)
5 DataLink Layer 8-34
CSMA Performance
5 DataLink Layer 8-35
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short time colliding transmissions aborted reducing channel
wastage collision detection
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs receiver shut off while transmitting
human analogy the polite conversationalist
5 DataLink Layer 8-36
CSMACD collision detection
5 DataLink Layer 8-37
CSMACD Collision Detection Delay
One way propagation delay
5 DataLink Layer 8-38
ldquo Taking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocols efficient at low load single node can fully
utilize channel high load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
5 DataLink Layer 8-39
ldquo Taking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
5 DataLink Layer 8-40
Limited Contention ndash Adaptive Tree Walking
Slot 0 for all stations under node 1 Repeat if no collisionsbull Otherwise Slot 1 for those under node 2 (left subtree)bull If successful Slot 2 for those under node 3 (right subtree)bull Else Slot 2 for those under node 4 (the left sub-subtree)
5 DataLink Layer 8-41
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-24
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle example 6-station LAN 134 have pkt
frequency bands 256 idle
frequ
ency
bands time
5 DataLink Layer 8-25
Random Access Protocols
When node has packet to send transmit at full channel data rate R no a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies
how to detect collisions how to recover from collisions (eg via delayed
retransmissions)
Examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA
5 DataLink Layer 8-26
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
5 DataLink Layer 8-27
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
5 DataLink Layer 8-28
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
5 DataLink Layer 8-29
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately
collision probability increases frame sent at t0 collides with other frames sent in [t0-
1t0+1]
5 DataLink Layer 8-30
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 n -gt infty
= 1(2e) = 18 Even worse
5 DataLink Layer 8-31
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
5 DataLink Layer 8-32
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
5 DataLink Layer 8-33
CSMA
1-persistent continuously senses the channel until itrsquos idle transmits whenever idle may still have collisions
nonpersistent if the channel is busy waits a random period time before
sensing it again transmits if idle
p-persistent for slotted channels if busy initially senses the channel again for the next slot
(like 1-persistent) if idle transmits with probability p (lt 1) (at the beginning
of the next slot) or defers with probability q = 1-p if it didnrsquot transmit senses the channel in the next slot if
idle again repeat the process (either transmits or defers) if busy waits a random period time before sensing it again (like non-persistent)
5 DataLink Layer 8-34
CSMA Performance
5 DataLink Layer 8-35
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short time colliding transmissions aborted reducing channel
wastage collision detection
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs receiver shut off while transmitting
human analogy the polite conversationalist
5 DataLink Layer 8-36
CSMACD collision detection
5 DataLink Layer 8-37
CSMACD Collision Detection Delay
One way propagation delay
5 DataLink Layer 8-38
ldquo Taking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocols efficient at low load single node can fully
utilize channel high load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
5 DataLink Layer 8-39
ldquo Taking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
5 DataLink Layer 8-40
Limited Contention ndash Adaptive Tree Walking
Slot 0 for all stations under node 1 Repeat if no collisionsbull Otherwise Slot 1 for those under node 2 (left subtree)bull If successful Slot 2 for those under node 3 (right subtree)bull Else Slot 2 for those under node 4 (the left sub-subtree)
5 DataLink Layer 8-41
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-25
Random Access Protocols
When node has packet to send transmit at full channel data rate R no a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies
how to detect collisions how to recover from collisions (eg via delayed
retransmissions)
Examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA
5 DataLink Layer 8-26
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
5 DataLink Layer 8-27
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
5 DataLink Layer 8-28
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
5 DataLink Layer 8-29
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately
collision probability increases frame sent at t0 collides with other frames sent in [t0-
1t0+1]
5 DataLink Layer 8-30
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 n -gt infty
= 1(2e) = 18 Even worse
5 DataLink Layer 8-31
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
5 DataLink Layer 8-32
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
5 DataLink Layer 8-33
CSMA
1-persistent continuously senses the channel until itrsquos idle transmits whenever idle may still have collisions
nonpersistent if the channel is busy waits a random period time before
sensing it again transmits if idle
p-persistent for slotted channels if busy initially senses the channel again for the next slot
(like 1-persistent) if idle transmits with probability p (lt 1) (at the beginning
of the next slot) or defers with probability q = 1-p if it didnrsquot transmit senses the channel in the next slot if
idle again repeat the process (either transmits or defers) if busy waits a random period time before sensing it again (like non-persistent)
5 DataLink Layer 8-34
CSMA Performance
5 DataLink Layer 8-35
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short time colliding transmissions aborted reducing channel
wastage collision detection
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs receiver shut off while transmitting
human analogy the polite conversationalist
5 DataLink Layer 8-36
CSMACD collision detection
5 DataLink Layer 8-37
CSMACD Collision Detection Delay
One way propagation delay
5 DataLink Layer 8-38
ldquo Taking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocols efficient at low load single node can fully
utilize channel high load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
5 DataLink Layer 8-39
ldquo Taking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
5 DataLink Layer 8-40
Limited Contention ndash Adaptive Tree Walking
Slot 0 for all stations under node 1 Repeat if no collisionsbull Otherwise Slot 1 for those under node 2 (left subtree)bull If successful Slot 2 for those under node 3 (right subtree)bull Else Slot 2 for those under node 4 (the left sub-subtree)
5 DataLink Layer 8-41
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-26
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
5 DataLink Layer 8-27
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
5 DataLink Layer 8-28
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
5 DataLink Layer 8-29
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately
collision probability increases frame sent at t0 collides with other frames sent in [t0-
1t0+1]
5 DataLink Layer 8-30
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 n -gt infty
= 1(2e) = 18 Even worse
5 DataLink Layer 8-31
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
5 DataLink Layer 8-32
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
5 DataLink Layer 8-33
CSMA
1-persistent continuously senses the channel until itrsquos idle transmits whenever idle may still have collisions
nonpersistent if the channel is busy waits a random period time before
sensing it again transmits if idle
p-persistent for slotted channels if busy initially senses the channel again for the next slot
(like 1-persistent) if idle transmits with probability p (lt 1) (at the beginning
of the next slot) or defers with probability q = 1-p if it didnrsquot transmit senses the channel in the next slot if
idle again repeat the process (either transmits or defers) if busy waits a random period time before sensing it again (like non-persistent)
5 DataLink Layer 8-34
CSMA Performance
5 DataLink Layer 8-35
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short time colliding transmissions aborted reducing channel
wastage collision detection
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs receiver shut off while transmitting
human analogy the polite conversationalist
5 DataLink Layer 8-36
CSMACD collision detection
5 DataLink Layer 8-37
CSMACD Collision Detection Delay
One way propagation delay
5 DataLink Layer 8-38
ldquo Taking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocols efficient at low load single node can fully
utilize channel high load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
5 DataLink Layer 8-39
ldquo Taking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
5 DataLink Layer 8-40
Limited Contention ndash Adaptive Tree Walking
Slot 0 for all stations under node 1 Repeat if no collisionsbull Otherwise Slot 1 for those under node 2 (left subtree)bull If successful Slot 2 for those under node 3 (right subtree)bull Else Slot 2 for those under node 4 (the left sub-subtree)
5 DataLink Layer 8-41
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-27
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
5 DataLink Layer 8-28
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
5 DataLink Layer 8-29
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately
collision probability increases frame sent at t0 collides with other frames sent in [t0-
1t0+1]
5 DataLink Layer 8-30
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 n -gt infty
= 1(2e) = 18 Even worse
5 DataLink Layer 8-31
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
5 DataLink Layer 8-32
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
5 DataLink Layer 8-33
CSMA
1-persistent continuously senses the channel until itrsquos idle transmits whenever idle may still have collisions
nonpersistent if the channel is busy waits a random period time before
sensing it again transmits if idle
p-persistent for slotted channels if busy initially senses the channel again for the next slot
(like 1-persistent) if idle transmits with probability p (lt 1) (at the beginning
of the next slot) or defers with probability q = 1-p if it didnrsquot transmit senses the channel in the next slot if
idle again repeat the process (either transmits or defers) if busy waits a random period time before sensing it again (like non-persistent)
5 DataLink Layer 8-34
CSMA Performance
5 DataLink Layer 8-35
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short time colliding transmissions aborted reducing channel
wastage collision detection
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs receiver shut off while transmitting
human analogy the polite conversationalist
5 DataLink Layer 8-36
CSMACD collision detection
5 DataLink Layer 8-37
CSMACD Collision Detection Delay
One way propagation delay
5 DataLink Layer 8-38
ldquo Taking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocols efficient at low load single node can fully
utilize channel high load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
5 DataLink Layer 8-39
ldquo Taking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
5 DataLink Layer 8-40
Limited Contention ndash Adaptive Tree Walking
Slot 0 for all stations under node 1 Repeat if no collisionsbull Otherwise Slot 1 for those under node 2 (left subtree)bull If successful Slot 2 for those under node 3 (right subtree)bull Else Slot 2 for those under node 4 (the left sub-subtree)
5 DataLink Layer 8-41
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-28
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
5 DataLink Layer 8-29
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately
collision probability increases frame sent at t0 collides with other frames sent in [t0-
1t0+1]
5 DataLink Layer 8-30
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 n -gt infty
= 1(2e) = 18 Even worse
5 DataLink Layer 8-31
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
5 DataLink Layer 8-32
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
5 DataLink Layer 8-33
CSMA
1-persistent continuously senses the channel until itrsquos idle transmits whenever idle may still have collisions
nonpersistent if the channel is busy waits a random period time before
sensing it again transmits if idle
p-persistent for slotted channels if busy initially senses the channel again for the next slot
(like 1-persistent) if idle transmits with probability p (lt 1) (at the beginning
of the next slot) or defers with probability q = 1-p if it didnrsquot transmit senses the channel in the next slot if
idle again repeat the process (either transmits or defers) if busy waits a random period time before sensing it again (like non-persistent)
5 DataLink Layer 8-34
CSMA Performance
5 DataLink Layer 8-35
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short time colliding transmissions aborted reducing channel
wastage collision detection
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs receiver shut off while transmitting
human analogy the polite conversationalist
5 DataLink Layer 8-36
CSMACD collision detection
5 DataLink Layer 8-37
CSMACD Collision Detection Delay
One way propagation delay
5 DataLink Layer 8-38
ldquo Taking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocols efficient at low load single node can fully
utilize channel high load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
5 DataLink Layer 8-39
ldquo Taking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
5 DataLink Layer 8-40
Limited Contention ndash Adaptive Tree Walking
Slot 0 for all stations under node 1 Repeat if no collisionsbull Otherwise Slot 1 for those under node 2 (left subtree)bull If successful Slot 2 for those under node 3 (right subtree)bull Else Slot 2 for those under node 4 (the left sub-subtree)
5 DataLink Layer 8-41
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-29
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately
collision probability increases frame sent at t0 collides with other frames sent in [t0-
1t0+1]
5 DataLink Layer 8-30
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 n -gt infty
= 1(2e) = 18 Even worse
5 DataLink Layer 8-31
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
5 DataLink Layer 8-32
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
5 DataLink Layer 8-33
CSMA
1-persistent continuously senses the channel until itrsquos idle transmits whenever idle may still have collisions
nonpersistent if the channel is busy waits a random period time before
sensing it again transmits if idle
p-persistent for slotted channels if busy initially senses the channel again for the next slot
(like 1-persistent) if idle transmits with probability p (lt 1) (at the beginning
of the next slot) or defers with probability q = 1-p if it didnrsquot transmit senses the channel in the next slot if
idle again repeat the process (either transmits or defers) if busy waits a random period time before sensing it again (like non-persistent)
5 DataLink Layer 8-34
CSMA Performance
5 DataLink Layer 8-35
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short time colliding transmissions aborted reducing channel
wastage collision detection
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs receiver shut off while transmitting
human analogy the polite conversationalist
5 DataLink Layer 8-36
CSMACD collision detection
5 DataLink Layer 8-37
CSMACD Collision Detection Delay
One way propagation delay
5 DataLink Layer 8-38
ldquo Taking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocols efficient at low load single node can fully
utilize channel high load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
5 DataLink Layer 8-39
ldquo Taking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
5 DataLink Layer 8-40
Limited Contention ndash Adaptive Tree Walking
Slot 0 for all stations under node 1 Repeat if no collisionsbull Otherwise Slot 1 for those under node 2 (left subtree)bull If successful Slot 2 for those under node 3 (right subtree)bull Else Slot 2 for those under node 4 (the left sub-subtree)
5 DataLink Layer 8-41
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-30
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 n -gt infty
= 1(2e) = 18 Even worse
5 DataLink Layer 8-31
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
5 DataLink Layer 8-32
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
5 DataLink Layer 8-33
CSMA
1-persistent continuously senses the channel until itrsquos idle transmits whenever idle may still have collisions
nonpersistent if the channel is busy waits a random period time before
sensing it again transmits if idle
p-persistent for slotted channels if busy initially senses the channel again for the next slot
(like 1-persistent) if idle transmits with probability p (lt 1) (at the beginning
of the next slot) or defers with probability q = 1-p if it didnrsquot transmit senses the channel in the next slot if
idle again repeat the process (either transmits or defers) if busy waits a random period time before sensing it again (like non-persistent)
5 DataLink Layer 8-34
CSMA Performance
5 DataLink Layer 8-35
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short time colliding transmissions aborted reducing channel
wastage collision detection
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs receiver shut off while transmitting
human analogy the polite conversationalist
5 DataLink Layer 8-36
CSMACD collision detection
5 DataLink Layer 8-37
CSMACD Collision Detection Delay
One way propagation delay
5 DataLink Layer 8-38
ldquo Taking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocols efficient at low load single node can fully
utilize channel high load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
5 DataLink Layer 8-39
ldquo Taking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
5 DataLink Layer 8-40
Limited Contention ndash Adaptive Tree Walking
Slot 0 for all stations under node 1 Repeat if no collisionsbull Otherwise Slot 1 for those under node 2 (left subtree)bull If successful Slot 2 for those under node 3 (right subtree)bull Else Slot 2 for those under node 4 (the left sub-subtree)
5 DataLink Layer 8-41
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-31
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
5 DataLink Layer 8-32
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
5 DataLink Layer 8-33
CSMA
1-persistent continuously senses the channel until itrsquos idle transmits whenever idle may still have collisions
nonpersistent if the channel is busy waits a random period time before
sensing it again transmits if idle
p-persistent for slotted channels if busy initially senses the channel again for the next slot
(like 1-persistent) if idle transmits with probability p (lt 1) (at the beginning
of the next slot) or defers with probability q = 1-p if it didnrsquot transmit senses the channel in the next slot if
idle again repeat the process (either transmits or defers) if busy waits a random period time before sensing it again (like non-persistent)
5 DataLink Layer 8-34
CSMA Performance
5 DataLink Layer 8-35
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short time colliding transmissions aborted reducing channel
wastage collision detection
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs receiver shut off while transmitting
human analogy the polite conversationalist
5 DataLink Layer 8-36
CSMACD collision detection
5 DataLink Layer 8-37
CSMACD Collision Detection Delay
One way propagation delay
5 DataLink Layer 8-38
ldquo Taking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocols efficient at low load single node can fully
utilize channel high load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
5 DataLink Layer 8-39
ldquo Taking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
5 DataLink Layer 8-40
Limited Contention ndash Adaptive Tree Walking
Slot 0 for all stations under node 1 Repeat if no collisionsbull Otherwise Slot 1 for those under node 2 (left subtree)bull If successful Slot 2 for those under node 3 (right subtree)bull Else Slot 2 for those under node 4 (the left sub-subtree)
5 DataLink Layer 8-41
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-32
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
5 DataLink Layer 8-33
CSMA
1-persistent continuously senses the channel until itrsquos idle transmits whenever idle may still have collisions
nonpersistent if the channel is busy waits a random period time before
sensing it again transmits if idle
p-persistent for slotted channels if busy initially senses the channel again for the next slot
(like 1-persistent) if idle transmits with probability p (lt 1) (at the beginning
of the next slot) or defers with probability q = 1-p if it didnrsquot transmit senses the channel in the next slot if
idle again repeat the process (either transmits or defers) if busy waits a random period time before sensing it again (like non-persistent)
5 DataLink Layer 8-34
CSMA Performance
5 DataLink Layer 8-35
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short time colliding transmissions aborted reducing channel
wastage collision detection
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs receiver shut off while transmitting
human analogy the polite conversationalist
5 DataLink Layer 8-36
CSMACD collision detection
5 DataLink Layer 8-37
CSMACD Collision Detection Delay
One way propagation delay
5 DataLink Layer 8-38
ldquo Taking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocols efficient at low load single node can fully
utilize channel high load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
5 DataLink Layer 8-39
ldquo Taking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
5 DataLink Layer 8-40
Limited Contention ndash Adaptive Tree Walking
Slot 0 for all stations under node 1 Repeat if no collisionsbull Otherwise Slot 1 for those under node 2 (left subtree)bull If successful Slot 2 for those under node 3 (right subtree)bull Else Slot 2 for those under node 4 (the left sub-subtree)
5 DataLink Layer 8-41
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-33
CSMA
1-persistent continuously senses the channel until itrsquos idle transmits whenever idle may still have collisions
nonpersistent if the channel is busy waits a random period time before
sensing it again transmits if idle
p-persistent for slotted channels if busy initially senses the channel again for the next slot
(like 1-persistent) if idle transmits with probability p (lt 1) (at the beginning
of the next slot) or defers with probability q = 1-p if it didnrsquot transmit senses the channel in the next slot if
idle again repeat the process (either transmits or defers) if busy waits a random period time before sensing it again (like non-persistent)
5 DataLink Layer 8-34
CSMA Performance
5 DataLink Layer 8-35
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short time colliding transmissions aborted reducing channel
wastage collision detection
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs receiver shut off while transmitting
human analogy the polite conversationalist
5 DataLink Layer 8-36
CSMACD collision detection
5 DataLink Layer 8-37
CSMACD Collision Detection Delay
One way propagation delay
5 DataLink Layer 8-38
ldquo Taking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocols efficient at low load single node can fully
utilize channel high load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
5 DataLink Layer 8-39
ldquo Taking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
5 DataLink Layer 8-40
Limited Contention ndash Adaptive Tree Walking
Slot 0 for all stations under node 1 Repeat if no collisionsbull Otherwise Slot 1 for those under node 2 (left subtree)bull If successful Slot 2 for those under node 3 (right subtree)bull Else Slot 2 for those under node 4 (the left sub-subtree)
5 DataLink Layer 8-41
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-34
CSMA Performance
5 DataLink Layer 8-35
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short time colliding transmissions aborted reducing channel
wastage collision detection
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs receiver shut off while transmitting
human analogy the polite conversationalist
5 DataLink Layer 8-36
CSMACD collision detection
5 DataLink Layer 8-37
CSMACD Collision Detection Delay
One way propagation delay
5 DataLink Layer 8-38
ldquo Taking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocols efficient at low load single node can fully
utilize channel high load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
5 DataLink Layer 8-39
ldquo Taking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
5 DataLink Layer 8-40
Limited Contention ndash Adaptive Tree Walking
Slot 0 for all stations under node 1 Repeat if no collisionsbull Otherwise Slot 1 for those under node 2 (left subtree)bull If successful Slot 2 for those under node 3 (right subtree)bull Else Slot 2 for those under node 4 (the left sub-subtree)
5 DataLink Layer 8-41
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-35
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short time colliding transmissions aborted reducing channel
wastage collision detection
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs receiver shut off while transmitting
human analogy the polite conversationalist
5 DataLink Layer 8-36
CSMACD collision detection
5 DataLink Layer 8-37
CSMACD Collision Detection Delay
One way propagation delay
5 DataLink Layer 8-38
ldquo Taking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocols efficient at low load single node can fully
utilize channel high load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
5 DataLink Layer 8-39
ldquo Taking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
5 DataLink Layer 8-40
Limited Contention ndash Adaptive Tree Walking
Slot 0 for all stations under node 1 Repeat if no collisionsbull Otherwise Slot 1 for those under node 2 (left subtree)bull If successful Slot 2 for those under node 3 (right subtree)bull Else Slot 2 for those under node 4 (the left sub-subtree)
5 DataLink Layer 8-41
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-36
CSMACD collision detection
5 DataLink Layer 8-37
CSMACD Collision Detection Delay
One way propagation delay
5 DataLink Layer 8-38
ldquo Taking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocols efficient at low load single node can fully
utilize channel high load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
5 DataLink Layer 8-39
ldquo Taking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
5 DataLink Layer 8-40
Limited Contention ndash Adaptive Tree Walking
Slot 0 for all stations under node 1 Repeat if no collisionsbull Otherwise Slot 1 for those under node 2 (left subtree)bull If successful Slot 2 for those under node 3 (right subtree)bull Else Slot 2 for those under node 4 (the left sub-subtree)
5 DataLink Layer 8-41
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-37
CSMACD Collision Detection Delay
One way propagation delay
5 DataLink Layer 8-38
ldquo Taking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocols efficient at low load single node can fully
utilize channel high load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
5 DataLink Layer 8-39
ldquo Taking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
5 DataLink Layer 8-40
Limited Contention ndash Adaptive Tree Walking
Slot 0 for all stations under node 1 Repeat if no collisionsbull Otherwise Slot 1 for those under node 2 (left subtree)bull If successful Slot 2 for those under node 3 (right subtree)bull Else Slot 2 for those under node 4 (the left sub-subtree)
5 DataLink Layer 8-41
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-38
ldquo Taking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocols efficient at low load single node can fully
utilize channel high load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
5 DataLink Layer 8-39
ldquo Taking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
5 DataLink Layer 8-40
Limited Contention ndash Adaptive Tree Walking
Slot 0 for all stations under node 1 Repeat if no collisionsbull Otherwise Slot 1 for those under node 2 (left subtree)bull If successful Slot 2 for those under node 3 (right subtree)bull Else Slot 2 for those under node 4 (the left sub-subtree)
5 DataLink Layer 8-41
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-39
ldquo Taking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
5 DataLink Layer 8-40
Limited Contention ndash Adaptive Tree Walking
Slot 0 for all stations under node 1 Repeat if no collisionsbull Otherwise Slot 1 for those under node 2 (left subtree)bull If successful Slot 2 for those under node 3 (right subtree)bull Else Slot 2 for those under node 4 (the left sub-subtree)
5 DataLink Layer 8-41
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-40
Limited Contention ndash Adaptive Tree Walking
Slot 0 for all stations under node 1 Repeat if no collisionsbull Otherwise Slot 1 for those under node 2 (left subtree)bull If successful Slot 2 for those under node 3 (right subtree)bull Else Slot 2 for those under node 4 (the left sub-subtree)
5 DataLink Layer 8-41
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-41
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-42
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-43
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-44
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-45
LAN Addresses and ARPEach 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)
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-46
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-47
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of a host 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
237196723
237196778
237196714
237196788
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-48
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-49
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
In routing table at source Host A find router R 111111111110
In ARP table at source find Rrsquos MAC address E6-E9-00-17-BB-4B etc
A RB
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-50
A creates datagram with source A destination B A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to
B
A
RB
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-51
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-52
Ethernet
ldquo dominantrdquo wired LAN (and MAN) technology cheap (lt ) $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-53
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-54
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011 used to synchronize receiver sender clock
rates
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-55
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error cannot be recovered the frame is simply dropped
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-56
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-57
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-58
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the m-th collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-59
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-60
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame (with max data)
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-61
Ethernet Performance
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 5-62
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100
Mbps 1Gbps 10G bps different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-63
10BaseT and 100BaseT 10100 Mbps rate latter called ldquofast ethernetrdquo T stands for Twisted Pair Nodes connect to a hub ldquostar topologyrdquo 100
m max distance between nodes and hub
twisted pair
hub
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-64
Manchester encoding
Used in 10BaseT Each bit has a transition Allows clocks in sending and receiving nodes to
synchronize to each other no need for a centralized global clock among nodes
Hey this is physical-layer stuff
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-65
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared
broadcast channels in shared mode CSMACD is used short
distances between nodes required for efficiency uses hubs called here ldquoBuffered Distributorsrdquo Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now and going for 100Gbps (and
1Tbps) soon
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-66
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-67
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 5-68
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 5-69
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and B-
to-Brsquo simultaneously without collisions not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 5-70
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 5-71
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
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
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 5-72
Switch frame filteringforwardingWhen 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
forward on all but the interface on which the frame arrived
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 5-73
Self-learning forwarding example
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 Arsquo unknownFlood but learns about A
Arsquo A
destination A location now known
Arsquo 4 60
selective sendlearns about Arsquo
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 5-74
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-75
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-76
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 8-77
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 5-78
VLANs motivation
What happens if CS user moves office to
EE but wants connect to CS switch
single broadcast domain all layer-2 broadcast
traffic (ARP DHCP) crosses entire LAN (securityprivacy efficiency issues)
each lowest level switch has only few ports in use
Computer Science Electrical
Engineering
ComputerEngineering
Whatrsquos wrong with this picture
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 5-79
VLANs Port-based VLAN switch ports grouped (by switch management software) so that single physical switch helliphellip
Switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over single physical LAN infrastructure
Virtual Local Area Network
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
Electrical Engineering(VLAN ports 1-8)
hellip
1
82
7 9
1610
15
hellip
Computer Science(VLAN ports 9-16)
hellip operates as multiple virtual switches
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 5-80
Port-based VLAN
1
8
9
16102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
traffic isolation frames tofrom ports 1-8 can only reach ports 1-8 can also define VLAN based on
MAC addresses of endpoints rather than switch port
dynamic membership ports can be dynamically assigned among VLANs
router
forwarding between VLANS done via routing (just as with separate switches) in practice vendors sell
combined switches plus routers
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 5-81
VLANS spanning multiple switches
trunk port carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches canrsquot be
vanilla 8021 frames (must carry VLAN ID info) 8021q protocol addsremoved additional header fields
for frames forwarded between trunk ports
1
8
9
102
7
hellip
Electrical Engineering(VLAN ports 1-8)
Computer Science(VLAN ports 9-15)
15
hellip
2
73
Ports 235 belong to EE VLANPorts 4678 belong to CS VLAN
5
4 6 816
1
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame
5 DataLink Layer 5-82
Type
2-byte Tag Protocol Identifier (value 81-00)
Tag Control Information (12 bit VLAN ID field
3 bit priority field like IP TOS)
Recomputed CRC
8021Q VLAN frame format
8021 frame
8021Q frame