physical and data link layersphysical and data link layers yuzo taenaka graduate school of science...
TRANSCRIPT
Physical and Data Link layers
Yuzo Taenaka
Graduate School of Science and Technology,Nara Institute of Science and Technology
Today’s topic
Internet Engineering / 2018 2
Application
Presentation
Session
Transport
Network
Data Link
Physical
ES (End System)Transmission procedure for data chunk (“frame”) over a single communication media.
Fundamental Transmission procedures for “bits” over communication media.
Physical Layer
Internet Engineering / 2018 3
Types of transmission medium=Cables
– Optical fiber
– Copper
=Wireless
Internet Engineering / 2018 4
Source: siemon.com
Source: blackbox.com
Cables and connectors=Copper
– UTP– STP
=Connectors– RJ45– RJ11
Internet Engineering / 2018 5
=Optical fibers– Single mode fiber– Multimode fiber
=Connectors– LC, SC, FC, MT-RJ…
RJ45 connector.Source: flukenetworks.com
Source: aisan.co.jp
Source: aisan
Source: aisan
Cable speed, distance and cost
Internet Engineering / 2018 6
Speed Medium Distance Cost10Gbit/s Optical (SMF) 10 km $$$10Gbit/s Copper 100 m $$1Gbit/s Optical (MMF) 550 m $$1Gbit/s Copper 100 m $1Mbit/s Copper 4 km $
Source: cable360.net
Physical characteristics: a crude comparison
= 54Mbit/s in wireless cannot be delivered as advertised,whereas 1Gbit/s in optical fiber can be delivered as advertised.
Internet Engineering / 2018 7
Copper Fiber Wireless
Attenuation XX XXXX
Attenuation distortion X X XX
Noise XX X XXXX
Bend XX
Chromatic dispersion X XXXX
Crosstalk XX XXXX
EM interference XX XXXX
Echo XX XXXX
Role of physical layer=Transmit every “bit” by electrical signal, radio wave,
or something that could carries 0/1 values.
Internet Engineering / 2018 8
�����������
�������������������end bit patternstart bit pattern��������
Physical layer
Example of encoding bits
=Manchester code (phase encoding)
– IEEE 802.3 (10base-T / 10Mbps�– A transition of electric voltage indicates 0 or 1
Internet Engineering / 2018 9
low → high
= 1high → low
= 0
More detail=take the lectures
– Principles of Signal Processing (3003)• https://syllabus.naist.jp/subjects/preview_detail/28• Prof. Kato
– Wireless Communication Systems (4015)• https://syllabus.naist.jp/subjects/preview_detail/70• Prof. Okada
– Signal Detection Theory (4016) • https://syllabus.naist.jp/subjects/preview_detail/71• Prof. Okada
Internet Engineering / 2018 10
Data Link Layer
Internet Engineering / 2018 11
Coverage of datalink
Internet Engineering / 2018 12
ApplicationPresentation
SessionTransportNetwork
Data LinkPhysical
ES (End System)
IS (Intermediate System)
Physical connection
Router handling network layer
datalink
Data Link Layer Services overview= Framing, link access:
– Encapsulate datagram into frame, adding header, trailer– Channel access if shared medium– “MAC” addresses used in frame headers to identify source &
destination= Flow Control:
– Pacing between adjacent sending and receiving nodes= Error Detection:
– Errors caused by signal attenuation and noise– Receiver detects presence of errors
= Error Correction: – Receiver identifies and corrects bit error(s) without resorting to
retransmission= Transmission mode (Half-duplex and full-duplex)
– With half duplex, nodes at both ends of link can transmit, but not at same time
Internet Engineering / 2018 13
Frame=Data link layer Protocol Data Unit (PDU)
– Defining the frame borders (delimiters)=Can determine if any failures (bit errors) occurred
– Adding error-detection / error-correction code to bit sequences in order to delimit the appropriate frame length
=Frame header– error detection and flow control– control information
Internet Engineering / 2018 14
01111110 address control data 01111110checksum
header payload
Inform ation N etw ork 1 / 2016
Internet Engineering / 2018 15
Frame Synchronization
=Bit-sequence-based frame synchronization
– A special bit sequence is inserted to the data header and footer.
• synchronization
– Insertion of a bit sequence composed of the “same” bit
• bit stuffing
– special bit sequence only appears at the frame header and footer
– e.g.
• special bit sequence� 01111110
• if sender detects “11111” in data, it “stuffs” a “0” right after.
• if receiver detects “11111” in data, it deletes the following
stuffed “0”.
01111110 address control data 01111110checksum
Inform ation N etw ork 1 / 2016
Ethernet frame=A frame captured by wireshark (introduced in today’s
hands-on)
Internet Engineering / 2018 16
Error detection & correlation
Internet Engineering / 2018 17
Errors in Physical Layer
Internet Engineering / 2018 18
Noise
Attenuation
Distortion
Inform ation N etw ork 1 / 2016
Internet Engineering / 2018 19
Error Control=Goal
– Detecting and correcting transmission error in channel• Was the frame correctly sent?• Was the frame sequence order correct?
=Techniques– Introducing the concept of frame (failure localization)– Coding techniques
• Error Detection Code – Parity, CRC (Cyclic redundancy check)• Error Correction Code – FEC
– Protocol techniques for error correction• Timer• Retransmission
Inform ation N etw ork 1 / 2016
Basic idea of CRC=Given:
– Polynomial expression of m bit frame M(x) (degree m-1)– Generator polynomial G(x), of degree r (r < m)
=Compute:– prepare xrM(x): frame with r zeros– Compute modulo of xrM(x) divided by G(x): R(x)– Frame for transmission: F(x)
• F(x) = xrM(x) + R(x)=Successful transmission: F(x) / G(x) = 0
– Nonzero otherwise. i.e., error detection.– Consecutive errors less than r bits can be detected
Internet Engineering / 2018 20
Internet Engineering / 2018 21
Standardized CRC polynomials=Commonly known standards
– CRC-12• x12+x11+x3+x2+x+1
– CRC-16• x16+x15+x2+1
– CRC-32• x32+x26+x23+x22+x16+x12+ x11+x10+x8+x7+ x5+x4+x2+x+1
– CRC-CCITT• x16+x12+x5+1
=There are many other error detection codes.
Inform ation N etw ork 1 / 2016
Flow control
Internet Engineering / 2018 22
Flow Control=Flow Control Protocols deal with how to send
sequences of frames=They have two goals:
– Recover from lost frames– Prevent buffer overflows
=Network Layer may want to receive same set of frames in the same order they were sent
=Automatic Repeat Request (ARQ)– Stop-and-wait– Go-back-N– Selective-repeat
Internet Engineering / 2018 23Inform ation N etw ork 1 / 2016
In a case without flow control= Sender sends frames at an arbitrary timing
Frames may be dropped on an intermediate medium
= Receiver takes time to process a frame
Internet Engineering / 2018 24
sender receiver
3 frames arrives while processing 1 frame→ buffer overflow
sender receiver
X
X
Internet Engineering / 2018 25
Stop-and-wait ARQ (1)
t1 t2 t3
t4
t5t1Sender
Receiver
t1: Round Trip Timet2: Frame Transmission Timet3: Frame Processing Timet4: ACK Transmission Timet5: ACK Processing Time
Inform ation N etw ork 1 / 2016
Internet Engineering / 2018 26
Stop-and-wait ARQ (2)
=Procedure– Waiting to receive ACK on each frame
transmission
– Setting a sender timer greater than 2t1+t2+t3+t4
– Retransmission when sender timer times out.
=Characteristics– Simple
– The buffer never contains more than one frame for the receiver and the sender
– Very low utilization of channel capacity
Inform ation N etw ork 1 / 2016
Internet Engineering / 2018 27
Go-back-N ARQ
1 653 45432
1 653 4542
ACK
ACK
ACK
ACK
ACK
ACK
Time out for Frame3
!!
Inform ation N etw ork 1 / 2016
Internet Engineering / 2018 28
Selective-Repeat ARQ
1 873 65432
1 873 6542
AC
K
AC
K
AC
K
AC
K
AC
K
AC
K
Time out for Frame3
!!
AC
K
AC
K
Inform ation N etw ork 1 / 2016
ARQ: simplicity vs efficiency, adaptability=Stop-and-Wait
– Simple– No large buffer required in both ends
=Go-back-N– Still simple, but buffer management has to be done at
SENDER.– N means the buffer size– There is no large buffer required at RECEIVER side.
=Selected Repeat– Efficient but complicated scheme that requires buffer, timer,
and ACK managements.– Buffers are required in both ends.– Window Flow Control is needed for buffer management.
Internet Engineering / 2018 29Inform ation N etw ork 1 / 2016
Internet Engineering / 2018 31
Burden sharing among layers=Assignment of function depends on communication
system designs=Various solutions exist
Data Link
Network
Transport sequence assuranceflow controlretransmissioninterconnection of networkerror detection and correctionframe boundary
Inform ation N etw ork 1 / 2016
Sublayers of the Data Link Layer
Internet Engineering / 2018 32
Internet Engineering / 2018 33
Sublayers of the Data Link Layer
Physical Layer
Data link Layer
Network Layer
Media Access Control Sublayer
802.2 LLC
802.3CSMA/CD
802.5Token Ring
802.4Token Bus
Logical Link Control Sublayer
IEEE standard 802
Inform ation N etw ork 1 / 2016
802.11Wireless LAN
CCITT X.25(HDLC/LAPB)
CCITT Data linkLayer Definition
Access Channel=Two types of “links”:
– Point-to-point• PPP for dial-up access• Point-to-point link between Ethernet switch and host
– Broadcast (shared wire or medium)• Traditional Ethernet• 802.11 wireless LAN
Internet Engineering / 2018 34Inform ation N etw ork 1 / 2016
MAC Protocols (1)=Single shared broadcast channel
– Two or more simultaneous transmissions can interfere with each other
– Collision will be observed whenever node receives two or more signals at the same time
=Ideal Media 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 R/M– Fully decentralized:
• No special node to coordinate transmissions• No synchronization of clocks, slots
– Simple
Internet Engineering / 2018 35Inform ation N etw ork 1 / 2016
MAC Protocols (2)=Control-based MAC
– Channel Partitioning• Divide channel into smaller “pieces” (time slots, frequency,
code)• Allocate piece to node for exclusive use
– Taking turns• Nodes take turns• Nodes with more to send can take longer turns
=Contention-based MAC– Random Access
• Channel not divided, allow collisions• “Recover” from collisions
Internet Engineering / 2018 36Inform ation N etw ork 1 / 2016
Channel Partitioning (1)=TDMA (Time division multiple access)
– Each node occupy channel at a specific time slot
Internet Engineering / 2018 37
Time
Node A Node B Node C
Channel Partitioning (2)=FDMA (Frequency division multiple access)
– Allocate frequency to a node
Internet Engineering / 2018 38
Time
Frequency
Node ANode B
Node C
Contention-based MAC (1)=Pure ALOHA (1970s) at Hawaii Univ.
– Wireless communication=How to communicate
– Outlying station transmits a packet on the inbound frequency– The central transmitter repeats the transmission on the outbound
frequency (which all stations can receive) – If a copy of its packet arrives, the sending station moves to the
next packet; if no copy arrives, the sending station waits a random period and tries again.
Internet Engineering / 2018 39Computer Networks & Internets: Douglas E. Comer
CSMA=Carrier Sense Multiple Access
– Sensing carriers to determine whether the medium is busy (or free) before sending a frame
=Variants– Non-persistent CSMA
• Send immediately if free. Otherwise, exponential backoff (wait for randomly determined period)
– 1-persistent CSMA• Send immediately if free. Otherwise, send immediately after
channel becomes free• Used in old Ethernet
– p-persistent CSMA• Send in probability p if free. Otherwise, send in same
probability after channel becomes free
Internet Engineering / 2018 40
Collision Detection/Avoidance=CSMA/CD
– For ethernet (but going to be not used)– terminate transmission as soon as a collision is detected
even while transmitting
=CSMA/CA– For wireless (still important mechanism)– Deferring transmission for a random interval if the channel is
busy
=CSMA/CA with RTS/CTS– Channel reservation mechanism by interaction of request-to-
send frame and clear-to-send (approved) frame
Internet Engineering / 2018 41
Controlled or Contention?
=Controlled assignment of partitioned channel is for higher efficient channel occupying (high throughput)
– TDMA (time), FDMA (frequency), WDM (wave length)
– Code Divided Multiple Access (CDMA)
=Contention type (random access) has its long history,
but CSMA/CD with binary back-off is the final answer.
– Pure ALOHA, Slotted ALOHA
• classic & primitive form of random access
– CSMA, CSMA/CD, CSMA/CD with binary back-off (Ethernet)
• More complicated form for avoiding unnecessary collisions.
• Carrier Sense is pre-action, Collision Detection is post-action.
– CSMA/CA (Collision Avoidance)
• More aggressive way to manage channels, WiFi.
Internet Engineering / 2018 42Inform ation N etw ork 1 / 2016
MAC Throughput Performance
Internet Engineering / 2018 43Inform ation N etw ork 1 / 2016
Evolution of data link technologies
Internet Engineering / 2018 44
Conventional Ethernet (10base5/2)=Electrical signal will be
attenuated as going far=Repeater amplifies
electrical signal
Internet Engineering / 2018 45
Physical
Repeater
Share a same medium (same datalink)
Bus
https://www.sqa.org.uk/e-learning/NetTechDC01CCD/page_12.htm
Bridge basics: Transparent bridge=Host is not aware of the bridge=Transparent bridge
– No modification of MAC frame– Promiscuous: capture all flowing packets– Administrator builds the bridge forwarding table
Internet Engineering / 2018 46
A
B
C
D
E
F
G
H
Transparent bridge
1 2
Fwd to 1 A, B, C, DFwd to 2 E, F, G, H
not share a medium but same datalink
Learning Bridge=Dynamic adaptation for topology changes & traffic
loop avoidance.– “Frame forwarding tables” in bridges are maintained for
optimizing the flow:• Any frame to unknown MAC addresses is forwarded, and the
table is updated for “unknown” MAC.• Any frame to known MAC addresses is forwarded if necessary.
• Spanning Tree Protocol (STP) is now very common for 802.3 families to avoid traffic loop.
– Exchanging data between bridges to form a singe spanning tree as their forwarding route.
– Today: improved protocol called RSTP (Rapid STP).
Internet Engineering / 2018 47
Switched media / full-duplex=Fully occupy a medium
– No competition
=Full-duplex
Internet Engineering / 2018 48
Non-blocking switch
Occupied medium but same datalink
Send (100Mbit/s)
Receive (100Mbit/s)
unused
http://www.aim-ele.co.jp/tech/metal-tech6/
Wireless LAN performance secrets=Wireless LAN performance will lag behind forever=Wireless LAN remains to be shared media
– Significantly slower, error prone– “crowded cocktail party” -- Don’t expect same performance
Internet Engineering / 2018 49
Switched mediaEthernet
1996 1998 2000 2002 2004 2006
Voice Video(MPEG2)
Video(D1)
Video(MotionJPEG)
Video(HD D1)
Voice Video(MPEG2)
Video(MotionJPEG)
Shared mediaWireless LAN
MAC in Wi-Fi=The MAC layer of Wi-Fi defines rate adaptation=Transmission rate is inversely proportional to the
distance from base station to the terminal node=You are effectively
sharing airtimewith others
Internet Engineering / 2018 50
Summary=Basic ideas of Data Link Layer
=Many simple but effective scheme to obtain good performance– Error control, flow control– Media access control (MAC)– Switched media & learning bridge– Ethernet families
Internet Engineering / 2018 51Inform ation N etw ork 1 / 2016
Assignment 2: Explore datalinks= Use the frame generator tool provided in the hands-on
https://iplab.naist.jp/lectures/internet-engineering/2018/materials/= Collaborative work in your group
– Capture frames sent/received to/from someone in your group1. Explain frames you captured (in two cases that you sent and you received)2. Draw (or explain) the hierarchical protocol architecture the tool used
– Explore a datalink3. Identify the range of a same datalink in ethernet (LAN) of your labs, wireless
(mm2010), or wherever you choose, and then explain what you did and what you found
– You can share this in your group but you must clear which part you did
= Optional assignment1. You must have the tool written in C and Python. Explain the both codes
and their (little) difference. Then, you’ll get an extra scores2. IEEE802.11 frame format is not the exact same with ethernet frame.
Investigate the reason why we can use ethernet frame (by the tool) on WLAN.
= Report: [name]-[studentID].pdf submit via email– Both English and Japanese are acceptable.
= Deadline: July 10, 2018 17:00 JSTInternet Engineering / 2018 52
� Even if you do not finish, you should submit.