You are on page 1of 27

18/01/2018

• Data Link Layer Design Issues


• Error Detection and Correction
• Compression Application
• Elementary Data Link Protocols Transport
Network
Link
Physical

 Link layer accepts packets from the network layer, and


encapsulates them into frames that it sends using the physical
layer; reception is the opposite process

Network

Link
Virtual data path

Physical Actual data path

Data Communication and Network Routing 2

1
18/01/2018

pp. 78-85
 A data frame is used to transport data across the network

Data Communication and Network Routing 3

Length/Type field is the


indicates the number of
bytes of data (0 to 1500
Preamble consists of seven bytes).
bytes all of the form
Frames size must be min 4 byte
10101010, and is used by the The MAC
46 bytes, not including the Checksum field
receiver to establish bit addresses used
preamble, if data is less uses a CRC-32
synchronisation in 802.3 are
than 46 bytes, the Pad field polynomial
always 48 bits
will compensated code
long
Start frame delimiter is a (dest. MAC
single byte, 10101011, through to Pad)
Data: This is the data
which is a frame flag,
being transferred from the
indicating the start of a
source to the destination
frame
and destination to the
source

Data Communication and Network Routing 4

2
18/01/2018

 Unacknowledged connectionless service


 Frame is sent with no connection / error recovery
 Ethernet is example

 Acknowledged connectionless service


 Frame is sent with retransmissions if needed
 Example is 802.11

 Acknowledged connection-oriented service


 Connection is set up; rare

Data Communication and Network Routing 5

 Many method can be used in framing, Byte count, Flag bytes with byte
stuffing, Flag bits with bit stuffing
 Byte count
Frame begins with a count of the number of bytes in it
 Simple, but difficult to resynchronize after an error

Expected case

Error case

 Transmission error changed 5 to 7. All frames now out of synch. Even if we


detect error, we have no way of recovering - of finding where next frame starts.

Data Communication and Network Routing 6

3
18/01/2018

 Special flag bytes delimit frames; thus occurrences of flags in the data must be
stuffed (escaped)
 Each frame starts with special start and end bytes (flag bytes). Here will imagine it
as same byte, FLAG. After error, can always find start of next frame.
 Q. What if flag byte itself is in the data?
 A. Insert special escape byte (ESC) before each FLAG in data. Removed at far end. This is
called byte stuffing or character stuffing.

 Q. What if ESC itself is in data?


 A. Insert another ESC before it. (See figure)

Frame format

Stuffing examples

Data Communication and Network Routing 7

Stuffing done at the bit level:


 Frame flag has six consecutive 1s
 Each frame begins and ends with bit pattern 01111110 (6 1's)
 On transmit, after five 1s in the data, a 0 is added
so will never be 6 in a row
 On receive, a 0 after five 1s is deleted

Data bits

Transmitted bits
with stuffing

Data Communication and Network Routing 8

4
18/01/2018

Flow Control
 Error Control
 Error control repairs frames that are received in error
 Requires errors to be detected at the receiver
 Typically retransmit the unacknowledged frames
 Timer protects against lost acknowledgements
 Detecting errors and retransmissions are next topics.
 Flow Control
 Prevents a fast sender from out-pacing a slow receiver
 Receiver gives feedback on the data it can accept
 Rare in the Link layer as NICs run at “wire speed”
o Receiver can take data as fast as it can be sent
 Flow control is a topic in the Link and Transport layers.

Data Communication and Network Routing 9

 Error codes add structured redundancy to data so errors can be


either detected, or corrected.
 Error correction codes:
 Hamming codes
 Binary convolutional codes
 Reed-Solomon and Low-Density Parity Check codes
 Mathematically complex, widely used in real systems

 Error detection codes:


 Parity
 Checksums
 Cyclic redundancy codes

Data Communication and Network Routing 10

5
18/01/2018

 The Rules
 All bit positions that are powers of 2 are parity bits (P) (1, 2, 4, 8, 16, etc.)
 For parity bit position n: skip n - 1 bits, check n bits, skip n bits, check n
bits,
 P1: n = 1, skip 0, check 1, skip 1, check 1, ...
P2: n = 2, skip 1, check 2, skip 2, check 2, ...
P3: n = 4, skip 3, check 4, skip 4, check 4, ...
P4: n = 8, skip 7, check 8, skip 8, check 8, ...

More in
seminar

Data Communication and Network Routing 11

Code turns data of n bits into codewords of n+k bits


Hamming distance is the minimum bit flips to turn one
valid codeword into any other valid one.
 Example with 4 codewords of 10 bits (n=2, k=8):
o 0000000000, 0000011111, 1111100000, and 1111111111
o Hamming distance is 5

Bounds for a code with distance:


 2d+1 – can correct d errors (e.g., 2 errors above)
 d+1 – can detect d errors (e.g., 4 errors above)

Data Communication and Network Routing 12

6
18/01/2018

Hamming code gives a simple way to add check bits


and correct up to a single bit error:
 Check bits are parity over subsets of the codeword
 Recomputing the parity sums (syndrome) gives the position of the
error to flip, or 0 if there is no error

More in
seminar
(11, 7) Hamming code adds 4 check bits and can correct 1 error
Data Communication and Network Routing 13

 Parity bit is added as the modulo 2 sum of data bits


 Equivalent to XOR; this is even parity
 Ex: 1110000 11100001
 Detection checks if the sum is wrong (an error)

 Simple way to detect an odd number of errors


 Ex: 1 error, 11100101; detected, sum is wrong
 Ex: 3 errors, 11011001; detected sum is wrong
 Ex: 2 errors, 11101101; not detected, sum is right!
 Error can also be in the parity bit itself
 Random errors are detected with probability ½

Data Communication and Network Routing 14

7
18/01/2018

 Two-dimensional parity is exactly what the name


suggests
 It is based on “simple” (one-dimensional) parity, which
usually involves adding one extra bit to a 7-bit code to
balance the number of 1s in the byte. For example,
 Odd parity sets the eighth bit to 1 if needed to give an odd
number of 1s in the byte, and
 Even parity sets the eighth bit to 1 if needed to give an even
number of 1s in the byte

Data Communication and Network Routing 15

 Two-dimensional parity does a similar calculation for each bit


position across each of the bytes contained in the frame
 Two-dimensional parity does a similar
calculation for each bit position
across each of the bytes contained in
the frame
 This results in an extra parity byte for
the entire frame, in addition to a
parity bit for each byte
 Two-dimensional parity catches all 1-,
2-, and 3-bit errors and most 4-bit
errors

Data Communication and Network Routing 16

8
18/01/2018

Interleaving of N parity bits detects burst errors up to N


 Each parity sum is made over non-adjacent bits
 An even burst of up to N errors will not cause it to fail

Data Communication and Network Routing 17

Checksum treats data as N-bit words and adds N check bits that are
the modulo 2N sum of the words
 Ex: Internet 16-bit 1s complement checksum

Properties:
 Improved error detection over parity bits
 Detects bursts up to N errors
 Detects random errors with probability 1-2N
 Vulnerable to systematic errors, e.g., added zeros

Data Communication and Network Routing 18

9
18/01/2018

 Reduce the number of extra bits and maximize protection


 Given a bit string 110001 we can associate a polynomial on a single
variable x for it.
1.x5+1.x4+0.x3+0.x2+0.x1+1.x0 = x5+x4+1
and the degree is 5.
A k-bit frame has a maximum degree of k-1
 Let M(x) be a message polynomial and C(x) be a generator
polynomial.
 Let M(x)/C(x) leave a remainder of 0.
 When M(x) is sent and M’(x) is received we have M’(x) = M(x)+E(x)
 The receiver computes M’(x)/C(x) and if the remainder is nonzero,
then an error has occurred.
 The common key between sender and receiver is C(x).

Data Communication and Network Routing 19

Adds bits so that transmitted frame viewed as a


polynomial is evenly divisible by a generator polynomial

Start by adding 0s to
frame and try dividing

Offset by any reminder to


make it evenly divisible
More in
seminar

Data Communication and Network Routing 20

10
18/01/2018

Properties of Generator Polynomial


In general, it is possible to prove that the following
types of errors can be detected by a C(x) with the
stated properties
All single-bit errors, as long as the xk and x0 terms have
nonzero coefficients.
All double-bit errors, as long as C(x) has a factor with at
least three terms.
Any odd number of errors, as long as C(x) contains the
factor (x+1).
Any “burst” error (i.e., sequence of consecutive error bits)
for which the length of the burst is less than k bits. (Most
burst errors of larger than k bits can also be detected.)

Data Communication and Network Routing 21

 Six generator polynomials that have become


international standards are:
CRC-8 = x8+x2+x+1
CRC-10 = x10+x9+x5+x4+x+1
CRC-12 = x12+x11+x3+x2+x+1
CRC-16 = x16+x15+x2+1
CRC-CCITT = x16+x12+x5+1
 Ethernet 32-bit CRC is defined by:

Data Communication and Network Routing 22

11
18/01/2018

 In a stream of digits there are often sequences of the same


characters, most frequently spaces.
 if a continuous string of three or more chars in a sequence it is
replaced by Cntrl, char, number
 thus CntrlF25 means 25Fs in a sequence, ie FFFFFFFFFFFFFFF
FFFFFFFFFF
 type of run-length encoding

Data Communication and Network Routing 24

12
18/01/2018

STX Cntrl sp 45 ‘A’ ‘B’ ETX BCC

Single letters
Closing flag
& Block CC
number of chars

Char being suppressed

Control character

Opening Flag

Data Communication and Network Routing 25

• Run-length compression where the codeword actually contains the


number of repetitions.
• A three byte minimum repetition is chosen such that all
occurrences of repetitions greater or equal to 3 will be encoded
thus.
• <char><char><char><n>
• this four byte codeword can represent repetitions up to 259
<char> <char>
<char><char> <char><char>
<char><char><char> <char><char><char><0>
<char><char><char><char> <char><char><char><1>
<char><char><char><char><char> <char><char><char><2>

Data Communication and Network Routing 26

13
18/01/2018

 Instead of representing symbols with a fixed no of bits (the normal


char representation is 8bit), fewer bits are used for frequently
occurring symbols and vice versa
 Method : Determine the relative frequency of symbols. Create an
unbalanced tree with unequal branches.

Data Communication and Network Routing 27

 Consider that a group of characters A to H is to be transmitted, having


different frequencies and comprises of :
 9As, 9Bs, 5Cs, 5Ds, 2Es, 2Fs, 2Gs, 2Hs
 Sequence of operations.
 a) Order the symbols in terms of probability
 b) Combine the two least frequently occurring symbols
 c) assigning 1(upper) and 0(lower) to each.
 d) This is now considered to be one entity.

 Perform the same steps until only two symbols are left.
 Determine the codeword by reading from left to right. The first bit being read is the
least significant one.

Data Communication and Network Routing 28

14
18/01/2018

The resulting Huffman Codes for these symbols are:


A 1

A9 --> 1 1
B 0
B9 --> 1 0 1
C5 --> 0 1 1 C 1

D5 --> 0 1 0
D 0
1
E2 --> 0 0 1 1
F2 --> 0 0 1 0 E 1 0

1
G2 --> 0 0 0 1 F
0
0
H2 --> 0 0 0 0
G 1 0

More in H 0 Another
seminar possible
answer

Data Communication and Network Routing 29

The resulting Huffman Codes for these


symbols are:

A9 --> 1 1

B9 --> 1 0

C5 --> 0 1 1
 If there were N symbols then N codewords would be sent. In the case of
fixed length binaryD5
codes
--> this would
0 1 be0 represented by 3N bits.
 How does this compare with those required by this example of Huffman
E2 --> 0 0 1 1
encoding?
F2 --> 0 0 1 0 Message Prob No of bits N messages
Therefore there has been a saving of 0.28N bits in
comparison with fixed length binary each of 3 bits. A 9/36 2 18/36N
G2 --> 0 0 0 1
B 9/36 2 18/36N
Redundancy it can shown that the ideal code for this
H2 2.53N
sequence of symbols would take --> 0bits 0ie. this
0 is 0 C 5/36 3 15/36N
the actual information content of the stream of
D 5/36 3 15/36N
codewords.
Thus for fixed length binary codes the E 2/36 4 8/36N
Information content
F 2/36 4 8/36N
Redundancy = 1- -------------------------
Number of bits sent G 2/36 4 8/36N

Or = 1 - 2.53N/3.0N H 2/36 4 8/36N


= 16%
Total number of Bits 98/36N = 2.72N bits
for Huffman = 1 - 2.53N/2.72N
= 7%

Data Communication and Network Routing 30

15
18/01/2018

Packet over SONET


PPP (Point-to-Point Protocol)
ADSL (Asymmetric Digital Subscriber Loop)

 Packet over SONET is the method used to carry IP packets over


SONET optical fibre links
 Uses PPP (Point-to-Point Protocol) for framing

PPP frames may be split over


Protocol stacks
SONET payloads

Data Communication and Network Routing 32

16
18/01/2018

 PPP (Point-to-Point Protocol) is a general method for delivering


packets across links
 Framing uses a flag (0x7E) and byte stuffing
 “Unnumbered mode” (connectionless unacknowledged service) is
used to carry IP packets
 Errors are detected with a checksum

0x21 for IPv4 IP packet

Data Communication and Network Routing 33

 A link control protocol brings the PPP link up/down

State machine for link control


Data Communication and Network Routing 34

17
18/01/2018

Widely used for broadband Internet over local loops


 ADSL runs from modem (customer) to DSLAM (ISP)
o DSLAM = Digital subscriber line access multiplexer
 IP packets are sent over PPP and AAL5/ATM (over)
o Asynchronous Transfer Mode (ATM)

Data Communication and Network Routing 35

PPP data is sent in AAL5 frames over ATM cells:


 ATM is a link layer that uses short, fixed-size cells (53 bytes);
each cell has a virtual circuit identifier
 AAL5 is a format to send packets over ATM
 PPP frame is converted to a AAL5 frame (PPPoA)

AAL5 frame is divided into 48 byte pieces, each of


which goes into one ATM cell with 5 header bytes

Data Communication and Network Routing 36

18
18/01/2018

 As businesses become increasingly dependent on the


network, the availability of the network infrastructure
becomes a critical business concern.
 Redundancy is the solution for achieving the necessary
availability.
 Layer 2 redundancy improves the availability of the network
by implementing alternate network paths by adding
equipment and cabling.
 Having multiple paths for data to traverse the network allows
for a single path to be disrupted without impacting the
connectivity of devices on the network.

Data Communication and Network Routing 38

19
18/01/2018

Data Communication and Network Routing 39

Redundant paths create loops in the


network.

How are they controlled?


Spanning Tree Protocol

Data Communication and Network Routing 40

20
18/01/2018

 The Spanning Tree Protocol (STP) is enabled on all switches.


 STP has placed some switch ports in forwarding state and other switch ports in
blocking state.

Forward

Blocked

Data Communication and Network Routing 41

 Redundancy is an important part of the hierarchical design.


 When multiple paths exist between two devices on the network and
STP has been disabled on those switches, a Layer 2 loop can occur.

 If STP is enabled on these switches, which is the default, a Layer 2 loop


would not occur.

Data Communication and Network Routing 42

21
18/01/2018

 Ethernet frames do not have a Time-To-Live (TTL)


parameter like IP packets.
 As a result, if they are not terminated properly on a switched
network, they continue to bounce from switch to switch
endlessly.

Data Communication and Network Routing 43

 Broadcast Storms:

In fact, the entire network can no longer


process new traffic and comes to a
screeching halt. Because of the high level of
traffic,
PC3 sends a PC4 itsends
broadcast
PC1
No STP cannot
PC2
sends
so aaabe
and
sends creates
a
processed.
Another
yet another
loop
broadcast
broadcast loop
is created
broadcast
loop

Data Communication and Network Routing 44

22
18/01/2018

Data Communication and Network Routing 45

 Redundancy:
 Increases the availability of the network topology by
protecting the network from a single point of failure.
 In a Layer 2 design, loops and duplicate frames can occur,
having severe consequences.
 The Spanning Tree Protocol (STP) was developed to
address these issues.
 STP ensures that there is only one logical path between all
destinations on the network by intentionally blocking
redundant paths that could cause a loop.
 The switches running STP are able to compensate for failures
by dynamically unblocking the previously blocked ports and
permitting traffic to traverse the alternate paths.

Data Communication and Network Routing 46

23
18/01/2018

 STP Topology – Avoiding a loop:

Because
STP
S1
PC1 F0/2
S2 forwards
forwards
issends
in useisathe
in blocking
and
the S3 has
state,
broadcast
placed port–
the
broadcast.broadcast
broadcast. F0/2
but not is not
in blocking
to
forwarded toback
state S3. avoidto S2. – NO
a loop.
LOOP!

Data Communication and Network Routing 47

 STP Topology – Network Failure:

S3 port
activated
Trunk 1
S3 port back to Failure
S2
PC1
S3forwards
and
Sends
S1 a
the
forward the Trunk 1 comes back
blocking mode.
broadcast.
broadcast.
broadcast. up.

Data Communication and Network Routing 48

24
18/01/2018

 Terminology:
 Root Bridge:
 A single switch used as the reference point for all
calculations.
 Root Ports:
 The switch port closest to the root bridge.
 Designated Port:
 All non-root ports that are still permitted to forward traffic
on the network.
 Non-designated Ports:
 All ports configured to be in a blocking state to prevent loops.

Data Communication and Network Routing 49

 STP uses the Spanning Tree Algorithm (STA) to


determine which switch ports on a network need to be
configured for blocking to prevent loops.
 Through an election process, the algorithm designates a single
switch as the root bridge and uses it as the reference point for
all calculations.
 The election process is controlled by the Bridge-ID (BID).

Bridge MAC
Priority Address

2 6

Data Communication and Network Routing 50

25
18/01/2018

Election Process:
 All switches in the broadcast domain participate.
 After a switch boots, it sends out Bridge Protocol Data Units (BPDU)
frames containing the switch BID and the root ID every 2 seconds.
 The root ID identifies the root bridge on the network.

 By default, the root ID matches the local BID for all switches on the
network.
 In other words, each switch considers itself as the root bridge when it boots.

Data Communication and Network Routing 51

Election Process:
 As the switches forward their BPDU frames, switches in the
broadcast domain read the root ID information from the BPDU
frame.
 If the root ID from the BPDU received is lower than the root ID
on the receiving switch, the receiving switch updates its root
ID identifying the adjacent switch as the root bridge.
 The switch then forwards new BPDU frames with the lower root
ID to the other adjacent switches.
 Eventually, the switch with the lowest BID ends up being
identified as the root bridge for the spanning-tree instance.

Data Communication and Network Routing 52

26
18/01/2018

Burgess, M., 2003. Principles of Network and System Administration. 2nd ed.
Chichester: John Wiley and Sons Ltd.
Hallberg, B., 2005. Networking: A Beginner’s Guide. 4th ed. Osborne: Mcgraw-Hill.
Limoncelli, T. & Hogan, C., 2001. The Practice Of System and Network
Administration. London: Addison-Wesley.
Lowe, D., 2005. Networking All-In-One Desk Reference For Dummies. 2nd ed. New
York: Hungry Minds Inc..
Olifer, N. & Olifer, V., 2005. Computer Networks: Principles, Technologies And
Protocols For Network Design. Chichester: John Wiley And Sons Ltd.
Stallings, W., 2003. Data And Computer Communications. 7th ed. New York:
Prentice Hall.
Subramanian, M., (2000). Network Management: An Introduction to Principles and
Practice. Chichester: Addison-Wesley.
Tanenbaum, A., 2002. Computer Networks. London: Prentice Hall Ptr.

Journals
The Institute of Engineering and Technology

Data Communication and Network Routing 54

27

You might also like