Upload
others
View
14
Download
0
Embed Size (px)
Citation preview
1
Physical and Data Link layers
Youki Kadobayashi Graduate School of Information Science
Nara Institute of Science and Technology
Physical Layer
Copyright(C)2014 Youki Kadobayashi. All rights reserved. 14/04/25
2
Types of transmission medium ● Cables
○ Optical fiber
○ Copper
● Wireless
14/04/25 Copyright(C)2014 Youki Kadobayashi. All rights reserved.
Source: siemon.com
Source: blackbox.com
Cables and connectors ● Copper
○ UTP ○ STP
● Connectors ○ RJ45 ○ RJ11
14/04/25 Copyright(C)2014 Youki Kadobayashi. All rights reserved.
● 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
3
Cable speed, distance and cost
14/04/25 Copyright(C)2014 Youki Kadobayashi. All rights reserved.
Speed Medium Distance Cost 10Gbit/s Optical (SMF) 10 km $$$ 10Gbit/s Copper 10 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.
14/04/25 Copyright(C)2014 Youki Kadobayashi. All rights reserved.
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
4
Basics of protocol
Copyright(C)2014 Youki Kadobayashi. All rights reserved. 14/04/25
Computer and network ● Computer ● Network interface ● Protocol
14/04/25 Copyright(C)2014 Youki Kadobayashi. All rights reserved.
10100111001
10100111001
01111110
end bit pattern start bit pattern 01111110
5
Fundamental aspect of network: Protocol ● 3 major elements of protocol
○ Finite State Machine ○ Message ○ Timer
14/04/25 Copyright(C)2014 Youki Kadobayashi. All rights reserved.
a b
c d
α
β
γ
δ ε
Basic constructs of protocol ● Main goal: Transmission, recovery from errors
● Message ○ Header, trailer ○ Error detection ○ Sequence number ○ Acknowledgement
● State machine ○ Negotiation ○ Retransmission ○ Error recovery
● Timer ○ Timeout
14/04/25 Copyright(C)2014 Youki Kadobayashi. All rights reserved.
Header
Data
Trailer
Error detection Sequence number
Acknowledgement
6
Ethernet frame
http://www.maximumpc.com/files/u22694/ethernet-howitworks.jpg
14/04/25 Information Network 1 / 2014
Data Link Layer
Copyright(C)2014 Youki Kadobayashi. All rights reserved. 14/04/25
7
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 ● Half-duplex and full-duplex
○ With half duplex, nodes at both ends of link can transmit, but not at same time
14/04/25 Copyright(C)2014 Youki Kadobayashi. All rights reserved.
Frame ● Data link layer Protocol Data Unit (PDU)
○ Defining the frame borders (delimiters) ● Can determine if any failures (bit errors) occured
○ 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
14/04/25 Copyright(C)2014 Youki Kadobayashi. All rights reserved.
01111110 address control data 01111110 checksum
header payload
Information Network 1 / 2014
8
Copyright(C)2014 Youki Kadobayashi. All rights reserved.
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 01111110 checksum
Information Network 1 / 2014
14/04/25
Errors in Physical Layer
Copyright(C)2014 Youki Kadobayashi. All rights reserved.
Noise
Attenuation
Distortion
Information Network 1 / 2014 14/04/25
9
Copyright(C)2014 Youki Kadobayashi. All rights reserved.
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 Correction Code ■ Error Detection Code – Parity, CRC (Cyclic redundancy check)
○ Protocol techniques ■ Timer ■ Retransmission
Information Network 1 / 2014 14/04/25
Basic idea of CRC ● Given:
○ Generator polynomial G(x), of degree r (r < m) ○ Polynomial expression of m bit frame M(x) (degree m-1)
● 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) ● Successul transmission: F(x) / G(x) = 0
○ Nonzero otherwise. i.e., error detection. ○ Consecutive errors less than r bits can be detected
14/04/25 Copyright(C)2014 Youki Kadobayashi. All rights reserved.
10
Copyright(C)2014 Youki Kadobayashi. All rights reserved.
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.
Information Network 1 / 2014 14/04/25
Copyright(C)2014 Youki Kadobayashi. All rights reserved.
Questions?
Information Network 1 / 2014 14/04/25
11
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
Copyright(C)2014 Youki Kadobayashi. All rights reserved. Information Network 1 / 2014 14/04/25
Copyright(C)2014 Youki Kadobayashi. All rights reserved.
Stop-and-wait ARQ (1)
t1
t2
t3
t4
t5
t1
Sender
Receiver
t1: Round Trip Time t2: Frame Transmission Time t3: Frame Processing Time t4: ACK Transmission Time t5: ACK Processing Time
Information Network 1 / 2014 14/04/25
12
Copyright(C)2014 Youki Kadobayashi. All rights reserved.
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
Information Network 1 / 2014 14/04/25
Copyright(C)2014 Youki Kadobayashi. All rights reserved.
Go-back-N ARQ
1 6 5 3 4 5 4 3 2
1 6 5 3 4 5 4 2
ACK
ACK
ACK
ACK
ACK
ACK
Time out for Frame3
!!
Information Network 1 / 2014 14/04/25
13
Copyright(C)2014 Youki Kadobayashi. All rights reserved.
Selective-Repeat ARQ
1 8 7 3 6 5 4 3 2
1 8 7 3 6 5 4 2
ACK
ACK
ACK
ACK
ACK
ACK
Time out for Frame3
!!
ACK
ACK
Information Network 1 / 2014 14/04/25
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 ○ Complicated scheme that requires buffer, timer, and ACK
managements. ○ Buffers are required in both ends. ○ Window Flow Control is needed for buffer management.
Copyright(C)2014 Youki Kadobayashi. All rights reserved. Information Network 1 / 2014 14/04/25
14
Copyright(C)2014 Youki Kadobayashi. All rights reserved.
Window Flow Control for selective-repeat ARQ
0 1 2 3 4 5 6 7 8 9 10
11
12
13
14
15
16
17 …
sent frame sendable frame(maximum size W)
already received ACK
last sent frame if sent move to right
If ACK is received move to right
keep frame until ACK is received
0 1 2 3 4 5 6 7 8 9 10
11
12
13
14
15
16
17 …
received frame receivable frame(maximum size W)
already transmitted ACK
last received frame if received move to right
if ACK is sent move to right
Sender
Receiver
14/04/25
Copyright(C)2014 Youki Kadobayashi. All rights reserved.
Burden sharing among layers ● Assignment of function depends on communication
system designs ● Various solutions exist
Data Link
Network
Transport sequence assurance flow control retransmission interconnection of network error detection and correction frame boundary
Information Network 1 / 2014 14/04/25
15
Copyright(C)2014 Youki Kadobayashi. All rights reserved.
Questions?
Information Network 1 / 2014 14/04/25
Copyright(C)2014 Youki Kadobayashi. All rights reserved.
Sublayers of the Data Link Layer
Physical Layer
Data link Layer
Network Layer
CCITT X.25 (HDLC/LAPB) Media Access
Control Sublayer
8802/2 LLC
8802/3 CSMA/CD
8802/5 Token Ring
8802/4 Token Bus
Logical Link Control Sublayer
ISO/OSI Local Area Network Definitions (8802)
CCITT Data link Layer Definition
Information Network 1 / 2014 14/04/25
16
Media Access Control (MAC) (1)
Copyright(C)2014 Youki Kadobayashi. All rights reserved.
Data link layer provides packet send/receive service to network layer
Physical Layer provides binary send/receive to data link layer
Different media have different constraints about multiple nodes
accessing the medium
14/04/25
Media Access Control (MAC) (2)
Copyright(C)2014 Youki Kadobayashi. All rights reserved.
MAC layer provides medium access service to the data link layer
A separate protocol is needed to implement the service for each different transmission medium
Subsequent slides: learn about channel allocation (multiplexing)
14/04/25
17
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
Copyright(C)2014 Youki Kadobayashi. All rights reserved. Information Network 1 / 2014 14/04/25
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
Copyright(C)2014 Youki Kadobayashi. All rights reserved. Information Network 1 / 2014 14/04/25
18
MAC Protocols (2) Three techniques: ● Channel Partitioning
○ Divide channel into smaller “pieces” (time slots, frequency, code)
○ Allocate piece to node for exclusive use ● Random Access
○ Channel not divided, allow collisions ○ “Recover” from collisions
● Taking turns ○ Nodes take turns ○ Nodes with more to send can take longer turns
Copyright(C)2014 Youki Kadobayashi. All rights reserved. Information Network 1 / 2014 14/04/25
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.
Copyright(C)2014 Youki Kadobayashi. All rights reserved. Information Network 1 / 2014 14/04/25
19
MAC Throughput Performance
Copyright(C)2014 Youki Kadobayashi. All rights reserved. Information Network 1 / 2014 14/04/25
Copyright(C)2014 Youki Kadobayashi. All rights reserved.
Questions?
14/04/25
20
Evolution of data link technologies ● Wide bandwidth
● Large scale
● Virtualization
● Coverage expansion
● Switched media
● Bridges
● VLAN
● Broadband wireless, residential access, etc.
Copyright(C)2014 Youki Kadobayashi. All rights reserved. 14/04/25
LAN performance secrets: shared media → switched media ● High-bandwidth and commodity LAN ● Effectively a channel partitioning scheme
Copyright(C)2014 Youki Kadobayashi. All rights reserved.
medium
access
Non-blocking crossbar switch
14/04/25
21
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
Copyright(C)2014 Youki Kadobayashi. All rights reserved.
Switched media Ethernet
1996 1998 2000 2002 2004 2006
Voice Video (MPEG2)
Video (D1)
Video (MotionJPEG)
Video (HD D1)
Voice Video (MPEG2)
Video (MotionJPEG)
Shared media Wireless LAN
14/04/25
Large scale: Bridges ● Compatibility between physical limitations and LAN
convenience ○ Coverage, capacity
14/04/25 Copyright(C)2014 Youki Kadobayashi. All rights reserved.
Wiring between buildings:optical fiber (~5km)
Wiring in floor:coax (~100m)
22
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
Copyright(C)2014 Youki Kadobayashi. All rights reserved.
A
B
C
D
E
F
G
H
Transparent bridge
1 2
Fwd to 1 A, B, C, D Fwd to 2 E, F, G, H
14/04/25
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).
Copyright(C)2014 Youki Kadobayashi. All rights reserved. 14/04/25
23
Copyright(C)2014 Youki Kadobayashi. All rights reserved.
Questions?
Information Network 1 / 2014 14/04/25
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
● How can we bind Datalink layer & network layer? ○ Address mapping – ARP and ND ○ Multiplexing & demultiplexing – protocol architecture in OS
Copyright(C)2014 Youki Kadobayashi. All rights reserved. Information Network 1 / 2014 14/04/25
24
Hands-On Activity 1
Information Network 1 / 2014
Objectives
● Part 1 ○ Learn basic use of VMWare and Wireshark ○ Understand the TCP/IP Model via packet inspection
using Wireshark
● Part 2 ○ Familiarize with the protocol stack ○ Understand the data link layer thru Wireshark
25
Part 1: Protocol Architecture
http://mabricksmumblings.files.wordpress.com/2014/01/osi_model_lan1.jpg
Recall: The OSI Model
26
WWW - World Wide Web
DNS - Domain Name System
P2P - Peer to Peer
FTP - File Transfer Protocol
SMTP - Simple Mail Transfer Protocol
ICMP - Internet Control Message Protocol
IP - Internet Protocol
IPsec - Security Architecture for Internet Protocol
Ethernet
PPP - Point to Point Protocol
ARP - Address Resolution Protocol
RJ-45 - Registered Jack 45
TCP - Transmission Control Protocol
UDP - User Datagram Protocol
JPEG - Joint Photographic Experts Group
MP3 - Moving Picture Experts Group Layer-3 Audio
HTML - Hyper Text Markup Language
SIP - Session Initiation Protocol
RTP - Real-time Transport Protocol
Review: Glossary of Layer Protocols
Recall: OSI Model vs. TCP/IP
Information Network 1 / 2014
27
Virtual Machine (VM)
• Virtual Machine allows you to run another OS on your PC o e.g, run a Linux OS on a Windows/Mac host OS
• Virtual Machine players o Oracle VirtualBox, VMware, etc.
Let’s parallely run a Linux OS in your PC!!!
Information Network 1 / 2014
Running VM and Logging in
user: information-network2014 pwd: network2014
VM player VM
Information Network 1 / 2014
28
Wireshark command menus
Listing of captured packets
Details of selected packet headers
Packet contents in hexadecimal and in ASCII
Perfect Encapsulation
29
Physical Layer
ethernet, IP, TCP, and http are coming!
Information Network 1 / 2014
Data Link
30
Network
Transport
31
Application
Information Network 1 / 2014
Part 2: Data Link
32
Indications • Turn off your wireless connection • Wireshark: start the live capture • Turn on your wireless connection • Wireshark: stop the live capture
Filtering
33
Filtering
Ethernet Frame: Exploring 802.3
14 bytes
34
Ethernet Address: Src & Dst Hexadecimal value of the field Type
Address Resolution Protocol: ARP (RFC 826)
35
ARP cache arp -a
ARP cache: Multiple Network interfaces
ARP cache of interface 1
ARP cache of interface 2
ARP cache of interface 3
36
Wireshark ARP packets
ARP request
37
ARP reply
ARP Gratuitous
38
Assignment 2 (1) Using wireshark, observe traffic generated by other applications and depict protocol stack, according to wireshark output. Indicate which protocol belongs to which OSI-7 layer in an illustration.
14/04/25 Copyright(C)2014 Youki Kadobayashi. All rights reserved.
Assignment 2 (2)
14/04/25 Copyright(C)2014 Youki Kadobayashi. All rights reserved.
A frame: ff ff ff ff ff ff 84 2b 2b 47 94 62 08 89 00 01 08 00 06 04 00 02 84 2b 2b 47 94 62 a3 dd 34 5e 00 00 00 00 00 00 a3 dd 34 5e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Inspect the above frame and look for error(s). Then, explain the root cause of the error(s).
39
Assignments: Miscellaneous
Deadline: 2014/05/1 at 23:59
Submit to: network1-2014 _at_ is.naist.jp
File nomenclature: Name_StudentID.pdf
Assignment 2: at most 4 pages.
Language: Japanese or English
14/04/25 Copyright(C)2014 Youki Kadobayashi. All rights reserved.