Summary of Link Layer Concepts
-
Upload
johnsondon -
Category
Documents
-
view
1.317 -
download
0
description
Transcript of Summary of Link Layer Concepts
copy Kemal Akkaya
Department of Computer ScienceSouthern Illinois University Carbondale
CS441 ndash Mobile amp Wireless ComputingOverview of Computer NetworkingData Link Layer of TCPIP Model
Computer Networking A Top Down Approach Featuring the
Internet 3rd edition
Jim Kurose Keith RossAddison-Wesley July 2004
Thanks to
Computer Networks 4th edition
Andrew S Tanenbaum
Prentice-Hall PTR
Data andComputerCommunications7th edition William Stallings
Prentice-Hall PTR
copy Kemal Akkaya
Link Layer Introduction What is Data Link Layer in
TCPIP Reference Model Also called Point-to-Point Protocol amp
Medium Access Layer (MAC) Some 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
ldquolinkrdquo
Data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
copy Kemal Akkaya
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 Princeton to Lausanne
limo Princeton to JFK plane JFK to Geneva train Geneva to Lausanne
Tourist = datagram Transport segment = communication link Transportation mode = link layer protocol Travel agent = routing algorithm
copy Kemal Akkaya
Link Layer Services Framing link access
Encapsulate datagram into frame adding header trailer Channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify source dest
Different from IP address
Reliable delivery between adjacent nodes Seldom used on low bit error link (fiber some twisted pair) Wireless links high error rates
Q why both link-level and end-end reliability
Flow Control Pacing between adjacent sending and receiving nodes
Error Detection Errors caused by signal attenuation noise Receiver detects presence of errors
Signals sender for retransmission or drops 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
copy Kemal Akkaya
Adaptors Communicating
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
receiving node
Adapter is semi-autonomous
Link amp physical layers
sendingnode
frame
receivingnode
datagram
frame
adapter adapter
link layer protocol
copy Kemal Akkaya
Link Layer - Outline
Flow Control
Error detection
Error correction
Multiple access protocols
Link-Layer Addressing
Ethernet
HDLC amp PPP
copy Kemal Akkaya
Flow Control The Data Link Layer also provides Flow Control What is Flow Control
Ensuring the sending entity does not overwhelm the receiving entity Preventing buffer overflow
One Solution Stop and Wait Flow Control Source transmits frame Destination receives frame and replies with acknowledgement Source waits for ACK before sending next frame Destination can stop flow by not sending ACK Works well for a few large frames
BUT Large block of data may be split into small frames Limited buffer size Errors detected sooner (when whole frame received) On error retransmission of smaller frames is needed Prevents one station occupying medium for long periods
Stop and wait becomes inadequate Link Utilization
copy Kemal Akkaya
Stop and Wait Link Utilization
Transmission time =1 Propagation time = a
copy Kemal Akkaya
Sliding Windows Flow Control Allow multiple frames to be in transit Receiver has buffer W long Transmitter can send up to W frames without ACK Each frame is numbered ACK includes number of next frame expected Sequence number bounded by size of field (k)
Frames are numbered modulo 2k
Enhancements Receiver can acknowledge frames without permitting
further transmission (Receive Not Ready) Must send a normal acknowledge to resume If duplex use piggybacking
If no data to send use acknowledgement frame If data but no acknowledgement to send send last acknowledgement
number again or have ACK valid flag (TCP)
copy Kemal Akkaya
Sliding Windows Diagram
copy Kemal Akkaya
Example
copy Kemal Akkaya
Error DetectionEDC = Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
Error detection not 100 reliable Protocol may miss some errors but rarely Larger EDC field yields better detection and correction
copy Kemal Akkaya
Parity Checking Single Bit Parity
Detect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
Internet Checksum Detect ldquoerrorsrdquo (eg flipped bits)
in transmitted segment (note used at transport layer only) 00
Sender Treat segment contents as sequence of 16-bit integers Checksum addition (1rsquos complement sum) of segment contents Sender puts checksum value into UDP checksum field
Receiver Compute checksum of received segment Check if computed checksum equals checksum field value NO - error detected YES - no error
copy Kemal Akkaya
Cyclic Redundancy Check View data bits D as a binary number Choose r+1 bit pattern (generator) G Goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) Receiver knows G divides ltDRgt by G If non-zero remainder error
detected Can detect all burst errors less than r+1 bits
Widely used in practice (ATM HDCL)
copy Kemal Akkaya
CRC Example
WantD2r XOR R = nG
EquivalentlyD2r = nG XOR R
Equivalently
If we divide D2r by G want remainder R
R = remainder[ ]D2r
G
copy Kemal Akkaya
Error Correction
Detection and correction of errors due to Lost frames Damaged frames Underlying channel can lose the frames or can be garbled
Solution at the Link Layer Automatic repeat request Error detection Positive acknowledgment Retransmission after timeout Negative acknowledgement and retransmission
Automatic Repeat Request (ARQ) methods Stop and wait Go back N Selective reject (selective retransmission)
copy Kemal Akkaya
Stop and Wait ARQ Source transmits single
frame Wait for ACK If received frame damaged
discard it Transmitter has timeout If no ACK within timeout
retransmit
If ACK damaged transmitter will not recognize it Transmitter will retransmit Receive gets two copies of frame Use ACK0 and ACK1
Simple but inefficient
copy Kemal Akkaya
More efficient method Go-back-N Based on sliding window If no error ACK as usual with next frame expected Use window to control number of outstanding frames If error reply with rejection
Discard that frame and all future frames until error frame received correctly
Transmitter must go back and retransmit that frame and all subsequent frames
Handling Damaged Frame Receiver detects error in frame i Receiver sends rejection-i Transmitter gets rejection-i Transmitter retransmits frame i and all subsequent
copy Kemal Akkaya
Go-back-N Handling Lost Frame First Approach
Frame i lost Transmitter sends i+1 Receiver gets frame i+1 out of sequence Receiver send reject i Transmitter goes back to frame i and retransmits
Second Approach Frame i lost and no additional frame sent Receiver gets nothing and returns neither acknowledgement nor
rejection Transmitter times out and sends acknowledgement frame with P bit
set to 1 Receiver interprets this as command which it acknowledges with the
number of the next frame it expects (frame i ) Transmitter then retransmits frame i
copy Kemal Akkaya
Go-back-N Damaged ACK
Receiver gets frame i and send acknowledgement (i+1) which is lost
Acknowledgements are cumulative so next acknowledgement (i+n) may arrive before transmitter times out on frame i
If transmitter times out it sends acknowledgement with P bit set as before
This can be repeated a number of times before a reset procedure is initiated
Damaged Rejection Same as Lost Frame (2)
copy Kemal Akkaya
Selective Reject
Also called selective retransmission
Only rejected frames are retransmitted
Subsequent frames are accepted by the receiver and buffered
Minimizes retransmission Receiver must maintain
large enough buffer More complex login in
transmitter
copy Kemal Akkaya
Multiple Access Links and ProtocolsTwo 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
copy Kemal Akkaya
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
Ideal Multiple Access Protocol When one node wants to transmit it can send at rate R When M nodes want to transmit each can send at average rate RM Fully decentralized
No special node to coordinate transmissions No synchronization of clocks slots
Simple
copy Kemal Akkaya
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 Nodes with more to send can take longer turns
copy Kemal Akkaya
Channel Partitioning MAC protocols TDMA
TDMA Time division multiple access Access to channel in rounds Each station gets fixed length slot
Length = packet transmission time in each round
Unused slots go idle Example 6-station LAN
134 have packet Slots 256 idle
copy Kemal Akkaya
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 packet frequency
bands 256 idle
frequ
ency
bands time
1
2
3
4
5
6
copy Kemal Akkaya
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 Carrier Sense Multiple Access (CSMA) CSMACollision Detection (CD) CSMACollision Avoidance (CA)
copy Kemal Akkaya
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
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
copy Kemal Akkaya
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]
Even worse than slotted ALOHA
copy Kemal Akkaya
Collisions can still occur Propagation delay means two nodes may not hear each otherrsquos transmission Entire packet transmission time wasted Role of distance amp propagation delay in determining collision probability spatial layout of nodes
Idea listen before transmit If channel sensed idle
transmit entire frame If channel sensed busy defer
transmission Human analogy donrsquot
interrupt others
CSMA (Carrier Sense Multiple Access)
copy Kemal Akkaya
CSMACD (Collision Detection)
CSMACD carrier sensing deferral as in CSMA Collisions detected within short
time Send jam sequence 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
copy Kemal Akkaya
ldquoTaking Turnsrdquo MAC protocols Channel 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 protocols Look for best of both worlds
Two implementations Polling Token
copy Kemal Akkaya
ldquoTaking 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)
copy Kemal Akkaya
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or code
Time Division Frequency Division
Random partitioning (dynamic) ALOHA S-ALOHA CSMA CSMACD Carrier sensing easy in some technologies (wire) hard in others
(wireless) CSMACD used in Ethernet CSMACA used in 80211
Taking Turns Polling from a central site token passing
copy Kemal Akkaya
LAN technologies
Data link layer so farServicesError detectioncorrectionMultiple access
Next LAN technologiesAddressingEthernetHubs switchesPPP
copy Kemal Akkaya
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
Find your PCrsquos MAC 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(wired orwireless)
Each adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF = adapter
copy Kemal Akkaya
MAC 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
copy Kemal Akkaya
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 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
copy Kemal Akkaya
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
copy Kemal Akkaya
Routing to another LAN Walkthrough send datagram from A to B via R
Assume A knows B IP address
Two ARP tables in router R one for each IP network (LAN) In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110
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
copy Kemal Akkaya
A
R
B
Routing to another LAN
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
Link Layer Introduction What is Data Link Layer in
TCPIP Reference Model Also called Point-to-Point Protocol amp
Medium Access Layer (MAC) Some 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
ldquolinkrdquo
Data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
copy Kemal Akkaya
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 Princeton to Lausanne
limo Princeton to JFK plane JFK to Geneva train Geneva to Lausanne
Tourist = datagram Transport segment = communication link Transportation mode = link layer protocol Travel agent = routing algorithm
copy Kemal Akkaya
Link Layer Services Framing link access
Encapsulate datagram into frame adding header trailer Channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify source dest
Different from IP address
Reliable delivery between adjacent nodes Seldom used on low bit error link (fiber some twisted pair) Wireless links high error rates
Q why both link-level and end-end reliability
Flow Control Pacing between adjacent sending and receiving nodes
Error Detection Errors caused by signal attenuation noise Receiver detects presence of errors
Signals sender for retransmission or drops 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
copy Kemal Akkaya
Adaptors Communicating
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
receiving node
Adapter is semi-autonomous
Link amp physical layers
sendingnode
frame
receivingnode
datagram
frame
adapter adapter
link layer protocol
copy Kemal Akkaya
Link Layer - Outline
Flow Control
Error detection
Error correction
Multiple access protocols
Link-Layer Addressing
Ethernet
HDLC amp PPP
copy Kemal Akkaya
Flow Control The Data Link Layer also provides Flow Control What is Flow Control
Ensuring the sending entity does not overwhelm the receiving entity Preventing buffer overflow
One Solution Stop and Wait Flow Control Source transmits frame Destination receives frame and replies with acknowledgement Source waits for ACK before sending next frame Destination can stop flow by not sending ACK Works well for a few large frames
BUT Large block of data may be split into small frames Limited buffer size Errors detected sooner (when whole frame received) On error retransmission of smaller frames is needed Prevents one station occupying medium for long periods
Stop and wait becomes inadequate Link Utilization
copy Kemal Akkaya
Stop and Wait Link Utilization
Transmission time =1 Propagation time = a
copy Kemal Akkaya
Sliding Windows Flow Control Allow multiple frames to be in transit Receiver has buffer W long Transmitter can send up to W frames without ACK Each frame is numbered ACK includes number of next frame expected Sequence number bounded by size of field (k)
Frames are numbered modulo 2k
Enhancements Receiver can acknowledge frames without permitting
further transmission (Receive Not Ready) Must send a normal acknowledge to resume If duplex use piggybacking
If no data to send use acknowledgement frame If data but no acknowledgement to send send last acknowledgement
number again or have ACK valid flag (TCP)
copy Kemal Akkaya
Sliding Windows Diagram
copy Kemal Akkaya
Example
copy Kemal Akkaya
Error DetectionEDC = Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
Error detection not 100 reliable Protocol may miss some errors but rarely Larger EDC field yields better detection and correction
copy Kemal Akkaya
Parity Checking Single Bit Parity
Detect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
Internet Checksum Detect ldquoerrorsrdquo (eg flipped bits)
in transmitted segment (note used at transport layer only) 00
Sender Treat segment contents as sequence of 16-bit integers Checksum addition (1rsquos complement sum) of segment contents Sender puts checksum value into UDP checksum field
Receiver Compute checksum of received segment Check if computed checksum equals checksum field value NO - error detected YES - no error
copy Kemal Akkaya
Cyclic Redundancy Check View data bits D as a binary number Choose r+1 bit pattern (generator) G Goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) Receiver knows G divides ltDRgt by G If non-zero remainder error
detected Can detect all burst errors less than r+1 bits
Widely used in practice (ATM HDCL)
copy Kemal Akkaya
CRC Example
WantD2r XOR R = nG
EquivalentlyD2r = nG XOR R
Equivalently
If we divide D2r by G want remainder R
R = remainder[ ]D2r
G
copy Kemal Akkaya
Error Correction
Detection and correction of errors due to Lost frames Damaged frames Underlying channel can lose the frames or can be garbled
Solution at the Link Layer Automatic repeat request Error detection Positive acknowledgment Retransmission after timeout Negative acknowledgement and retransmission
Automatic Repeat Request (ARQ) methods Stop and wait Go back N Selective reject (selective retransmission)
copy Kemal Akkaya
Stop and Wait ARQ Source transmits single
frame Wait for ACK If received frame damaged
discard it Transmitter has timeout If no ACK within timeout
retransmit
If ACK damaged transmitter will not recognize it Transmitter will retransmit Receive gets two copies of frame Use ACK0 and ACK1
Simple but inefficient
copy Kemal Akkaya
More efficient method Go-back-N Based on sliding window If no error ACK as usual with next frame expected Use window to control number of outstanding frames If error reply with rejection
Discard that frame and all future frames until error frame received correctly
Transmitter must go back and retransmit that frame and all subsequent frames
Handling Damaged Frame Receiver detects error in frame i Receiver sends rejection-i Transmitter gets rejection-i Transmitter retransmits frame i and all subsequent
copy Kemal Akkaya
Go-back-N Handling Lost Frame First Approach
Frame i lost Transmitter sends i+1 Receiver gets frame i+1 out of sequence Receiver send reject i Transmitter goes back to frame i and retransmits
Second Approach Frame i lost and no additional frame sent Receiver gets nothing and returns neither acknowledgement nor
rejection Transmitter times out and sends acknowledgement frame with P bit
set to 1 Receiver interprets this as command which it acknowledges with the
number of the next frame it expects (frame i ) Transmitter then retransmits frame i
copy Kemal Akkaya
Go-back-N Damaged ACK
Receiver gets frame i and send acknowledgement (i+1) which is lost
Acknowledgements are cumulative so next acknowledgement (i+n) may arrive before transmitter times out on frame i
If transmitter times out it sends acknowledgement with P bit set as before
This can be repeated a number of times before a reset procedure is initiated
Damaged Rejection Same as Lost Frame (2)
copy Kemal Akkaya
Selective Reject
Also called selective retransmission
Only rejected frames are retransmitted
Subsequent frames are accepted by the receiver and buffered
Minimizes retransmission Receiver must maintain
large enough buffer More complex login in
transmitter
copy Kemal Akkaya
Multiple Access Links and ProtocolsTwo 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
copy Kemal Akkaya
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
Ideal Multiple Access Protocol When one node wants to transmit it can send at rate R When M nodes want to transmit each can send at average rate RM Fully decentralized
No special node to coordinate transmissions No synchronization of clocks slots
Simple
copy Kemal Akkaya
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 Nodes with more to send can take longer turns
copy Kemal Akkaya
Channel Partitioning MAC protocols TDMA
TDMA Time division multiple access Access to channel in rounds Each station gets fixed length slot
Length = packet transmission time in each round
Unused slots go idle Example 6-station LAN
134 have packet Slots 256 idle
copy Kemal Akkaya
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 packet frequency
bands 256 idle
frequ
ency
bands time
1
2
3
4
5
6
copy Kemal Akkaya
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 Carrier Sense Multiple Access (CSMA) CSMACollision Detection (CD) CSMACollision Avoidance (CA)
copy Kemal Akkaya
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
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
copy Kemal Akkaya
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]
Even worse than slotted ALOHA
copy Kemal Akkaya
Collisions can still occur Propagation delay means two nodes may not hear each otherrsquos transmission Entire packet transmission time wasted Role of distance amp propagation delay in determining collision probability spatial layout of nodes
Idea listen before transmit If channel sensed idle
transmit entire frame If channel sensed busy defer
transmission Human analogy donrsquot
interrupt others
CSMA (Carrier Sense Multiple Access)
copy Kemal Akkaya
CSMACD (Collision Detection)
CSMACD carrier sensing deferral as in CSMA Collisions detected within short
time Send jam sequence 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
copy Kemal Akkaya
ldquoTaking Turnsrdquo MAC protocols Channel 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 protocols Look for best of both worlds
Two implementations Polling Token
copy Kemal Akkaya
ldquoTaking 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)
copy Kemal Akkaya
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or code
Time Division Frequency Division
Random partitioning (dynamic) ALOHA S-ALOHA CSMA CSMACD Carrier sensing easy in some technologies (wire) hard in others
(wireless) CSMACD used in Ethernet CSMACA used in 80211
Taking Turns Polling from a central site token passing
copy Kemal Akkaya
LAN technologies
Data link layer so farServicesError detectioncorrectionMultiple access
Next LAN technologiesAddressingEthernetHubs switchesPPP
copy Kemal Akkaya
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
Find your PCrsquos MAC 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(wired orwireless)
Each adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF = adapter
copy Kemal Akkaya
MAC 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
copy Kemal Akkaya
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 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
copy Kemal Akkaya
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
copy Kemal Akkaya
Routing to another LAN Walkthrough send datagram from A to B via R
Assume A knows B IP address
Two ARP tables in router R one for each IP network (LAN) In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110
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
copy Kemal Akkaya
A
R
B
Routing to another LAN
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
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 Princeton to Lausanne
limo Princeton to JFK plane JFK to Geneva train Geneva to Lausanne
Tourist = datagram Transport segment = communication link Transportation mode = link layer protocol Travel agent = routing algorithm
copy Kemal Akkaya
Link Layer Services Framing link access
Encapsulate datagram into frame adding header trailer Channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify source dest
Different from IP address
Reliable delivery between adjacent nodes Seldom used on low bit error link (fiber some twisted pair) Wireless links high error rates
Q why both link-level and end-end reliability
Flow Control Pacing between adjacent sending and receiving nodes
Error Detection Errors caused by signal attenuation noise Receiver detects presence of errors
Signals sender for retransmission or drops 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
copy Kemal Akkaya
Adaptors Communicating
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
receiving node
Adapter is semi-autonomous
Link amp physical layers
sendingnode
frame
receivingnode
datagram
frame
adapter adapter
link layer protocol
copy Kemal Akkaya
Link Layer - Outline
Flow Control
Error detection
Error correction
Multiple access protocols
Link-Layer Addressing
Ethernet
HDLC amp PPP
copy Kemal Akkaya
Flow Control The Data Link Layer also provides Flow Control What is Flow Control
Ensuring the sending entity does not overwhelm the receiving entity Preventing buffer overflow
One Solution Stop and Wait Flow Control Source transmits frame Destination receives frame and replies with acknowledgement Source waits for ACK before sending next frame Destination can stop flow by not sending ACK Works well for a few large frames
BUT Large block of data may be split into small frames Limited buffer size Errors detected sooner (when whole frame received) On error retransmission of smaller frames is needed Prevents one station occupying medium for long periods
Stop and wait becomes inadequate Link Utilization
copy Kemal Akkaya
Stop and Wait Link Utilization
Transmission time =1 Propagation time = a
copy Kemal Akkaya
Sliding Windows Flow Control Allow multiple frames to be in transit Receiver has buffer W long Transmitter can send up to W frames without ACK Each frame is numbered ACK includes number of next frame expected Sequence number bounded by size of field (k)
Frames are numbered modulo 2k
Enhancements Receiver can acknowledge frames without permitting
further transmission (Receive Not Ready) Must send a normal acknowledge to resume If duplex use piggybacking
If no data to send use acknowledgement frame If data but no acknowledgement to send send last acknowledgement
number again or have ACK valid flag (TCP)
copy Kemal Akkaya
Sliding Windows Diagram
copy Kemal Akkaya
Example
copy Kemal Akkaya
Error DetectionEDC = Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
Error detection not 100 reliable Protocol may miss some errors but rarely Larger EDC field yields better detection and correction
copy Kemal Akkaya
Parity Checking Single Bit Parity
Detect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
Internet Checksum Detect ldquoerrorsrdquo (eg flipped bits)
in transmitted segment (note used at transport layer only) 00
Sender Treat segment contents as sequence of 16-bit integers Checksum addition (1rsquos complement sum) of segment contents Sender puts checksum value into UDP checksum field
Receiver Compute checksum of received segment Check if computed checksum equals checksum field value NO - error detected YES - no error
copy Kemal Akkaya
Cyclic Redundancy Check View data bits D as a binary number Choose r+1 bit pattern (generator) G Goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) Receiver knows G divides ltDRgt by G If non-zero remainder error
detected Can detect all burst errors less than r+1 bits
Widely used in practice (ATM HDCL)
copy Kemal Akkaya
CRC Example
WantD2r XOR R = nG
EquivalentlyD2r = nG XOR R
Equivalently
If we divide D2r by G want remainder R
R = remainder[ ]D2r
G
copy Kemal Akkaya
Error Correction
Detection and correction of errors due to Lost frames Damaged frames Underlying channel can lose the frames or can be garbled
Solution at the Link Layer Automatic repeat request Error detection Positive acknowledgment Retransmission after timeout Negative acknowledgement and retransmission
Automatic Repeat Request (ARQ) methods Stop and wait Go back N Selective reject (selective retransmission)
copy Kemal Akkaya
Stop and Wait ARQ Source transmits single
frame Wait for ACK If received frame damaged
discard it Transmitter has timeout If no ACK within timeout
retransmit
If ACK damaged transmitter will not recognize it Transmitter will retransmit Receive gets two copies of frame Use ACK0 and ACK1
Simple but inefficient
copy Kemal Akkaya
More efficient method Go-back-N Based on sliding window If no error ACK as usual with next frame expected Use window to control number of outstanding frames If error reply with rejection
Discard that frame and all future frames until error frame received correctly
Transmitter must go back and retransmit that frame and all subsequent frames
Handling Damaged Frame Receiver detects error in frame i Receiver sends rejection-i Transmitter gets rejection-i Transmitter retransmits frame i and all subsequent
copy Kemal Akkaya
Go-back-N Handling Lost Frame First Approach
Frame i lost Transmitter sends i+1 Receiver gets frame i+1 out of sequence Receiver send reject i Transmitter goes back to frame i and retransmits
Second Approach Frame i lost and no additional frame sent Receiver gets nothing and returns neither acknowledgement nor
rejection Transmitter times out and sends acknowledgement frame with P bit
set to 1 Receiver interprets this as command which it acknowledges with the
number of the next frame it expects (frame i ) Transmitter then retransmits frame i
copy Kemal Akkaya
Go-back-N Damaged ACK
Receiver gets frame i and send acknowledgement (i+1) which is lost
Acknowledgements are cumulative so next acknowledgement (i+n) may arrive before transmitter times out on frame i
If transmitter times out it sends acknowledgement with P bit set as before
This can be repeated a number of times before a reset procedure is initiated
Damaged Rejection Same as Lost Frame (2)
copy Kemal Akkaya
Selective Reject
Also called selective retransmission
Only rejected frames are retransmitted
Subsequent frames are accepted by the receiver and buffered
Minimizes retransmission Receiver must maintain
large enough buffer More complex login in
transmitter
copy Kemal Akkaya
Multiple Access Links and ProtocolsTwo 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
copy Kemal Akkaya
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
Ideal Multiple Access Protocol When one node wants to transmit it can send at rate R When M nodes want to transmit each can send at average rate RM Fully decentralized
No special node to coordinate transmissions No synchronization of clocks slots
Simple
copy Kemal Akkaya
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 Nodes with more to send can take longer turns
copy Kemal Akkaya
Channel Partitioning MAC protocols TDMA
TDMA Time division multiple access Access to channel in rounds Each station gets fixed length slot
Length = packet transmission time in each round
Unused slots go idle Example 6-station LAN
134 have packet Slots 256 idle
copy Kemal Akkaya
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 packet frequency
bands 256 idle
frequ
ency
bands time
1
2
3
4
5
6
copy Kemal Akkaya
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 Carrier Sense Multiple Access (CSMA) CSMACollision Detection (CD) CSMACollision Avoidance (CA)
copy Kemal Akkaya
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
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
copy Kemal Akkaya
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]
Even worse than slotted ALOHA
copy Kemal Akkaya
Collisions can still occur Propagation delay means two nodes may not hear each otherrsquos transmission Entire packet transmission time wasted Role of distance amp propagation delay in determining collision probability spatial layout of nodes
Idea listen before transmit If channel sensed idle
transmit entire frame If channel sensed busy defer
transmission Human analogy donrsquot
interrupt others
CSMA (Carrier Sense Multiple Access)
copy Kemal Akkaya
CSMACD (Collision Detection)
CSMACD carrier sensing deferral as in CSMA Collisions detected within short
time Send jam sequence 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
copy Kemal Akkaya
ldquoTaking Turnsrdquo MAC protocols Channel 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 protocols Look for best of both worlds
Two implementations Polling Token
copy Kemal Akkaya
ldquoTaking 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)
copy Kemal Akkaya
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or code
Time Division Frequency Division
Random partitioning (dynamic) ALOHA S-ALOHA CSMA CSMACD Carrier sensing easy in some technologies (wire) hard in others
(wireless) CSMACD used in Ethernet CSMACA used in 80211
Taking Turns Polling from a central site token passing
copy Kemal Akkaya
LAN technologies
Data link layer so farServicesError detectioncorrectionMultiple access
Next LAN technologiesAddressingEthernetHubs switchesPPP
copy Kemal Akkaya
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
Find your PCrsquos MAC 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(wired orwireless)
Each adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF = adapter
copy Kemal Akkaya
MAC 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
copy Kemal Akkaya
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 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
copy Kemal Akkaya
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
copy Kemal Akkaya
Routing to another LAN Walkthrough send datagram from A to B via R
Assume A knows B IP address
Two ARP tables in router R one for each IP network (LAN) In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110
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
copy Kemal Akkaya
A
R
B
Routing to another LAN
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
Link Layer Services Framing link access
Encapsulate datagram into frame adding header trailer Channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify source dest
Different from IP address
Reliable delivery between adjacent nodes Seldom used on low bit error link (fiber some twisted pair) Wireless links high error rates
Q why both link-level and end-end reliability
Flow Control Pacing between adjacent sending and receiving nodes
Error Detection Errors caused by signal attenuation noise Receiver detects presence of errors
Signals sender for retransmission or drops 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
copy Kemal Akkaya
Adaptors Communicating
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
receiving node
Adapter is semi-autonomous
Link amp physical layers
sendingnode
frame
receivingnode
datagram
frame
adapter adapter
link layer protocol
copy Kemal Akkaya
Link Layer - Outline
Flow Control
Error detection
Error correction
Multiple access protocols
Link-Layer Addressing
Ethernet
HDLC amp PPP
copy Kemal Akkaya
Flow Control The Data Link Layer also provides Flow Control What is Flow Control
Ensuring the sending entity does not overwhelm the receiving entity Preventing buffer overflow
One Solution Stop and Wait Flow Control Source transmits frame Destination receives frame and replies with acknowledgement Source waits for ACK before sending next frame Destination can stop flow by not sending ACK Works well for a few large frames
BUT Large block of data may be split into small frames Limited buffer size Errors detected sooner (when whole frame received) On error retransmission of smaller frames is needed Prevents one station occupying medium for long periods
Stop and wait becomes inadequate Link Utilization
copy Kemal Akkaya
Stop and Wait Link Utilization
Transmission time =1 Propagation time = a
copy Kemal Akkaya
Sliding Windows Flow Control Allow multiple frames to be in transit Receiver has buffer W long Transmitter can send up to W frames without ACK Each frame is numbered ACK includes number of next frame expected Sequence number bounded by size of field (k)
Frames are numbered modulo 2k
Enhancements Receiver can acknowledge frames without permitting
further transmission (Receive Not Ready) Must send a normal acknowledge to resume If duplex use piggybacking
If no data to send use acknowledgement frame If data but no acknowledgement to send send last acknowledgement
number again or have ACK valid flag (TCP)
copy Kemal Akkaya
Sliding Windows Diagram
copy Kemal Akkaya
Example
copy Kemal Akkaya
Error DetectionEDC = Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
Error detection not 100 reliable Protocol may miss some errors but rarely Larger EDC field yields better detection and correction
copy Kemal Akkaya
Parity Checking Single Bit Parity
Detect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
Internet Checksum Detect ldquoerrorsrdquo (eg flipped bits)
in transmitted segment (note used at transport layer only) 00
Sender Treat segment contents as sequence of 16-bit integers Checksum addition (1rsquos complement sum) of segment contents Sender puts checksum value into UDP checksum field
Receiver Compute checksum of received segment Check if computed checksum equals checksum field value NO - error detected YES - no error
copy Kemal Akkaya
Cyclic Redundancy Check View data bits D as a binary number Choose r+1 bit pattern (generator) G Goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) Receiver knows G divides ltDRgt by G If non-zero remainder error
detected Can detect all burst errors less than r+1 bits
Widely used in practice (ATM HDCL)
copy Kemal Akkaya
CRC Example
WantD2r XOR R = nG
EquivalentlyD2r = nG XOR R
Equivalently
If we divide D2r by G want remainder R
R = remainder[ ]D2r
G
copy Kemal Akkaya
Error Correction
Detection and correction of errors due to Lost frames Damaged frames Underlying channel can lose the frames or can be garbled
Solution at the Link Layer Automatic repeat request Error detection Positive acknowledgment Retransmission after timeout Negative acknowledgement and retransmission
Automatic Repeat Request (ARQ) methods Stop and wait Go back N Selective reject (selective retransmission)
copy Kemal Akkaya
Stop and Wait ARQ Source transmits single
frame Wait for ACK If received frame damaged
discard it Transmitter has timeout If no ACK within timeout
retransmit
If ACK damaged transmitter will not recognize it Transmitter will retransmit Receive gets two copies of frame Use ACK0 and ACK1
Simple but inefficient
copy Kemal Akkaya
More efficient method Go-back-N Based on sliding window If no error ACK as usual with next frame expected Use window to control number of outstanding frames If error reply with rejection
Discard that frame and all future frames until error frame received correctly
Transmitter must go back and retransmit that frame and all subsequent frames
Handling Damaged Frame Receiver detects error in frame i Receiver sends rejection-i Transmitter gets rejection-i Transmitter retransmits frame i and all subsequent
copy Kemal Akkaya
Go-back-N Handling Lost Frame First Approach
Frame i lost Transmitter sends i+1 Receiver gets frame i+1 out of sequence Receiver send reject i Transmitter goes back to frame i and retransmits
Second Approach Frame i lost and no additional frame sent Receiver gets nothing and returns neither acknowledgement nor
rejection Transmitter times out and sends acknowledgement frame with P bit
set to 1 Receiver interprets this as command which it acknowledges with the
number of the next frame it expects (frame i ) Transmitter then retransmits frame i
copy Kemal Akkaya
Go-back-N Damaged ACK
Receiver gets frame i and send acknowledgement (i+1) which is lost
Acknowledgements are cumulative so next acknowledgement (i+n) may arrive before transmitter times out on frame i
If transmitter times out it sends acknowledgement with P bit set as before
This can be repeated a number of times before a reset procedure is initiated
Damaged Rejection Same as Lost Frame (2)
copy Kemal Akkaya
Selective Reject
Also called selective retransmission
Only rejected frames are retransmitted
Subsequent frames are accepted by the receiver and buffered
Minimizes retransmission Receiver must maintain
large enough buffer More complex login in
transmitter
copy Kemal Akkaya
Multiple Access Links and ProtocolsTwo 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
copy Kemal Akkaya
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
Ideal Multiple Access Protocol When one node wants to transmit it can send at rate R When M nodes want to transmit each can send at average rate RM Fully decentralized
No special node to coordinate transmissions No synchronization of clocks slots
Simple
copy Kemal Akkaya
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 Nodes with more to send can take longer turns
copy Kemal Akkaya
Channel Partitioning MAC protocols TDMA
TDMA Time division multiple access Access to channel in rounds Each station gets fixed length slot
Length = packet transmission time in each round
Unused slots go idle Example 6-station LAN
134 have packet Slots 256 idle
copy Kemal Akkaya
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 packet frequency
bands 256 idle
frequ
ency
bands time
1
2
3
4
5
6
copy Kemal Akkaya
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 Carrier Sense Multiple Access (CSMA) CSMACollision Detection (CD) CSMACollision Avoidance (CA)
copy Kemal Akkaya
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
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
copy Kemal Akkaya
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]
Even worse than slotted ALOHA
copy Kemal Akkaya
Collisions can still occur Propagation delay means two nodes may not hear each otherrsquos transmission Entire packet transmission time wasted Role of distance amp propagation delay in determining collision probability spatial layout of nodes
Idea listen before transmit If channel sensed idle
transmit entire frame If channel sensed busy defer
transmission Human analogy donrsquot
interrupt others
CSMA (Carrier Sense Multiple Access)
copy Kemal Akkaya
CSMACD (Collision Detection)
CSMACD carrier sensing deferral as in CSMA Collisions detected within short
time Send jam sequence 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
copy Kemal Akkaya
ldquoTaking Turnsrdquo MAC protocols Channel 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 protocols Look for best of both worlds
Two implementations Polling Token
copy Kemal Akkaya
ldquoTaking 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)
copy Kemal Akkaya
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or code
Time Division Frequency Division
Random partitioning (dynamic) ALOHA S-ALOHA CSMA CSMACD Carrier sensing easy in some technologies (wire) hard in others
(wireless) CSMACD used in Ethernet CSMACA used in 80211
Taking Turns Polling from a central site token passing
copy Kemal Akkaya
LAN technologies
Data link layer so farServicesError detectioncorrectionMultiple access
Next LAN technologiesAddressingEthernetHubs switchesPPP
copy Kemal Akkaya
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
Find your PCrsquos MAC 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(wired orwireless)
Each adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF = adapter
copy Kemal Akkaya
MAC 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
copy Kemal Akkaya
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 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
copy Kemal Akkaya
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
copy Kemal Akkaya
Routing to another LAN Walkthrough send datagram from A to B via R
Assume A knows B IP address
Two ARP tables in router R one for each IP network (LAN) In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110
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
copy Kemal Akkaya
A
R
B
Routing to another LAN
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
Adaptors Communicating
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
receiving node
Adapter is semi-autonomous
Link amp physical layers
sendingnode
frame
receivingnode
datagram
frame
adapter adapter
link layer protocol
copy Kemal Akkaya
Link Layer - Outline
Flow Control
Error detection
Error correction
Multiple access protocols
Link-Layer Addressing
Ethernet
HDLC amp PPP
copy Kemal Akkaya
Flow Control The Data Link Layer also provides Flow Control What is Flow Control
Ensuring the sending entity does not overwhelm the receiving entity Preventing buffer overflow
One Solution Stop and Wait Flow Control Source transmits frame Destination receives frame and replies with acknowledgement Source waits for ACK before sending next frame Destination can stop flow by not sending ACK Works well for a few large frames
BUT Large block of data may be split into small frames Limited buffer size Errors detected sooner (when whole frame received) On error retransmission of smaller frames is needed Prevents one station occupying medium for long periods
Stop and wait becomes inadequate Link Utilization
copy Kemal Akkaya
Stop and Wait Link Utilization
Transmission time =1 Propagation time = a
copy Kemal Akkaya
Sliding Windows Flow Control Allow multiple frames to be in transit Receiver has buffer W long Transmitter can send up to W frames without ACK Each frame is numbered ACK includes number of next frame expected Sequence number bounded by size of field (k)
Frames are numbered modulo 2k
Enhancements Receiver can acknowledge frames without permitting
further transmission (Receive Not Ready) Must send a normal acknowledge to resume If duplex use piggybacking
If no data to send use acknowledgement frame If data but no acknowledgement to send send last acknowledgement
number again or have ACK valid flag (TCP)
copy Kemal Akkaya
Sliding Windows Diagram
copy Kemal Akkaya
Example
copy Kemal Akkaya
Error DetectionEDC = Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
Error detection not 100 reliable Protocol may miss some errors but rarely Larger EDC field yields better detection and correction
copy Kemal Akkaya
Parity Checking Single Bit Parity
Detect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
Internet Checksum Detect ldquoerrorsrdquo (eg flipped bits)
in transmitted segment (note used at transport layer only) 00
Sender Treat segment contents as sequence of 16-bit integers Checksum addition (1rsquos complement sum) of segment contents Sender puts checksum value into UDP checksum field
Receiver Compute checksum of received segment Check if computed checksum equals checksum field value NO - error detected YES - no error
copy Kemal Akkaya
Cyclic Redundancy Check View data bits D as a binary number Choose r+1 bit pattern (generator) G Goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) Receiver knows G divides ltDRgt by G If non-zero remainder error
detected Can detect all burst errors less than r+1 bits
Widely used in practice (ATM HDCL)
copy Kemal Akkaya
CRC Example
WantD2r XOR R = nG
EquivalentlyD2r = nG XOR R
Equivalently
If we divide D2r by G want remainder R
R = remainder[ ]D2r
G
copy Kemal Akkaya
Error Correction
Detection and correction of errors due to Lost frames Damaged frames Underlying channel can lose the frames or can be garbled
Solution at the Link Layer Automatic repeat request Error detection Positive acknowledgment Retransmission after timeout Negative acknowledgement and retransmission
Automatic Repeat Request (ARQ) methods Stop and wait Go back N Selective reject (selective retransmission)
copy Kemal Akkaya
Stop and Wait ARQ Source transmits single
frame Wait for ACK If received frame damaged
discard it Transmitter has timeout If no ACK within timeout
retransmit
If ACK damaged transmitter will not recognize it Transmitter will retransmit Receive gets two copies of frame Use ACK0 and ACK1
Simple but inefficient
copy Kemal Akkaya
More efficient method Go-back-N Based on sliding window If no error ACK as usual with next frame expected Use window to control number of outstanding frames If error reply with rejection
Discard that frame and all future frames until error frame received correctly
Transmitter must go back and retransmit that frame and all subsequent frames
Handling Damaged Frame Receiver detects error in frame i Receiver sends rejection-i Transmitter gets rejection-i Transmitter retransmits frame i and all subsequent
copy Kemal Akkaya
Go-back-N Handling Lost Frame First Approach
Frame i lost Transmitter sends i+1 Receiver gets frame i+1 out of sequence Receiver send reject i Transmitter goes back to frame i and retransmits
Second Approach Frame i lost and no additional frame sent Receiver gets nothing and returns neither acknowledgement nor
rejection Transmitter times out and sends acknowledgement frame with P bit
set to 1 Receiver interprets this as command which it acknowledges with the
number of the next frame it expects (frame i ) Transmitter then retransmits frame i
copy Kemal Akkaya
Go-back-N Damaged ACK
Receiver gets frame i and send acknowledgement (i+1) which is lost
Acknowledgements are cumulative so next acknowledgement (i+n) may arrive before transmitter times out on frame i
If transmitter times out it sends acknowledgement with P bit set as before
This can be repeated a number of times before a reset procedure is initiated
Damaged Rejection Same as Lost Frame (2)
copy Kemal Akkaya
Selective Reject
Also called selective retransmission
Only rejected frames are retransmitted
Subsequent frames are accepted by the receiver and buffered
Minimizes retransmission Receiver must maintain
large enough buffer More complex login in
transmitter
copy Kemal Akkaya
Multiple Access Links and ProtocolsTwo 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
copy Kemal Akkaya
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
Ideal Multiple Access Protocol When one node wants to transmit it can send at rate R When M nodes want to transmit each can send at average rate RM Fully decentralized
No special node to coordinate transmissions No synchronization of clocks slots
Simple
copy Kemal Akkaya
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 Nodes with more to send can take longer turns
copy Kemal Akkaya
Channel Partitioning MAC protocols TDMA
TDMA Time division multiple access Access to channel in rounds Each station gets fixed length slot
Length = packet transmission time in each round
Unused slots go idle Example 6-station LAN
134 have packet Slots 256 idle
copy Kemal Akkaya
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 packet frequency
bands 256 idle
frequ
ency
bands time
1
2
3
4
5
6
copy Kemal Akkaya
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 Carrier Sense Multiple Access (CSMA) CSMACollision Detection (CD) CSMACollision Avoidance (CA)
copy Kemal Akkaya
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
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
copy Kemal Akkaya
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]
Even worse than slotted ALOHA
copy Kemal Akkaya
Collisions can still occur Propagation delay means two nodes may not hear each otherrsquos transmission Entire packet transmission time wasted Role of distance amp propagation delay in determining collision probability spatial layout of nodes
Idea listen before transmit If channel sensed idle
transmit entire frame If channel sensed busy defer
transmission Human analogy donrsquot
interrupt others
CSMA (Carrier Sense Multiple Access)
copy Kemal Akkaya
CSMACD (Collision Detection)
CSMACD carrier sensing deferral as in CSMA Collisions detected within short
time Send jam sequence 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
copy Kemal Akkaya
ldquoTaking Turnsrdquo MAC protocols Channel 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 protocols Look for best of both worlds
Two implementations Polling Token
copy Kemal Akkaya
ldquoTaking 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)
copy Kemal Akkaya
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or code
Time Division Frequency Division
Random partitioning (dynamic) ALOHA S-ALOHA CSMA CSMACD Carrier sensing easy in some technologies (wire) hard in others
(wireless) CSMACD used in Ethernet CSMACA used in 80211
Taking Turns Polling from a central site token passing
copy Kemal Akkaya
LAN technologies
Data link layer so farServicesError detectioncorrectionMultiple access
Next LAN technologiesAddressingEthernetHubs switchesPPP
copy Kemal Akkaya
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
Find your PCrsquos MAC 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(wired orwireless)
Each adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF = adapter
copy Kemal Akkaya
MAC 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
copy Kemal Akkaya
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 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
copy Kemal Akkaya
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
copy Kemal Akkaya
Routing to another LAN Walkthrough send datagram from A to B via R
Assume A knows B IP address
Two ARP tables in router R one for each IP network (LAN) In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110
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
copy Kemal Akkaya
A
R
B
Routing to another LAN
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
Link Layer - Outline
Flow Control
Error detection
Error correction
Multiple access protocols
Link-Layer Addressing
Ethernet
HDLC amp PPP
copy Kemal Akkaya
Flow Control The Data Link Layer also provides Flow Control What is Flow Control
Ensuring the sending entity does not overwhelm the receiving entity Preventing buffer overflow
One Solution Stop and Wait Flow Control Source transmits frame Destination receives frame and replies with acknowledgement Source waits for ACK before sending next frame Destination can stop flow by not sending ACK Works well for a few large frames
BUT Large block of data may be split into small frames Limited buffer size Errors detected sooner (when whole frame received) On error retransmission of smaller frames is needed Prevents one station occupying medium for long periods
Stop and wait becomes inadequate Link Utilization
copy Kemal Akkaya
Stop and Wait Link Utilization
Transmission time =1 Propagation time = a
copy Kemal Akkaya
Sliding Windows Flow Control Allow multiple frames to be in transit Receiver has buffer W long Transmitter can send up to W frames without ACK Each frame is numbered ACK includes number of next frame expected Sequence number bounded by size of field (k)
Frames are numbered modulo 2k
Enhancements Receiver can acknowledge frames without permitting
further transmission (Receive Not Ready) Must send a normal acknowledge to resume If duplex use piggybacking
If no data to send use acknowledgement frame If data but no acknowledgement to send send last acknowledgement
number again or have ACK valid flag (TCP)
copy Kemal Akkaya
Sliding Windows Diagram
copy Kemal Akkaya
Example
copy Kemal Akkaya
Error DetectionEDC = Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
Error detection not 100 reliable Protocol may miss some errors but rarely Larger EDC field yields better detection and correction
copy Kemal Akkaya
Parity Checking Single Bit Parity
Detect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
Internet Checksum Detect ldquoerrorsrdquo (eg flipped bits)
in transmitted segment (note used at transport layer only) 00
Sender Treat segment contents as sequence of 16-bit integers Checksum addition (1rsquos complement sum) of segment contents Sender puts checksum value into UDP checksum field
Receiver Compute checksum of received segment Check if computed checksum equals checksum field value NO - error detected YES - no error
copy Kemal Akkaya
Cyclic Redundancy Check View data bits D as a binary number Choose r+1 bit pattern (generator) G Goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) Receiver knows G divides ltDRgt by G If non-zero remainder error
detected Can detect all burst errors less than r+1 bits
Widely used in practice (ATM HDCL)
copy Kemal Akkaya
CRC Example
WantD2r XOR R = nG
EquivalentlyD2r = nG XOR R
Equivalently
If we divide D2r by G want remainder R
R = remainder[ ]D2r
G
copy Kemal Akkaya
Error Correction
Detection and correction of errors due to Lost frames Damaged frames Underlying channel can lose the frames or can be garbled
Solution at the Link Layer Automatic repeat request Error detection Positive acknowledgment Retransmission after timeout Negative acknowledgement and retransmission
Automatic Repeat Request (ARQ) methods Stop and wait Go back N Selective reject (selective retransmission)
copy Kemal Akkaya
Stop and Wait ARQ Source transmits single
frame Wait for ACK If received frame damaged
discard it Transmitter has timeout If no ACK within timeout
retransmit
If ACK damaged transmitter will not recognize it Transmitter will retransmit Receive gets two copies of frame Use ACK0 and ACK1
Simple but inefficient
copy Kemal Akkaya
More efficient method Go-back-N Based on sliding window If no error ACK as usual with next frame expected Use window to control number of outstanding frames If error reply with rejection
Discard that frame and all future frames until error frame received correctly
Transmitter must go back and retransmit that frame and all subsequent frames
Handling Damaged Frame Receiver detects error in frame i Receiver sends rejection-i Transmitter gets rejection-i Transmitter retransmits frame i and all subsequent
copy Kemal Akkaya
Go-back-N Handling Lost Frame First Approach
Frame i lost Transmitter sends i+1 Receiver gets frame i+1 out of sequence Receiver send reject i Transmitter goes back to frame i and retransmits
Second Approach Frame i lost and no additional frame sent Receiver gets nothing and returns neither acknowledgement nor
rejection Transmitter times out and sends acknowledgement frame with P bit
set to 1 Receiver interprets this as command which it acknowledges with the
number of the next frame it expects (frame i ) Transmitter then retransmits frame i
copy Kemal Akkaya
Go-back-N Damaged ACK
Receiver gets frame i and send acknowledgement (i+1) which is lost
Acknowledgements are cumulative so next acknowledgement (i+n) may arrive before transmitter times out on frame i
If transmitter times out it sends acknowledgement with P bit set as before
This can be repeated a number of times before a reset procedure is initiated
Damaged Rejection Same as Lost Frame (2)
copy Kemal Akkaya
Selective Reject
Also called selective retransmission
Only rejected frames are retransmitted
Subsequent frames are accepted by the receiver and buffered
Minimizes retransmission Receiver must maintain
large enough buffer More complex login in
transmitter
copy Kemal Akkaya
Multiple Access Links and ProtocolsTwo 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
copy Kemal Akkaya
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
Ideal Multiple Access Protocol When one node wants to transmit it can send at rate R When M nodes want to transmit each can send at average rate RM Fully decentralized
No special node to coordinate transmissions No synchronization of clocks slots
Simple
copy Kemal Akkaya
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 Nodes with more to send can take longer turns
copy Kemal Akkaya
Channel Partitioning MAC protocols TDMA
TDMA Time division multiple access Access to channel in rounds Each station gets fixed length slot
Length = packet transmission time in each round
Unused slots go idle Example 6-station LAN
134 have packet Slots 256 idle
copy Kemal Akkaya
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 packet frequency
bands 256 idle
frequ
ency
bands time
1
2
3
4
5
6
copy Kemal Akkaya
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 Carrier Sense Multiple Access (CSMA) CSMACollision Detection (CD) CSMACollision Avoidance (CA)
copy Kemal Akkaya
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
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
copy Kemal Akkaya
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]
Even worse than slotted ALOHA
copy Kemal Akkaya
Collisions can still occur Propagation delay means two nodes may not hear each otherrsquos transmission Entire packet transmission time wasted Role of distance amp propagation delay in determining collision probability spatial layout of nodes
Idea listen before transmit If channel sensed idle
transmit entire frame If channel sensed busy defer
transmission Human analogy donrsquot
interrupt others
CSMA (Carrier Sense Multiple Access)
copy Kemal Akkaya
CSMACD (Collision Detection)
CSMACD carrier sensing deferral as in CSMA Collisions detected within short
time Send jam sequence 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
copy Kemal Akkaya
ldquoTaking Turnsrdquo MAC protocols Channel 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 protocols Look for best of both worlds
Two implementations Polling Token
copy Kemal Akkaya
ldquoTaking 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)
copy Kemal Akkaya
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or code
Time Division Frequency Division
Random partitioning (dynamic) ALOHA S-ALOHA CSMA CSMACD Carrier sensing easy in some technologies (wire) hard in others
(wireless) CSMACD used in Ethernet CSMACA used in 80211
Taking Turns Polling from a central site token passing
copy Kemal Akkaya
LAN technologies
Data link layer so farServicesError detectioncorrectionMultiple access
Next LAN technologiesAddressingEthernetHubs switchesPPP
copy Kemal Akkaya
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
Find your PCrsquos MAC 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(wired orwireless)
Each adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF = adapter
copy Kemal Akkaya
MAC 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
copy Kemal Akkaya
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 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
copy Kemal Akkaya
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
copy Kemal Akkaya
Routing to another LAN Walkthrough send datagram from A to B via R
Assume A knows B IP address
Two ARP tables in router R one for each IP network (LAN) In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110
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
copy Kemal Akkaya
A
R
B
Routing to another LAN
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
Flow Control The Data Link Layer also provides Flow Control What is Flow Control
Ensuring the sending entity does not overwhelm the receiving entity Preventing buffer overflow
One Solution Stop and Wait Flow Control Source transmits frame Destination receives frame and replies with acknowledgement Source waits for ACK before sending next frame Destination can stop flow by not sending ACK Works well for a few large frames
BUT Large block of data may be split into small frames Limited buffer size Errors detected sooner (when whole frame received) On error retransmission of smaller frames is needed Prevents one station occupying medium for long periods
Stop and wait becomes inadequate Link Utilization
copy Kemal Akkaya
Stop and Wait Link Utilization
Transmission time =1 Propagation time = a
copy Kemal Akkaya
Sliding Windows Flow Control Allow multiple frames to be in transit Receiver has buffer W long Transmitter can send up to W frames without ACK Each frame is numbered ACK includes number of next frame expected Sequence number bounded by size of field (k)
Frames are numbered modulo 2k
Enhancements Receiver can acknowledge frames without permitting
further transmission (Receive Not Ready) Must send a normal acknowledge to resume If duplex use piggybacking
If no data to send use acknowledgement frame If data but no acknowledgement to send send last acknowledgement
number again or have ACK valid flag (TCP)
copy Kemal Akkaya
Sliding Windows Diagram
copy Kemal Akkaya
Example
copy Kemal Akkaya
Error DetectionEDC = Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
Error detection not 100 reliable Protocol may miss some errors but rarely Larger EDC field yields better detection and correction
copy Kemal Akkaya
Parity Checking Single Bit Parity
Detect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
Internet Checksum Detect ldquoerrorsrdquo (eg flipped bits)
in transmitted segment (note used at transport layer only) 00
Sender Treat segment contents as sequence of 16-bit integers Checksum addition (1rsquos complement sum) of segment contents Sender puts checksum value into UDP checksum field
Receiver Compute checksum of received segment Check if computed checksum equals checksum field value NO - error detected YES - no error
copy Kemal Akkaya
Cyclic Redundancy Check View data bits D as a binary number Choose r+1 bit pattern (generator) G Goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) Receiver knows G divides ltDRgt by G If non-zero remainder error
detected Can detect all burst errors less than r+1 bits
Widely used in practice (ATM HDCL)
copy Kemal Akkaya
CRC Example
WantD2r XOR R = nG
EquivalentlyD2r = nG XOR R
Equivalently
If we divide D2r by G want remainder R
R = remainder[ ]D2r
G
copy Kemal Akkaya
Error Correction
Detection and correction of errors due to Lost frames Damaged frames Underlying channel can lose the frames or can be garbled
Solution at the Link Layer Automatic repeat request Error detection Positive acknowledgment Retransmission after timeout Negative acknowledgement and retransmission
Automatic Repeat Request (ARQ) methods Stop and wait Go back N Selective reject (selective retransmission)
copy Kemal Akkaya
Stop and Wait ARQ Source transmits single
frame Wait for ACK If received frame damaged
discard it Transmitter has timeout If no ACK within timeout
retransmit
If ACK damaged transmitter will not recognize it Transmitter will retransmit Receive gets two copies of frame Use ACK0 and ACK1
Simple but inefficient
copy Kemal Akkaya
More efficient method Go-back-N Based on sliding window If no error ACK as usual with next frame expected Use window to control number of outstanding frames If error reply with rejection
Discard that frame and all future frames until error frame received correctly
Transmitter must go back and retransmit that frame and all subsequent frames
Handling Damaged Frame Receiver detects error in frame i Receiver sends rejection-i Transmitter gets rejection-i Transmitter retransmits frame i and all subsequent
copy Kemal Akkaya
Go-back-N Handling Lost Frame First Approach
Frame i lost Transmitter sends i+1 Receiver gets frame i+1 out of sequence Receiver send reject i Transmitter goes back to frame i and retransmits
Second Approach Frame i lost and no additional frame sent Receiver gets nothing and returns neither acknowledgement nor
rejection Transmitter times out and sends acknowledgement frame with P bit
set to 1 Receiver interprets this as command which it acknowledges with the
number of the next frame it expects (frame i ) Transmitter then retransmits frame i
copy Kemal Akkaya
Go-back-N Damaged ACK
Receiver gets frame i and send acknowledgement (i+1) which is lost
Acknowledgements are cumulative so next acknowledgement (i+n) may arrive before transmitter times out on frame i
If transmitter times out it sends acknowledgement with P bit set as before
This can be repeated a number of times before a reset procedure is initiated
Damaged Rejection Same as Lost Frame (2)
copy Kemal Akkaya
Selective Reject
Also called selective retransmission
Only rejected frames are retransmitted
Subsequent frames are accepted by the receiver and buffered
Minimizes retransmission Receiver must maintain
large enough buffer More complex login in
transmitter
copy Kemal Akkaya
Multiple Access Links and ProtocolsTwo 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
copy Kemal Akkaya
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
Ideal Multiple Access Protocol When one node wants to transmit it can send at rate R When M nodes want to transmit each can send at average rate RM Fully decentralized
No special node to coordinate transmissions No synchronization of clocks slots
Simple
copy Kemal Akkaya
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 Nodes with more to send can take longer turns
copy Kemal Akkaya
Channel Partitioning MAC protocols TDMA
TDMA Time division multiple access Access to channel in rounds Each station gets fixed length slot
Length = packet transmission time in each round
Unused slots go idle Example 6-station LAN
134 have packet Slots 256 idle
copy Kemal Akkaya
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 packet frequency
bands 256 idle
frequ
ency
bands time
1
2
3
4
5
6
copy Kemal Akkaya
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 Carrier Sense Multiple Access (CSMA) CSMACollision Detection (CD) CSMACollision Avoidance (CA)
copy Kemal Akkaya
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
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
copy Kemal Akkaya
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]
Even worse than slotted ALOHA
copy Kemal Akkaya
Collisions can still occur Propagation delay means two nodes may not hear each otherrsquos transmission Entire packet transmission time wasted Role of distance amp propagation delay in determining collision probability spatial layout of nodes
Idea listen before transmit If channel sensed idle
transmit entire frame If channel sensed busy defer
transmission Human analogy donrsquot
interrupt others
CSMA (Carrier Sense Multiple Access)
copy Kemal Akkaya
CSMACD (Collision Detection)
CSMACD carrier sensing deferral as in CSMA Collisions detected within short
time Send jam sequence 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
copy Kemal Akkaya
ldquoTaking Turnsrdquo MAC protocols Channel 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 protocols Look for best of both worlds
Two implementations Polling Token
copy Kemal Akkaya
ldquoTaking 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)
copy Kemal Akkaya
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or code
Time Division Frequency Division
Random partitioning (dynamic) ALOHA S-ALOHA CSMA CSMACD Carrier sensing easy in some technologies (wire) hard in others
(wireless) CSMACD used in Ethernet CSMACA used in 80211
Taking Turns Polling from a central site token passing
copy Kemal Akkaya
LAN technologies
Data link layer so farServicesError detectioncorrectionMultiple access
Next LAN technologiesAddressingEthernetHubs switchesPPP
copy Kemal Akkaya
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
Find your PCrsquos MAC 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(wired orwireless)
Each adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF = adapter
copy Kemal Akkaya
MAC 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
copy Kemal Akkaya
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 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
copy Kemal Akkaya
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
copy Kemal Akkaya
Routing to another LAN Walkthrough send datagram from A to B via R
Assume A knows B IP address
Two ARP tables in router R one for each IP network (LAN) In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110
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
copy Kemal Akkaya
A
R
B
Routing to another LAN
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
Stop and Wait Link Utilization
Transmission time =1 Propagation time = a
copy Kemal Akkaya
Sliding Windows Flow Control Allow multiple frames to be in transit Receiver has buffer W long Transmitter can send up to W frames without ACK Each frame is numbered ACK includes number of next frame expected Sequence number bounded by size of field (k)
Frames are numbered modulo 2k
Enhancements Receiver can acknowledge frames without permitting
further transmission (Receive Not Ready) Must send a normal acknowledge to resume If duplex use piggybacking
If no data to send use acknowledgement frame If data but no acknowledgement to send send last acknowledgement
number again or have ACK valid flag (TCP)
copy Kemal Akkaya
Sliding Windows Diagram
copy Kemal Akkaya
Example
copy Kemal Akkaya
Error DetectionEDC = Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
Error detection not 100 reliable Protocol may miss some errors but rarely Larger EDC field yields better detection and correction
copy Kemal Akkaya
Parity Checking Single Bit Parity
Detect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
Internet Checksum Detect ldquoerrorsrdquo (eg flipped bits)
in transmitted segment (note used at transport layer only) 00
Sender Treat segment contents as sequence of 16-bit integers Checksum addition (1rsquos complement sum) of segment contents Sender puts checksum value into UDP checksum field
Receiver Compute checksum of received segment Check if computed checksum equals checksum field value NO - error detected YES - no error
copy Kemal Akkaya
Cyclic Redundancy Check View data bits D as a binary number Choose r+1 bit pattern (generator) G Goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) Receiver knows G divides ltDRgt by G If non-zero remainder error
detected Can detect all burst errors less than r+1 bits
Widely used in practice (ATM HDCL)
copy Kemal Akkaya
CRC Example
WantD2r XOR R = nG
EquivalentlyD2r = nG XOR R
Equivalently
If we divide D2r by G want remainder R
R = remainder[ ]D2r
G
copy Kemal Akkaya
Error Correction
Detection and correction of errors due to Lost frames Damaged frames Underlying channel can lose the frames or can be garbled
Solution at the Link Layer Automatic repeat request Error detection Positive acknowledgment Retransmission after timeout Negative acknowledgement and retransmission
Automatic Repeat Request (ARQ) methods Stop and wait Go back N Selective reject (selective retransmission)
copy Kemal Akkaya
Stop and Wait ARQ Source transmits single
frame Wait for ACK If received frame damaged
discard it Transmitter has timeout If no ACK within timeout
retransmit
If ACK damaged transmitter will not recognize it Transmitter will retransmit Receive gets two copies of frame Use ACK0 and ACK1
Simple but inefficient
copy Kemal Akkaya
More efficient method Go-back-N Based on sliding window If no error ACK as usual with next frame expected Use window to control number of outstanding frames If error reply with rejection
Discard that frame and all future frames until error frame received correctly
Transmitter must go back and retransmit that frame and all subsequent frames
Handling Damaged Frame Receiver detects error in frame i Receiver sends rejection-i Transmitter gets rejection-i Transmitter retransmits frame i and all subsequent
copy Kemal Akkaya
Go-back-N Handling Lost Frame First Approach
Frame i lost Transmitter sends i+1 Receiver gets frame i+1 out of sequence Receiver send reject i Transmitter goes back to frame i and retransmits
Second Approach Frame i lost and no additional frame sent Receiver gets nothing and returns neither acknowledgement nor
rejection Transmitter times out and sends acknowledgement frame with P bit
set to 1 Receiver interprets this as command which it acknowledges with the
number of the next frame it expects (frame i ) Transmitter then retransmits frame i
copy Kemal Akkaya
Go-back-N Damaged ACK
Receiver gets frame i and send acknowledgement (i+1) which is lost
Acknowledgements are cumulative so next acknowledgement (i+n) may arrive before transmitter times out on frame i
If transmitter times out it sends acknowledgement with P bit set as before
This can be repeated a number of times before a reset procedure is initiated
Damaged Rejection Same as Lost Frame (2)
copy Kemal Akkaya
Selective Reject
Also called selective retransmission
Only rejected frames are retransmitted
Subsequent frames are accepted by the receiver and buffered
Minimizes retransmission Receiver must maintain
large enough buffer More complex login in
transmitter
copy Kemal Akkaya
Multiple Access Links and ProtocolsTwo 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
copy Kemal Akkaya
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
Ideal Multiple Access Protocol When one node wants to transmit it can send at rate R When M nodes want to transmit each can send at average rate RM Fully decentralized
No special node to coordinate transmissions No synchronization of clocks slots
Simple
copy Kemal Akkaya
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 Nodes with more to send can take longer turns
copy Kemal Akkaya
Channel Partitioning MAC protocols TDMA
TDMA Time division multiple access Access to channel in rounds Each station gets fixed length slot
Length = packet transmission time in each round
Unused slots go idle Example 6-station LAN
134 have packet Slots 256 idle
copy Kemal Akkaya
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 packet frequency
bands 256 idle
frequ
ency
bands time
1
2
3
4
5
6
copy Kemal Akkaya
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 Carrier Sense Multiple Access (CSMA) CSMACollision Detection (CD) CSMACollision Avoidance (CA)
copy Kemal Akkaya
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
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
copy Kemal Akkaya
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]
Even worse than slotted ALOHA
copy Kemal Akkaya
Collisions can still occur Propagation delay means two nodes may not hear each otherrsquos transmission Entire packet transmission time wasted Role of distance amp propagation delay in determining collision probability spatial layout of nodes
Idea listen before transmit If channel sensed idle
transmit entire frame If channel sensed busy defer
transmission Human analogy donrsquot
interrupt others
CSMA (Carrier Sense Multiple Access)
copy Kemal Akkaya
CSMACD (Collision Detection)
CSMACD carrier sensing deferral as in CSMA Collisions detected within short
time Send jam sequence 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
copy Kemal Akkaya
ldquoTaking Turnsrdquo MAC protocols Channel 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 protocols Look for best of both worlds
Two implementations Polling Token
copy Kemal Akkaya
ldquoTaking 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)
copy Kemal Akkaya
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or code
Time Division Frequency Division
Random partitioning (dynamic) ALOHA S-ALOHA CSMA CSMACD Carrier sensing easy in some technologies (wire) hard in others
(wireless) CSMACD used in Ethernet CSMACA used in 80211
Taking Turns Polling from a central site token passing
copy Kemal Akkaya
LAN technologies
Data link layer so farServicesError detectioncorrectionMultiple access
Next LAN technologiesAddressingEthernetHubs switchesPPP
copy Kemal Akkaya
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
Find your PCrsquos MAC 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(wired orwireless)
Each adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF = adapter
copy Kemal Akkaya
MAC 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
copy Kemal Akkaya
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 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
copy Kemal Akkaya
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
copy Kemal Akkaya
Routing to another LAN Walkthrough send datagram from A to B via R
Assume A knows B IP address
Two ARP tables in router R one for each IP network (LAN) In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110
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
copy Kemal Akkaya
A
R
B
Routing to another LAN
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
Sliding Windows Flow Control Allow multiple frames to be in transit Receiver has buffer W long Transmitter can send up to W frames without ACK Each frame is numbered ACK includes number of next frame expected Sequence number bounded by size of field (k)
Frames are numbered modulo 2k
Enhancements Receiver can acknowledge frames without permitting
further transmission (Receive Not Ready) Must send a normal acknowledge to resume If duplex use piggybacking
If no data to send use acknowledgement frame If data but no acknowledgement to send send last acknowledgement
number again or have ACK valid flag (TCP)
copy Kemal Akkaya
Sliding Windows Diagram
copy Kemal Akkaya
Example
copy Kemal Akkaya
Error DetectionEDC = Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
Error detection not 100 reliable Protocol may miss some errors but rarely Larger EDC field yields better detection and correction
copy Kemal Akkaya
Parity Checking Single Bit Parity
Detect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
Internet Checksum Detect ldquoerrorsrdquo (eg flipped bits)
in transmitted segment (note used at transport layer only) 00
Sender Treat segment contents as sequence of 16-bit integers Checksum addition (1rsquos complement sum) of segment contents Sender puts checksum value into UDP checksum field
Receiver Compute checksum of received segment Check if computed checksum equals checksum field value NO - error detected YES - no error
copy Kemal Akkaya
Cyclic Redundancy Check View data bits D as a binary number Choose r+1 bit pattern (generator) G Goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) Receiver knows G divides ltDRgt by G If non-zero remainder error
detected Can detect all burst errors less than r+1 bits
Widely used in practice (ATM HDCL)
copy Kemal Akkaya
CRC Example
WantD2r XOR R = nG
EquivalentlyD2r = nG XOR R
Equivalently
If we divide D2r by G want remainder R
R = remainder[ ]D2r
G
copy Kemal Akkaya
Error Correction
Detection and correction of errors due to Lost frames Damaged frames Underlying channel can lose the frames or can be garbled
Solution at the Link Layer Automatic repeat request Error detection Positive acknowledgment Retransmission after timeout Negative acknowledgement and retransmission
Automatic Repeat Request (ARQ) methods Stop and wait Go back N Selective reject (selective retransmission)
copy Kemal Akkaya
Stop and Wait ARQ Source transmits single
frame Wait for ACK If received frame damaged
discard it Transmitter has timeout If no ACK within timeout
retransmit
If ACK damaged transmitter will not recognize it Transmitter will retransmit Receive gets two copies of frame Use ACK0 and ACK1
Simple but inefficient
copy Kemal Akkaya
More efficient method Go-back-N Based on sliding window If no error ACK as usual with next frame expected Use window to control number of outstanding frames If error reply with rejection
Discard that frame and all future frames until error frame received correctly
Transmitter must go back and retransmit that frame and all subsequent frames
Handling Damaged Frame Receiver detects error in frame i Receiver sends rejection-i Transmitter gets rejection-i Transmitter retransmits frame i and all subsequent
copy Kemal Akkaya
Go-back-N Handling Lost Frame First Approach
Frame i lost Transmitter sends i+1 Receiver gets frame i+1 out of sequence Receiver send reject i Transmitter goes back to frame i and retransmits
Second Approach Frame i lost and no additional frame sent Receiver gets nothing and returns neither acknowledgement nor
rejection Transmitter times out and sends acknowledgement frame with P bit
set to 1 Receiver interprets this as command which it acknowledges with the
number of the next frame it expects (frame i ) Transmitter then retransmits frame i
copy Kemal Akkaya
Go-back-N Damaged ACK
Receiver gets frame i and send acknowledgement (i+1) which is lost
Acknowledgements are cumulative so next acknowledgement (i+n) may arrive before transmitter times out on frame i
If transmitter times out it sends acknowledgement with P bit set as before
This can be repeated a number of times before a reset procedure is initiated
Damaged Rejection Same as Lost Frame (2)
copy Kemal Akkaya
Selective Reject
Also called selective retransmission
Only rejected frames are retransmitted
Subsequent frames are accepted by the receiver and buffered
Minimizes retransmission Receiver must maintain
large enough buffer More complex login in
transmitter
copy Kemal Akkaya
Multiple Access Links and ProtocolsTwo 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
copy Kemal Akkaya
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
Ideal Multiple Access Protocol When one node wants to transmit it can send at rate R When M nodes want to transmit each can send at average rate RM Fully decentralized
No special node to coordinate transmissions No synchronization of clocks slots
Simple
copy Kemal Akkaya
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 Nodes with more to send can take longer turns
copy Kemal Akkaya
Channel Partitioning MAC protocols TDMA
TDMA Time division multiple access Access to channel in rounds Each station gets fixed length slot
Length = packet transmission time in each round
Unused slots go idle Example 6-station LAN
134 have packet Slots 256 idle
copy Kemal Akkaya
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 packet frequency
bands 256 idle
frequ
ency
bands time
1
2
3
4
5
6
copy Kemal Akkaya
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 Carrier Sense Multiple Access (CSMA) CSMACollision Detection (CD) CSMACollision Avoidance (CA)
copy Kemal Akkaya
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
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
copy Kemal Akkaya
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]
Even worse than slotted ALOHA
copy Kemal Akkaya
Collisions can still occur Propagation delay means two nodes may not hear each otherrsquos transmission Entire packet transmission time wasted Role of distance amp propagation delay in determining collision probability spatial layout of nodes
Idea listen before transmit If channel sensed idle
transmit entire frame If channel sensed busy defer
transmission Human analogy donrsquot
interrupt others
CSMA (Carrier Sense Multiple Access)
copy Kemal Akkaya
CSMACD (Collision Detection)
CSMACD carrier sensing deferral as in CSMA Collisions detected within short
time Send jam sequence 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
copy Kemal Akkaya
ldquoTaking Turnsrdquo MAC protocols Channel 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 protocols Look for best of both worlds
Two implementations Polling Token
copy Kemal Akkaya
ldquoTaking 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)
copy Kemal Akkaya
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or code
Time Division Frequency Division
Random partitioning (dynamic) ALOHA S-ALOHA CSMA CSMACD Carrier sensing easy in some technologies (wire) hard in others
(wireless) CSMACD used in Ethernet CSMACA used in 80211
Taking Turns Polling from a central site token passing
copy Kemal Akkaya
LAN technologies
Data link layer so farServicesError detectioncorrectionMultiple access
Next LAN technologiesAddressingEthernetHubs switchesPPP
copy Kemal Akkaya
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
Find your PCrsquos MAC 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(wired orwireless)
Each adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF = adapter
copy Kemal Akkaya
MAC 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
copy Kemal Akkaya
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 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
copy Kemal Akkaya
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
copy Kemal Akkaya
Routing to another LAN Walkthrough send datagram from A to B via R
Assume A knows B IP address
Two ARP tables in router R one for each IP network (LAN) In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110
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
copy Kemal Akkaya
A
R
B
Routing to another LAN
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
Sliding Windows Diagram
copy Kemal Akkaya
Example
copy Kemal Akkaya
Error DetectionEDC = Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
Error detection not 100 reliable Protocol may miss some errors but rarely Larger EDC field yields better detection and correction
copy Kemal Akkaya
Parity Checking Single Bit Parity
Detect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
Internet Checksum Detect ldquoerrorsrdquo (eg flipped bits)
in transmitted segment (note used at transport layer only) 00
Sender Treat segment contents as sequence of 16-bit integers Checksum addition (1rsquos complement sum) of segment contents Sender puts checksum value into UDP checksum field
Receiver Compute checksum of received segment Check if computed checksum equals checksum field value NO - error detected YES - no error
copy Kemal Akkaya
Cyclic Redundancy Check View data bits D as a binary number Choose r+1 bit pattern (generator) G Goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) Receiver knows G divides ltDRgt by G If non-zero remainder error
detected Can detect all burst errors less than r+1 bits
Widely used in practice (ATM HDCL)
copy Kemal Akkaya
CRC Example
WantD2r XOR R = nG
EquivalentlyD2r = nG XOR R
Equivalently
If we divide D2r by G want remainder R
R = remainder[ ]D2r
G
copy Kemal Akkaya
Error Correction
Detection and correction of errors due to Lost frames Damaged frames Underlying channel can lose the frames or can be garbled
Solution at the Link Layer Automatic repeat request Error detection Positive acknowledgment Retransmission after timeout Negative acknowledgement and retransmission
Automatic Repeat Request (ARQ) methods Stop and wait Go back N Selective reject (selective retransmission)
copy Kemal Akkaya
Stop and Wait ARQ Source transmits single
frame Wait for ACK If received frame damaged
discard it Transmitter has timeout If no ACK within timeout
retransmit
If ACK damaged transmitter will not recognize it Transmitter will retransmit Receive gets two copies of frame Use ACK0 and ACK1
Simple but inefficient
copy Kemal Akkaya
More efficient method Go-back-N Based on sliding window If no error ACK as usual with next frame expected Use window to control number of outstanding frames If error reply with rejection
Discard that frame and all future frames until error frame received correctly
Transmitter must go back and retransmit that frame and all subsequent frames
Handling Damaged Frame Receiver detects error in frame i Receiver sends rejection-i Transmitter gets rejection-i Transmitter retransmits frame i and all subsequent
copy Kemal Akkaya
Go-back-N Handling Lost Frame First Approach
Frame i lost Transmitter sends i+1 Receiver gets frame i+1 out of sequence Receiver send reject i Transmitter goes back to frame i and retransmits
Second Approach Frame i lost and no additional frame sent Receiver gets nothing and returns neither acknowledgement nor
rejection Transmitter times out and sends acknowledgement frame with P bit
set to 1 Receiver interprets this as command which it acknowledges with the
number of the next frame it expects (frame i ) Transmitter then retransmits frame i
copy Kemal Akkaya
Go-back-N Damaged ACK
Receiver gets frame i and send acknowledgement (i+1) which is lost
Acknowledgements are cumulative so next acknowledgement (i+n) may arrive before transmitter times out on frame i
If transmitter times out it sends acknowledgement with P bit set as before
This can be repeated a number of times before a reset procedure is initiated
Damaged Rejection Same as Lost Frame (2)
copy Kemal Akkaya
Selective Reject
Also called selective retransmission
Only rejected frames are retransmitted
Subsequent frames are accepted by the receiver and buffered
Minimizes retransmission Receiver must maintain
large enough buffer More complex login in
transmitter
copy Kemal Akkaya
Multiple Access Links and ProtocolsTwo 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
copy Kemal Akkaya
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
Ideal Multiple Access Protocol When one node wants to transmit it can send at rate R When M nodes want to transmit each can send at average rate RM Fully decentralized
No special node to coordinate transmissions No synchronization of clocks slots
Simple
copy Kemal Akkaya
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 Nodes with more to send can take longer turns
copy Kemal Akkaya
Channel Partitioning MAC protocols TDMA
TDMA Time division multiple access Access to channel in rounds Each station gets fixed length slot
Length = packet transmission time in each round
Unused slots go idle Example 6-station LAN
134 have packet Slots 256 idle
copy Kemal Akkaya
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 packet frequency
bands 256 idle
frequ
ency
bands time
1
2
3
4
5
6
copy Kemal Akkaya
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 Carrier Sense Multiple Access (CSMA) CSMACollision Detection (CD) CSMACollision Avoidance (CA)
copy Kemal Akkaya
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
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
copy Kemal Akkaya
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]
Even worse than slotted ALOHA
copy Kemal Akkaya
Collisions can still occur Propagation delay means two nodes may not hear each otherrsquos transmission Entire packet transmission time wasted Role of distance amp propagation delay in determining collision probability spatial layout of nodes
Idea listen before transmit If channel sensed idle
transmit entire frame If channel sensed busy defer
transmission Human analogy donrsquot
interrupt others
CSMA (Carrier Sense Multiple Access)
copy Kemal Akkaya
CSMACD (Collision Detection)
CSMACD carrier sensing deferral as in CSMA Collisions detected within short
time Send jam sequence 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
copy Kemal Akkaya
ldquoTaking Turnsrdquo MAC protocols Channel 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 protocols Look for best of both worlds
Two implementations Polling Token
copy Kemal Akkaya
ldquoTaking 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)
copy Kemal Akkaya
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or code
Time Division Frequency Division
Random partitioning (dynamic) ALOHA S-ALOHA CSMA CSMACD Carrier sensing easy in some technologies (wire) hard in others
(wireless) CSMACD used in Ethernet CSMACA used in 80211
Taking Turns Polling from a central site token passing
copy Kemal Akkaya
LAN technologies
Data link layer so farServicesError detectioncorrectionMultiple access
Next LAN technologiesAddressingEthernetHubs switchesPPP
copy Kemal Akkaya
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
Find your PCrsquos MAC 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(wired orwireless)
Each adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF = adapter
copy Kemal Akkaya
MAC 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
copy Kemal Akkaya
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 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
copy Kemal Akkaya
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
copy Kemal Akkaya
Routing to another LAN Walkthrough send datagram from A to B via R
Assume A knows B IP address
Two ARP tables in router R one for each IP network (LAN) In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110
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
copy Kemal Akkaya
A
R
B
Routing to another LAN
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
Example
copy Kemal Akkaya
Error DetectionEDC = Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
Error detection not 100 reliable Protocol may miss some errors but rarely Larger EDC field yields better detection and correction
copy Kemal Akkaya
Parity Checking Single Bit Parity
Detect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
Internet Checksum Detect ldquoerrorsrdquo (eg flipped bits)
in transmitted segment (note used at transport layer only) 00
Sender Treat segment contents as sequence of 16-bit integers Checksum addition (1rsquos complement sum) of segment contents Sender puts checksum value into UDP checksum field
Receiver Compute checksum of received segment Check if computed checksum equals checksum field value NO - error detected YES - no error
copy Kemal Akkaya
Cyclic Redundancy Check View data bits D as a binary number Choose r+1 bit pattern (generator) G Goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) Receiver knows G divides ltDRgt by G If non-zero remainder error
detected Can detect all burst errors less than r+1 bits
Widely used in practice (ATM HDCL)
copy Kemal Akkaya
CRC Example
WantD2r XOR R = nG
EquivalentlyD2r = nG XOR R
Equivalently
If we divide D2r by G want remainder R
R = remainder[ ]D2r
G
copy Kemal Akkaya
Error Correction
Detection and correction of errors due to Lost frames Damaged frames Underlying channel can lose the frames or can be garbled
Solution at the Link Layer Automatic repeat request Error detection Positive acknowledgment Retransmission after timeout Negative acknowledgement and retransmission
Automatic Repeat Request (ARQ) methods Stop and wait Go back N Selective reject (selective retransmission)
copy Kemal Akkaya
Stop and Wait ARQ Source transmits single
frame Wait for ACK If received frame damaged
discard it Transmitter has timeout If no ACK within timeout
retransmit
If ACK damaged transmitter will not recognize it Transmitter will retransmit Receive gets two copies of frame Use ACK0 and ACK1
Simple but inefficient
copy Kemal Akkaya
More efficient method Go-back-N Based on sliding window If no error ACK as usual with next frame expected Use window to control number of outstanding frames If error reply with rejection
Discard that frame and all future frames until error frame received correctly
Transmitter must go back and retransmit that frame and all subsequent frames
Handling Damaged Frame Receiver detects error in frame i Receiver sends rejection-i Transmitter gets rejection-i Transmitter retransmits frame i and all subsequent
copy Kemal Akkaya
Go-back-N Handling Lost Frame First Approach
Frame i lost Transmitter sends i+1 Receiver gets frame i+1 out of sequence Receiver send reject i Transmitter goes back to frame i and retransmits
Second Approach Frame i lost and no additional frame sent Receiver gets nothing and returns neither acknowledgement nor
rejection Transmitter times out and sends acknowledgement frame with P bit
set to 1 Receiver interprets this as command which it acknowledges with the
number of the next frame it expects (frame i ) Transmitter then retransmits frame i
copy Kemal Akkaya
Go-back-N Damaged ACK
Receiver gets frame i and send acknowledgement (i+1) which is lost
Acknowledgements are cumulative so next acknowledgement (i+n) may arrive before transmitter times out on frame i
If transmitter times out it sends acknowledgement with P bit set as before
This can be repeated a number of times before a reset procedure is initiated
Damaged Rejection Same as Lost Frame (2)
copy Kemal Akkaya
Selective Reject
Also called selective retransmission
Only rejected frames are retransmitted
Subsequent frames are accepted by the receiver and buffered
Minimizes retransmission Receiver must maintain
large enough buffer More complex login in
transmitter
copy Kemal Akkaya
Multiple Access Links and ProtocolsTwo 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
copy Kemal Akkaya
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
Ideal Multiple Access Protocol When one node wants to transmit it can send at rate R When M nodes want to transmit each can send at average rate RM Fully decentralized
No special node to coordinate transmissions No synchronization of clocks slots
Simple
copy Kemal Akkaya
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 Nodes with more to send can take longer turns
copy Kemal Akkaya
Channel Partitioning MAC protocols TDMA
TDMA Time division multiple access Access to channel in rounds Each station gets fixed length slot
Length = packet transmission time in each round
Unused slots go idle Example 6-station LAN
134 have packet Slots 256 idle
copy Kemal Akkaya
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 packet frequency
bands 256 idle
frequ
ency
bands time
1
2
3
4
5
6
copy Kemal Akkaya
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 Carrier Sense Multiple Access (CSMA) CSMACollision Detection (CD) CSMACollision Avoidance (CA)
copy Kemal Akkaya
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
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
copy Kemal Akkaya
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]
Even worse than slotted ALOHA
copy Kemal Akkaya
Collisions can still occur Propagation delay means two nodes may not hear each otherrsquos transmission Entire packet transmission time wasted Role of distance amp propagation delay in determining collision probability spatial layout of nodes
Idea listen before transmit If channel sensed idle
transmit entire frame If channel sensed busy defer
transmission Human analogy donrsquot
interrupt others
CSMA (Carrier Sense Multiple Access)
copy Kemal Akkaya
CSMACD (Collision Detection)
CSMACD carrier sensing deferral as in CSMA Collisions detected within short
time Send jam sequence 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
copy Kemal Akkaya
ldquoTaking Turnsrdquo MAC protocols Channel 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 protocols Look for best of both worlds
Two implementations Polling Token
copy Kemal Akkaya
ldquoTaking 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)
copy Kemal Akkaya
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or code
Time Division Frequency Division
Random partitioning (dynamic) ALOHA S-ALOHA CSMA CSMACD Carrier sensing easy in some technologies (wire) hard in others
(wireless) CSMACD used in Ethernet CSMACA used in 80211
Taking Turns Polling from a central site token passing
copy Kemal Akkaya
LAN technologies
Data link layer so farServicesError detectioncorrectionMultiple access
Next LAN technologiesAddressingEthernetHubs switchesPPP
copy Kemal Akkaya
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
Find your PCrsquos MAC 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(wired orwireless)
Each adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF = adapter
copy Kemal Akkaya
MAC 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
copy Kemal Akkaya
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 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
copy Kemal Akkaya
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
copy Kemal Akkaya
Routing to another LAN Walkthrough send datagram from A to B via R
Assume A knows B IP address
Two ARP tables in router R one for each IP network (LAN) In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110
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
copy Kemal Akkaya
A
R
B
Routing to another LAN
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
Error DetectionEDC = Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
Error detection not 100 reliable Protocol may miss some errors but rarely Larger EDC field yields better detection and correction
copy Kemal Akkaya
Parity Checking Single Bit Parity
Detect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
Internet Checksum Detect ldquoerrorsrdquo (eg flipped bits)
in transmitted segment (note used at transport layer only) 00
Sender Treat segment contents as sequence of 16-bit integers Checksum addition (1rsquos complement sum) of segment contents Sender puts checksum value into UDP checksum field
Receiver Compute checksum of received segment Check if computed checksum equals checksum field value NO - error detected YES - no error
copy Kemal Akkaya
Cyclic Redundancy Check View data bits D as a binary number Choose r+1 bit pattern (generator) G Goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) Receiver knows G divides ltDRgt by G If non-zero remainder error
detected Can detect all burst errors less than r+1 bits
Widely used in practice (ATM HDCL)
copy Kemal Akkaya
CRC Example
WantD2r XOR R = nG
EquivalentlyD2r = nG XOR R
Equivalently
If we divide D2r by G want remainder R
R = remainder[ ]D2r
G
copy Kemal Akkaya
Error Correction
Detection and correction of errors due to Lost frames Damaged frames Underlying channel can lose the frames or can be garbled
Solution at the Link Layer Automatic repeat request Error detection Positive acknowledgment Retransmission after timeout Negative acknowledgement and retransmission
Automatic Repeat Request (ARQ) methods Stop and wait Go back N Selective reject (selective retransmission)
copy Kemal Akkaya
Stop and Wait ARQ Source transmits single
frame Wait for ACK If received frame damaged
discard it Transmitter has timeout If no ACK within timeout
retransmit
If ACK damaged transmitter will not recognize it Transmitter will retransmit Receive gets two copies of frame Use ACK0 and ACK1
Simple but inefficient
copy Kemal Akkaya
More efficient method Go-back-N Based on sliding window If no error ACK as usual with next frame expected Use window to control number of outstanding frames If error reply with rejection
Discard that frame and all future frames until error frame received correctly
Transmitter must go back and retransmit that frame and all subsequent frames
Handling Damaged Frame Receiver detects error in frame i Receiver sends rejection-i Transmitter gets rejection-i Transmitter retransmits frame i and all subsequent
copy Kemal Akkaya
Go-back-N Handling Lost Frame First Approach
Frame i lost Transmitter sends i+1 Receiver gets frame i+1 out of sequence Receiver send reject i Transmitter goes back to frame i and retransmits
Second Approach Frame i lost and no additional frame sent Receiver gets nothing and returns neither acknowledgement nor
rejection Transmitter times out and sends acknowledgement frame with P bit
set to 1 Receiver interprets this as command which it acknowledges with the
number of the next frame it expects (frame i ) Transmitter then retransmits frame i
copy Kemal Akkaya
Go-back-N Damaged ACK
Receiver gets frame i and send acknowledgement (i+1) which is lost
Acknowledgements are cumulative so next acknowledgement (i+n) may arrive before transmitter times out on frame i
If transmitter times out it sends acknowledgement with P bit set as before
This can be repeated a number of times before a reset procedure is initiated
Damaged Rejection Same as Lost Frame (2)
copy Kemal Akkaya
Selective Reject
Also called selective retransmission
Only rejected frames are retransmitted
Subsequent frames are accepted by the receiver and buffered
Minimizes retransmission Receiver must maintain
large enough buffer More complex login in
transmitter
copy Kemal Akkaya
Multiple Access Links and ProtocolsTwo 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
copy Kemal Akkaya
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
Ideal Multiple Access Protocol When one node wants to transmit it can send at rate R When M nodes want to transmit each can send at average rate RM Fully decentralized
No special node to coordinate transmissions No synchronization of clocks slots
Simple
copy Kemal Akkaya
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 Nodes with more to send can take longer turns
copy Kemal Akkaya
Channel Partitioning MAC protocols TDMA
TDMA Time division multiple access Access to channel in rounds Each station gets fixed length slot
Length = packet transmission time in each round
Unused slots go idle Example 6-station LAN
134 have packet Slots 256 idle
copy Kemal Akkaya
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 packet frequency
bands 256 idle
frequ
ency
bands time
1
2
3
4
5
6
copy Kemal Akkaya
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 Carrier Sense Multiple Access (CSMA) CSMACollision Detection (CD) CSMACollision Avoidance (CA)
copy Kemal Akkaya
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
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
copy Kemal Akkaya
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]
Even worse than slotted ALOHA
copy Kemal Akkaya
Collisions can still occur Propagation delay means two nodes may not hear each otherrsquos transmission Entire packet transmission time wasted Role of distance amp propagation delay in determining collision probability spatial layout of nodes
Idea listen before transmit If channel sensed idle
transmit entire frame If channel sensed busy defer
transmission Human analogy donrsquot
interrupt others
CSMA (Carrier Sense Multiple Access)
copy Kemal Akkaya
CSMACD (Collision Detection)
CSMACD carrier sensing deferral as in CSMA Collisions detected within short
time Send jam sequence 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
copy Kemal Akkaya
ldquoTaking Turnsrdquo MAC protocols Channel 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 protocols Look for best of both worlds
Two implementations Polling Token
copy Kemal Akkaya
ldquoTaking 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)
copy Kemal Akkaya
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or code
Time Division Frequency Division
Random partitioning (dynamic) ALOHA S-ALOHA CSMA CSMACD Carrier sensing easy in some technologies (wire) hard in others
(wireless) CSMACD used in Ethernet CSMACA used in 80211
Taking Turns Polling from a central site token passing
copy Kemal Akkaya
LAN technologies
Data link layer so farServicesError detectioncorrectionMultiple access
Next LAN technologiesAddressingEthernetHubs switchesPPP
copy Kemal Akkaya
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
Find your PCrsquos MAC 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(wired orwireless)
Each adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF = adapter
copy Kemal Akkaya
MAC 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
copy Kemal Akkaya
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 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
copy Kemal Akkaya
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
copy Kemal Akkaya
Routing to another LAN Walkthrough send datagram from A to B via R
Assume A knows B IP address
Two ARP tables in router R one for each IP network (LAN) In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110
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
copy Kemal Akkaya
A
R
B
Routing to another LAN
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
Parity Checking Single Bit Parity
Detect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
Internet Checksum Detect ldquoerrorsrdquo (eg flipped bits)
in transmitted segment (note used at transport layer only) 00
Sender Treat segment contents as sequence of 16-bit integers Checksum addition (1rsquos complement sum) of segment contents Sender puts checksum value into UDP checksum field
Receiver Compute checksum of received segment Check if computed checksum equals checksum field value NO - error detected YES - no error
copy Kemal Akkaya
Cyclic Redundancy Check View data bits D as a binary number Choose r+1 bit pattern (generator) G Goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) Receiver knows G divides ltDRgt by G If non-zero remainder error
detected Can detect all burst errors less than r+1 bits
Widely used in practice (ATM HDCL)
copy Kemal Akkaya
CRC Example
WantD2r XOR R = nG
EquivalentlyD2r = nG XOR R
Equivalently
If we divide D2r by G want remainder R
R = remainder[ ]D2r
G
copy Kemal Akkaya
Error Correction
Detection and correction of errors due to Lost frames Damaged frames Underlying channel can lose the frames or can be garbled
Solution at the Link Layer Automatic repeat request Error detection Positive acknowledgment Retransmission after timeout Negative acknowledgement and retransmission
Automatic Repeat Request (ARQ) methods Stop and wait Go back N Selective reject (selective retransmission)
copy Kemal Akkaya
Stop and Wait ARQ Source transmits single
frame Wait for ACK If received frame damaged
discard it Transmitter has timeout If no ACK within timeout
retransmit
If ACK damaged transmitter will not recognize it Transmitter will retransmit Receive gets two copies of frame Use ACK0 and ACK1
Simple but inefficient
copy Kemal Akkaya
More efficient method Go-back-N Based on sliding window If no error ACK as usual with next frame expected Use window to control number of outstanding frames If error reply with rejection
Discard that frame and all future frames until error frame received correctly
Transmitter must go back and retransmit that frame and all subsequent frames
Handling Damaged Frame Receiver detects error in frame i Receiver sends rejection-i Transmitter gets rejection-i Transmitter retransmits frame i and all subsequent
copy Kemal Akkaya
Go-back-N Handling Lost Frame First Approach
Frame i lost Transmitter sends i+1 Receiver gets frame i+1 out of sequence Receiver send reject i Transmitter goes back to frame i and retransmits
Second Approach Frame i lost and no additional frame sent Receiver gets nothing and returns neither acknowledgement nor
rejection Transmitter times out and sends acknowledgement frame with P bit
set to 1 Receiver interprets this as command which it acknowledges with the
number of the next frame it expects (frame i ) Transmitter then retransmits frame i
copy Kemal Akkaya
Go-back-N Damaged ACK
Receiver gets frame i and send acknowledgement (i+1) which is lost
Acknowledgements are cumulative so next acknowledgement (i+n) may arrive before transmitter times out on frame i
If transmitter times out it sends acknowledgement with P bit set as before
This can be repeated a number of times before a reset procedure is initiated
Damaged Rejection Same as Lost Frame (2)
copy Kemal Akkaya
Selective Reject
Also called selective retransmission
Only rejected frames are retransmitted
Subsequent frames are accepted by the receiver and buffered
Minimizes retransmission Receiver must maintain
large enough buffer More complex login in
transmitter
copy Kemal Akkaya
Multiple Access Links and ProtocolsTwo 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
copy Kemal Akkaya
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
Ideal Multiple Access Protocol When one node wants to transmit it can send at rate R When M nodes want to transmit each can send at average rate RM Fully decentralized
No special node to coordinate transmissions No synchronization of clocks slots
Simple
copy Kemal Akkaya
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 Nodes with more to send can take longer turns
copy Kemal Akkaya
Channel Partitioning MAC protocols TDMA
TDMA Time division multiple access Access to channel in rounds Each station gets fixed length slot
Length = packet transmission time in each round
Unused slots go idle Example 6-station LAN
134 have packet Slots 256 idle
copy Kemal Akkaya
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 packet frequency
bands 256 idle
frequ
ency
bands time
1
2
3
4
5
6
copy Kemal Akkaya
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 Carrier Sense Multiple Access (CSMA) CSMACollision Detection (CD) CSMACollision Avoidance (CA)
copy Kemal Akkaya
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
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
copy Kemal Akkaya
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]
Even worse than slotted ALOHA
copy Kemal Akkaya
Collisions can still occur Propagation delay means two nodes may not hear each otherrsquos transmission Entire packet transmission time wasted Role of distance amp propagation delay in determining collision probability spatial layout of nodes
Idea listen before transmit If channel sensed idle
transmit entire frame If channel sensed busy defer
transmission Human analogy donrsquot
interrupt others
CSMA (Carrier Sense Multiple Access)
copy Kemal Akkaya
CSMACD (Collision Detection)
CSMACD carrier sensing deferral as in CSMA Collisions detected within short
time Send jam sequence 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
copy Kemal Akkaya
ldquoTaking Turnsrdquo MAC protocols Channel 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 protocols Look for best of both worlds
Two implementations Polling Token
copy Kemal Akkaya
ldquoTaking 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)
copy Kemal Akkaya
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or code
Time Division Frequency Division
Random partitioning (dynamic) ALOHA S-ALOHA CSMA CSMACD Carrier sensing easy in some technologies (wire) hard in others
(wireless) CSMACD used in Ethernet CSMACA used in 80211
Taking Turns Polling from a central site token passing
copy Kemal Akkaya
LAN technologies
Data link layer so farServicesError detectioncorrectionMultiple access
Next LAN technologiesAddressingEthernetHubs switchesPPP
copy Kemal Akkaya
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
Find your PCrsquos MAC 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(wired orwireless)
Each adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF = adapter
copy Kemal Akkaya
MAC 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
copy Kemal Akkaya
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 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
copy Kemal Akkaya
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
copy Kemal Akkaya
Routing to another LAN Walkthrough send datagram from A to B via R
Assume A knows B IP address
Two ARP tables in router R one for each IP network (LAN) In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110
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
copy Kemal Akkaya
A
R
B
Routing to another LAN
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
Cyclic Redundancy Check View data bits D as a binary number Choose r+1 bit pattern (generator) G Goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) Receiver knows G divides ltDRgt by G If non-zero remainder error
detected Can detect all burst errors less than r+1 bits
Widely used in practice (ATM HDCL)
copy Kemal Akkaya
CRC Example
WantD2r XOR R = nG
EquivalentlyD2r = nG XOR R
Equivalently
If we divide D2r by G want remainder R
R = remainder[ ]D2r
G
copy Kemal Akkaya
Error Correction
Detection and correction of errors due to Lost frames Damaged frames Underlying channel can lose the frames or can be garbled
Solution at the Link Layer Automatic repeat request Error detection Positive acknowledgment Retransmission after timeout Negative acknowledgement and retransmission
Automatic Repeat Request (ARQ) methods Stop and wait Go back N Selective reject (selective retransmission)
copy Kemal Akkaya
Stop and Wait ARQ Source transmits single
frame Wait for ACK If received frame damaged
discard it Transmitter has timeout If no ACK within timeout
retransmit
If ACK damaged transmitter will not recognize it Transmitter will retransmit Receive gets two copies of frame Use ACK0 and ACK1
Simple but inefficient
copy Kemal Akkaya
More efficient method Go-back-N Based on sliding window If no error ACK as usual with next frame expected Use window to control number of outstanding frames If error reply with rejection
Discard that frame and all future frames until error frame received correctly
Transmitter must go back and retransmit that frame and all subsequent frames
Handling Damaged Frame Receiver detects error in frame i Receiver sends rejection-i Transmitter gets rejection-i Transmitter retransmits frame i and all subsequent
copy Kemal Akkaya
Go-back-N Handling Lost Frame First Approach
Frame i lost Transmitter sends i+1 Receiver gets frame i+1 out of sequence Receiver send reject i Transmitter goes back to frame i and retransmits
Second Approach Frame i lost and no additional frame sent Receiver gets nothing and returns neither acknowledgement nor
rejection Transmitter times out and sends acknowledgement frame with P bit
set to 1 Receiver interprets this as command which it acknowledges with the
number of the next frame it expects (frame i ) Transmitter then retransmits frame i
copy Kemal Akkaya
Go-back-N Damaged ACK
Receiver gets frame i and send acknowledgement (i+1) which is lost
Acknowledgements are cumulative so next acknowledgement (i+n) may arrive before transmitter times out on frame i
If transmitter times out it sends acknowledgement with P bit set as before
This can be repeated a number of times before a reset procedure is initiated
Damaged Rejection Same as Lost Frame (2)
copy Kemal Akkaya
Selective Reject
Also called selective retransmission
Only rejected frames are retransmitted
Subsequent frames are accepted by the receiver and buffered
Minimizes retransmission Receiver must maintain
large enough buffer More complex login in
transmitter
copy Kemal Akkaya
Multiple Access Links and ProtocolsTwo 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
copy Kemal Akkaya
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
Ideal Multiple Access Protocol When one node wants to transmit it can send at rate R When M nodes want to transmit each can send at average rate RM Fully decentralized
No special node to coordinate transmissions No synchronization of clocks slots
Simple
copy Kemal Akkaya
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 Nodes with more to send can take longer turns
copy Kemal Akkaya
Channel Partitioning MAC protocols TDMA
TDMA Time division multiple access Access to channel in rounds Each station gets fixed length slot
Length = packet transmission time in each round
Unused slots go idle Example 6-station LAN
134 have packet Slots 256 idle
copy Kemal Akkaya
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 packet frequency
bands 256 idle
frequ
ency
bands time
1
2
3
4
5
6
copy Kemal Akkaya
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 Carrier Sense Multiple Access (CSMA) CSMACollision Detection (CD) CSMACollision Avoidance (CA)
copy Kemal Akkaya
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
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
copy Kemal Akkaya
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]
Even worse than slotted ALOHA
copy Kemal Akkaya
Collisions can still occur Propagation delay means two nodes may not hear each otherrsquos transmission Entire packet transmission time wasted Role of distance amp propagation delay in determining collision probability spatial layout of nodes
Idea listen before transmit If channel sensed idle
transmit entire frame If channel sensed busy defer
transmission Human analogy donrsquot
interrupt others
CSMA (Carrier Sense Multiple Access)
copy Kemal Akkaya
CSMACD (Collision Detection)
CSMACD carrier sensing deferral as in CSMA Collisions detected within short
time Send jam sequence 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
copy Kemal Akkaya
ldquoTaking Turnsrdquo MAC protocols Channel 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 protocols Look for best of both worlds
Two implementations Polling Token
copy Kemal Akkaya
ldquoTaking 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)
copy Kemal Akkaya
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or code
Time Division Frequency Division
Random partitioning (dynamic) ALOHA S-ALOHA CSMA CSMACD Carrier sensing easy in some technologies (wire) hard in others
(wireless) CSMACD used in Ethernet CSMACA used in 80211
Taking Turns Polling from a central site token passing
copy Kemal Akkaya
LAN technologies
Data link layer so farServicesError detectioncorrectionMultiple access
Next LAN technologiesAddressingEthernetHubs switchesPPP
copy Kemal Akkaya
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
Find your PCrsquos MAC 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(wired orwireless)
Each adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF = adapter
copy Kemal Akkaya
MAC 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
copy Kemal Akkaya
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 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
copy Kemal Akkaya
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
copy Kemal Akkaya
Routing to another LAN Walkthrough send datagram from A to B via R
Assume A knows B IP address
Two ARP tables in router R one for each IP network (LAN) In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110
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
copy Kemal Akkaya
A
R
B
Routing to another LAN
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
CRC Example
WantD2r XOR R = nG
EquivalentlyD2r = nG XOR R
Equivalently
If we divide D2r by G want remainder R
R = remainder[ ]D2r
G
copy Kemal Akkaya
Error Correction
Detection and correction of errors due to Lost frames Damaged frames Underlying channel can lose the frames or can be garbled
Solution at the Link Layer Automatic repeat request Error detection Positive acknowledgment Retransmission after timeout Negative acknowledgement and retransmission
Automatic Repeat Request (ARQ) methods Stop and wait Go back N Selective reject (selective retransmission)
copy Kemal Akkaya
Stop and Wait ARQ Source transmits single
frame Wait for ACK If received frame damaged
discard it Transmitter has timeout If no ACK within timeout
retransmit
If ACK damaged transmitter will not recognize it Transmitter will retransmit Receive gets two copies of frame Use ACK0 and ACK1
Simple but inefficient
copy Kemal Akkaya
More efficient method Go-back-N Based on sliding window If no error ACK as usual with next frame expected Use window to control number of outstanding frames If error reply with rejection
Discard that frame and all future frames until error frame received correctly
Transmitter must go back and retransmit that frame and all subsequent frames
Handling Damaged Frame Receiver detects error in frame i Receiver sends rejection-i Transmitter gets rejection-i Transmitter retransmits frame i and all subsequent
copy Kemal Akkaya
Go-back-N Handling Lost Frame First Approach
Frame i lost Transmitter sends i+1 Receiver gets frame i+1 out of sequence Receiver send reject i Transmitter goes back to frame i and retransmits
Second Approach Frame i lost and no additional frame sent Receiver gets nothing and returns neither acknowledgement nor
rejection Transmitter times out and sends acknowledgement frame with P bit
set to 1 Receiver interprets this as command which it acknowledges with the
number of the next frame it expects (frame i ) Transmitter then retransmits frame i
copy Kemal Akkaya
Go-back-N Damaged ACK
Receiver gets frame i and send acknowledgement (i+1) which is lost
Acknowledgements are cumulative so next acknowledgement (i+n) may arrive before transmitter times out on frame i
If transmitter times out it sends acknowledgement with P bit set as before
This can be repeated a number of times before a reset procedure is initiated
Damaged Rejection Same as Lost Frame (2)
copy Kemal Akkaya
Selective Reject
Also called selective retransmission
Only rejected frames are retransmitted
Subsequent frames are accepted by the receiver and buffered
Minimizes retransmission Receiver must maintain
large enough buffer More complex login in
transmitter
copy Kemal Akkaya
Multiple Access Links and ProtocolsTwo 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
copy Kemal Akkaya
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
Ideal Multiple Access Protocol When one node wants to transmit it can send at rate R When M nodes want to transmit each can send at average rate RM Fully decentralized
No special node to coordinate transmissions No synchronization of clocks slots
Simple
copy Kemal Akkaya
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 Nodes with more to send can take longer turns
copy Kemal Akkaya
Channel Partitioning MAC protocols TDMA
TDMA Time division multiple access Access to channel in rounds Each station gets fixed length slot
Length = packet transmission time in each round
Unused slots go idle Example 6-station LAN
134 have packet Slots 256 idle
copy Kemal Akkaya
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 packet frequency
bands 256 idle
frequ
ency
bands time
1
2
3
4
5
6
copy Kemal Akkaya
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 Carrier Sense Multiple Access (CSMA) CSMACollision Detection (CD) CSMACollision Avoidance (CA)
copy Kemal Akkaya
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
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
copy Kemal Akkaya
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]
Even worse than slotted ALOHA
copy Kemal Akkaya
Collisions can still occur Propagation delay means two nodes may not hear each otherrsquos transmission Entire packet transmission time wasted Role of distance amp propagation delay in determining collision probability spatial layout of nodes
Idea listen before transmit If channel sensed idle
transmit entire frame If channel sensed busy defer
transmission Human analogy donrsquot
interrupt others
CSMA (Carrier Sense Multiple Access)
copy Kemal Akkaya
CSMACD (Collision Detection)
CSMACD carrier sensing deferral as in CSMA Collisions detected within short
time Send jam sequence 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
copy Kemal Akkaya
ldquoTaking Turnsrdquo MAC protocols Channel 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 protocols Look for best of both worlds
Two implementations Polling Token
copy Kemal Akkaya
ldquoTaking 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)
copy Kemal Akkaya
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or code
Time Division Frequency Division
Random partitioning (dynamic) ALOHA S-ALOHA CSMA CSMACD Carrier sensing easy in some technologies (wire) hard in others
(wireless) CSMACD used in Ethernet CSMACA used in 80211
Taking Turns Polling from a central site token passing
copy Kemal Akkaya
LAN technologies
Data link layer so farServicesError detectioncorrectionMultiple access
Next LAN technologiesAddressingEthernetHubs switchesPPP
copy Kemal Akkaya
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
Find your PCrsquos MAC 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(wired orwireless)
Each adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF = adapter
copy Kemal Akkaya
MAC 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
copy Kemal Akkaya
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 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
copy Kemal Akkaya
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
copy Kemal Akkaya
Routing to another LAN Walkthrough send datagram from A to B via R
Assume A knows B IP address
Two ARP tables in router R one for each IP network (LAN) In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110
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
copy Kemal Akkaya
A
R
B
Routing to another LAN
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
Error Correction
Detection and correction of errors due to Lost frames Damaged frames Underlying channel can lose the frames or can be garbled
Solution at the Link Layer Automatic repeat request Error detection Positive acknowledgment Retransmission after timeout Negative acknowledgement and retransmission
Automatic Repeat Request (ARQ) methods Stop and wait Go back N Selective reject (selective retransmission)
copy Kemal Akkaya
Stop and Wait ARQ Source transmits single
frame Wait for ACK If received frame damaged
discard it Transmitter has timeout If no ACK within timeout
retransmit
If ACK damaged transmitter will not recognize it Transmitter will retransmit Receive gets two copies of frame Use ACK0 and ACK1
Simple but inefficient
copy Kemal Akkaya
More efficient method Go-back-N Based on sliding window If no error ACK as usual with next frame expected Use window to control number of outstanding frames If error reply with rejection
Discard that frame and all future frames until error frame received correctly
Transmitter must go back and retransmit that frame and all subsequent frames
Handling Damaged Frame Receiver detects error in frame i Receiver sends rejection-i Transmitter gets rejection-i Transmitter retransmits frame i and all subsequent
copy Kemal Akkaya
Go-back-N Handling Lost Frame First Approach
Frame i lost Transmitter sends i+1 Receiver gets frame i+1 out of sequence Receiver send reject i Transmitter goes back to frame i and retransmits
Second Approach Frame i lost and no additional frame sent Receiver gets nothing and returns neither acknowledgement nor
rejection Transmitter times out and sends acknowledgement frame with P bit
set to 1 Receiver interprets this as command which it acknowledges with the
number of the next frame it expects (frame i ) Transmitter then retransmits frame i
copy Kemal Akkaya
Go-back-N Damaged ACK
Receiver gets frame i and send acknowledgement (i+1) which is lost
Acknowledgements are cumulative so next acknowledgement (i+n) may arrive before transmitter times out on frame i
If transmitter times out it sends acknowledgement with P bit set as before
This can be repeated a number of times before a reset procedure is initiated
Damaged Rejection Same as Lost Frame (2)
copy Kemal Akkaya
Selective Reject
Also called selective retransmission
Only rejected frames are retransmitted
Subsequent frames are accepted by the receiver and buffered
Minimizes retransmission Receiver must maintain
large enough buffer More complex login in
transmitter
copy Kemal Akkaya
Multiple Access Links and ProtocolsTwo 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
copy Kemal Akkaya
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
Ideal Multiple Access Protocol When one node wants to transmit it can send at rate R When M nodes want to transmit each can send at average rate RM Fully decentralized
No special node to coordinate transmissions No synchronization of clocks slots
Simple
copy Kemal Akkaya
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 Nodes with more to send can take longer turns
copy Kemal Akkaya
Channel Partitioning MAC protocols TDMA
TDMA Time division multiple access Access to channel in rounds Each station gets fixed length slot
Length = packet transmission time in each round
Unused slots go idle Example 6-station LAN
134 have packet Slots 256 idle
copy Kemal Akkaya
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 packet frequency
bands 256 idle
frequ
ency
bands time
1
2
3
4
5
6
copy Kemal Akkaya
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 Carrier Sense Multiple Access (CSMA) CSMACollision Detection (CD) CSMACollision Avoidance (CA)
copy Kemal Akkaya
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
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
copy Kemal Akkaya
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]
Even worse than slotted ALOHA
copy Kemal Akkaya
Collisions can still occur Propagation delay means two nodes may not hear each otherrsquos transmission Entire packet transmission time wasted Role of distance amp propagation delay in determining collision probability spatial layout of nodes
Idea listen before transmit If channel sensed idle
transmit entire frame If channel sensed busy defer
transmission Human analogy donrsquot
interrupt others
CSMA (Carrier Sense Multiple Access)
copy Kemal Akkaya
CSMACD (Collision Detection)
CSMACD carrier sensing deferral as in CSMA Collisions detected within short
time Send jam sequence 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
copy Kemal Akkaya
ldquoTaking Turnsrdquo MAC protocols Channel 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 protocols Look for best of both worlds
Two implementations Polling Token
copy Kemal Akkaya
ldquoTaking 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)
copy Kemal Akkaya
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or code
Time Division Frequency Division
Random partitioning (dynamic) ALOHA S-ALOHA CSMA CSMACD Carrier sensing easy in some technologies (wire) hard in others
(wireless) CSMACD used in Ethernet CSMACA used in 80211
Taking Turns Polling from a central site token passing
copy Kemal Akkaya
LAN technologies
Data link layer so farServicesError detectioncorrectionMultiple access
Next LAN technologiesAddressingEthernetHubs switchesPPP
copy Kemal Akkaya
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
Find your PCrsquos MAC 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(wired orwireless)
Each adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF = adapter
copy Kemal Akkaya
MAC 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
copy Kemal Akkaya
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 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
copy Kemal Akkaya
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
copy Kemal Akkaya
Routing to another LAN Walkthrough send datagram from A to B via R
Assume A knows B IP address
Two ARP tables in router R one for each IP network (LAN) In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110
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
copy Kemal Akkaya
A
R
B
Routing to another LAN
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
Stop and Wait ARQ Source transmits single
frame Wait for ACK If received frame damaged
discard it Transmitter has timeout If no ACK within timeout
retransmit
If ACK damaged transmitter will not recognize it Transmitter will retransmit Receive gets two copies of frame Use ACK0 and ACK1
Simple but inefficient
copy Kemal Akkaya
More efficient method Go-back-N Based on sliding window If no error ACK as usual with next frame expected Use window to control number of outstanding frames If error reply with rejection
Discard that frame and all future frames until error frame received correctly
Transmitter must go back and retransmit that frame and all subsequent frames
Handling Damaged Frame Receiver detects error in frame i Receiver sends rejection-i Transmitter gets rejection-i Transmitter retransmits frame i and all subsequent
copy Kemal Akkaya
Go-back-N Handling Lost Frame First Approach
Frame i lost Transmitter sends i+1 Receiver gets frame i+1 out of sequence Receiver send reject i Transmitter goes back to frame i and retransmits
Second Approach Frame i lost and no additional frame sent Receiver gets nothing and returns neither acknowledgement nor
rejection Transmitter times out and sends acknowledgement frame with P bit
set to 1 Receiver interprets this as command which it acknowledges with the
number of the next frame it expects (frame i ) Transmitter then retransmits frame i
copy Kemal Akkaya
Go-back-N Damaged ACK
Receiver gets frame i and send acknowledgement (i+1) which is lost
Acknowledgements are cumulative so next acknowledgement (i+n) may arrive before transmitter times out on frame i
If transmitter times out it sends acknowledgement with P bit set as before
This can be repeated a number of times before a reset procedure is initiated
Damaged Rejection Same as Lost Frame (2)
copy Kemal Akkaya
Selective Reject
Also called selective retransmission
Only rejected frames are retransmitted
Subsequent frames are accepted by the receiver and buffered
Minimizes retransmission Receiver must maintain
large enough buffer More complex login in
transmitter
copy Kemal Akkaya
Multiple Access Links and ProtocolsTwo 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
copy Kemal Akkaya
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
Ideal Multiple Access Protocol When one node wants to transmit it can send at rate R When M nodes want to transmit each can send at average rate RM Fully decentralized
No special node to coordinate transmissions No synchronization of clocks slots
Simple
copy Kemal Akkaya
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 Nodes with more to send can take longer turns
copy Kemal Akkaya
Channel Partitioning MAC protocols TDMA
TDMA Time division multiple access Access to channel in rounds Each station gets fixed length slot
Length = packet transmission time in each round
Unused slots go idle Example 6-station LAN
134 have packet Slots 256 idle
copy Kemal Akkaya
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 packet frequency
bands 256 idle
frequ
ency
bands time
1
2
3
4
5
6
copy Kemal Akkaya
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 Carrier Sense Multiple Access (CSMA) CSMACollision Detection (CD) CSMACollision Avoidance (CA)
copy Kemal Akkaya
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
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
copy Kemal Akkaya
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]
Even worse than slotted ALOHA
copy Kemal Akkaya
Collisions can still occur Propagation delay means two nodes may not hear each otherrsquos transmission Entire packet transmission time wasted Role of distance amp propagation delay in determining collision probability spatial layout of nodes
Idea listen before transmit If channel sensed idle
transmit entire frame If channel sensed busy defer
transmission Human analogy donrsquot
interrupt others
CSMA (Carrier Sense Multiple Access)
copy Kemal Akkaya
CSMACD (Collision Detection)
CSMACD carrier sensing deferral as in CSMA Collisions detected within short
time Send jam sequence 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
copy Kemal Akkaya
ldquoTaking Turnsrdquo MAC protocols Channel 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 protocols Look for best of both worlds
Two implementations Polling Token
copy Kemal Akkaya
ldquoTaking 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)
copy Kemal Akkaya
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or code
Time Division Frequency Division
Random partitioning (dynamic) ALOHA S-ALOHA CSMA CSMACD Carrier sensing easy in some technologies (wire) hard in others
(wireless) CSMACD used in Ethernet CSMACA used in 80211
Taking Turns Polling from a central site token passing
copy Kemal Akkaya
LAN technologies
Data link layer so farServicesError detectioncorrectionMultiple access
Next LAN technologiesAddressingEthernetHubs switchesPPP
copy Kemal Akkaya
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
Find your PCrsquos MAC 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(wired orwireless)
Each adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF = adapter
copy Kemal Akkaya
MAC 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
copy Kemal Akkaya
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 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
copy Kemal Akkaya
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
copy Kemal Akkaya
Routing to another LAN Walkthrough send datagram from A to B via R
Assume A knows B IP address
Two ARP tables in router R one for each IP network (LAN) In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110
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
copy Kemal Akkaya
A
R
B
Routing to another LAN
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
More efficient method Go-back-N Based on sliding window If no error ACK as usual with next frame expected Use window to control number of outstanding frames If error reply with rejection
Discard that frame and all future frames until error frame received correctly
Transmitter must go back and retransmit that frame and all subsequent frames
Handling Damaged Frame Receiver detects error in frame i Receiver sends rejection-i Transmitter gets rejection-i Transmitter retransmits frame i and all subsequent
copy Kemal Akkaya
Go-back-N Handling Lost Frame First Approach
Frame i lost Transmitter sends i+1 Receiver gets frame i+1 out of sequence Receiver send reject i Transmitter goes back to frame i and retransmits
Second Approach Frame i lost and no additional frame sent Receiver gets nothing and returns neither acknowledgement nor
rejection Transmitter times out and sends acknowledgement frame with P bit
set to 1 Receiver interprets this as command which it acknowledges with the
number of the next frame it expects (frame i ) Transmitter then retransmits frame i
copy Kemal Akkaya
Go-back-N Damaged ACK
Receiver gets frame i and send acknowledgement (i+1) which is lost
Acknowledgements are cumulative so next acknowledgement (i+n) may arrive before transmitter times out on frame i
If transmitter times out it sends acknowledgement with P bit set as before
This can be repeated a number of times before a reset procedure is initiated
Damaged Rejection Same as Lost Frame (2)
copy Kemal Akkaya
Selective Reject
Also called selective retransmission
Only rejected frames are retransmitted
Subsequent frames are accepted by the receiver and buffered
Minimizes retransmission Receiver must maintain
large enough buffer More complex login in
transmitter
copy Kemal Akkaya
Multiple Access Links and ProtocolsTwo 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
copy Kemal Akkaya
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
Ideal Multiple Access Protocol When one node wants to transmit it can send at rate R When M nodes want to transmit each can send at average rate RM Fully decentralized
No special node to coordinate transmissions No synchronization of clocks slots
Simple
copy Kemal Akkaya
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 Nodes with more to send can take longer turns
copy Kemal Akkaya
Channel Partitioning MAC protocols TDMA
TDMA Time division multiple access Access to channel in rounds Each station gets fixed length slot
Length = packet transmission time in each round
Unused slots go idle Example 6-station LAN
134 have packet Slots 256 idle
copy Kemal Akkaya
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 packet frequency
bands 256 idle
frequ
ency
bands time
1
2
3
4
5
6
copy Kemal Akkaya
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 Carrier Sense Multiple Access (CSMA) CSMACollision Detection (CD) CSMACollision Avoidance (CA)
copy Kemal Akkaya
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
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
copy Kemal Akkaya
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]
Even worse than slotted ALOHA
copy Kemal Akkaya
Collisions can still occur Propagation delay means two nodes may not hear each otherrsquos transmission Entire packet transmission time wasted Role of distance amp propagation delay in determining collision probability spatial layout of nodes
Idea listen before transmit If channel sensed idle
transmit entire frame If channel sensed busy defer
transmission Human analogy donrsquot
interrupt others
CSMA (Carrier Sense Multiple Access)
copy Kemal Akkaya
CSMACD (Collision Detection)
CSMACD carrier sensing deferral as in CSMA Collisions detected within short
time Send jam sequence 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
copy Kemal Akkaya
ldquoTaking Turnsrdquo MAC protocols Channel 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 protocols Look for best of both worlds
Two implementations Polling Token
copy Kemal Akkaya
ldquoTaking 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)
copy Kemal Akkaya
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or code
Time Division Frequency Division
Random partitioning (dynamic) ALOHA S-ALOHA CSMA CSMACD Carrier sensing easy in some technologies (wire) hard in others
(wireless) CSMACD used in Ethernet CSMACA used in 80211
Taking Turns Polling from a central site token passing
copy Kemal Akkaya
LAN technologies
Data link layer so farServicesError detectioncorrectionMultiple access
Next LAN technologiesAddressingEthernetHubs switchesPPP
copy Kemal Akkaya
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
Find your PCrsquos MAC 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(wired orwireless)
Each adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF = adapter
copy Kemal Akkaya
MAC 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
copy Kemal Akkaya
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 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
copy Kemal Akkaya
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
copy Kemal Akkaya
Routing to another LAN Walkthrough send datagram from A to B via R
Assume A knows B IP address
Two ARP tables in router R one for each IP network (LAN) In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110
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
copy Kemal Akkaya
A
R
B
Routing to another LAN
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
Go-back-N Handling Lost Frame First Approach
Frame i lost Transmitter sends i+1 Receiver gets frame i+1 out of sequence Receiver send reject i Transmitter goes back to frame i and retransmits
Second Approach Frame i lost and no additional frame sent Receiver gets nothing and returns neither acknowledgement nor
rejection Transmitter times out and sends acknowledgement frame with P bit
set to 1 Receiver interprets this as command which it acknowledges with the
number of the next frame it expects (frame i ) Transmitter then retransmits frame i
copy Kemal Akkaya
Go-back-N Damaged ACK
Receiver gets frame i and send acknowledgement (i+1) which is lost
Acknowledgements are cumulative so next acknowledgement (i+n) may arrive before transmitter times out on frame i
If transmitter times out it sends acknowledgement with P bit set as before
This can be repeated a number of times before a reset procedure is initiated
Damaged Rejection Same as Lost Frame (2)
copy Kemal Akkaya
Selective Reject
Also called selective retransmission
Only rejected frames are retransmitted
Subsequent frames are accepted by the receiver and buffered
Minimizes retransmission Receiver must maintain
large enough buffer More complex login in
transmitter
copy Kemal Akkaya
Multiple Access Links and ProtocolsTwo 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
copy Kemal Akkaya
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
Ideal Multiple Access Protocol When one node wants to transmit it can send at rate R When M nodes want to transmit each can send at average rate RM Fully decentralized
No special node to coordinate transmissions No synchronization of clocks slots
Simple
copy Kemal Akkaya
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 Nodes with more to send can take longer turns
copy Kemal Akkaya
Channel Partitioning MAC protocols TDMA
TDMA Time division multiple access Access to channel in rounds Each station gets fixed length slot
Length = packet transmission time in each round
Unused slots go idle Example 6-station LAN
134 have packet Slots 256 idle
copy Kemal Akkaya
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 packet frequency
bands 256 idle
frequ
ency
bands time
1
2
3
4
5
6
copy Kemal Akkaya
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 Carrier Sense Multiple Access (CSMA) CSMACollision Detection (CD) CSMACollision Avoidance (CA)
copy Kemal Akkaya
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
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
copy Kemal Akkaya
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]
Even worse than slotted ALOHA
copy Kemal Akkaya
Collisions can still occur Propagation delay means two nodes may not hear each otherrsquos transmission Entire packet transmission time wasted Role of distance amp propagation delay in determining collision probability spatial layout of nodes
Idea listen before transmit If channel sensed idle
transmit entire frame If channel sensed busy defer
transmission Human analogy donrsquot
interrupt others
CSMA (Carrier Sense Multiple Access)
copy Kemal Akkaya
CSMACD (Collision Detection)
CSMACD carrier sensing deferral as in CSMA Collisions detected within short
time Send jam sequence 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
copy Kemal Akkaya
ldquoTaking Turnsrdquo MAC protocols Channel 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 protocols Look for best of both worlds
Two implementations Polling Token
copy Kemal Akkaya
ldquoTaking 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)
copy Kemal Akkaya
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or code
Time Division Frequency Division
Random partitioning (dynamic) ALOHA S-ALOHA CSMA CSMACD Carrier sensing easy in some technologies (wire) hard in others
(wireless) CSMACD used in Ethernet CSMACA used in 80211
Taking Turns Polling from a central site token passing
copy Kemal Akkaya
LAN technologies
Data link layer so farServicesError detectioncorrectionMultiple access
Next LAN technologiesAddressingEthernetHubs switchesPPP
copy Kemal Akkaya
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
Find your PCrsquos MAC 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(wired orwireless)
Each adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF = adapter
copy Kemal Akkaya
MAC 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
copy Kemal Akkaya
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 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
copy Kemal Akkaya
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
copy Kemal Akkaya
Routing to another LAN Walkthrough send datagram from A to B via R
Assume A knows B IP address
Two ARP tables in router R one for each IP network (LAN) In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110
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
copy Kemal Akkaya
A
R
B
Routing to another LAN
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
Go-back-N Damaged ACK
Receiver gets frame i and send acknowledgement (i+1) which is lost
Acknowledgements are cumulative so next acknowledgement (i+n) may arrive before transmitter times out on frame i
If transmitter times out it sends acknowledgement with P bit set as before
This can be repeated a number of times before a reset procedure is initiated
Damaged Rejection Same as Lost Frame (2)
copy Kemal Akkaya
Selective Reject
Also called selective retransmission
Only rejected frames are retransmitted
Subsequent frames are accepted by the receiver and buffered
Minimizes retransmission Receiver must maintain
large enough buffer More complex login in
transmitter
copy Kemal Akkaya
Multiple Access Links and ProtocolsTwo 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
copy Kemal Akkaya
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
Ideal Multiple Access Protocol When one node wants to transmit it can send at rate R When M nodes want to transmit each can send at average rate RM Fully decentralized
No special node to coordinate transmissions No synchronization of clocks slots
Simple
copy Kemal Akkaya
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 Nodes with more to send can take longer turns
copy Kemal Akkaya
Channel Partitioning MAC protocols TDMA
TDMA Time division multiple access Access to channel in rounds Each station gets fixed length slot
Length = packet transmission time in each round
Unused slots go idle Example 6-station LAN
134 have packet Slots 256 idle
copy Kemal Akkaya
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 packet frequency
bands 256 idle
frequ
ency
bands time
1
2
3
4
5
6
copy Kemal Akkaya
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 Carrier Sense Multiple Access (CSMA) CSMACollision Detection (CD) CSMACollision Avoidance (CA)
copy Kemal Akkaya
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
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
copy Kemal Akkaya
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]
Even worse than slotted ALOHA
copy Kemal Akkaya
Collisions can still occur Propagation delay means two nodes may not hear each otherrsquos transmission Entire packet transmission time wasted Role of distance amp propagation delay in determining collision probability spatial layout of nodes
Idea listen before transmit If channel sensed idle
transmit entire frame If channel sensed busy defer
transmission Human analogy donrsquot
interrupt others
CSMA (Carrier Sense Multiple Access)
copy Kemal Akkaya
CSMACD (Collision Detection)
CSMACD carrier sensing deferral as in CSMA Collisions detected within short
time Send jam sequence 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
copy Kemal Akkaya
ldquoTaking Turnsrdquo MAC protocols Channel 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 protocols Look for best of both worlds
Two implementations Polling Token
copy Kemal Akkaya
ldquoTaking 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)
copy Kemal Akkaya
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or code
Time Division Frequency Division
Random partitioning (dynamic) ALOHA S-ALOHA CSMA CSMACD Carrier sensing easy in some technologies (wire) hard in others
(wireless) CSMACD used in Ethernet CSMACA used in 80211
Taking Turns Polling from a central site token passing
copy Kemal Akkaya
LAN technologies
Data link layer so farServicesError detectioncorrectionMultiple access
Next LAN technologiesAddressingEthernetHubs switchesPPP
copy Kemal Akkaya
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
Find your PCrsquos MAC 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(wired orwireless)
Each adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF = adapter
copy Kemal Akkaya
MAC 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
copy Kemal Akkaya
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 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
copy Kemal Akkaya
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
copy Kemal Akkaya
Routing to another LAN Walkthrough send datagram from A to B via R
Assume A knows B IP address
Two ARP tables in router R one for each IP network (LAN) In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110
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
copy Kemal Akkaya
A
R
B
Routing to another LAN
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
Selective Reject
Also called selective retransmission
Only rejected frames are retransmitted
Subsequent frames are accepted by the receiver and buffered
Minimizes retransmission Receiver must maintain
large enough buffer More complex login in
transmitter
copy Kemal Akkaya
Multiple Access Links and ProtocolsTwo 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
copy Kemal Akkaya
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
Ideal Multiple Access Protocol When one node wants to transmit it can send at rate R When M nodes want to transmit each can send at average rate RM Fully decentralized
No special node to coordinate transmissions No synchronization of clocks slots
Simple
copy Kemal Akkaya
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 Nodes with more to send can take longer turns
copy Kemal Akkaya
Channel Partitioning MAC protocols TDMA
TDMA Time division multiple access Access to channel in rounds Each station gets fixed length slot
Length = packet transmission time in each round
Unused slots go idle Example 6-station LAN
134 have packet Slots 256 idle
copy Kemal Akkaya
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 packet frequency
bands 256 idle
frequ
ency
bands time
1
2
3
4
5
6
copy Kemal Akkaya
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 Carrier Sense Multiple Access (CSMA) CSMACollision Detection (CD) CSMACollision Avoidance (CA)
copy Kemal Akkaya
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
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
copy Kemal Akkaya
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]
Even worse than slotted ALOHA
copy Kemal Akkaya
Collisions can still occur Propagation delay means two nodes may not hear each otherrsquos transmission Entire packet transmission time wasted Role of distance amp propagation delay in determining collision probability spatial layout of nodes
Idea listen before transmit If channel sensed idle
transmit entire frame If channel sensed busy defer
transmission Human analogy donrsquot
interrupt others
CSMA (Carrier Sense Multiple Access)
copy Kemal Akkaya
CSMACD (Collision Detection)
CSMACD carrier sensing deferral as in CSMA Collisions detected within short
time Send jam sequence 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
copy Kemal Akkaya
ldquoTaking Turnsrdquo MAC protocols Channel 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 protocols Look for best of both worlds
Two implementations Polling Token
copy Kemal Akkaya
ldquoTaking 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)
copy Kemal Akkaya
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or code
Time Division Frequency Division
Random partitioning (dynamic) ALOHA S-ALOHA CSMA CSMACD Carrier sensing easy in some technologies (wire) hard in others
(wireless) CSMACD used in Ethernet CSMACA used in 80211
Taking Turns Polling from a central site token passing
copy Kemal Akkaya
LAN technologies
Data link layer so farServicesError detectioncorrectionMultiple access
Next LAN technologiesAddressingEthernetHubs switchesPPP
copy Kemal Akkaya
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
Find your PCrsquos MAC 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(wired orwireless)
Each adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF = adapter
copy Kemal Akkaya
MAC 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
copy Kemal Akkaya
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 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
copy Kemal Akkaya
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
copy Kemal Akkaya
Routing to another LAN Walkthrough send datagram from A to B via R
Assume A knows B IP address
Two ARP tables in router R one for each IP network (LAN) In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110
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
copy Kemal Akkaya
A
R
B
Routing to another LAN
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
Multiple Access Links and ProtocolsTwo 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
copy Kemal Akkaya
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
Ideal Multiple Access Protocol When one node wants to transmit it can send at rate R When M nodes want to transmit each can send at average rate RM Fully decentralized
No special node to coordinate transmissions No synchronization of clocks slots
Simple
copy Kemal Akkaya
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 Nodes with more to send can take longer turns
copy Kemal Akkaya
Channel Partitioning MAC protocols TDMA
TDMA Time division multiple access Access to channel in rounds Each station gets fixed length slot
Length = packet transmission time in each round
Unused slots go idle Example 6-station LAN
134 have packet Slots 256 idle
copy Kemal Akkaya
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 packet frequency
bands 256 idle
frequ
ency
bands time
1
2
3
4
5
6
copy Kemal Akkaya
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 Carrier Sense Multiple Access (CSMA) CSMACollision Detection (CD) CSMACollision Avoidance (CA)
copy Kemal Akkaya
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
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
copy Kemal Akkaya
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]
Even worse than slotted ALOHA
copy Kemal Akkaya
Collisions can still occur Propagation delay means two nodes may not hear each otherrsquos transmission Entire packet transmission time wasted Role of distance amp propagation delay in determining collision probability spatial layout of nodes
Idea listen before transmit If channel sensed idle
transmit entire frame If channel sensed busy defer
transmission Human analogy donrsquot
interrupt others
CSMA (Carrier Sense Multiple Access)
copy Kemal Akkaya
CSMACD (Collision Detection)
CSMACD carrier sensing deferral as in CSMA Collisions detected within short
time Send jam sequence 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
copy Kemal Akkaya
ldquoTaking Turnsrdquo MAC protocols Channel 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 protocols Look for best of both worlds
Two implementations Polling Token
copy Kemal Akkaya
ldquoTaking 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)
copy Kemal Akkaya
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or code
Time Division Frequency Division
Random partitioning (dynamic) ALOHA S-ALOHA CSMA CSMACD Carrier sensing easy in some technologies (wire) hard in others
(wireless) CSMACD used in Ethernet CSMACA used in 80211
Taking Turns Polling from a central site token passing
copy Kemal Akkaya
LAN technologies
Data link layer so farServicesError detectioncorrectionMultiple access
Next LAN technologiesAddressingEthernetHubs switchesPPP
copy Kemal Akkaya
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
Find your PCrsquos MAC 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(wired orwireless)
Each adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF = adapter
copy Kemal Akkaya
MAC 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
copy Kemal Akkaya
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 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
copy Kemal Akkaya
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
copy Kemal Akkaya
Routing to another LAN Walkthrough send datagram from A to B via R
Assume A knows B IP address
Two ARP tables in router R one for each IP network (LAN) In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110
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
copy Kemal Akkaya
A
R
B
Routing to another LAN
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
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
Ideal Multiple Access Protocol When one node wants to transmit it can send at rate R When M nodes want to transmit each can send at average rate RM Fully decentralized
No special node to coordinate transmissions No synchronization of clocks slots
Simple
copy Kemal Akkaya
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 Nodes with more to send can take longer turns
copy Kemal Akkaya
Channel Partitioning MAC protocols TDMA
TDMA Time division multiple access Access to channel in rounds Each station gets fixed length slot
Length = packet transmission time in each round
Unused slots go idle Example 6-station LAN
134 have packet Slots 256 idle
copy Kemal Akkaya
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 packet frequency
bands 256 idle
frequ
ency
bands time
1
2
3
4
5
6
copy Kemal Akkaya
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 Carrier Sense Multiple Access (CSMA) CSMACollision Detection (CD) CSMACollision Avoidance (CA)
copy Kemal Akkaya
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
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
copy Kemal Akkaya
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]
Even worse than slotted ALOHA
copy Kemal Akkaya
Collisions can still occur Propagation delay means two nodes may not hear each otherrsquos transmission Entire packet transmission time wasted Role of distance amp propagation delay in determining collision probability spatial layout of nodes
Idea listen before transmit If channel sensed idle
transmit entire frame If channel sensed busy defer
transmission Human analogy donrsquot
interrupt others
CSMA (Carrier Sense Multiple Access)
copy Kemal Akkaya
CSMACD (Collision Detection)
CSMACD carrier sensing deferral as in CSMA Collisions detected within short
time Send jam sequence 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
copy Kemal Akkaya
ldquoTaking Turnsrdquo MAC protocols Channel 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 protocols Look for best of both worlds
Two implementations Polling Token
copy Kemal Akkaya
ldquoTaking 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)
copy Kemal Akkaya
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or code
Time Division Frequency Division
Random partitioning (dynamic) ALOHA S-ALOHA CSMA CSMACD Carrier sensing easy in some technologies (wire) hard in others
(wireless) CSMACD used in Ethernet CSMACA used in 80211
Taking Turns Polling from a central site token passing
copy Kemal Akkaya
LAN technologies
Data link layer so farServicesError detectioncorrectionMultiple access
Next LAN technologiesAddressingEthernetHubs switchesPPP
copy Kemal Akkaya
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
Find your PCrsquos MAC 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(wired orwireless)
Each adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF = adapter
copy Kemal Akkaya
MAC 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
copy Kemal Akkaya
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 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
copy Kemal Akkaya
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
copy Kemal Akkaya
Routing to another LAN Walkthrough send datagram from A to B via R
Assume A knows B IP address
Two ARP tables in router R one for each IP network (LAN) In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110
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
copy Kemal Akkaya
A
R
B
Routing to another LAN
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
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 Nodes with more to send can take longer turns
copy Kemal Akkaya
Channel Partitioning MAC protocols TDMA
TDMA Time division multiple access Access to channel in rounds Each station gets fixed length slot
Length = packet transmission time in each round
Unused slots go idle Example 6-station LAN
134 have packet Slots 256 idle
copy Kemal Akkaya
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 packet frequency
bands 256 idle
frequ
ency
bands time
1
2
3
4
5
6
copy Kemal Akkaya
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 Carrier Sense Multiple Access (CSMA) CSMACollision Detection (CD) CSMACollision Avoidance (CA)
copy Kemal Akkaya
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
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
copy Kemal Akkaya
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]
Even worse than slotted ALOHA
copy Kemal Akkaya
Collisions can still occur Propagation delay means two nodes may not hear each otherrsquos transmission Entire packet transmission time wasted Role of distance amp propagation delay in determining collision probability spatial layout of nodes
Idea listen before transmit If channel sensed idle
transmit entire frame If channel sensed busy defer
transmission Human analogy donrsquot
interrupt others
CSMA (Carrier Sense Multiple Access)
copy Kemal Akkaya
CSMACD (Collision Detection)
CSMACD carrier sensing deferral as in CSMA Collisions detected within short
time Send jam sequence 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
copy Kemal Akkaya
ldquoTaking Turnsrdquo MAC protocols Channel 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 protocols Look for best of both worlds
Two implementations Polling Token
copy Kemal Akkaya
ldquoTaking 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)
copy Kemal Akkaya
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or code
Time Division Frequency Division
Random partitioning (dynamic) ALOHA S-ALOHA CSMA CSMACD Carrier sensing easy in some technologies (wire) hard in others
(wireless) CSMACD used in Ethernet CSMACA used in 80211
Taking Turns Polling from a central site token passing
copy Kemal Akkaya
LAN technologies
Data link layer so farServicesError detectioncorrectionMultiple access
Next LAN technologiesAddressingEthernetHubs switchesPPP
copy Kemal Akkaya
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
Find your PCrsquos MAC 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(wired orwireless)
Each adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF = adapter
copy Kemal Akkaya
MAC 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
copy Kemal Akkaya
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 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
copy Kemal Akkaya
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
copy Kemal Akkaya
Routing to another LAN Walkthrough send datagram from A to B via R
Assume A knows B IP address
Two ARP tables in router R one for each IP network (LAN) In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110
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
copy Kemal Akkaya
A
R
B
Routing to another LAN
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
Channel Partitioning MAC protocols TDMA
TDMA Time division multiple access Access to channel in rounds Each station gets fixed length slot
Length = packet transmission time in each round
Unused slots go idle Example 6-station LAN
134 have packet Slots 256 idle
copy Kemal Akkaya
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 packet frequency
bands 256 idle
frequ
ency
bands time
1
2
3
4
5
6
copy Kemal Akkaya
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 Carrier Sense Multiple Access (CSMA) CSMACollision Detection (CD) CSMACollision Avoidance (CA)
copy Kemal Akkaya
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
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
copy Kemal Akkaya
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]
Even worse than slotted ALOHA
copy Kemal Akkaya
Collisions can still occur Propagation delay means two nodes may not hear each otherrsquos transmission Entire packet transmission time wasted Role of distance amp propagation delay in determining collision probability spatial layout of nodes
Idea listen before transmit If channel sensed idle
transmit entire frame If channel sensed busy defer
transmission Human analogy donrsquot
interrupt others
CSMA (Carrier Sense Multiple Access)
copy Kemal Akkaya
CSMACD (Collision Detection)
CSMACD carrier sensing deferral as in CSMA Collisions detected within short
time Send jam sequence 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
copy Kemal Akkaya
ldquoTaking Turnsrdquo MAC protocols Channel 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 protocols Look for best of both worlds
Two implementations Polling Token
copy Kemal Akkaya
ldquoTaking 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)
copy Kemal Akkaya
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or code
Time Division Frequency Division
Random partitioning (dynamic) ALOHA S-ALOHA CSMA CSMACD Carrier sensing easy in some technologies (wire) hard in others
(wireless) CSMACD used in Ethernet CSMACA used in 80211
Taking Turns Polling from a central site token passing
copy Kemal Akkaya
LAN technologies
Data link layer so farServicesError detectioncorrectionMultiple access
Next LAN technologiesAddressingEthernetHubs switchesPPP
copy Kemal Akkaya
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
Find your PCrsquos MAC 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(wired orwireless)
Each adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF = adapter
copy Kemal Akkaya
MAC 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
copy Kemal Akkaya
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 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
copy Kemal Akkaya
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
copy Kemal Akkaya
Routing to another LAN Walkthrough send datagram from A to B via R
Assume A knows B IP address
Two ARP tables in router R one for each IP network (LAN) In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110
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
copy Kemal Akkaya
A
R
B
Routing to another LAN
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
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 packet frequency
bands 256 idle
frequ
ency
bands time
1
2
3
4
5
6
copy Kemal Akkaya
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 Carrier Sense Multiple Access (CSMA) CSMACollision Detection (CD) CSMACollision Avoidance (CA)
copy Kemal Akkaya
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
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
copy Kemal Akkaya
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]
Even worse than slotted ALOHA
copy Kemal Akkaya
Collisions can still occur Propagation delay means two nodes may not hear each otherrsquos transmission Entire packet transmission time wasted Role of distance amp propagation delay in determining collision probability spatial layout of nodes
Idea listen before transmit If channel sensed idle
transmit entire frame If channel sensed busy defer
transmission Human analogy donrsquot
interrupt others
CSMA (Carrier Sense Multiple Access)
copy Kemal Akkaya
CSMACD (Collision Detection)
CSMACD carrier sensing deferral as in CSMA Collisions detected within short
time Send jam sequence 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
copy Kemal Akkaya
ldquoTaking Turnsrdquo MAC protocols Channel 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 protocols Look for best of both worlds
Two implementations Polling Token
copy Kemal Akkaya
ldquoTaking 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)
copy Kemal Akkaya
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or code
Time Division Frequency Division
Random partitioning (dynamic) ALOHA S-ALOHA CSMA CSMACD Carrier sensing easy in some technologies (wire) hard in others
(wireless) CSMACD used in Ethernet CSMACA used in 80211
Taking Turns Polling from a central site token passing
copy Kemal Akkaya
LAN technologies
Data link layer so farServicesError detectioncorrectionMultiple access
Next LAN technologiesAddressingEthernetHubs switchesPPP
copy Kemal Akkaya
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
Find your PCrsquos MAC 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(wired orwireless)
Each adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF = adapter
copy Kemal Akkaya
MAC 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
copy Kemal Akkaya
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 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
copy Kemal Akkaya
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
copy Kemal Akkaya
Routing to another LAN Walkthrough send datagram from A to B via R
Assume A knows B IP address
Two ARP tables in router R one for each IP network (LAN) In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110
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
copy Kemal Akkaya
A
R
B
Routing to another LAN
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
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 Carrier Sense Multiple Access (CSMA) CSMACollision Detection (CD) CSMACollision Avoidance (CA)
copy Kemal Akkaya
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
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
copy Kemal Akkaya
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]
Even worse than slotted ALOHA
copy Kemal Akkaya
Collisions can still occur Propagation delay means two nodes may not hear each otherrsquos transmission Entire packet transmission time wasted Role of distance amp propagation delay in determining collision probability spatial layout of nodes
Idea listen before transmit If channel sensed idle
transmit entire frame If channel sensed busy defer
transmission Human analogy donrsquot
interrupt others
CSMA (Carrier Sense Multiple Access)
copy Kemal Akkaya
CSMACD (Collision Detection)
CSMACD carrier sensing deferral as in CSMA Collisions detected within short
time Send jam sequence 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
copy Kemal Akkaya
ldquoTaking Turnsrdquo MAC protocols Channel 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 protocols Look for best of both worlds
Two implementations Polling Token
copy Kemal Akkaya
ldquoTaking 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)
copy Kemal Akkaya
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or code
Time Division Frequency Division
Random partitioning (dynamic) ALOHA S-ALOHA CSMA CSMACD Carrier sensing easy in some technologies (wire) hard in others
(wireless) CSMACD used in Ethernet CSMACA used in 80211
Taking Turns Polling from a central site token passing
copy Kemal Akkaya
LAN technologies
Data link layer so farServicesError detectioncorrectionMultiple access
Next LAN technologiesAddressingEthernetHubs switchesPPP
copy Kemal Akkaya
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
Find your PCrsquos MAC 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(wired orwireless)
Each adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF = adapter
copy Kemal Akkaya
MAC 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
copy Kemal Akkaya
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 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
copy Kemal Akkaya
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
copy Kemal Akkaya
Routing to another LAN Walkthrough send datagram from A to B via R
Assume A knows B IP address
Two ARP tables in router R one for each IP network (LAN) In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110
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
copy Kemal Akkaya
A
R
B
Routing to another LAN
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
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
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
copy Kemal Akkaya
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]
Even worse than slotted ALOHA
copy Kemal Akkaya
Collisions can still occur Propagation delay means two nodes may not hear each otherrsquos transmission Entire packet transmission time wasted Role of distance amp propagation delay in determining collision probability spatial layout of nodes
Idea listen before transmit If channel sensed idle
transmit entire frame If channel sensed busy defer
transmission Human analogy donrsquot
interrupt others
CSMA (Carrier Sense Multiple Access)
copy Kemal Akkaya
CSMACD (Collision Detection)
CSMACD carrier sensing deferral as in CSMA Collisions detected within short
time Send jam sequence 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
copy Kemal Akkaya
ldquoTaking Turnsrdquo MAC protocols Channel 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 protocols Look for best of both worlds
Two implementations Polling Token
copy Kemal Akkaya
ldquoTaking 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)
copy Kemal Akkaya
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or code
Time Division Frequency Division
Random partitioning (dynamic) ALOHA S-ALOHA CSMA CSMACD Carrier sensing easy in some technologies (wire) hard in others
(wireless) CSMACD used in Ethernet CSMACA used in 80211
Taking Turns Polling from a central site token passing
copy Kemal Akkaya
LAN technologies
Data link layer so farServicesError detectioncorrectionMultiple access
Next LAN technologiesAddressingEthernetHubs switchesPPP
copy Kemal Akkaya
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
Find your PCrsquos MAC 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(wired orwireless)
Each adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF = adapter
copy Kemal Akkaya
MAC 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
copy Kemal Akkaya
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 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
copy Kemal Akkaya
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
copy Kemal Akkaya
Routing to another LAN Walkthrough send datagram from A to B via R
Assume A knows B IP address
Two ARP tables in router R one for each IP network (LAN) In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110
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
copy Kemal Akkaya
A
R
B
Routing to another LAN
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
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]
Even worse than slotted ALOHA
copy Kemal Akkaya
Collisions can still occur Propagation delay means two nodes may not hear each otherrsquos transmission Entire packet transmission time wasted Role of distance amp propagation delay in determining collision probability spatial layout of nodes
Idea listen before transmit If channel sensed idle
transmit entire frame If channel sensed busy defer
transmission Human analogy donrsquot
interrupt others
CSMA (Carrier Sense Multiple Access)
copy Kemal Akkaya
CSMACD (Collision Detection)
CSMACD carrier sensing deferral as in CSMA Collisions detected within short
time Send jam sequence 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
copy Kemal Akkaya
ldquoTaking Turnsrdquo MAC protocols Channel 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 protocols Look for best of both worlds
Two implementations Polling Token
copy Kemal Akkaya
ldquoTaking 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)
copy Kemal Akkaya
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or code
Time Division Frequency Division
Random partitioning (dynamic) ALOHA S-ALOHA CSMA CSMACD Carrier sensing easy in some technologies (wire) hard in others
(wireless) CSMACD used in Ethernet CSMACA used in 80211
Taking Turns Polling from a central site token passing
copy Kemal Akkaya
LAN technologies
Data link layer so farServicesError detectioncorrectionMultiple access
Next LAN technologiesAddressingEthernetHubs switchesPPP
copy Kemal Akkaya
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
Find your PCrsquos MAC 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(wired orwireless)
Each adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF = adapter
copy Kemal Akkaya
MAC 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
copy Kemal Akkaya
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 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
copy Kemal Akkaya
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
copy Kemal Akkaya
Routing to another LAN Walkthrough send datagram from A to B via R
Assume A knows B IP address
Two ARP tables in router R one for each IP network (LAN) In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110
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
copy Kemal Akkaya
A
R
B
Routing to another LAN
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
Collisions can still occur Propagation delay means two nodes may not hear each otherrsquos transmission Entire packet transmission time wasted Role of distance amp propagation delay in determining collision probability spatial layout of nodes
Idea listen before transmit If channel sensed idle
transmit entire frame If channel sensed busy defer
transmission Human analogy donrsquot
interrupt others
CSMA (Carrier Sense Multiple Access)
copy Kemal Akkaya
CSMACD (Collision Detection)
CSMACD carrier sensing deferral as in CSMA Collisions detected within short
time Send jam sequence 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
copy Kemal Akkaya
ldquoTaking Turnsrdquo MAC protocols Channel 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 protocols Look for best of both worlds
Two implementations Polling Token
copy Kemal Akkaya
ldquoTaking 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)
copy Kemal Akkaya
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or code
Time Division Frequency Division
Random partitioning (dynamic) ALOHA S-ALOHA CSMA CSMACD Carrier sensing easy in some technologies (wire) hard in others
(wireless) CSMACD used in Ethernet CSMACA used in 80211
Taking Turns Polling from a central site token passing
copy Kemal Akkaya
LAN technologies
Data link layer so farServicesError detectioncorrectionMultiple access
Next LAN technologiesAddressingEthernetHubs switchesPPP
copy Kemal Akkaya
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
Find your PCrsquos MAC 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(wired orwireless)
Each adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF = adapter
copy Kemal Akkaya
MAC 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
copy Kemal Akkaya
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 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
copy Kemal Akkaya
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
copy Kemal Akkaya
Routing to another LAN Walkthrough send datagram from A to B via R
Assume A knows B IP address
Two ARP tables in router R one for each IP network (LAN) In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110
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
copy Kemal Akkaya
A
R
B
Routing to another LAN
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
CSMACD (Collision Detection)
CSMACD carrier sensing deferral as in CSMA Collisions detected within short
time Send jam sequence 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
copy Kemal Akkaya
ldquoTaking Turnsrdquo MAC protocols Channel 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 protocols Look for best of both worlds
Two implementations Polling Token
copy Kemal Akkaya
ldquoTaking 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)
copy Kemal Akkaya
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or code
Time Division Frequency Division
Random partitioning (dynamic) ALOHA S-ALOHA CSMA CSMACD Carrier sensing easy in some technologies (wire) hard in others
(wireless) CSMACD used in Ethernet CSMACA used in 80211
Taking Turns Polling from a central site token passing
copy Kemal Akkaya
LAN technologies
Data link layer so farServicesError detectioncorrectionMultiple access
Next LAN technologiesAddressingEthernetHubs switchesPPP
copy Kemal Akkaya
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
Find your PCrsquos MAC 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(wired orwireless)
Each adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF = adapter
copy Kemal Akkaya
MAC 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
copy Kemal Akkaya
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 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
copy Kemal Akkaya
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
copy Kemal Akkaya
Routing to another LAN Walkthrough send datagram from A to B via R
Assume A knows B IP address
Two ARP tables in router R one for each IP network (LAN) In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110
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
copy Kemal Akkaya
A
R
B
Routing to another LAN
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
ldquoTaking Turnsrdquo MAC protocols Channel 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 protocols Look for best of both worlds
Two implementations Polling Token
copy Kemal Akkaya
ldquoTaking 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)
copy Kemal Akkaya
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or code
Time Division Frequency Division
Random partitioning (dynamic) ALOHA S-ALOHA CSMA CSMACD Carrier sensing easy in some technologies (wire) hard in others
(wireless) CSMACD used in Ethernet CSMACA used in 80211
Taking Turns Polling from a central site token passing
copy Kemal Akkaya
LAN technologies
Data link layer so farServicesError detectioncorrectionMultiple access
Next LAN technologiesAddressingEthernetHubs switchesPPP
copy Kemal Akkaya
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
Find your PCrsquos MAC 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(wired orwireless)
Each adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF = adapter
copy Kemal Akkaya
MAC 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
copy Kemal Akkaya
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 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
copy Kemal Akkaya
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
copy Kemal Akkaya
Routing to another LAN Walkthrough send datagram from A to B via R
Assume A knows B IP address
Two ARP tables in router R one for each IP network (LAN) In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110
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
copy Kemal Akkaya
A
R
B
Routing to another LAN
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
ldquoTaking 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)
copy Kemal Akkaya
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or code
Time Division Frequency Division
Random partitioning (dynamic) ALOHA S-ALOHA CSMA CSMACD Carrier sensing easy in some technologies (wire) hard in others
(wireless) CSMACD used in Ethernet CSMACA used in 80211
Taking Turns Polling from a central site token passing
copy Kemal Akkaya
LAN technologies
Data link layer so farServicesError detectioncorrectionMultiple access
Next LAN technologiesAddressingEthernetHubs switchesPPP
copy Kemal Akkaya
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
Find your PCrsquos MAC 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(wired orwireless)
Each adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF = adapter
copy Kemal Akkaya
MAC 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
copy Kemal Akkaya
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 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
copy Kemal Akkaya
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
copy Kemal Akkaya
Routing to another LAN Walkthrough send datagram from A to B via R
Assume A knows B IP address
Two ARP tables in router R one for each IP network (LAN) In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110
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
copy Kemal Akkaya
A
R
B
Routing to another LAN
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or code
Time Division Frequency Division
Random partitioning (dynamic) ALOHA S-ALOHA CSMA CSMACD Carrier sensing easy in some technologies (wire) hard in others
(wireless) CSMACD used in Ethernet CSMACA used in 80211
Taking Turns Polling from a central site token passing
copy Kemal Akkaya
LAN technologies
Data link layer so farServicesError detectioncorrectionMultiple access
Next LAN technologiesAddressingEthernetHubs switchesPPP
copy Kemal Akkaya
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
Find your PCrsquos MAC 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(wired orwireless)
Each adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF = adapter
copy Kemal Akkaya
MAC 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
copy Kemal Akkaya
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 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
copy Kemal Akkaya
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
copy Kemal Akkaya
Routing to another LAN Walkthrough send datagram from A to B via R
Assume A knows B IP address
Two ARP tables in router R one for each IP network (LAN) In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110
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
copy Kemal Akkaya
A
R
B
Routing to another LAN
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
LAN technologies
Data link layer so farServicesError detectioncorrectionMultiple access
Next LAN technologiesAddressingEthernetHubs switchesPPP
copy Kemal Akkaya
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
Find your PCrsquos MAC 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(wired orwireless)
Each adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF = adapter
copy Kemal Akkaya
MAC 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
copy Kemal Akkaya
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 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
copy Kemal Akkaya
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
copy Kemal Akkaya
Routing to another LAN Walkthrough send datagram from A to B via R
Assume A knows B IP address
Two ARP tables in router R one for each IP network (LAN) In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110
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
copy Kemal Akkaya
A
R
B
Routing to another LAN
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
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
Find your PCrsquos MAC 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(wired orwireless)
Each adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF = adapter
copy Kemal Akkaya
MAC 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
copy Kemal Akkaya
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 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
copy Kemal Akkaya
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
copy Kemal Akkaya
Routing to another LAN Walkthrough send datagram from A to B via R
Assume A knows B IP address
Two ARP tables in router R one for each IP network (LAN) In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110
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
copy Kemal Akkaya
A
R
B
Routing to another LAN
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
MAC 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
copy Kemal Akkaya
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 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
copy Kemal Akkaya
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
copy Kemal Akkaya
Routing to another LAN Walkthrough send datagram from A to B via R
Assume A knows B IP address
Two ARP tables in router R one for each IP network (LAN) In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110
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
copy Kemal Akkaya
A
R
B
Routing to another LAN
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
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 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
copy Kemal Akkaya
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
copy Kemal Akkaya
Routing to another LAN Walkthrough send datagram from A to B via R
Assume A knows B IP address
Two ARP tables in router R one for each IP network (LAN) In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110
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
copy Kemal Akkaya
A
R
B
Routing to another LAN
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
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
copy Kemal Akkaya
Routing to another LAN Walkthrough send datagram from A to B via R
Assume A knows B IP address
Two ARP tables in router R one for each IP network (LAN) In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110
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
copy Kemal Akkaya
A
R
B
Routing to another LAN
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
Routing to another LAN Walkthrough send datagram from A to B via R
Assume A knows B IP address
Two ARP tables in router R one for each IP network (LAN) In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110
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
copy Kemal Akkaya
A
R
B
Routing to another LAN
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
A
R
B
Routing to another LAN
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
EthernetldquoDominantrdquo wired LAN technology Cheap $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 Ethernet sketch
Star Topology Bus topology popular
through mid 90s Now star topology prevails Connection choices hub or
switch (more later)
hub orswitch
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
Ethernet Frame Structure
Preamble 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 Used to synchronize receiver sender clock rates
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 is detected the frame is simply dropped
Sending adapter encapsulates IP datagram in Ethernet frame
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
Ethernet uses CSMACD 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
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
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
Ethernet CSMACD algorithm1 Adaptor receives datagram from
net layer amp creates frame2 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 mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
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
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
CSMACD efficiency Tprop = max prop between 2 nodes in LAN ttrans = time to transmit max-size frame
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
Other Ethernets Switched Ethernet Fast Ethernet Gigabit Ethernet
transprop tt 51
1efficiency
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
Point to Point Data Link Control
One sender one receiver one link easier than broadcast link No Media Access Control No need for explicit MAC addressing eg dialup link ISDN line
Popular point-to-point DLC protocols PPP (point-to-point protocol) HDLC High level data link control (Data link used to be considered
ldquohigh layerrdquo in protocol stack
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
HDLC
Frame format for bit-oriented protocol HDLC
Control field of
(a) An information frame
(b) A supervisory frame
(c) An unnumbered frame
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
HDLC Exchange of information supervisory and unnumbered
frames Information - data to be transmitted to user (next layer up)
Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control
Three phases Initialization Data transfer Disconnect
Uses bit stuffing Flag delimit frame at both ends 01111110 is the Flag May close one frame and open another Bit stuffing to find flag data
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
Internet Datalink Protocol PPP Design Requirements [RFC 1557]
Packet framing encapsulation of network-layer datagram in data link frame Carry network layer data of any network layer protocol (not just IP) at
same time Ability to demultiplex upwards
Bit transparency must carry any bit pattern in the data field Error detection (no correction) Connection liveness detect signal link failure to network layer Network layer address negotiation endpoint can learnconfigure
each otherrsquos network address
PPP non-design requirements No error correctionrecovery No flow control Out of order delivery OK No need to support multipoint links (eg polling)
Error recovery flow control data re-ordering all relegated to higher layers
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
PPP Data Frame
Flag delimiter (framing) Address does nothing (only one option) Control does nothing in the future possible multiple
control fields Protocol upper layer protocol to which frame delivered
(eg PPP-LCP IP IPCP etc) Info upper layer data being carried Check cyclic redundancy check for error detection
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
Byte Stuffing ldquoData transparencyrdquo requirement data field must be allowed to include
flag pattern lt01111110gt Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte How about bit stuffing
Receiver Two 01111110 bytes in a row Discard first byte continue data reception Single 01111110 flag byte
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down
copy Kemal Akkaya
PPP Data Control Protocol Before exchanging
network-layer data data link peers must configure PPP link
(max frame length authentication)
learnconfigure network layer information
For IP carry IP Control Protocol (IPCP) messages (protocol field 8021) to configurelearn IP address
Diagram for bring a line up and down