Layer 2
Data Framing for
Fun and Profit
Eric L. Michelsen
Inductive Logic
Where In the Stack Are We?
OSI
7. Application
6. Presentation
5. Session Link Layer
Sublayers
4. Transport
1490
3. Network PPP Frame AAL2 AAL5 Ether- 802.2 Novell
SNAP
Relay net II (LLC) IPX
2. Link HDLC ATM
Bit serial
1. Physical (V.35, HSSI, DS1, DS3, etc.)
Ethernet
4/27/2001 Inductive Logic 2
Layers Upon Layers
• Synchronous HDLC (SDLC)
• RFC 1662 (Asynchronous HDLC)
• Frame Relay
• RFC 1490 (Multiprotocol in Frame Relay)
• Four Flavors of Ethernet
• ATM (cells, AAL5 packets)
• RFC 1483 (Multiprotocol in AAL5)
• FUNI
• Reference formats: DSL, Frame Relay, ATM,
DS1, DS3, SONET
4/27/2001 Inductive Logic 3
Synchronous HDLC (aka SDLC)
1 octet 2 or 4
opening CRC closing flag flag
flag data flag
01111110 01111110 ... idle ...
• Sends frames (packets) over a serial (synchronous)
bit stream
• Frames are delimited by flags (8 bits: 01111110)
• Shared flag closes one frame and opens the next
• Idle is usually flags, but may be 1s (mark idle)
• Shared zero flag is deprecated, and often banned:
flag
flag 0111111011111101111110 flag
4/27/2001 Inductive Logic 4
HDLC Bit Stuffing
bit stuffed 0
01111110 . . . 111110 . . . . 01111110
opening flag user data: closing flag
five 1s
• Transparency is by “bit stuffing” everything between the
flags: any sequence of five 1s has a 0 bit stuffed after it
• Stuffed frame length need not be a multiple of 8 bits
• Stuffing makes the “effective data rate” pattern sensitive
• 3 kinds of CRC: CRC-SDLC (aka CRC-CCITT), CRC-16,
and CRC-32 (used by CCITT).
• CRC-16 detects errors better, but wasn‟t known when
CRC-SDLC was chosen. Rarely used.
• Hardware sends/detects flags, bit stuffing, CRC
4/27/2001 Inductive Logic 5
RFC 1662 (Asynchronous HDLC)
• Sends frames over a synchronous or asynchronous octet
stream (e.g., modem, X.25, SONET)
• Based on ISO/IEC 3309:1991 (HDLC framing)
• Frames delimited by flag octets: 01111110 (0x7E)
• Byte stuffing: escape = 0x7D,
Following byte = (user data XOR 0x20)
• Flag and Escape bytes in user data MUST be escaped
• PPP Async Control Character Map (ACCM) specifies
other values from 0 - 0x1F to escape (Tx), and ignore (Rx)
• Byte stuffing is often done in software
1 octet 2 or 4
opening CRC closing idle...
flag data flag
01111110 01111110
4/27/2001 Inductive Logic 6
Frame Relay
• Uses synchronous HDLC framing sublayer
• Data Link Control Identifier (DLCI) multiplexes virtual
circuits. Usually only local significance.
• Uses Q.922 header: Usually 2-octet address (1024 DLCIs),
extensions for 3 or 4 (EA=1 on last address octet)
• Max information length is configurable, 4096 max
1 octet 2 to 4 1 to max-length 2 1
opening frame CRC closing
flag information flag
address
EA
F B
DLCI[9:4] CR E
DLCI[3:0] C E DE EA
=0 C =1
N N
7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
4/27/2001 Inductive Logic 7
Frame Relay (cont.)
• Link Management Interface (LMI) on fixed DLCI
• Forward Explicit Congestion Notification (FECN) set by
Frame Relay network if frame experienced congestion
• Backward ECN set if reverse direction is congested
• FECN & BECN set by network only
Q.922 is not clear if user equipment can set them or not
• Discard Eligible, set by network for overcommitted, or
user for low priority, frames
• C/R bit carried transparently by Frame Relay network
frame address
EA
F B
DLCI[9:4] CR E
DLCI[3:0] C E DE EA
=0 C =1
N N
7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
4/27/2001 Inductive Logic 8
RFC 1490
Multiprotocol Encapsulation in FR
• Allows a SNAP-like header in data field to encapsulate
raw LAN frames (“bridged” mode)
Bridging header (OUI = 0x00-80-C2 for 802.1) encapsulates
LAN frame
PID specifies with or without LAN FCS
1 1 1 3 2 6 0 or 4
Ctl pad NLPID optional
OUI PID dest ... LAN data
=3 =0 =0x80 MAC LAN FCS
LAN frame
Frame Relay information field
• Also allows direct IP encapsulation (“routed” mode)
Ctl NLPID
IP packet
= 3 = 0xCC
Frame Relay information field
4/27/2001 Inductive Logic 9
Four Flavors of Ethernet
• Ethernet II
• IEEE 802.2
• IEEE 802.2 SNAP
• Novell IPX (“raw 802.3”)
• All use a common hardware sublayer:
This is the basis of the “64-byte” minimum frame size
Finally recognized by IEEE 802.3-1998 as the “MAC” layer
frame size 64 to 1518
8 octets 6 6 48 (min) to 1502 (max) 4
S
destination source pad (if
preamble F PID + data needed)
FCS
D MAC MAC
1010 ... 1011 CRC-32
Ethernet Common HW sublayer
4/27/2001 Inductive Logic 10
Ethernet II
• First widespread Ethernet standard
• PIDs administered by IEEE
• All IP on Ethernet is required to support this (RFC
1122), and almost all use it.
• All PIDs are >= 1536 (decimal)
• Exact packet length is not available from frame
data alone, because of padding
8 octets 6 6 2 46 (min) to 1500 (max) 4
S
preamble destination source pad (if
F PID data FCS
D MAC MAC needed)
Common HW sublayer Ethernet II Common HW
sublayer
4/27/2001 Inductive Logic 11
Ethernet IEEE 802.2
• Destination and Source Service Access Points (DSAP and
SSAP) are essentially protocol IDs
• Used by IPX since Netware 3.12 (SAP=0xE0)
• Not used for IP
• Exact length available because „length‟ specifies valid
data, not including padding
• Don‟t confuse Service Access Point (SAP) with Service
Advertising Protocol (SAP)
8 octets 6 6 2 1 1 1 43 to 1497 4
dest source pad (if FCS
preamble
MAC MAC
length DSAP SSAP Ctl data
needed)
length
4/27/2001 Inductive Logic 12
IEEE 802.2 SNAP
• SubNetwork Access Protocol (SNAP)
• OUI + PID allows vendors to define globally
unique protocol identifiers
OUI = Organizationally Unique Identifier
• OUI = 0 implies PID is an Ethernet II PID
• Optional support in IP (RFC 1042)
8 octets 6 6 2 1 1 1 3 2 38 to 1492 4
dest source data pad (if
preamble
MAC MAC
length DSAP SSAP Ctl OUI PID needed)
FCS
length
4/27/2001 Inductive Logic 13
Novell IPX (“raw 802.3”)
• Defined by Novell before 802.3 was complete
• Phased out by Novell in Netware 3.12
• “Checksum” is forced to 0xFFFF (=> none), takes
place of DSAP/SSAP
• Does not allow a real IPX checksum
46 (min) to 1500 (max)
8 octets 6 6 2 2 4
IPX
destination source data pad (if
preamble length checksum FCS
MAC MAC = FFFF needed)
IEEE 802.3 IPX header
4/27/2001 Inductive Logic 14
How Can I Tell?
• Check PID/length first, then DSAP/SSAP
dest source PID >= data/pad
preamble MAC MAC FCS Ethernet
1536 II
dest source length DSAP SSAP Ctl data/pad
preamble MAC MAC 3-1535 FCS 802.2
dest source length DSAP SSAP Ctl OUI PID data/pad 802.2
preamble MAC MAC 8-1535 = AA = AA FCS
SNAP
dest source length data/pad Novell
preamble MAC MAC FFFF FCS
2-1535 old IPX
4/27/2001 Inductive Logic 15
ATM Cells
• Synchronous bit stream 8 bits
• Bit stream may be framed (DS3, OC3) 1
GFC/
VPI... VPI...
• Cells are 53 bytes: 2 ...VPI VCI...
5 header + 48 payload
3 ...VCI...
• Idle with null or unassigned cells
4 ...VCI PT CLP
• Cell delineation usually by Header
Error Check (HEC) 5 HEC (8-bit CRC)
• ATM switches operate primarily on 6
cells, ignoring payload type (PT)
:
• VPI/VCI is virtual circuit identifier Payload
48 octets
• VPI is 8 bits (UNI) or 12 bits (NNI) :
• VCI is 16 bits 53
• CLP is like Frame Relay DE
4/27/2001 Inductive Logic 16
ATM AAL5 (Packets)
• Packet framing above cell layer packet layer
• ATM Adaptation Layer 5 (AAL5) packets
includes Segmentation and
Reassembly (SAR) of packets SAR (AAL5)
• User-user bit in cell header cells
payload-type (PTI) indicates last
ATM layer
cell in packet
cell header
AAL5 packet
cell cell cell cell cell cell
PTI =
last cell last cell
4/27/2001 Inductive Logic 17
ATM AAL5 (Packets), cont.
• Control, length, and CRC-32 at end of last cell
• Control field currently unused
• „data length‟ provides precise length
• Length in trailer allows starting to send packet
before length is known
(cut through switches, e.g. frame to ATM)
N x 48
0 to 65,535 octets 0 to 47 1 1 2 4
pad data
data UU ctl CRC-32
length
data length
4/27/2001 Inductive Logic 18
RFC 1483
Multiprotocol Encapsulation in ATM
• Requires an 802.2 SNAP-like header in data field
• Allows for raw LAN frames (“bridged” mode)
Header (OUI = 0x00-80-C2 for 802.1) encapsulates LAN frames
PID specifies with or without LAN FCS
1 1 1 3 2 2 6 ... 0 or 4
DSAP SSAP Ctl OUI PID pad dest ... optional
LAN data
=AA =AA =3 00 80 C2 00 xx 00-00 MAC LAN FCS
LAN frame
AAL5 or FUNI data field
• Also allows direct IP encapsulation (“routed” mode)
DSAP SSAP Ctl OUI PID IP packet
AA AA 03 00 00 00 08 00
4/27/2001 Inductive Logic 19
Classical IP Over ATM
• RFC 1577 (Classical IP and ARP over ATM)
Specifies RFC 1483 Routed IP format (802.2 SNAP)
Defines Inverse-ARP for identifying your IP peer
Defines a bunch of LAN Emulation (LANE) SVC stuff
that no one uses
4/27/2001 Inductive Logic 20
FUNI
• ATM standard for Frame User-Network Interface
• Q.922 HDLC frames to ATM AAL5 interworking
• Fully supports ILMI, OAM, SVCs: all ATM management
Premise FUNI Interworking cells
Device
Premise format ATM Network
HDLC HDLC
flag Q.922 VC payload CRC flag
variable ATM format
VC payload pad AAL5 trailer
4/27/2001 Inductive Logic 21
Some Common Encapsulations
1483 FUNI HDLC Q.922 HDLC
(Ethernet) flag DLCI 528 AA AA 03 00 80 C2 00 07 00 00 Ethernet frame CRC flag
1483 FUNI HDLC Q.922 HDLC
(IP) flag DLCI 528 AA AA 03 00 00 00 08 00 IP packet CRC flag
1490 HDLC Q.922 HDLC
(Ethernet) flag DLCI 16 03 00 80 00 80 C2 00 07 Ethernet frame CRC flag
1490 HDLC Q.922 HDLC
(IP) flag DLCI 16 03 CC IP packet CRC flag
Q.922 HDLC HDLC
flag Q.922 VC payload CRC flag
Q.922 HDLC NL- HDLC
+1490 flag Q.922 03 PID ISO protocol packet CRC flag
HDLC HDLC HDLC
flag HDLC payload CRC flag
Optional 1 or 2
HDLC HDLC Adrs Ctl HDLC
+ PPP flag FF 03
PPP-PID PPP information CRC flag
4/27/2001 Inductive Logic 22
Frame Relay Encapsulations
1483 FUNI HDLC HDLC
flag Q.922 AA AA 03 00 80 C2 00 07 00 00 Ethernet frame CRC flag
(Ethernet)
1483 FUNI HDLC HDLC
flag Q.922 AA AA 03 00 00 00 08 00 IP packet CRC flag
(IP)
1490 HDLC HDLC
flag Q.922 03 00 80 00 80 C2 00 07 Ethernet frame CRC flag
(Ethernet)
1490 HDLC HDLC
(IP) flag Q.922 03 CC IP packet CRC flag
HDLC HDLC
“None” flag Q.922 VC payload CRC flag
variable
PPP- HDLC NL- HDLC
Q.922 03 PPP-PID PPP information CRC
RFC1973 flag PID flag
4/27/2001 Inductive Logic 23
ATM Encapsulations
variable
“None”
VC payload pad AAL5 trailer
(AAL5)
variable
1483
AA AA 03 00 80 C2 00 07 00 00 Ethernet frame pad AAL5 trailer
(Ethernet)
variable
1483 IP
AA AA 03 00 00 00 08 00 IP packet pad AAL5 trailer
(ATM)
variable
FRF.5 Q.922 VC payload pad AAL5 trailer
Optional 1 or 2 variable
Cisco- Adrs Ctl
PPP FF 03
PPP-PID PPP information pad AAL5 trailer
1 or 2 variable
PPP-2364- PPP-PID PPP information pad AAL5 trailer
NULL
1 or 2 variable
PPP-2364- FE FE 03 CF PPP-PID PPP information pad AAL5 trailer
LLC
4/27/2001 Inductive Logic 24
DS1 ESF Framing
193-bit frame
M1
192-bit C1 M2 F1=0
DS1-ESF Payload
(unchannelized) M3 C2 M4 F2=0
M5 C3 M6 F3=1
Reference 4 x 6 = 24 frames
T1.107 = 1 superframe
M7 C4 M8 F4=0
M9 C5 M10 F5=1
M11 C6 M12 F6=1
6-bit CRC Frame Alignment
Signal (FAS)
4 kbps Facility
Data Link (FDL)
Framing is bit-oriented (rather than octet-oriented) Note:
8k frames/s x 193 = 1.544 Mbps line rate (exactly) SF (aka D4) framing is not
8k frames/s x 192 = 1.536 Mbps payload rate (exactly) usable for data transport
8k frames/s 24 333 superframes/s
4/27/2001 Inductive Logic 25
DS3 Framing
680-bit M-subframe
X1
84-bit F1=1 C1=1 F2=0 C2=1 F3=0 FE F4=1
Payload AC
X2 F1=1 C1=1 F2=0 C2=1 F3=0 C3=1 F4=1
P1 F1=1 CP F2=0 CP F3=0 CP F4=1
P2 F1=1 FE F2=0 FE F3=0 FE F4=1
BE BE BE
M1 F1=1 DL F2=0 DL F3=0 DL F4=1
=0
M2 F1=1 C1=1 F2=0 C2=1 F3=0 C3=1 F4=1
=1
M3 F1=1 C1=1 F2=0 C2=1 F3=0 C3=1 F4=1
=0
M-Frame 7 M-subframes
Alignment M-subframe Alignment = 1 M-frame
Framing is bit-oriented. C-bit-parity shown. Reference T1.107
M23 mode sets C1 in subframe-1 randomly, other C-bits per stuffing
X1 = X2 = not Remote Alarm Indication (RAI) FEAC = Far End Alaram & Control
P1 = P2 = CP = XOR of previous M-frame payload bits FEBE = Far End Block Error
CP are end-to-end parity bits DL = Data Link: HDLC EOC
44.736 Mbps line rate (exact)
44.736 x (84 / 85) 44.210 Mbps payload rate
Inductive Logic
4/27/2001 26
STS-1 (component of OCn)
90 Columns Reference GR-253, chap 3.
A1 A2 J0/Z
0
Section STS-1 Payload Capacity (84 useable columns)
overhead B1 E1 F1 8000 x 84 x 9 x 8 = 48.384 Mbps
H1/H2 point to the
D1 D2 D3 Synchronous Payload Envelope J1 J1
(SPE) at arbitrary byte offset
H1 H2 H3 B3
9 Rows
B2 K1 K2 C2
STS-1 Envelope Capacity ATM cells,
Line D4 D5 D6 87 Columns G1 etc.
Fixed Stuff
Fixed Stuff
overhead
D7 D8 D9 F2
D10 D11 D12 H4
S1/ M0 | E2
M1/ Z3
Z1 Z2
810 Byte Frame Z4
Transport
overhead
Z5
Framing is byte-oriented. Path
Line rate = Overhead
(POH)
8000 frames/s x 90 x 9 x 8 bits= 51.840 Mbps
4/27/2001 Inductive Logic 27
STS-Nc SPE
STS-3c SPE: 3 x 87 = 261 Columns STS-12c SPE: 12 x 87 = 1044 Columns
J1 J1
B3 B3
C2 C2
G1 G1 STS-12c Payload Capacity:
Fixed Stuff
Fixed Stuff
Fixed Stuff
STS-3c Payload Capacity:
8000 x 1040 x 9 x 8
F2 8000 x 260 x 9 x 8 = 149.760 Mbps F2
= 599.040 Mbps
H4 260 Columns H4
1040 Columns
Z3 Z3
Z4 Z4
Z5 Z5
Path 9 Rows Path 9 Rows
Overhead Overhead
(POH) (POH)
Line Rate = N x 51.840 Mbps Reference GR-253, chap 3.
Framing chosen to match STM-N
STS-48c (not shown) is exactly 4 times STS-12c
(POH + 15 Stuff)
4/27/2001 Inductive Logic 28
This slide intentionally left blank
4/27/2001 Inductive Logic 29