part 2: packet transmission packets, frames local area networks (lans) wide area networks (lans)...

27
Part 2: Packet Transmission Packets, frames Local area networks (LANs) Wide area networks (LANs) Hardware addresses Bridges and switches Routing and protocols

Upload: christian-jones

Post on 16-Jan-2016

247 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Part 2: Packet Transmission Packets, frames Local area networks (LANs) Wide area networks (LANs) Hardware addresses Bridges and switches Routing and protocols

Part 2: Packet Transmission

Packets, framesLocal area networks (LANs)Wide area networks (LANs)

Hardware addressesBridges and switchesRouting and protocols

Page 2: Part 2: Packet Transmission Packets, frames Local area networks (LANs) Wide area networks (LANs) Hardware addresses Bridges and switches Routing and protocols

Packets, frames and error detection

• Packets and frames

• Control data and byte stuffing

• Error detection - parity bits, checksums and cyclic redundancy checks

Page 3: Part 2: Packet Transmission Packets, frames Local area networks (LANs) Wide area networks (LANs) Hardware addresses Bridges and switches Routing and protocols

Packets

• Most networks transmit data in small blocks called packets– helps to detect transmission errors– gives fair access for a shared connection

between many computers

• These are packet networks or packet switching networks

Page 4: Part 2: Packet Transmission Packets, frames Local area networks (LANs) Wide area networks (LANs) Hardware addresses Bridges and switches Routing and protocols

An example of fair access

A wants to send a 5 megabyte file to C

B wants to send a 10 kilobyte file to D

network speed is 56,000 bits per second

Page 5: Part 2: Packet Transmission Packets, frames Local area networks (LANs) Wide area networks (LANs) Hardware addresses Bridges and switches Routing and protocols

Packets and time division multiplexing

• Packet networks use a form of TDM

Page 6: Part 2: Packet Transmission Packets, frames Local area networks (LANs) Wide area networks (LANs) Hardware addresses Bridges and switches Routing and protocols

Packets and hardware frames

• Each type of hardware defines its own format/wrapping for a packet called a frame

Page 7: Part 2: Packet Transmission Packets, frames Local area networks (LANs) Wide area networks (LANs) Hardware addresses Bridges and switches Routing and protocols

Simple example of framing

• A frame may include “unused” control data values to mark both its beginning and end

• Advantage is error detection:– transmitter crashes => eot will not arrive– receiver crashes => soh marks next valid frame

• Disadvantages:– requires two extra characters per frame– cannot carry arbitrary values (e.g, soh and eot)

Page 8: Part 2: Packet Transmission Packets, frames Local area networks (LANs) Wide area networks (LANs) Hardware addresses Bridges and switches Routing and protocols

Byte stuffing• So control characters can be included in data

• Reserve a special character to mark the occurrence of control characters

• Transmitter scans data block and replaces all occurrences of control characters. Receiver performs the reverse mapping.

Character in data Characters sentsoh esc xeot esc yesc esc z

Page 9: Part 2: Packet Transmission Packets, frames Local area networks (LANs) Wide area networks (LANs) Hardware addresses Bridges and switches Routing and protocols

An example of byte stuffing

Frame before byte stuffing

Frame after byte stuffing

Page 10: Part 2: Packet Transmission Packets, frames Local area networks (LANs) Wide area networks (LANs) Hardware addresses Bridges and switches Routing and protocols

Transmission Errors

• Much of the complexity of networks arises from susceptibility to interference that can cause:– transmitted data to be lost or changed– random data to appear

• Single-bit errors versus burst errors

Page 11: Part 2: Packet Transmission Packets, frames Local area networks (LANs) Wide area networks (LANs) Hardware addresses Bridges and switches Routing and protocols

Error Detection and Correction

• First we need to detect errors– Sender includes some extra (redundant) information

that summarises the original data

– Receiver checks this

– Various schemes, differing in complexity, data overhead and robustness

• Then we need to decide what to do– Error correction

– Retransmission

Page 12: Part 2: Packet Transmission Packets, frames Local area networks (LANs) Wide area networks (LANs) Hardware addresses Bridges and switches Routing and protocols

Parity bits and parity checking• Count number of 1 bits in the data and add an extra

parity bit to make this odd or even– even parity - parity bit is set so that total number of 1s is

even - 1011001 => parity bit 0

– odd parity - total 1s should be odd - 1011001 => parity bit 1

• Transmitter calculates and adds, receiver calculates and checks

• Introduces additional costs• Only detects limited types of errors

Page 13: Part 2: Packet Transmission Packets, frames Local area networks (LANs) Wide area networks (LANs) Hardware addresses Bridges and switches Routing and protocols

Other error detection methods

• Other methods include checksums and cyclic redundancy checks

• These can be compared according to:– amount of extra data to be transmitted– amount of extra computation involved– types of errors that are detected

• Note the difference between detecting that an error occurred and knowing how to fix it

Page 14: Part 2: Packet Transmission Packets, frames Local area networks (LANs) Wide area networks (LANs) Hardware addresses Bridges and switches Routing and protocols

Checksums

– Interpret the data as if it were a sequence of integers and add them together to get an integer result called a checksum

– Add in any carry bits too– Append the checksum to the frame– 16 and 32 bit checksums are common and are

usually computed for a whole packet

Page 15: Part 2: Packet Transmission Packets, frames Local area networks (LANs) Wide area networks (LANs) Hardware addresses Bridges and switches Routing and protocols

Example checksum

Page 16: Part 2: Packet Transmission Packets, frames Local area networks (LANs) Wide area networks (LANs) Hardware addresses Bridges and switches Routing and protocols

Evaluation of checksums

• Data overhead - 16 or 32 bits

• Computational overhead - simple additions

• Undetected errors - some periodic reversal of bits (e.g., reversing one bit in each of four data items)

Page 17: Part 2: Packet Transmission Packets, frames Local area networks (LANs) Wide area networks (LANs) Hardware addresses Bridges and switches Routing and protocols

Example failure of checksums

data item(binary)

0001001000110001totals

checksumvalue

12317

data item(binary)

0011000000010011totals

checksumvalue

30137

Page 18: Part 2: Packet Transmission Packets, frames Local area networks (LANs) Wide area networks (LANs) Hardware addresses Bridges and switches Routing and protocols

Cyclic redundancy checks (CRCs)

• Detects more errors than checksums and only requires simple hardware

• Based on binary division rather than addition

Page 19: Part 2: Packet Transmission Packets, frames Local area networks (LANs) Wide area networks (LANs) Hardware addresses Bridges and switches Routing and protocols

Overview of CRC

• Uses binary division instead of addition• Sender wants to send D, a piece of data d bits long• Sender and receiver agree a generator, G, a bit

pattern that is r + 1 bits long• Sender appends R (an additional sequence of r

bits) to D so that the resulting sequence is exactly divisible by G using binary (modulo 2) arithmetic

• Receiver divides the received bit pattern by G and checks whether the remainder is 0

Page 20: Part 2: Packet Transmission Packets, frames Local area networks (LANs) Wide area networks (LANs) Hardware addresses Bridges and switches Routing and protocols

• Can detect burst errors of less than r +1 bits and odd number of bit errors

• Can detect burst errors of length greater than r + 1 with probability 1 – 0.5r

D: Data bits R: CRC bits

d bits r bits

Page 21: Part 2: Packet Transmission Packets, frames Local area networks (LANs) Wide area networks (LANs) Hardware addresses Bridges and switches Routing and protocols

CRC - hardware components

Exclusive or (xor) unit

Page 22: Part 2: Packet Transmission Packets, frames Local area networks (LANs) Wide area networks (LANs) Hardware addresses Bridges and switches Routing and protocols

CRC - hardware components

Shift register

Page 23: Part 2: Packet Transmission Packets, frames Local area networks (LANs) Wide area networks (LANs) Hardware addresses Bridges and switches Routing and protocols

CRC - combining components• Combine 3 shift registers and 3 xor units

• Initialise registers and then feed in the bits of the message one at a time

• Final state gives the CRC - calculated by both the transmitter and receiver

Page 24: Part 2: Packet Transmission Packets, frames Local area networks (LANs) Wide area networks (LANs) Hardware addresses Bridges and switches Routing and protocols

Evaluation of CRCs

• Data overhead - 16 or 32 bits

• Computational overhead - low - combines simple hardware devices

• Types of errors - good for burst errors - changes to several bits in one location that may be caused by a sudden interference (e.g. by lightening)

Page 25: Part 2: Packet Transmission Packets, frames Local area networks (LANs) Wide area networks (LANs) Hardware addresses Bridges and switches Routing and protocols

Why do CRCs work?

• Mathematical analysis is beyond our scope

• Intuition– each single bit of the message dramatically

affects the whole CRC (feeds into three places)– the effect of each bit loops through the process

several times (the registers are connected into a cycle)

Page 26: Part 2: Packet Transmission Packets, frames Local area networks (LANs) Wide area networks (LANs) Hardware addresses Bridges and switches Routing and protocols

Revised frame format

• Frames now contain a data block, framing information and error detection information

• Transmitter does: data -> byte stuffing -> framing -> error detection and receiver does the reverse

Page 27: Part 2: Packet Transmission Packets, frames Local area networks (LANs) Wide area networks (LANs) Hardware addresses Bridges and switches Routing and protocols

Summary

• Packets and frames

• Control data and byte stuffing

• Error detection - parity bits, checksums and cyclic redundancy checks